Commit 86f65f02296afb600429f81c6f4ed8a93ebd737e
1 parent
aabd2f7b
Reordered includes, fixed small mistakes and warnings. Quests WIP
Showing
6 changed files
with
349 additions
and
24 deletions
d2char.c
1 | +#include <stdio.h> | ||
2 | + | ||
1 | #include "d2char.h" | 3 | #include "d2char.h" |
2 | -#include "d2skills.h" | ||
3 | #include "d2mercs.h" | 4 | #include "d2mercs.h" |
4 | -#include <stdio.h> | 5 | +#include "d2skills.h" |
5 | 6 | ||
6 | uint32_t calcChecksum(D2CharHeader* c, void* charData) { | 7 | uint32_t calcChecksum(D2CharHeader* c, void* charData) { |
7 | uint32_t origChecksum = c->checksum; | 8 | uint32_t origChecksum = c->checksum; |
@@ -61,9 +62,6 @@ const char* getCharacterTitle(D2CharHeader* c) { | @@ -61,9 +62,6 @@ const char* getCharacterTitle(D2CharHeader* c) { | ||
61 | if(isHardcore(c)) { | 62 | if(isHardcore(c)) { |
62 | // Expansion Hardcore | 63 | // Expansion Hardcore |
63 | switch(tier) { | 64 | switch(tier) { |
64 | - case 0: | ||
65 | - return D2S_CHARPROGRESS_TIER0_NAME; | ||
66 | - break; | ||
67 | case 1: | 65 | case 1: |
68 | return D2S_CHARPROGRESS_EXPANSION_TIER1_NAME_HARDCORE; | 66 | return D2S_CHARPROGRESS_EXPANSION_TIER1_NAME_HARDCORE; |
69 | break; | 67 | break; |
@@ -77,9 +75,6 @@ const char* getCharacterTitle(D2CharHeader* c) { | @@ -77,9 +75,6 @@ const char* getCharacterTitle(D2CharHeader* c) { | ||
77 | } else { | 75 | } else { |
78 | // Expansion Softcore | 76 | // Expansion Softcore |
79 | switch(tier) { | 77 | switch(tier) { |
80 | - case 0: | ||
81 | - return D2S_CHARPROGRESS_TIER0_NAME; | ||
82 | - break; | ||
83 | case 1: | 78 | case 1: |
84 | return D2S_CHARPROGRESS_EXPANSION_TIER1_NAME; | 79 | return D2S_CHARPROGRESS_EXPANSION_TIER1_NAME; |
85 | break; | 80 | break; |
@@ -96,9 +91,6 @@ const char* getCharacterTitle(D2CharHeader* c) { | @@ -96,9 +91,6 @@ const char* getCharacterTitle(D2CharHeader* c) { | ||
96 | if(isHardcore(c)) { | 91 | if(isHardcore(c)) { |
97 | // Classic Hardcore | 92 | // Classic Hardcore |
98 | switch(tier) { | 93 | switch(tier) { |
99 | - case 0: | ||
100 | - return D2S_CHARPROGRESS_TIER0_NAME; | ||
101 | - break; | ||
102 | case 1: | 94 | case 1: |
103 | return isFemale(c) ? D2S_CHARPROGRESS_CLASSIC_TIER1_NAME_HARDCORE_F : D2S_CHARPROGRESS_CLASSIC_TIER1_NAME_HARDCORE_M; | 95 | return isFemale(c) ? D2S_CHARPROGRESS_CLASSIC_TIER1_NAME_HARDCORE_F : D2S_CHARPROGRESS_CLASSIC_TIER1_NAME_HARDCORE_M; |
104 | break; | 96 | break; |
@@ -112,9 +104,6 @@ const char* getCharacterTitle(D2CharHeader* c) { | @@ -112,9 +104,6 @@ const char* getCharacterTitle(D2CharHeader* c) { | ||
112 | } else { | 104 | } else { |
113 | // Classic Softcore | 105 | // Classic Softcore |
114 | switch(tier) { | 106 | switch(tier) { |
115 | - case 0: | ||
116 | - return D2S_CHARPROGRESS_TIER0_NAME; | ||
117 | - break; | ||
118 | case 1: | 107 | case 1: |
119 | return isFemale(c) ? D2S_CHARPROGRESS_CLASSIC_TIER1_NAME_F : D2S_CHARPROGRESS_CLASSIC_TIER1_NAME_M; | 108 | return isFemale(c) ? D2S_CHARPROGRESS_CLASSIC_TIER1_NAME_F : D2S_CHARPROGRESS_CLASSIC_TIER1_NAME_M; |
120 | break; | 109 | break; |
@@ -127,10 +116,18 @@ const char* getCharacterTitle(D2CharHeader* c) { | @@ -127,10 +116,18 @@ const char* getCharacterTitle(D2CharHeader* c) { | ||
127 | } | 116 | } |
128 | } | 117 | } |
129 | } | 118 | } |
119 | + return D2S_CHARPROGRESS_TIER0_NAME; | ||
130 | } | 120 | } |
131 | 121 | ||
132 | size_t getLastPlayed(D2CharHeader* c, char* buf, size_t bufLen) { | 122 | size_t getLastPlayed(D2CharHeader* c, char* buf, size_t bufLen) { |
133 | - struct tm* time = localtime(&(c->lastPlayed)); | 123 | + // In amd64, since long is 64 bits long, time_t is also 64 bits long |
124 | + // thus needing conversion from the save file type, which is a uint32_t | ||
125 | + #ifdef __x86_64__ | ||
126 | + uint64_t convTimestamp = c->lastPlayed; | ||
127 | + #else | ||
128 | + uint32_t convTimestamp = c->lastPlayed; | ||
129 | + #endif | ||
130 | + struct tm* time = localtime((time_t*)&convTimestamp); | ||
134 | size_t ret = strftime(buf, bufLen, "%c", time); | 131 | size_t ret = strftime(buf, bufLen, "%c", time); |
135 | if(!ret) { | 132 | if(!ret) { |
136 | fprintf(stderr,"libd2char error: Provided buffer for time string was too small\n"); | 133 | fprintf(stderr,"libd2char error: Provided buffer for time string was too small\n"); |
@@ -152,7 +149,7 @@ int getCurrentDifficulty(D2CharHeader* c) { | @@ -152,7 +149,7 @@ int getCurrentDifficulty(D2CharHeader* c) { | ||
152 | } | 149 | } |
153 | 150 | ||
154 | const char* getMercName(D2CharHeader* c) { | 151 | const char* getMercName(D2CharHeader* c) { |
155 | - return getMercNameTableEntry(c->mercenaryType, c->mercenaryNameID); | 152 | + return _getMercName(c->mercenaryType, c->mercenaryNameID); |
156 | } | 153 | } |
157 | 154 | ||
158 | const char* getMercType(D2CharHeader* c) { | 155 | const char* getMercType(D2CharHeader* c) { |
d2char.h
@@ -3,6 +3,10 @@ | @@ -3,6 +3,10 @@ | ||
3 | 3 | ||
4 | #include <stdint.h> | 4 | #include <stdint.h> |
5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
6 | +#include <string.h> | ||
7 | +#include <time.h> | ||
8 | + | ||
9 | +#include "d2quest.h" | ||
6 | #include "d2strings.h" | 10 | #include "d2strings.h" |
7 | 11 | ||
8 | #define D2S_HEADER_LENGTH 765 | 12 | #define D2S_HEADER_LENGTH 765 |
@@ -13,7 +17,6 @@ | @@ -13,7 +17,6 @@ | ||
13 | #define D2S_HOTKEYS_LENGTH 64 | 17 | #define D2S_HOTKEYS_LENGTH 64 |
14 | #define D2S_CHAR_APPEARANCE_LENGTH 32 | 18 | #define D2S_CHAR_APPEARANCE_LENGTH 32 |
15 | #define D2S_DIFFICULTY_LENGTH 3 | 19 | #define D2S_DIFFICULTY_LENGTH 3 |
16 | -#define D2S_QUESTS_LENGTH 298 | ||
17 | #define D2S_WAYPOINTS_LENGTH 81 | 20 | #define D2S_WAYPOINTS_LENGTH 81 |
18 | #define D2S_NPCDATA_LENGTH 51 | 21 | #define D2S_NPCDATA_LENGTH 51 |
19 | 22 | ||
@@ -49,10 +52,10 @@ enum D2S_CHARCLASS { | @@ -49,10 +52,10 @@ enum D2S_CHARCLASS { | ||
49 | 52 | ||
50 | enum D2S_ACT { | 53 | enum D2S_ACT { |
51 | D2S_ACT1 = 0, | 54 | D2S_ACT1 = 0, |
52 | - D2S_ACT2 = 1, | ||
53 | - D2S_ACT3 = 2, | ||
54 | - D2S_ACT4 = 3, | ||
55 | - D2S_ACT5 = 4 | 55 | + D2S_ACT2, |
56 | + D2S_ACT3, | ||
57 | + D2S_ACT4, | ||
58 | + D2S_ACT5 | ||
56 | }; | 59 | }; |
57 | 60 | ||
58 | typedef struct __attribute__((packed)){ | 61 | typedef struct __attribute__((packed)){ |
@@ -71,7 +74,7 @@ typedef struct __attribute__((packed)){ | @@ -71,7 +74,7 @@ typedef struct __attribute__((packed)){ | ||
71 | uint32_t unknown3; // TODO | 74 | uint32_t unknown3; // TODO |
72 | uint32_t lastPlayed; | 75 | uint32_t lastPlayed; |
73 | uint32_t unknown4; // TODO | 76 | uint32_t unknown4; // TODO |
74 | - uint8_t hotkeys[D2S_HOTKEYS_LENGTH]; // Not implemented. Too bad! | 77 | + uint8_t hotkeys[D2S_HOTKEYS_LENGTH]; // Not implemented. (Yet) |
75 | uint32_t leftAbility; | 78 | uint32_t leftAbility; |
76 | uint32_t rightAbility; | 79 | uint32_t rightAbility; |
77 | uint32_t leftAbilityAlt; // Left ability when alternative weapon set (II) is selected | 80 | uint32_t leftAbilityAlt; // Left ability when alternative weapon set (II) is selected |
@@ -86,7 +89,7 @@ typedef struct __attribute__((packed)){ | @@ -86,7 +89,7 @@ typedef struct __attribute__((packed)){ | ||
86 | uint16_t mercenaryType; | 89 | uint16_t mercenaryType; |
87 | uint32_t mercenaryExp; | 90 | uint32_t mercenaryExp; |
88 | uint8_t unknown6[144]; // TODO | 91 | uint8_t unknown6[144]; // TODO |
89 | - uint8_t questData[D2S_QUESTS_LENGTH]; | 92 | + D2QuestData questData; |
90 | uint8_t waypointData[D2S_WAYPOINTS_LENGTH]; | 93 | uint8_t waypointData[D2S_WAYPOINTS_LENGTH]; |
91 | uint8_t NPCIntroductions[D2S_NPCDATA_LENGTH]; // Not implemented. (Yet) | 94 | uint8_t NPCIntroductions[D2S_NPCDATA_LENGTH]; // Not implemented. (Yet) |
92 | } D2CharHeader; | 95 | } D2CharHeader; |
d2mercs.c
@@ -15,6 +15,6 @@ int _getMercType(int mercID) { | @@ -15,6 +15,6 @@ int _getMercType(int mercID) { | ||
15 | } | 15 | } |
16 | 16 | ||
17 | const char* _getMercName(int mercID, int mercNameID) { | 17 | const char* _getMercName(int mercID, int mercNameID) { |
18 | - int offset = getMercType(mercID); | 18 | + int offset = _getMercType(mercID); |
19 | return mercNames[mercNameID + offset]; | 19 | return mercNames[mercNameID + offset]; |
20 | } | 20 | } |
21 | \ No newline at end of file | 21 | \ No newline at end of file |
d2quest.c
0 โ 100644
1 | +#include "d2char.h" | ||
2 | +#include "d2quest.h" | ||
3 | + | ||
4 | +void getQuestData_DenOfEvil(D2QuestData* d, int difficulty, void* dest) { | ||
5 | + uint16_t questData = d->quests[difficulty].actData[D2S_ACT1].questCheckpoints[0]; | ||
6 | + | ||
7 | +} | ||
8 | + | ||
9 | +void getQuestData_SisterBurialGrounds(D2QuestData* d, int difficulty, void* dest) { | ||
10 | + | ||
11 | +} | ||
12 | + | ||
13 | +void getQuestData_SearchForCain(D2QuestData* d, int difficulty, void* dest) { | ||
14 | + | ||
15 | +} | ||
16 | + | ||
17 | +void getQuestData_ForgottenTower(D2QuestData* d, int difficulty, void* dest) { | ||
18 | + | ||
19 | +} | ||
20 | + | ||
21 | +void getQuestData_ToolsOfTheTrade(D2QuestData* d, int difficulty, void* dest) { | ||
22 | + | ||
23 | +} | ||
24 | + | ||
25 | +void getQuestData_SistersToTheSlaughter(D2QuestData* d, int difficulty, void* dest) { | ||
26 | + | ||
27 | +} | ||
28 | + | ||
29 | +void getQuestData_RadamentLair(D2QuestData* d, int difficulty, void* dest) { | ||
30 | + | ||
31 | +} | ||
32 | + | ||
33 | +void getQuestData_HoradricStaff(D2QuestData* d, int difficulty, void* dest) { | ||
34 | + | ||
35 | +} | ||
36 | + | ||
37 | +void getQuestData_TaintedSun(D2QuestData* d, int difficulty, void* dest) { | ||
38 | + | ||
39 | +} | ||
40 | + | ||
41 | +void getQuestData_ArcaneSanctuary(D2QuestData* d, int difficulty, void* dest) { | ||
42 | + | ||
43 | +} | ||
44 | + | ||
45 | +void getQuestData_Summoner(D2QuestData* d, int difficulty, void* dest) { | ||
46 | + | ||
47 | +} | ||
48 | + | ||
49 | +void getQuestData_SevenTombs(D2QuestData* d, int difficulty, void* dest) { | ||
50 | + | ||
51 | +} | ||
52 | + | ||
53 | +void getQuestData_GoldenBird(D2QuestData* d, int difficulty, void* dest) { | ||
54 | + | ||
55 | +} | ||
56 | + | ||
57 | +void getQuestData_BladeOfTheOldReligion(D2QuestData* d, int difficulty, void* dest) { | ||
58 | + | ||
59 | +} | ||
60 | + | ||
61 | +void getQuestData_KhalimWill(D2QuestData* d, int difficulty, void* dest) { | ||
62 | + | ||
63 | +} | ||
64 | + | ||
65 | +void getQuestData_LamEsenTome(D2QuestData* d, int difficulty, void* dest) { | ||
66 | + | ||
67 | +} | ||
68 | + | ||
69 | +void getQuestData_BlackenedTemple(D2QuestData* d, int difficulty, void* dest) { | ||
70 | + | ||
71 | +} | ||
72 | + | ||
73 | +void getQuestData_Guardian(D2QuestData* d, int difficulty, void* dest) { | ||
74 | + | ||
75 | +} | ||
76 | + | ||
77 | +void getQuestData_FallenAngel(D2QuestData* d, int difficulty, void* dest) { | ||
78 | + | ||
79 | +} | ||
80 | + | ||
81 | +void getQuestData_Hellforge(D2QuestData* d, int difficulty, void* dest) { | ||
82 | + | ||
83 | +} | ||
84 | + | ||
85 | +void getQuestData_TerrorEnd(D2QuestData* d, int difficulty, void* dest) { | ||
86 | + | ||
87 | +} | ||
88 | + | ||
89 | +void getQuestData_SiegeOnHarrogath(D2QuestData* d, int difficulty, void* dest) { | ||
90 | + | ||
91 | +} | ||
92 | + | ||
93 | +void getQuestData_RescueOnMountArreat(D2QuestData* d, int difficulty, void* dest) { | ||
94 | + | ||
95 | +} | ||
96 | + | ||
97 | +void getQuestData_PrisonOfIce(D2QuestData* d, int difficulty, void* dest) { | ||
98 | + | ||
99 | +} | ||
100 | + | ||
101 | +void getQuestData_BetrayalOfHarrogath(D2QuestData* d, int difficulty, void* dest) { | ||
102 | + | ||
103 | +} | ||
104 | + | ||
105 | +void getQuestData_RiteOfPassage(D2QuestData* d, int difficulty, void* dest) { | ||
106 | + | ||
107 | +} | ||
108 | + | ||
109 | +void getQuestData_EveOfDestruction(D2QuestData* d, int difficulty, void* dest) { | ||
110 | + | ||
111 | +} | ||
112 | + | ||
113 | +void(*questFunc[])(D2QuestData*,int,void*) = { | ||
114 | + &getQuestData_DenOfEvil, | ||
115 | + &getQuestData_SisterBurialGrounds, | ||
116 | + &getQuestData_SearchForCain, | ||
117 | + &getQuestData_ForgottenTower, | ||
118 | + &getQuestData_ToolsOfTheTrade, | ||
119 | + &getQuestData_SistersToTheSlaughter, | ||
120 | + &getQuestData_RadamentLair, | ||
121 | + &getQuestData_HoradricStaff, | ||
122 | + &getQuestData_TaintedSun, | ||
123 | + &getQuestData_ArcaneSanctuary, | ||
124 | + &getQuestData_Summoner, | ||
125 | + &getQuestData_SevenTombs, | ||
126 | + &getQuestData_GoldenBird, | ||
127 | + &getQuestData_BladeOfTheOldReligion, | ||
128 | + &getQuestData_KhalimWill, | ||
129 | + &getQuestData_LamEsenTome, | ||
130 | + &getQuestData_BlackenedTemple, | ||
131 | + &getQuestData_Guardian, | ||
132 | + &getQuestData_FallenAngel, | ||
133 | + &getQuestData_Hellforge, | ||
134 | + &getQuestData_TerrorEnd, | ||
135 | + &getQuestData_SiegeOnHarrogath, | ||
136 | + &getQuestData_RescueOnMountArreat, | ||
137 | + &getQuestData_PrisonOfIce, | ||
138 | + &getQuestData_BetrayalOfHarrogath, | ||
139 | + &getQuestData_RiteOfPassage, | ||
140 | + &getQuestData_EveOfDestruction | ||
141 | +}; | ||
142 | + | ||
143 | +int getQuestStatus(D2QuestData* d, unsigned int quest, unsigned int difficulty, void* dest) { | ||
144 | + if(quest >= D2S_QUEST_DEN_OF_EVIL && quest <= D2S_QUEST_EVE_OF_DESTRUCTION) { | ||
145 | + questFunc[quest](d,difficulty,dest); | ||
146 | + } | ||
147 | + return D2S_QUEST_UNKNOWN; | ||
148 | +} | ||
0 | \ No newline at end of file | 149 | \ No newline at end of file |
d2quest.h
0 โ 100644
1 | +#ifndef D2QUEST_H | ||
2 | +#define D2QUEST_H | ||
3 | + | ||
4 | +#include <stdint.h> | ||
5 | + | ||
6 | +#define D2S_QUESTDATA_HEADER_LENGTH 4 | ||
7 | + | ||
8 | +enum D2S_QUEST { | ||
9 | + D2S_QUEST_UNKNOWN = -1, | ||
10 | + D2S_QUEST_DEN_OF_EVIL = 0, | ||
11 | + D2S_QUEST_SISTER_BURIAL_GROUNDS, | ||
12 | + D2S_QUEST_SEARCH_FOR_CAIN, | ||
13 | + D2S_QUEST_FORGOTTEN_TOWER, | ||
14 | + D2S_QUEST_TOOLS_OF_THE_TRADE, | ||
15 | + D2S_QUEST_SISTERS_TO_THE_SLAUGHTER, | ||
16 | + D2S_QUEST_RADAMENT_LAIR, | ||
17 | + D2S_QUEST_HORADRIC_STAFF, | ||
18 | + D2S_QUEST_TAINTED_SUN, | ||
19 | + D2S_QUEST_ARCANE_SANCTUARY, | ||
20 | + D2S_QUEST_SUMMONER, | ||
21 | + D2S_QUEST_SEVEN_TOMBS, | ||
22 | + D2S_QUEST_GOLDEN_BIRD, | ||
23 | + D2S_QUEST_BLADE_OF_THE_OLD_RELIGION, | ||
24 | + D2S_QUEST_KHALIM_WILL, | ||
25 | + D2S_QUEST_LAM_ESEN_TOME, | ||
26 | + D2S_QUEST_BLACKENED_TEMPLE, | ||
27 | + D2S_QUEST_GUARDIAN, | ||
28 | + D2S_QUEST_FALLEN_ANGEL, | ||
29 | + D2S_QUEST_HELLFORGE, | ||
30 | + D2S_QUEST_TERROR_END, | ||
31 | + D2S_QUEST_SIEGE_ON_HARROGATH, | ||
32 | + D2S_QUEST_RESCUE_ON_MOUNT_ARREAT, | ||
33 | + D2S_QUEST_PRISON_OF_ICE, | ||
34 | + D2S_QUEST_BETRAYAL_OF_HARROGATH, | ||
35 | + D2S_QUEST_RITE_OF_PASSAGE, | ||
36 | + D2S_QUEST_EVE_OF_DESTRUCTION | ||
37 | +}; | ||
38 | + | ||
39 | +typedef struct { | ||
40 | + int enteredDen; | ||
41 | +} D2S_QUEST_DEN_OF_EVIL_struct; | ||
42 | + | ||
43 | +typedef struct { | ||
44 | + int enteredDen; | ||
45 | +} D2S_QUEST_SISTER_BURIAL_GROUNDS_struct; | ||
46 | + | ||
47 | +typedef struct { | ||
48 | + int enteredDen; | ||
49 | +} D2S_QUEST_SEARCH_FOR_CAIN_struct; | ||
50 | + | ||
51 | +typedef struct { | ||
52 | + int enteredDen; | ||
53 | +} D2S_QUEST_FORGOTTEN_TOWER_struct; | ||
54 | + | ||
55 | +typedef struct { | ||
56 | + int enteredDen; | ||
57 | +} D2S_QUEST_TOOLS_OF_THE_TRADE_struct; | ||
58 | + | ||
59 | +typedef struct { | ||
60 | + int enteredDen; | ||
61 | +} D2S_QUEST_SISTERS_TO_THE_SLAUGHTER_struct; | ||
62 | + | ||
63 | +typedef struct { | ||
64 | + int enteredDen; | ||
65 | +} D2S_QUEST_RADAMENT_LAIR_struct; | ||
66 | + | ||
67 | +typedef struct { | ||
68 | + int enteredDen; | ||
69 | +} D2S_QUEST_HORADRIC_STAFF_struct; | ||
70 | + | ||
71 | +typedef struct { | ||
72 | + int enteredDen; | ||
73 | +} D2S_QUEST_TAINTED_SUN_struct; | ||
74 | + | ||
75 | +typedef struct { | ||
76 | + int enteredDen; | ||
77 | +} D2S_QUEST_ARCANE_SANCTUARY_struct; | ||
78 | + | ||
79 | +typedef struct { | ||
80 | + int enteredDen; | ||
81 | +} D2S_QUEST_SUMMONER_struct; | ||
82 | + | ||
83 | +typedef struct { | ||
84 | + int enteredDen; | ||
85 | +} D2S_QUEST_SEVEN_TOMBS_struct; | ||
86 | + | ||
87 | +typedef struct { | ||
88 | + int enteredDen; | ||
89 | +} D2S_QUEST_GOLDEN_BIRD_struct; | ||
90 | + | ||
91 | +typedef struct { | ||
92 | + int enteredDen; | ||
93 | +} D2S_QUEST_BLADE_OF_THE_OLD_RELIGION_struct; | ||
94 | + | ||
95 | +typedef struct { | ||
96 | + int enteredDen; | ||
97 | +} D2S_QUEST_KHALIM_WILL_struct; | ||
98 | + | ||
99 | +typedef struct { | ||
100 | + int enteredDen; | ||
101 | +} D2S_QUEST_LAM_ESEN_TOME_struct; | ||
102 | + | ||
103 | +typedef struct { | ||
104 | + int enteredDen; | ||
105 | +} D2S_QUEST_BLACKENED_TEMPLE_struct; | ||
106 | + | ||
107 | +typedef struct { | ||
108 | + int enteredDen; | ||
109 | +} D2S_QUEST_GUARDIAN_struct; | ||
110 | + | ||
111 | +typedef struct { | ||
112 | + int enteredDen; | ||
113 | +} D2S_QUEST_FALLEN_ANGEL_struct; | ||
114 | + | ||
115 | +typedef struct { | ||
116 | + int enteredDen; | ||
117 | +} D2S_QUEST_HELLFORGE_struct; | ||
118 | + | ||
119 | +typedef struct { | ||
120 | + int enteredDen; | ||
121 | +} D2S_QUEST_TERROR_END_struct; | ||
122 | + | ||
123 | +typedef struct { | ||
124 | + int enteredDen; | ||
125 | +} D2S_QUEST_SIEGE_ON_HARROGATH_struct; | ||
126 | + | ||
127 | +typedef struct { | ||
128 | + int enteredDen; | ||
129 | +} D2S_QUEST_RESCUE_ON_MOUNT_ARREAT_struct; | ||
130 | + | ||
131 | +typedef struct { | ||
132 | + int enteredDen; | ||
133 | +} D2S_QUEST_PRISON_OF_ICE_struct; | ||
134 | + | ||
135 | +typedef struct { | ||
136 | + int enteredDen; | ||
137 | +} D2S_QUEST_BETRAYAL_OF_HARROGATH_struct; | ||
138 | + | ||
139 | +typedef struct { | ||
140 | + int enteredDen; | ||
141 | +} D2S_QUEST_RITE_OF_PASSAGE_struct; | ||
142 | + | ||
143 | +typedef struct { | ||
144 | + int enteredDen; | ||
145 | +} D2S_QUEST_EVE_OF_DESTRUCTION_struct; | ||
146 | + | ||
147 | +typedef struct __attribute__((packed)) { | ||
148 | + uint16_t actStarted; | ||
149 | + uint16_t questCheckpoints[6]; | ||
150 | + uint16_t actEnded; | ||
151 | +} D2ActData; | ||
152 | + | ||
153 | +typedef struct __attribute__((packed)) { | ||
154 | + uint16_t actStarted; | ||
155 | + uint16_t unknown1[2]; | ||
156 | + uint16_t questCheckpoints[6]; | ||
157 | + uint16_t unknown2[7]; | ||
158 | +} D2XActData; | ||
159 | + | ||
160 | +typedef struct __attribute__((packed)) { | ||
161 | + D2ActData actData[4]; | ||
162 | + D2XActData expansionAct; | ||
163 | +} D2Quests; | ||
164 | + | ||
165 | +typedef struct __attribute__((packed)) { | ||
166 | + const char* header[D2S_QUESTDATA_HEADER_LENGTH]; | ||
167 | + uint32_t unknown1; | ||
168 | + uint16_t size; // in bytes | ||
169 | + D2Quests quests[3]; // 1 set for each difficulty | ||
170 | +} D2QuestData; | ||
171 | + | ||
172 | +// Returns quest status for the specified quest and act. dest must be a struct of the specified | ||
173 | +// quest. Passing anything else may cause the program to crash if it doesn't fit into memory :) | ||
174 | +int getQuestStatus(D2QuestData* d, unsigned int quest, unsigned int difficulty, void* dest); | ||
175 | + | ||
176 | +#endif | ||
0 | \ No newline at end of file | 177 | \ No newline at end of file |