annotate NPC.cpp @ 936:365a9acad64e

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