annotate NPC.cpp @ 1087:cde32f9b5f33

mistake in GetDirectionInfo
author zipi
date Sun, 26 May 2013 00:40:43 +0100
parents c45d51b3f4f4
children c40d40027b77
rev   line source
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 949
diff changeset
1
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
2
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
3 #include "Allocator.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
4 #include "texts.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
5 #include "LOD.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
6 #include "Autonotes.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
7 #include "Awards.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
8 #include "mm7_data.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
9 #include "MM7.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 949
diff changeset
10 #include "Party.h"
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
11 #include "NPC.h"
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
12
629
59713bb36033 houses func moved to uihouses
Gloval
parents: 570
diff changeset
13 int pDialogueNPCCount;
59713bb36033 houses func moved to uihouses
Gloval
parents: 570
diff changeset
14 struct Texture *pDialogueNPCPortraits[6];
59713bb36033 houses func moved to uihouses
Gloval
parents: 570
diff changeset
15 int uNumDialogueNPCPortraits; // weak
59713bb36033 houses func moved to uihouses
Gloval
parents: 570
diff changeset
16 struct NPCStats *pNPCStats = nullptr;
59713bb36033 houses func moved to uihouses
Gloval
parents: 570
diff changeset
17
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
18 void InitializeAwards();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
19 void InitializeScrolls();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
20 void InitializeMerchants();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
21 void InitializeTransitions();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
22 void InitializeAutonotes();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
23 void InitializeQuests();
307
72faa54ff319 Events stuff moved to its file
Gloval
parents: 293
diff changeset
24 bool CheckPortretAgainstSex(int portret_num, int sex);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
25
781
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
26 //----- (004459F9) --------------------------------------------------------
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
27 NPCData *__fastcall GetNPCData(signed int npcid)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
28 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
29 unsigned int v1; // esi@1
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
30 NPCData *result; // eax@5
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
31 int v3; // esi@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
32 int v4; // ecx@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
33 //int v5; // edx@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
34 //NPCData *v6; // eax@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
35 char *v7; // ebx@14
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
36 NPCData *v8; // edi@14
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
37 char v9; // al@22
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
38 char v10;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
39 //std::string v10; // [sp-18h] [bp-2Ch]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
40 int v11;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
41 //const char *v11; // [sp-8h] [bp-1Ch]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
42 int v12; // [sp-4h] [bp-18h]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
43 int v13;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
44 char *v14;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
45 //std::string *v13; // [sp+Ch] [bp-8h]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
46 int a3; // [sp+13h] [bp-1h]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
47 int i;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
48
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
49 /*v1 = npcid;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
50 if ( (npcid & 0x80000000u) == 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
51 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
52 if ( (signed int)npcid < 5000 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
53 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
54 if ( (signed int)npcid >= 501 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
55 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
56 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1984", 0);
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
57 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
58 return &pNPCStats->pNewNPCData[v1];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
59 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
60 return &pNPCStats->array_13EF4[npcid - 5000];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
61 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
62 if ( (signed int)npcid >= 5000 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
63 return &pNPCStats->array_13EF4[npcid - 5000];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
64 if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
65 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
66 result = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
67 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
68 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
69 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
70 v3 = abs((int)sDialogue_SpeakingActorNPC_ID) - 1;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
71 v4 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
72 v5 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
73 v6 = pParty->pHirelings;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
74 do
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
75 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
76 if ( v6->pName )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
77 pTmpBuf[v4++] = v5;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
78 ++v6;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
79 ++v5;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
80 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
81 while ( (signed int)v6 < (signed int)&pParty->pPickedItem );
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
82 v13 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
83 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
84 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
85 v7 = &pTmpBuf[v4];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
86 v8 = pNPCStats->pNewNPCData;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
87 do
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
88 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
89 if ( v8->uFlags & 0x80
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
90 && (!pParty->pHirelings[0].pName || strcmp(v8->pName, pParty->pHirelings[0].pName))
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
91 && (!pParty->pHirelings[1].pName || strcmp(v8->pName, pParty->pHirelings[1].pName)) )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
92 *v7++ = (char)v13 + 2;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
93 v13 = (std::string *)((char *)v13 + 1);
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
94 ++v8;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
95 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
96 while ( (signed int)v13 < (signed int)pNPCStats->uNumNewNPCs );
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
97 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
98 v9 = pTmpBuf[v3];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
99 if ( (unsigned __int8)v9 >= 2u )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
100 result = &pNPCStats->pNPCData[(unsigned __int8)v9 + 499];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
101 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
102 result = &pParty->pHirelings[(unsigned __int8)v9];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
103 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
104 return result;*/
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
105 v1 = npcid;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
106 if ( npcid >= 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
107 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
108 if ( npcid < 5000 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
109 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
110 if ( npcid >= 501 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
111 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
112 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1984", 0);
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
113 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
114 return &pNPCStats->pNewNPCData[v1];// - 1];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
115 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
116 return &pNPCStats->pAdditionalNPC[npcid - 5000];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
117 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
118
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
119
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
120 if ( npcid >= 5000 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
121 return &pNPCStats->pAdditionalNPC[npcid - 5000];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
122 if (sDialogue_SpeakingActorNPC_ID >= 0)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
123 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
124 result = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
125 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
126 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
127 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
128 v3 = abs(sDialogue_SpeakingActorNPC_ID) - 1;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
129 v4 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
130
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
131 for (i = 0; i < 2; ++i)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
132 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
133 if (pParty->pHirelings[i].pName)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
134 pTmpBuf[v4++] = i;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
135 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
136
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
137 if (pNPCStats->uNumNewNPCs > 0)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
138 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
139 for (i = 0; i < pNPCStats->uNumNewNPCs; ++i)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
140 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
141 if (pNPCStats->pNewNPCData[i].Hired())
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
142 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
143 if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName))
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
144 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
145 if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName))
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
146 pTmpBuf[v4++] = i + 2;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
147 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
148 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
149 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
150 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
151
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
152 v9 = pTmpBuf[v3];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
153 if ( v9 >= 2 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
154 result = &pNPCStats->pNPCData[499 + v9];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
155 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
156 result = &pParty->pHirelings[v9];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
157 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
158 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
159
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
160 //----- (00445B2C) --------------------------------------------------------
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
161 NPCData *__fastcall GetNewNPCData(signed int npcid, int a2)
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
162 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
163 signed int v2; // esi@1
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
164 int v3; // edi@1
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
165 NPCData *result; // eax@5
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
166 int v5; // esi@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
167 int v6; // ecx@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
168 int v7; // edx@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
169 NPCData *v8; // eax@9
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
170 NPCData *v9; // edi@14
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
171 int v10; // ecx@20
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
172 char v11; // al@23
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
173 std::string v12; // [sp-18h] [bp-34h]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
174 const char *v13; // [sp-8h] [bp-24h]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
175 int v14; // [sp-4h] [bp-20h]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
176 std::string *v15; // [sp+Ch] [bp-10h]@1
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
177 char *v16; // [sp+10h] [bp-Ch]@14
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
178 int v17; // [sp+14h] [bp-8h]@13
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
179 int a3; // [sp+1Bh] [bp-1h]@4
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
180
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
181 v2 = npcid;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
182 v3 = a2;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
183 v15 = (std::string *)a2;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
184 if ( npcid >= 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
185 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
186 if ( npcid < 5000 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
187 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
188 if ( npcid >= 501 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
189 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
190 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:2040", 0);
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
191 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
192 *(int *)v3 = v2;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
193 return &pNPCStats->pNewNPCData[v2];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
194 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
195 LABEL_7:
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
196 *(int *)a2 = npcid - 5000;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
197 return &pNPCStats->pAdditionalNPC[npcid - 5000];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
198 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
199 if ( npcid >= 5000 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
200 goto LABEL_7;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
201 if ( sDialogue_SpeakingActorNPC_ID >= 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
202 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
203 *(int *)a2 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
204 result = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
205 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
206 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
207 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
208 v5 = abs((int)sDialogue_SpeakingActorNPC_ID) - 1;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
209 v6 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
210 v7 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
211 v8 = pParty->pHirelings;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
212 do
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
213 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
214 if ( v8->pName )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
215 pTmpBuf[v6++] = v7;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
216 ++v8;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
217 ++v7;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
218 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
219 while ( (signed int)v8 < (signed int)&pParty->pPickedItem );
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
220 v17 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
221 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
222 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
223 v9 = pNPCStats->pNewNPCData;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
224 v16 = &pTmpBuf[v6];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
225 do
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
226 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
227 if ( v9->Hired()
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
228 && (!pParty->pHirelings[0].pName || strcmp(v9->pName, pParty->pHirelings[0].pName))
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
229 && (!pParty->pHirelings[1].pName || strcmp(v9->pName, pParty->pHirelings[1].pName)) )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
230 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
231 v10 = (int)v16++;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
232 *(char *)v10 = v17 + 2;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
233 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
234 ++v17;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
235 ++v9;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
236 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
237 while ( v17 < (signed int)pNPCStats->uNumNewNPCs );
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
238 v3 = (int)v15;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
239 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
240 v11 = pTmpBuf[v5];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
241 if ( (unsigned __int8)v11 >= 2u )
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
242 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
243 *(int *)v3 = (unsigned __int8)v11 - 2;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
244 result = &pNPCStats->pNPCData[(unsigned __int8)pTmpBuf[v5] + 499];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
245 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
246 else
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
247 {
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
248 *(int *)v3 = (unsigned __int8)v11;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
249 result = &pParty->pHirelings[(unsigned __int8)pTmpBuf[v5]];
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
250 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
251 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
252 return result;
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
253 }
d170f23f70d1 tidy, code moving
zipi
parents: 667
diff changeset
254
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
255 //----- (00476977) --------------------------------------------------------
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
256 void NPCStats::InitializeNPCText()
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
257 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
258 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
259 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
260 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
261 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
262 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
263 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
264 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
265
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
266 if (pNPCTextTXT_Raw)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
267 pAllocator->FreeChunk(pNPCTextTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
268 pNPCTextTXT_Raw =NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
269 pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
270 strtok(pNPCTextTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
271
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
272 for (i=0; i<789; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
273 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
274 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
275 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
276 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
277 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
278 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
279 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
280 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
281 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
282 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
283 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
284 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
285 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
286 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
287 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
288 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
289 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
290 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
291 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
292 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
293 pNPCTopics[i].pText =RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
294 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
295 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
296 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
297 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
298 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
299 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
300 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
301 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
302 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
303
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
304 if (pNPCTopicTXT_Raw)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
305 pAllocator->FreeChunk(pNPCTopicTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
306 pNPCTopicTXT_Raw =NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
307 pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
308 strtok(pNPCTopicTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
309
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
310 for (i=0; i<579; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
311 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
312 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
313 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
314 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
315 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
316 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
317 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
318 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
319 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
320 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
321 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
322 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
323 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
324 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
325 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
326 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
327 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
328 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
329 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
330 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
331 pNPCTopics[i].pTopic = RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
332 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
333 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
334 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
335 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
336 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
337 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
338 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
339 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
340 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
341
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
342 if (pNPCDistTXT_Raw)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
343 pAllocator->FreeChunk(pNPCDistTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
344 pNPCDistTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
345 pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdist.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
346 strtok(pNPCDistTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
347 strtok(NULL, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
348
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
349 for (i=1; i<59; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
350 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
351 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
352 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
353 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
354 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
355 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
356 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
357 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
358 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
359 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
360 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
361 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
362 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
363 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
364 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
365 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
366 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
367 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
368 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
369 if ((decode_step>0)&&(decode_step<77))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
370 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
371 pProfessionChance[decode_step].professionChancePerArea[i]=atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
372 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
373 else if (decode_step==0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
374 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
375 pProfessionChance[0].professionChancePerArea[i]=10;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
376 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
377 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
378 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
379 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
380 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
381 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
382 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
383 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
384 } while ((decode_step<78)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
385 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
386
825
Ritor1
parents: 781
diff changeset
387 for ( i = 0; i < 77; ++i )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
388 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
389 pProfessionChance[i].uTotalprofChance=0;
825
Ritor1
parents: 781
diff changeset
390 for ( int ii = 1; ii < 59; ++ii )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
391 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
392 pProfessionChance[i].uTotalprofChance+=pProfessionChance[i].professionChancePerArea[ii];
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
393 }
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
394 pProfessionChance[i].professionChancePerArea[0]=0;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
395 pProfessionChance[i].professionChancePerArea[59]=0;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
396 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
397
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
398 if (pNPCDistTXT_Raw)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
399 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
400 pAllocator->FreeChunk(pNPCDistTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
401 pNPCDistTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
402 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
403 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
404
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
405 //----- (00476C60) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
406 void NPCStats::_476C60()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
407 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
408 for (unsigned int i = 1; i < uNumNewNPCs; ++i)
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
409 pNewNPCData[i].pName = pNPCUnicNames[i - 1];
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
410
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
411 if (pParty->pHirelings[0].pName)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
412 pParty->pHirelings[0].pName = pParty->pHireling1Name;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
413 if (pParty->pHirelings[1].pName)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
414 pParty->pHirelings[1].pName = pParty->pHireling2Name;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
415 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
416
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
417 //----- (00476CB5) --------------------------------------------------------
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
418 void NPCStats::InitializeNPCData()
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
419 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
420 int i;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
421 char* test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
422 unsigned char c;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
423 bool break_loop;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
424 unsigned int temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
425 char* tmp_pos;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
426 int decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
427
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
428 pNPCDataTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdata.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
429 strtok(pNPCDataTXT_Raw, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
430 strtok(NULL, "\r");
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
431
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
432 for (i=0; i<500; ++i)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
433 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
434 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
435 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
436 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
437 do
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
438 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
439 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
440 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
441 while((c!='\t')&&(c>0))
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
442 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
443 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
444 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
445 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
446 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
447 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
448 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
449 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
450 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
451 { //i+1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
452 switch (decode_step)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
453 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
454 case 1:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
455 pNPCUnicNames[i] = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
456 pNPCData[i+1].pName=pNPCUnicNames[i];
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
457 break;
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
458 case 2:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
459 pNPCData[i+1].uPortraitID = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
460 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
461 case 6:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
462 pNPCData[i+1].Location2D = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
463 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
464 case 7:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
465 pNPCData[i+1].uProfession = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
466 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
467 case 8:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
468 pNPCData[i+1].greet = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
469 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
470 case 9:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
471 pNPCData[i+1].joins = (*test_string == 'y')?1:0;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
472 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
473 case 10:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
474 pNPCData[i+1].evt_A = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
475 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
476 case 11:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
477 pNPCData[i+1].evt_B = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
478 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
479 case 12:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
480 pNPCData[i+1].evt_C = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
481 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
482 case 13:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
483 pNPCData[i+1].evt_D = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
484 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
485 case 14:
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
486 pNPCData[i+1].evt_E = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
487 break;
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
488 case 15:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
489 pNPCData[i+1].evt_F = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
490 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
491 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
492 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
493 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
494 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
495 } while ((decode_step<16)&&!break_loop);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
496 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
497 uNumNewNPCs = 501;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
498 pNPCGreetTXT_Raw = (char*)pEvents_LOD->LoadRaw("npcgreet.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
499 strtok(pNPCGreetTXT_Raw, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
500 for (i=0; i<205; ++i)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
501 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
502 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
503 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
504 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
505 do
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
506 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
507 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
508 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
509 while((c!='\t')&&(c>0))
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
510 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
511 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
512 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
513 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
514 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
515 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
516 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
517 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
518 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
519 { //i+1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
520 switch (decode_step)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
521 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
522 case 1:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
523 pNPCGreetings[i].pGreeting1 = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
524 break;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
525 case 2:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
526 pNPCGreetings[i].pGreeting2 = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
527 break;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
528 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
529 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
530 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
531 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
532 } while ((decode_step<3)&&!break_loop);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
533 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
534
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
535 pNCPGroupTXT_Raw = (char*)pEvents_LOD->LoadRaw("npcgroup.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
536 strtok(pNCPGroupTXT_Raw, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
537
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
538 for (i=0; i<51; ++i)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
539 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
540 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
541 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
542 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
543 do
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
544 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
545 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
546 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
547 while((c!='\t')&&(c>0))
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
548 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
549 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
550 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
551 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
552 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
553 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
554 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
555 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
556 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
557 { //i+1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
558 if (decode_step==1)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
559 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
560 pGroups[i] = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
561 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
562 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
563 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
564 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
565 } while ((decode_step<2)&&!break_loop);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
566 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
567
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
568 pNPCNewsTXT_Raw = (char*)pEvents_LOD->LoadRaw("npcnews.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
569 strtok(pNPCNewsTXT_Raw, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
570
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
571
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
572 for (i=0; i<51; ++i)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
573 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
574 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
575 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
576 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
577 do
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
578 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
579 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
580 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
581 while((c!='\t')&&(c>0))
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
582 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
583 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
584 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
585 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
586 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
587 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
588 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
589 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
590 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
591 { //i+1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
592 if (decode_step==1)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
593 pCatchPhrases[i] = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
594 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
595 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
596 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
597 } while ((decode_step<2)&&!break_loop);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
598 }
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
599 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
600
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
601 //----- (0047702F) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
602 void NPCStats::Initialize()
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
603 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
604 int i;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
605 char* test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
606 unsigned char c;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
607 bool break_loop;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
608 unsigned int temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
609 char* tmp_pos;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
610 int decode_step;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
611
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
612 InitializeNPCData();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
613 InitializeNPCText();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
614 InitializeQuests();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
615 InitializeAutonotes();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
616 InitializeAwards();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
617 InitializeTransitions();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
618 InitializeMerchants();
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
619 InitializeScrolls();
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
620
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
621 pNPCNamesTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
622 pNPCNamesTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
623 strtok(pNPCNamesTXT_Raw, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
624
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
625 uNewlNPCBufPos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
626
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
627 for (i=0; i<540; ++i)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
628 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
629 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
630 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
631 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
632 do
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
633 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
634 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
635 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
636 if (c=='\t')
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
637 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
638 if ( (decode_step == 1)&&(!uNumNPCNames[1]))
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
639 uNumNPCNames[1]=i;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
640 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
641 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
642 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
643 while((c!='\n')&&(c!='\t')&&(c>0))
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
644 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
645 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
646 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
647 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
648 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
649 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
650 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
651
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
652 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
653 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
654 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
655 if ( decode_step == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
656 pNPCNames[i][0] =RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
657 else if ( decode_step == 1)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
658 pNPCNames[i][1] =RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
659 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
660 else
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
661 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
662 if ( (decode_step == 1)&&(!uNumNPCNames[1]))
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
663 uNumNPCNames[1]=i;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
664 }
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
665 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
666 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
667 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
668 } while ((decode_step<2)&&!break_loop);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
669 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
670 uNumNPCNames[0] = i;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
671
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
672 pNPCProfTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
673 pNPCProfTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
674 strtok(pNPCProfTXT_Raw, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
675 strtok(NULL, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
676 strtok(NULL, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
677 strtok(NULL, "\r");
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
678
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
679 for (i=1; i<59; ++i)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
680 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
681 test_string = strtok(NULL, "\r") + 1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
682 break_loop = false;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
683 decode_step=0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
684 do
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
685 {
667
8c6c41037c39 profession NPC dialogue fixed
zipi
parents: 659
diff changeset
686 //while (*test_string == '\t') // some steps are separated by multiple \t's
8c6c41037c39 profession NPC dialogue fixed
zipi
parents: 659
diff changeset
687 //++test_string;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 629
diff changeset
688
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
689 c = *(unsigned char*)test_string;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
690 temp_str_len = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
691 while((c!='\t')&&(c>0))
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
692 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
693 ++temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
694 c=test_string[temp_str_len];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
695 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
696 tmp_pos=test_string+temp_str_len;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
697 if (*tmp_pos == 0)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
698 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
699 *tmp_pos = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
700 if (temp_str_len)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
701 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
702 switch(decode_step)
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
703 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
704 case 2:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
705 pProfessions[i].uHirePrice = atoi(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
706 break;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
707 case 3:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
708 pProfessions[i].pActionText = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
709 break;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
710 case 4:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
711 pProfessions[i].pBenefits= RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
712 break;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
713 case 5:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
714 pProfessions[i].pJoinText = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
715 break;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
716 case 6:
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
717 pProfessions[i].pDismissText = RemoveQuotes(test_string);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
718 }
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
719 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
720 else
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
721 {
667
8c6c41037c39 profession NPC dialogue fixed
zipi
parents: 659
diff changeset
722 if (!decode_step)
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
723 break_loop = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
724 }
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
725 ++decode_step;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
726 test_string=tmp_pos+1;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
727 } while ((decode_step<7)&&!break_loop);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
728 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
729 uNumNPCProfessions = 59;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
730 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
731
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
732 //----- (00477266) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
733 void NPCStats::Release()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
734 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
735 pAllocator->FreeChunk(pNPCTopicTXT_Raw);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
736 pNPCTopicTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
737 pAllocator->FreeChunk(pNPCTextTXT_Raw);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
738 pNPCTextTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
739 pAllocator->FreeChunk(pNPCNewsTXT_Raw);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
740 pNPCNewsTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
741 pAllocator->FreeChunk(pNPCProfTXT_Raw);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
742 pNPCProfTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
743 pAllocator->FreeChunk(pNPCNamesTXT_Raw);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
744 pNPCNamesTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
745 pAllocator->FreeChunk(pNPCDataTXT_Raw);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
746 pNPCDataTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
747 pAllocator->FreeChunk(pNPCDistTXT_Raw);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
748 pNPCDistTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
749 pAllocator->FreeChunk(pNPCGreetTXT_Raw);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
750 pNPCGreetTXT_Raw = NULL;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
751 pAllocator->FreeChunk(pNCPGroupTXT_Raw);
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
752 pNCPGroupTXT_Raw = NULL;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
753 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
754
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
755 //----- (0047730C) --------------------------------------------------------
307
72faa54ff319 Events stuff moved to its file
Gloval
parents: 293
diff changeset
756 bool CheckPortretAgainstSex(int a1, int)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
757 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
758 return true;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
759 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
760 // 47730C: using guessed type int __stdcall const_1(int);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
761
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
762 //----- (0047732C) --------------------------------------------------------
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
763 void NPCStats::InitializeAdditionalNPCs(NPCData *pNPCDataBuff, int npc_uid, int uLocation2D, int uMapId)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
764 {
292
5586bb4e8395 build fix
Gloval
parents: 291
diff changeset
765 int rep_gen;
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
766 int uNPCSex; // esi@1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
767 int uGeneratedPortret; // ecx@23
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
768 int test_prof_summ; // ecx@37
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
769 int gen_profession; // eax@37
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
770 int max_prof_cap; // edx@37
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
771 signed int result; // eax@39
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
772 int uRace; // [sp+Ch] [bp-Ch]@1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
773 bool break_gen; // [sp+10h] [bp-8h]@1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
774 signed int gen_attempts; // [sp+14h] [bp-4h]@1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
775 int uPortretMin; // [sp+24h] [bp+Ch]@1
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
776 int uPortretMax;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
777
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
778 static const unsigned __int8 NPCSexGenTable[86] ={
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
779 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
780 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
781 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
782 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
783 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0 };
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
784 static const unsigned __int8 NPCRaceGenTable[86] ={
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
785 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
786 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
787 0, 0, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
788 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
789 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0};
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
790
307
72faa54ff319 Events stuff moved to its file
Gloval
parents: 293
diff changeset
791 unsigned __int8 seed = (unsigned __int8)((double)(npc_uid - 1)/3.0);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
792 uNPCSex = NPCSexGenTable[seed];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
793 uRace = NPCRaceGenTable[seed];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
794 pNPCDataBuff->uSex = uNPCSex;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
795 pNPCDataBuff->pName = pNPCNames[rand() % uNumNPCNames[uNPCSex]][uNPCSex];
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
796
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
797 gen_attempts = 0;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
798 break_gen = false;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
799
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
800 do
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
801 {
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
802 switch ( uRace )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
803 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
804 case 0:
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
805 if ( uNPCSex == 0 )
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
806 {
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
807 uPortretMin = 2;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
808 uPortretMax = 100;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
809 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
810 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
811 {
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
812 uPortretMin = 201;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
813 uPortretMax = 250;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
814 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
815 case 1:
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
816 if ( uNPCSex == 0 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
817 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
818 uPortretMin = 400;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
819 uPortretMax = 430;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
820 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
821 else
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
822 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
823 uPortretMin = 460;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
824 uPortretMax = 490;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
825 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
826 break;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
827 case 2:
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
828 if ( uNPCSex == 0 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
829 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
830 uPortretMin = 500;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
831 uPortretMax = 520;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
832 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
833 else
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
834 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
835 uPortretMin = 530;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
836 uPortretMax = 550;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
837 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
838 break;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
839 case 3:
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
840 if ( uNPCSex == 0 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
841 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
842 uPortretMin = 300;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
843 uPortretMax = 330;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
844 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
845 else
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
846 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
847 uPortretMin = 360;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
848 uPortretMax = 387;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
849 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
850
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
851 break;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
852 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
853
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
854 uGeneratedPortret = uPortretMin + rand() % (uPortretMax - uPortretMin + 1);
307
72faa54ff319 Events stuff moved to its file
Gloval
parents: 293
diff changeset
855 if ( CheckPortretAgainstSex(uGeneratedPortret, uNPCSex))
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
856 break_gen = true;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
857 ++gen_attempts;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
858 if ( gen_attempts >= 4 )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
859 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
860 uGeneratedPortret = uPortretMin;
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
861 break_gen = true;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
862 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
863 }
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
864 while(!break_gen);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
865
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
866 pNPCDataBuff->uPortraitID = uGeneratedPortret;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
867 pNPCDataBuff->uFlags = 0;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
868 pNPCDataBuff->fame = 0;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
869 //generate reputation
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
870 rep_gen = rand() % 100 + 1;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
871
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
872 if ( rep_gen >= 60 )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
873 {
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
874 if ( rep_gen >= 90 )
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
875 {
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
876 if ( rep_gen >= 95 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
877 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
878 if ( rep_gen >= 98 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
879 pNPCDataBuff->rep = -600;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
880 else
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
881 pNPCDataBuff->rep = 400;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
882 }
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
883 else
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
884 pNPCDataBuff->rep = -300;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
885 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
886 else
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
887 pNPCDataBuff->rep = 200;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
888 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
889 else
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
890 pNPCDataBuff->rep = 0;
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 257
diff changeset
891
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
892 max_prof_cap = rand() % pProfessionChance[uMapId].uTotalprofChance+1;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
893 test_prof_summ = 0;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
894 gen_profession = 0;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
895
293
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
896 if ( max_prof_cap > 0 )
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
897 {
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
898 do
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
899 test_prof_summ += pProfessionChance[uMapId].professionChancePerArea[gen_profession++];
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
900 while ( test_prof_summ < max_prof_cap );
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
901 }
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
902 pNPCDataBuff->uProfession = gen_profession - 1;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
903 pNPCDataBuff->Location2D = uLocation2D;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
904 pNPCDataBuff->field_24 = 1;
27670273a6ff little fix npc gen
Gloval
parents: 292
diff changeset
905 pNPCDataBuff->joins = 1;
659
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
906 pNPCDataBuff->evt_A = 0;
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
907 pNPCDataBuff->evt_B = 0;
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
908 pNPCDataBuff->evt_C = 0;
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
909 pNPCDataBuff->evt_D = 0;
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
910 pNPCDataBuff->evt_E = 0;
c10163a6d946 NPC hiring fixed
zipi
parents: 652
diff changeset
911 pNPCDataBuff->evt_F = 0;
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
912 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
913
257
Nomad
parents: 253
diff changeset
914 //----- (00476387) --------------------------------------------------------
Nomad
parents: 253
diff changeset
915 bool PartyHasDragon()
Nomad
parents: 253
diff changeset
916 {
Nomad
parents: 253
diff changeset
917 return pNPCStats->pNewNPCData[57].Hired();
Nomad
parents: 253
diff changeset
918 }
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
919
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
920 //----- (00476395) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
921 //0x26 Wizard eye at skill level 2
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
922 bool __thiscall CheckHiredNPCSpeciality(unsigned int uProfession)
353
95be2dcecadf Partial refactor for Player::GetActualSkillLevel
Nomad
parents: 307
diff changeset
923 {
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
924 bool result; // eax@2
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
925 signed int v2; // esi@3
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
926 char *v3; // eax@4
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
927
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
928 if ( bNoNPCHiring == 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
929 return 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
930 v2 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
931 if ( (signed int)pNPCStats->uNumNewNPCs <= 0 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
932 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
933 LABEL_8:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
934 result = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
935 if ( pParty->pHirelings[0].uProfession != uProfession )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
936 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
937 LOBYTE(result) = pParty->pHirelings[1].uProfession == uProfession;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
938 return result;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
939 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
940 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
941 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
942 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
943 v3 = (char *)&pNPCStats->pNewNPCData[0].uFlags;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
944 while ( *((int *)v3 + 4) != uProfession || !(*v3 & 0x80) )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
945 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
946 ++v2;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
947 v3 += 76;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
948 if ( v2 >= (signed int)pNPCStats->uNumNewNPCs )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
949 goto LABEL_8;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
950 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
951 result = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
952 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
953 ++result;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
954 return result;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
955 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
956 // 6BE3C5: using guessed type char bNoNPCHiring;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
957
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
958 //----- (004763E0) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
959 void InitializeAwards()
949
Nomad
parents: 825
diff changeset
960 {
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
961 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
962 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
963 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
964 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
965 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
966 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
967 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
968
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
969 if ( pAwardsTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
970 pAllocator->FreeChunk(pAwardsTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
971 pAwardsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
972 pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
973 strtok(pAwardsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
974
949
Nomad
parents: 825
diff changeset
975 for (i=1; i<105; ++i)
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
976 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
977 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
978 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
979 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
980 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
981 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
982 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
983 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
984 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
985 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
986 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
987 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
988 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
989 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
990 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
991 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
992 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
993 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
994 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
995 if (decode_step==1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
996 pAwards[i].pText=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
997 else if (decode_step==2)
949
Nomad
parents: 825
diff changeset
998 pAwards[i].uPriority = atoi(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
999 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1000 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1001 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1002 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1003 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1004 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1005 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1006 } while ((decode_step<3)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1007 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1008 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1009 // 7241C8: using guessed type int dword_7241C8;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1010
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1011 //----- (004764C2) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1012 void InitializeScrolls()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1013 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1014
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1015 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1016 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1017 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1018 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1019 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1020 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1021 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1022
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1023 if ( pScrollsTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1024 pAllocator->FreeChunk(pScrollsTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1025 pScrollsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1026 pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1027 strtok(pScrollsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1028 for (i=0; i<82; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1029 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1030 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1031 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1032 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1033 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1034 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1035 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1036 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1037 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1038 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1039 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1040 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1041 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1042 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1043 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1044 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1045 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1046 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1047 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1048 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1049 pScrolls[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1050 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1051 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1052 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1053 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1054 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1055 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1056 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1057 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1058 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1059 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1060
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1061 //----- (00476590) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1062 void InitializeMerchants()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1063 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1064 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1065 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1066 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1067 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1068 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1069 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1070 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1071
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1072 if ( pMerchantsTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1073 pAllocator->FreeChunk(pMerchantsTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1074 pMerchantsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1075 pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1076 strtok(pMerchantsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1077
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1078 for (i=0; i<7; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1079 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1080 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1081 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1082 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1083 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1084 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1085 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1086 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1087 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1088 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1089 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1090 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1091 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1092 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1093 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1094 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1095 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1096 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1097 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1098 switch (decode_step)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1099 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1100 case 1:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1101 pMerchantsBuyPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1102 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1103 case 2:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1104 pMerchantsSellPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1105 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1106 case 3:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1107 pMerchantsRepairPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1108 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1109 case 4:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1110 pMerchantsIdentifyPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1111 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1112 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1113 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1114 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1115 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1116 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1117 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1118 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1119 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1120 } while ((decode_step<5)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1121 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1122
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1123 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1124
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1125 //----- (00476682) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1126 void InitializeTransitions()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1127 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1128 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1129 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1130 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1131 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1132 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1133 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1134 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1135
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1136 if ( pTransitionsTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1137 pAllocator->FreeChunk(pTransitionsTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1138 pTransitionsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1139 pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1140 strtok(pTransitionsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1141
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1142 for (i=0; i<464; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1143 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1144 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1145 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1146 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1147 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1148 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1149 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1150 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1151 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1152 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1153 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1154 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1155 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1156 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1157 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1158 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1159 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1160 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1161 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1162 if ( decode_step == 1)
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 353
diff changeset
1163 pTransitionStrings[i + 1]=RemoveQuotes(test_string);
251
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1164 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1165 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1166 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1167 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1168 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1169 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1170 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1171 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1172 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1173 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1174
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1175 //----- (00476750) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1176 void __cdecl InitializeAutonotes()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1177 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1178 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1179 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1180 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1181 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1182 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1183 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1184 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1185
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1186 if ( pAutonoteTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1187 pAllocator->FreeChunk(pAutonoteTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1188 pAutonoteTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1189 pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1190 strtok(pAutonoteTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1191
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1192 for (i=0; i<195; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1193 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1194 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1195 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1196 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1197 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1198 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1199 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1200 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1201 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1202 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1203 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1204 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1205 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1206 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1207 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1208 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1209 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1210 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1211 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1212 switch (decode_step)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1213 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1214 case 1:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1215 pAutonoteTxt[i].pText=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1216 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1217 case 2:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1218 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1219 if ( !_strcmpi(test_string, "potion"))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1220 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1221 pAutonoteTxt[i].eType = AUTONOTE_POTION_RECEPIE;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1222 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1223 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1224 if ( !_strcmpi(test_string, "stat") )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1225 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1226 pAutonoteTxt[i].eType = AUTONOTE_STAT_HINT;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1227 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1228 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1229 if ( !_strcmpi(test_string, "seer") )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1230 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1231 pAutonoteTxt[i].eType = AUTONOTE_SEER;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1232 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1233 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1234 if ( !_strcmpi(test_string, "obelisk") )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1235 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1236 pAutonoteTxt[i].eType = AUTONOTE_OBELISK;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1237 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1238 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1239 if ( !_strcmpi(test_string, "teacher") )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1240 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1241 pAutonoteTxt[i].eType = AUTONOTE_TEACHER;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1242 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1243 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1244 pAutonoteTxt[i].eType =AUTONOTE_MISC;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1245 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1246 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1247 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1248 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1249 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1250 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1251 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1252 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1253 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1254 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1255 } while ((decode_step<3)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1256 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1257 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1258
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1259
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1260 //----- (004768A9) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1261 void __cdecl InitializeQuests()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1262 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1263 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1264 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1265 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1266 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1267 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1268 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1269 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1270
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1271 if ( pQuestsTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1272 pAllocator->FreeChunk(pQuestsTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1273 pQuestsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1274 pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1275 strtok(pQuestsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1276
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1277 for (i=0; i<512; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1278 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1279 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1280 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1281 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1282 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1283 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1284 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1285 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1286 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1287 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1288 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1289 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1290 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1291 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1292 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1293 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1294 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1295 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1296 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1297 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1298 pQuestTable[i] =RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1299 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1300 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1301 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1302 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1303 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1304 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1305 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1306 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1307 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1308 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1309