annotate NPC.cpp @ 251:48f21f569328

Npc related stuff separated
author Gloval
date Mon, 18 Feb 2013 08:47:21 +0400
parents
children f1218b9d67f1
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
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
14
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
15 void InitializeAwards();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
16 void InitializeScrolls();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
17 void InitializeMerchants();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
18 void InitializeTransitions();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
19 void InitializeAutonotes();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
20 void InitializeQuests();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
21
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
22
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
23 //----- (00476977) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
24 void NPCStats::Initialize2()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
25 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
26 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
27 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
28 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
29 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
30 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
31 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
32 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
33
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
34 if (pNPCTextTXT_Raw)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
35 pAllocator->FreeChunk(pNPCTextTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
36 pNPCTextTXT_Raw =NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
37 pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
38 strtok(pNPCTextTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
39
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
40 for (i=0; i<789; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
41 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
42 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
43 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
44 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
45 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
46 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
47 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
48 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
49 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
50 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
51 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
52 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
53 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
54 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
55 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
56 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
57 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
58 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
59 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
60 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
61 pNPCTopics[i].pText =RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
62 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
63 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
64 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
65 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
66 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
67 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
68 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
69 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
70 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
71
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
72 if (pNPCTopicTXT_Raw)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
73 pAllocator->FreeChunk(pNPCTopicTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
74 pNPCTopicTXT_Raw =NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
75 pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
76 strtok(pNPCTopicTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
77
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
78 for (i=0; i<579; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
79 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
80 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
81 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
82 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
83 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
84 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
85 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
86 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
87 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
88 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
89 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
90 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
91 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
92 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
93 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
94 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
95 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
96 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
97 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
98 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
99 pNPCTopics[i].pTopic = RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
100 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
101 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
102 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
103 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
104 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
105 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
106 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
107 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
108 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
109
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
110 if (pNPCDistTXT_Raw)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
111 pAllocator->FreeChunk(pNPCDistTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
112 pNPCDistTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
113 pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdist.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
114 strtok(pNPCDistTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
115 strtok(NULL, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
116
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
117 for (i=1; i<59; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
118 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
119 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
120 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
121 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
122 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
123 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
124 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
125 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
126 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
127 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
128 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
129 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
130 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
131 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
132 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
133 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
134 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
135 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
136 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
137 if ((decode_step>0)&&(decode_step<77))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
138 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
139 array_16544[decode_step].field_4[i]=atoi(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
140 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
141 else if (decode_step==0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
142 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
143 array_16544[0].field_4[i]=10;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
144 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
145 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
146 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
147 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
148 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
149 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
150 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
151 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
152 } while ((decode_step<78)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
153 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
154
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
155 for (i=0; i<78; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
156 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
157 array_16544[i].field_0=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
158 for (int ii=1; ii<59; ++ii)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
159 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
160 array_16544[i].field_0+=array_16544[i].field_4[ii];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
161 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
162 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
163
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
164 if (pNPCDistTXT_Raw)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
165 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
166 pAllocator->FreeChunk(pNPCDistTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
167 pNPCDistTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
168 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
169 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
170
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
171 //----- (00476C60) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
172 void NPCStats::_476C60()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
173 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
174 for (unsigned int i = 1; i < uNumNewNPCs; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
175 pNewNPCData[i].pName = pNPCNames2[i - 1];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
176
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
177 if (pParty->pHirelings[0].pName)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
178 pParty->pHirelings[0].pName = pParty->pHireling1Name;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
179 if (pParty->pHirelings[1].pName)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
180 pParty->pHirelings[1].pName = pParty->pHireling2Name;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
181 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
182
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
183 //----- (00476CB5) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
184 void NPCStats::Initialize1()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
185 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
186 NPCStats *pNPCStats; // esi@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
187 char *pRaw; // eax@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
188 char *pHouse; // edi@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
189 char *v4; // eax@2
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
190 char v5; // dl@3
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
191 int v6; // ecx@3
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
192 char *v7; // eax@11
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
193 char *v8; // eax@26
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
194 char *v9; // ecx@27
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
195 char v10; // dl@28
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
196 int v11; // eax@28
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
197 int v12; // edi@32
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
198 char *v13; // eax@42
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
199 char *v14; // eax@43
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
200 char v15; // dl@44
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
201 int v16; // ecx@44
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
202 int v17; // edi@48
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
203 char *v18; // eax@56
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
204 char *v19; // eax@57
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
205 char v20; // cl@58
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
206 int v21; // edi@58
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
207 int v22; // esi@62
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
208 int v23; // [sp+Ch] [bp-14h]@7
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
209 signed int v24; // [sp+10h] [bp-10h]@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
210 signed int v25; // [sp+10h] [bp-10h]@26
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
211 signed int v26; // [sp+10h] [bp-10h]@42
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
212 signed int v27; // [sp+10h] [bp-10h]@56
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
213 char *Str; // [sp+14h] [bp-Ch]@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
214 NPCGreeting *pGreetings; // [sp+14h] [bp-Ch]@26
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
215 unsigned __int16 *pGroups; // [sp+14h] [bp-Ch]@42
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
216 char **pCatchPhrase; // [sp+14h] [bp-Ch]@56
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
217 signed int v32; // [sp+18h] [bp-8h]@2
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
218 signed int v33; // [sp+18h] [bp-8h]@27
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
219 signed int v34; // [sp+18h] [bp-8h]@43
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
220 signed int v35; // [sp+18h] [bp-8h]@57
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
221 signed int v36; // [sp+1Ch] [bp-4h]@2
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
222 signed int v37; // [sp+1Ch] [bp-4h]@27
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
223 signed int v38; // [sp+1Ch] [bp-4h]@43
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
224 signed int v39; // [sp+1Ch] [bp-4h]@57
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
225
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
226 pNPCStats = this;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
227 pRaw = (char *)pEvents_LOD->LoadRaw("npcdata.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
228 pNPCStats->pNPCDataTXT_Raw = pRaw;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
229 strtok(pRaw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
230 strtok(0, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
231 pHouse = (char *)&pNPCStats->pNPCData[1].house;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
232 Str = (char *)pNPCStats->pNPCNames2;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
233 v24 = 500;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
234 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
235 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
236 v32 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
237 v4 = strtok(0, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
238 v36 = -1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
239 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
240 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
241 v5 = *v4;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
242 v6 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
243 while ( v5 != 9 && v5 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
244 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
245 ++v6;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
246 v5 = v4[v6];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
247 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
248 v23 = (int)&v4[v6];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
249 if ( !v4[v6] )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
250 v32 = 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
251 v4[v6] = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
252 if ( v6 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
253 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
254 switch ( v36 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
255 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
256 case 0:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
257 v7 = RemoveQuotes(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
258 *((int *)pHouse - 5) = (int)v7;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
259 *(int *)Str = (int)v7;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
260 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
261 case 1:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
262 *((int *)pHouse - 4) = atoi(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
263 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
264 case 5:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
265 *(int *)pHouse = atoi(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
266 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
267 case 6:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
268 *((int *)pHouse + 1) = atoi(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
269 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
270 case 7:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
271 *((int *)pHouse + 2) = atoi(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
272 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
273 case 8:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
274 *((int *)pHouse + 3) = *v4 == 121;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
275 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
276 case 9:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
277 *((int *)pHouse + 5) = atoi(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
278 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
279 case 10:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
280 *((int *)pHouse + 6) = atoi(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
281 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
282 case 11:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
283 *((int *)pHouse + 7) = atoi(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
284 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
285 case 12:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
286 *((int *)pHouse + 8) = atoi(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
287 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
288 case 13:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
289 *((int *)pHouse + 9) = atoi(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
290 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
291 case 14:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
292 *((int *)pHouse + 10) = atoi(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
293 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
294 default:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
295 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
296 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
297 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
298 ++v36;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
299 v4 = (char *)(v23 + 1);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
300 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
301 while ( v36 + 1 <= 15 && !v32 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
302 Str += 4;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
303 pHouse += 76;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
304 --v24;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
305 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
306 while ( v24 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
307 pNPCStats->uNumNewNPCs = 501;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
308 v8 = (char *)pEvents_LOD->LoadRaw("npcgreet.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
309 pNPCStats->pNPCGreetTXT_Raw = v8;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
310 strtok(v8, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
311 pGreetings = pNPCStats->pNPCGreetings;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
312 v25 = 205;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
313 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
314 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
315 v37 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
316 v33 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
317 v9 = strtok(0, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
318 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
319 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
320 v10 = *v9;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
321 v11 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
322 while ( v10 != 9 && v10 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
323 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
324 ++v11;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
325 v10 = v9[v11];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
326 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
327 v12 = (int)&v9[v11];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
328 if ( !v9[v11] )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
329 v33 = 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
330 *(char *)v12 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
331 if ( v11 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
332 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
333 if ( v37 == 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
334 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
335 pGreetings->pGreeting1 = (char *)RemoveQuotes(v9);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
336 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
337 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
338 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
339 if ( v37 == 2 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
340 pGreetings->pGreeting2 = (char *)RemoveQuotes(v9);
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 ++v37;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
344 v9 = (char *)(v12 + 1);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
345 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
346 while ( v37 <= 2 && !v33 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
347 ++pGreetings;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
348 --v25;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
349 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
350 while ( v25 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
351 v13 = (char *)pEvents_LOD->LoadRaw("npcgroup.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
352 pNPCStats->pNCPGroupTXT_Raw = v13;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
353 strtok(v13, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
354 pGroups = pNPCStats->pGroups;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
355 v26 = 51;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
356 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
357 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
358 v14 = strtok(0, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
359 v38 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
360 v34 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
361 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
362 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
363 v15 = *v14;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
364 v16 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
365 while ( v15 != 9 && v15 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
366 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
367 ++v16;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
368 v15 = v14[v16];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
369 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
370 v17 = (int)&v14[v16];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
371 if ( !v14[v16] )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
372 v34 = 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
373 *(char *)v17 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
374 if ( v16 && v38 == 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
375 *pGroups = atoi(v14);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
376 ++v38;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
377 v14 = (char *)(v17 + 1);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
378 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
379 while ( v38 <= 1 && !v34 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
380 ++pGroups;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
381 --v26;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
382 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
383 while ( v26 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
384 v18 = (char *)pEvents_LOD->LoadRaw("npcnews.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
385 pNPCStats->pNPCNewsTXT_Raw = v18;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
386 strtok(v18, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
387 pCatchPhrase = pNPCStats->pCatchPhrases;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
388 v27 = 51;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
389 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
390 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
391 v19 = strtok(0, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
392 v39 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
393 v35 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
394 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
395 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
396 v20 = *v19;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
397 v21 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
398 while ( v20 != 9 && v20 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
399 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
400 ++v21;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
401 v20 = v19[v21];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
402 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
403 v22 = (int)&v19[v21];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
404 if ( !v19[v21] )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
405 v35 = 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
406 *(char *)v22 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
407 if ( v21 && v39 == 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
408 *pCatchPhrase = (char *)RemoveQuotes(v19);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
409 ++v39;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
410 v19 = (char *)(v22 + 1);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
411 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
412 while ( v39 <= 1 && !v35 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
413 ++pCatchPhrase;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
414 --v27;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
415 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
416 while ( v27 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
417 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
418
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
419 //----- (0047702F) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
420 void NPCStats::Initialize()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
421 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
422 //NPCStats *v1; // edi@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
423 char *v2; // ebx@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
424 //char *v3; // eax@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
425 char *v4; // ebx@3
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
426 char v5; // al@4
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
427 int v6; // ecx@4
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
428 //char *v7; // eax@18
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
429 char *v8; // ebx@18
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
430 char *v9; // ecx@19
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
431 char v10; // dl@20
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
432 int v11; // eax@20
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
433 char v12; // zf@41
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
434 signed int v13; // [sp+Ch] [bp-14h]@18
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
435 int v14; // [sp+10h] [bp-10h]@4
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
436 int v15; // [sp+10h] [bp-10h]@24
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
437 char *v16; // [sp+14h] [bp-Ch]@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
438 signed int v17; // [sp+14h] [bp-Ch]@19
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
439 unsigned int v18; // [sp+18h] [bp-8h]@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
440 char *v19; // [sp+18h] [bp-8h]@18
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
441 signed int v20; // [sp+1Ch] [bp-4h]@3
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
442 signed int v21; // [sp+1Ch] [bp-4h]@19
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
443 //v1 = this;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
444
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
445 Initialize1();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
446 Initialize2();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
447
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
448 InitializeQuests();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
449 InitializeAutonotes();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
450 InitializeAwards();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
451 InitializeTransitions();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
452 InitializeMerchants();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
453 InitializeScrolls();
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
454 v2 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
455 field_17FC0 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
456 pNPCNamesTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
457 //v3 = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
458 pNPCNamesTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
459 strtok(pNPCNamesTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
460 v18 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
461 v16 = (char *)pNPCNames;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
462 while ( 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
463 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
464 v4 = strtok(v2, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
465 v20 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
466 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
467 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
468 v5 = *v4;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
469 v6 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
470 v14 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
471 if ( *v4 == 9 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
472 goto LABEL_45;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
473 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
474 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
475 if ( !v5 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
476 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
477 if ( v5 == 10 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
478 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
479 ++v6;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
480 v14 = v6;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
481 v5 = v4[v6];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
482 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
483 while ( v5 != 9 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
484 if ( v6 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
485 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
486 v4[v6] = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
487 if ( v20 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
488 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
489 if ( v20 == 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
490 *((int *)v16 + 1) = (int)RemoveQuotes(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
491 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
492 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
493 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
494 *(int *)v16 = (int)RemoveQuotes(v4);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
495 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
496 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
497 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
498 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
499 LABEL_45:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
500 if ( v20 == 1 && !uNumNPCNames[1] )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
501 uNumNPCNames[1] = v18;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
502 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
503 ++v20;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
504 v4 += v14 + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
505 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
506 while ( v20 <= 1 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
507 ++v18;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
508 v16 += 8;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
509 if ( (signed int)v18 >= 540 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
510 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
511 v2 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
512 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
513 pNPCProfTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
514 uNumNPCNames[0] = v18;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
515 //v7 = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
516 pNPCProfTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
517 strtok(pNPCProfTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
518 strtok(0, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
519 strtok(0, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
520 strtok(0, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
521 v8 = (char *)&pProfessions[0].pJoinText;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
522 v19 = (char *)&pProfessions[0].pJoinText;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
523 v13 = 58;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
524 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
525 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
526 v21 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
527 v9 = strtok(0, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
528 v17 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
529 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
530 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
531 v10 = *v9;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
532 v11 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
533 if ( *v9 != 9 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
534 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
535 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
536 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
537 if ( !v10 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
538 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
539 ++v11;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
540 v10 = v9[v11];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
541 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
542 while ( v10 != 9 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
543 v8 = v19;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
544 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
545 v15 = (int)&v9[v11];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
546 if ( !v9[v11] )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
547 v17 = 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
548 *(char *)v15 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
549 if ( v11 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
550 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
551 switch ( v21 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
552 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
553 case 2:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
554 *((int *)v8 - 3) = atoi(v9);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
555 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
556 case 3:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
557 *((int *)v8 - 1) = (int)RemoveQuotes(v9);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
558 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
559 case 4:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
560 *((int *)v8 - 2) = (int)RemoveQuotes(v9);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
561 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
562 case 5:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
563 *(int *)v8 = (int)RemoveQuotes(v9);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
564 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
565 case 6:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
566 *((int *)v8 + 1) = (int)RemoveQuotes(v9);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
567 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
568 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
569 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
570 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
571 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
572 if ( !v21 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
573 v17 = 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
574 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
575 ++v21;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
576 v9 = (char *)(v15 + 1);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
577 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
578 while ( v21 <= 6 && !v17 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
579 v8 += 20;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
580 v12 = v13-- == 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
581 v19 = v8;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
582 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
583 while ( !v12 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
584 uNumNPCProfessions = 59;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
585 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
586
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
587 //----- (00477266) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
588 void NPCStats::Release()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
589 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
590 NPCStats *v1; // esi@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
591 void *v2; // ST00_4@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
592 int v3; // ebx@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
593
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
594 v1 = this;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
595 pAllocator->FreeChunk(this->pNPCTopicTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
596 v2 = v1->pNPCTextTXT_Raw;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
597 v1->pNPCNewsTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
598 pAllocator->FreeChunk(v2);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
599 v1->pNPCNewsTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
600 pAllocator->FreeChunk(0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
601 v1->pNPCNewsTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
602 pAllocator->FreeChunk(v1->pNPCProfTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
603 v1->pNPCProfTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
604 pAllocator->FreeChunk(v1->pNPCNamesTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
605 v1->pNPCNamesTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
606 pAllocator->FreeChunk(v1->pNPCDataTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
607 v1->pNPCDataTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
608 pAllocator->FreeChunk(v1->pNPCDistTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
609 v1->pNPCDistTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
610 v3 = (int)&v1->pNPCGreetTXT_Raw;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
611 pAllocator->FreeChunk(v1->pNPCGreetTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
612 v1 = (NPCStats *)((char *)v1 + 98296);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
613 *(int *)v3 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
614 pAllocator->FreeChunk(v1->pNPCData[0].pName);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
615 v1->pNPCData[0].pName = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
616 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
617
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
618 //----- (0047730C) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
619 int __fastcall const_1(int a1, int)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
620 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
621 return 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
622 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
623 // 47730C: using guessed type int __stdcall const_1(int);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
624
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
625 //----- (0047732C) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
626 bool NPCStats::InitializeAdditionalNPCs(NPCData *a2, int a3, int a4, int a5)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
627 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
628 //NPCStats *v5; // ebx@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
629 signed __int64 v6; // qax@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
630 int v7; // esi@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
631 int v8; // edx@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
632 NPCData *v9; // edi@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
633 int v10; // eax@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
634 //int v11; // eax@23
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
635 int v12; // ecx@23
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
636 int v13; // edx@28
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
637 int v14; // esi@37
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
638 int v15; // edx@37
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
639 int v16; // ecx@37
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
640 int v17; // eax@37
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
641 int v18; // edx@37
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
642 signed int result; // eax@39
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
643 int v20; // [sp+Ch] [bp-Ch]@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
644 signed int v21; // [sp+10h] [bp-8h]@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
645 signed int v22; // [sp+14h] [bp-4h]@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
646 int v23; // [sp+24h] [bp+Ch]@1
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
647
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
648
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
649 v23 = a3 - 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
650 //v5 = this;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
651 v6 = (signed __int64)((double)v23 * -0.33333334);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
652 v7 = (unsigned __int8)byte_4E8394[-(_DWORD)v6 + 28];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
653 v20 = (unsigned __int8)byte_4E8394[-(_DWORD)v6 + 116];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
654 v8 = rand() % uNumNPCNames[v7];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
655 v9 = a2;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
656 a2->uSex = v7;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
657 a2->pName = pNPCNames[v8][v7];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
658 v10 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
659 v22 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
660 v21 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
661
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
662 while ( 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
663 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
664 if ( v20 == v10 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
665 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
666 if ( v7 == v10 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
667 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
668 v23 = 2;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
669 a2 = (NPCData *)100;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
670 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
671 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
672 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
673 if ( v7 - v10 == 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
674 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
675 v23 = 201;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
676 a2 = (NPCData *)250;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
677 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
678 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
679 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
680 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
681 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
682 switch ( v20 - v10 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
683 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
684 case 1:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
685 if ( v7 == v10 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
686 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
687 v23 = 400;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
688 a2 = (NPCData *)430;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
689 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
690 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
691 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
692 if ( v7 - v10 == 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
693 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
694 v23 = 460;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
695 a2 = (NPCData *)490;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
696 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
697 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
698 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
699 case 2:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
700 if ( v7 == v10 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
701 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
702 v23 = 500;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
703 a2 = (NPCData *)520;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
704 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
705 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
706 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
707 if ( v7 - v10 == 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
708 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
709 v23 = 530;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
710 a2 = (NPCData *)550;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
711 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
712 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
713 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
714 case 3:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
715 if ( v7 == v10 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
716 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
717 v23 = 300;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
718 a2 = (NPCData *)330;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
719 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
720 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
721 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
722 if ( v7 - v10 == 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
723 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
724 v23 = 360;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
725 a2 = (NPCData *)387;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
726 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
727 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
728 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
729 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
730 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
731 v12 = v23 + rand() % ((int)a2 - v23 + 1);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
732 if ( const_1(v12, v7) == 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
733 v21 = 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
734 ++v22;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
735 if ( v22 >= 4 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
736 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
737 v12 = v23;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
738 v21 = 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
739 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
740 if ( v21 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
741 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
742 v10 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
743 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
744
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
745 v9->uPortraitID = v12;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
746 v9->uFlags = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
747 v9->fame = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
748 v13 = rand() % 100 + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
749
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
750 if ( v13 >= 60 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
751 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
752 if ( v13 >= 90 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
753 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
754 if ( v13 >= 95 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
755 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
756 if ( v13 >= 98 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
757 v9->rep = -600;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
758 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
759 v9->rep = 400;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
760 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
761 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
762 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
763 v9->rep = -300;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
764 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
765 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
766 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
767 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
768 v9->rep = 200;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
769 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
770 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
771 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
772 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
773 v9->rep = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
774 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
775
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
776 //v14 = (int)((char *)v5 + 64 * a5);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
777 //v15 = rand() % *(_DWORD *)(v14 + 91460);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
778 v15 = rand() % array_16544[a5].field_0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
779 v16 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
780 v17 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
781 v18 = v15 + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
782
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
783 if ( v18 > 0 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
784 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
785 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
786 //v14 += *(char *)(v14 + v17++ + 0x16548);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
787 v16 += array_16544[a5].field_4[v17++];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
788 while ( v16 < v18 );
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
789 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
790 v9->uProfession = v17 - 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
791 v9->house = a4;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
792 v9->field_24 = 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
793 v9->joins = 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
794 return true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
795 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
796
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
797
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
798 //----- (00476387) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
799 bool __cdecl sub_476387()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
800 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
801 return (pNPCStats->pNewNPCData[57].uFlags & 0x80) != 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
802 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
803
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
804 //----- (00476395) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
805 //0x26 Wizard eye at skill level 2
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
806 bool __thiscall CheckHiredNPCSpeciality(unsigned int uProfession)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
807 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
808 bool result; // eax@2
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
809 signed int v2; // esi@3
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
810 char *v3; // eax@4
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
811
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
812 if ( bNoNPCHiring == 1 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
813 return 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
814 v2 = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
815 if ( (signed int)pNPCStats->uNumNewNPCs <= 0 )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
816 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
817 LABEL_8:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
818 result = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
819 if ( pParty->pHirelings[0].uProfession != uProfession )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
820 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
821 LOBYTE(result) = pParty->pHirelings[1].uProfession == uProfession;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
822 return result;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
823 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
824 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
825 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
826 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
827 v3 = (char *)&pNPCStats->pNewNPCData[0].uFlags;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
828 while ( *((int *)v3 + 4) != uProfession || !(*v3 & 0x80) )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
829 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
830 ++v2;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
831 v3 += 76;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
832 if ( v2 >= (signed int)pNPCStats->uNumNewNPCs )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
833 goto LABEL_8;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
834 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
835 result = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
836 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
837 ++result;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
838 return result;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
839 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
840 // 6BE3C5: using guessed type char bNoNPCHiring;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
841
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
842 //----- (004763E0) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
843 void InitializeAwards()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
844 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
845
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
846 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
847 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
848 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
849 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
850 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
851 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
852 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
853 int item_counter;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
854
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
855 if ( pAwardsTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
856 pAllocator->FreeChunk(pAwardsTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
857 pAwardsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
858 pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
859 strtok(pAwardsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
860
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
861 for (i=1; i<104; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
862 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
863 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
864 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
865 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
866 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
867 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
868 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
869 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
870 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
871 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
872 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
873 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
874 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
875 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
876 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
877 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
878 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
879 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
880 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
881 if (decode_step==1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
882 pAwards[i].pText=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
883 else if (decode_step==2)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
884 pAwards[i].uSort=atoi(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
885 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
886 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
887 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
888 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
889 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
890 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
891 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
892 } while ((decode_step<3)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
893 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
894
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
895 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
896 // 7241C8: using guessed type int dword_7241C8;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
897
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
898 //----- (004764C2) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
899 void InitializeScrolls()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
900 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
901
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
902 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
903 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
904 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
905 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
906 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
907 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
908 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
909 int item_counter;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
910
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
911 if ( pScrollsTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
912 pAllocator->FreeChunk(pScrollsTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
913 pScrollsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
914 pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
915 strtok(pScrollsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
916 for (i=0; i<82; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
917 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
918 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
919 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
920 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
921 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
922 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
923 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
924 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
925 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
926 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
927 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
928 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
929 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
930 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
931 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
932 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
933 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
934 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
935 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
936 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
937 pScrolls[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
938 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
939 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
940 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
941 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
942 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
943 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
944 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
945 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
946 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
947 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
948
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
949
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
950 //----- (00476590) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
951 void InitializeMerchants()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
952 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
953 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
954 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
955 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
956 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
957 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
958 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
959 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
960 int item_counter;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
961
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
962 if ( pMerchantsTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
963 pAllocator->FreeChunk(pMerchantsTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
964 pMerchantsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
965 pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
966 strtok(pMerchantsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
967
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
968 for (i=0; i<7; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
969 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
970 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
971 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
972 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
973 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
974 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
975 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
976 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
977 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
978 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
979 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
980 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
981 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
982 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
983 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
984 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
985 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
986 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
987 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
988 switch (decode_step)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
989 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
990 case 1:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
991 pMerchantsBuyPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
992 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
993 case 2:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
994 pMerchantsSellPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
995 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
996 case 3:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
997 pMerchantsRepairPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
998 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
999 case 4:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1000 pMerchantsIdentifyPhrases[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1001 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1002 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1003 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1004 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1005 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1006 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1007 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1008 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1009 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1010 } while ((decode_step<5)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1011 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1012
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1013 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1014
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1015 //----- (00476682) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1016 void InitializeTransitions()
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 int item_counter;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1026
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1027 if ( pTransitionsTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1028 pAllocator->FreeChunk(pTransitionsTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1029 pTransitionsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1030 pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1031 strtok(pTransitionsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1032
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1033 for (i=0; i<464; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1034 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1035 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1036 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1037 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1038 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1039 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1040 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1041 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1042 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1043 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1044 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1045 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1046 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1047 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1048 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1049 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1050 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1051 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1052 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1053 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1054 pTransitionStrings[i]=RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1055 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1056 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1057 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1058 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1059 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1060 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1061 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1062 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1063 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1064 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1065
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1066 //----- (00476750) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1067 void __cdecl InitializeAutonotes()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1068 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1069 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1070 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1071 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1072 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1073 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1074 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1075 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1076 int item_counter;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1077
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1078 if ( pAutonoteTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1079 pAllocator->FreeChunk(pAutonoteTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1080 pAutonoteTXT_Raw = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1081 pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1082 strtok(pAutonoteTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1083
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1084 for (i=0; i<195; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1085 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1086 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1087 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1088 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1089 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1090 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1091 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1092 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1093 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1094 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1095 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1096 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1097 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1098 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1099 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1100 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1101 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1102 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1103 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1104 switch (decode_step)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1105 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1106 case 1:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1107 pAutonoteTxt[i].pText=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 2:
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1110 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1111 if ( !_strcmpi(test_string, "potion"))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1112 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1113 pAutonoteTxt[i].eType = AUTONOTE_POTION_RECEPIE;
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 if ( !_strcmpi(test_string, "stat") )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1117 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1118 pAutonoteTxt[i].eType = AUTONOTE_STAT_HINT;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1119 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1120 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1121 if ( !_strcmpi(test_string, "seer") )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1122 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1123 pAutonoteTxt[i].eType = AUTONOTE_SEER;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1124 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1125 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1126 if ( !_strcmpi(test_string, "obelisk") )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1127 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1128 pAutonoteTxt[i].eType = AUTONOTE_OBELISK;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1129 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1130 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1131 if ( !_strcmpi(test_string, "teacher") )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1132 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1133 pAutonoteTxt[i].eType = AUTONOTE_TEACHER;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1134 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1135 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1136 pAutonoteTxt[i].eType =AUTONOTE_MISC;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1137 break;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1138 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1139 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1140 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1141 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1142 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1143 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1144 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1145 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1146 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1147 } while ((decode_step<3)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1148 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1149 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1150
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1151
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1152 //----- (004768A9) --------------------------------------------------------
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1153 void __cdecl InitializeQuests()
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1154 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1155 int i;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1156 char* test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1157 unsigned char c;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1158 bool break_loop;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1159 unsigned int temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1160 char* tmp_pos;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1161 int decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1162 int item_counter;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1163
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1164 if ( pQuestsTXT_Raw )
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1165 pAllocator->FreeChunk(pQuestsTXT_Raw);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1166 pQuestsTXT_Raw = NULL;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1167 pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1168 strtok(pQuestsTXT_Raw, "\r");
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1169
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1170 for (i=0; i<512; ++i)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1171 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1172 test_string = strtok(NULL, "\r") + 1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1173 break_loop = false;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1174 decode_step=0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1175 do
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1176 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1177 c = *(unsigned char*)test_string;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1178 temp_str_len = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1179 while((c!='\t')&&(c>0))
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1180 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1181 ++temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1182 c=test_string[temp_str_len];
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1183 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1184 tmp_pos=test_string+temp_str_len;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1185 if (*tmp_pos == 0)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1186 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1187 *tmp_pos = 0;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1188 if (temp_str_len)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1189 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1190 if ( decode_step == 1)
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1191 pQuestTable[i] =RemoveQuotes(test_string);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1192 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1193 else
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1194 {
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1195 break_loop = true;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1196 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1197 ++decode_step;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1198 test_string=tmp_pos+1;
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1199 } while ((decode_step<2)&&!break_loop);
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1200 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1201 }
48f21f569328 Npc related stuff separated
Gloval
parents:
diff changeset
1202