0
|
1 #include <stdlib.h>
|
|
2 #include <stdio.h>
|
|
3 #include <string.h>
|
|
4
|
|
5 #include "Monsters.h"
|
|
6 #include "FrameTableInc.h"
|
|
7 #include "Allocator.h"
|
|
8 #include "LOD.h"
|
|
9
|
|
10 #include "mm7_data.h"
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15
|
|
16 struct MonsterStats *pMonsterStats;
|
|
17 struct MonsterList *pMonsterList;
|
|
18
|
|
19
|
|
20 //----- (004598FC) --------------------------------------------------------
|
|
21 bool MonsterList::FromFileTxt(const char *Args)
|
|
22 {
|
|
23 MonsterList *v2; // ebx@1
|
|
24 FILE *v3; // eax@1
|
|
25 unsigned int v4; // esi@3
|
|
26 void *v5; // eax@9
|
|
27 FILE *v6; // ST14_4@11
|
|
28 char *i; // eax@11
|
|
29 signed int v8; // esi@12
|
|
30 unsigned __int16 v9; // ax@16
|
|
31 const char *v10; // ST18_4@16
|
|
32 unsigned __int16 v11; // ax@16
|
|
33 const char *v12; // ST14_4@16
|
|
34 unsigned __int16 v13; // ax@16
|
|
35 const char *v14; // ST10_4@16
|
|
36 __int16 v15; // ax@16
|
|
37 const char *v16; // ST0C_4@16
|
|
38 int v17; // esi@16
|
|
39 unsigned __int8 v18; // al@16
|
|
40 signed int v19; // esi@16
|
|
41 unsigned __int16 v20; // ax@17
|
|
42 int v21; // ecx@17
|
|
43 char Buf; // [sp+4h] [bp-304h]@3
|
|
44 FrameTableTxtLine v24; // [sp+1F8h] [bp-110h]@4
|
|
45 FrameTableTxtLine v25; // [sp+274h] [bp-94h]@4
|
|
46 int v26; // [sp+2F0h] [bp-18h]@16
|
|
47 char v27; // [sp+2F4h] [bp-14h]@14
|
|
48 char v28; // [sp+2F5h] [bp-13h]@14
|
|
49 char v29; // [sp+2F6h] [bp-12h]@14
|
|
50 char v30; // [sp+2F7h] [bp-11h]@14
|
|
51 char v31; // [sp+2F8h] [bp-10h]@14
|
|
52 char v32; // [sp+2F9h] [bp-Fh]@14
|
|
53 char v33; // [sp+2FAh] [bp-Eh]@14
|
|
54 char v34; // [sp+2FBh] [bp-Dh]@14
|
|
55 char v35; // [sp+2FCh] [bp-Ch]@14
|
|
56 char v36; // [sp+2FDh] [bp-Bh]@14
|
|
57 char v37; // [sp+2FEh] [bp-Ah]@14
|
|
58 char v38; // [sp+2FFh] [bp-9h]@14
|
|
59 char v39; // [sp+300h] [bp-8h]@14
|
|
60 char v40; // [sp+301h] [bp-7h]@14
|
|
61 char v41; // [sp+302h] [bp-6h]@14
|
|
62 char v42; // [sp+303h] [bp-5h]@14
|
|
63 FILE *File; // [sp+304h] [bp-4h]@1
|
|
64 unsigned int Argsa; // [sp+310h] [bp+8h]@3
|
|
65 int Argsb; // [sp+310h] [bp+8h]@16
|
|
66
|
|
67 v2 = this;
|
|
68 v3 = fopen(Args, "r");
|
|
69 File = v3;
|
|
70 if ( !v3 )
|
|
71 Abortf("MonsterRaceListStruct::load - Unable to open file: %s.");
|
|
72 v4 = 0;
|
|
73 Argsa = 0;
|
|
74 if ( fgets(&Buf, 490, v3) )
|
|
75 {
|
|
76 do
|
|
77 {
|
|
78 *strchr(&Buf, 10) = 0;
|
|
79 memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25));
|
|
80 if ( v25.field_0 && *v25.pProperties[0] != 47 )
|
|
81 ++Argsa;
|
|
82 }
|
|
83 while ( fgets(&Buf, 490, File) );
|
|
84 v4 = Argsa;
|
|
85 }
|
|
86 v2->uNumMonsters = v4;
|
|
87 v5 = pAllocator->AllocNamedChunk(v2->pMonsters, 152 * v4, "Mon Race");
|
|
88 v2->pMonsters = (MonsterDesc *)v5;
|
|
89 if ( !v5 )
|
|
90 Abortf("MonsterRaceListStruct::load - Out of Memory!");
|
|
91 v6 = File;
|
|
92 v2->uNumMonsters = 0;
|
|
93 fseek(v6, 0, 0);
|
|
94 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
|
|
95 {
|
|
96 *strchr(&Buf, 10) = 0;
|
|
97 memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25));
|
|
98 v8 = 0;
|
|
99 if ( v25.field_0 && *v25.pProperties[0] != 47 )
|
|
100 {
|
|
101 strcpy(v2->pMonsters[v2->uNumMonsters].pMonsterName, v25.pProperties[0]);
|
|
102 v35 = 0;
|
|
103 v36 = 1;
|
|
104 v37 = 7;
|
|
105 v38 = 2;
|
|
106 v39 = 3;
|
|
107 v40 = 4;
|
|
108 v41 = 5;
|
|
109 v42 = 6;
|
|
110 v27 = 1;
|
|
111 v28 = 2;
|
|
112 v29 = 3;
|
|
113 v30 = 4;
|
|
114 v31 = 4;
|
|
115 v32 = 5;
|
|
116 v33 = 6;
|
|
117 v34 = 7;
|
|
118 do
|
|
119 {
|
|
120 strcpy(
|
|
121 v2->pMonsters[v2->uNumMonsters].pSpriteNames[(unsigned __int8)*(&v35 + v8)],
|
|
122 v25.pProperties[(unsigned __int8)*(&v27 + v8)]);
|
|
123 ++v8;
|
|
124 }
|
|
125 while ( v8 < 8 );
|
|
126 v9 = atoi(v25.pProperties[8]);
|
|
127 v10 = v25.pProperties[9];
|
|
128 v2->pMonsters[v2->uNumMonsters].uMonsterHeight = v9;
|
|
129 v11 = atoi(v10);
|
|
130 v12 = v25.pProperties[10];
|
|
131 v2->pMonsters[v2->uNumMonsters].uMovementSpeed = v11;
|
|
132 v13 = atoi(v12);
|
|
133 v14 = v25.pProperties[11];
|
|
134 v2->pMonsters[v2->uNumMonsters].uMonsterRadius = v13;
|
|
135 v15 = atoi(v14);
|
|
136 v16 = v25.pProperties[12];
|
|
137 v2->pMonsters[v2->uNumMonsters].uToHitRadius = v15;
|
|
138 v17 = (unsigned __int8)atoi(v16);
|
|
139 Argsb = atoi(v25.pProperties2[0]) & 0xFF;
|
|
140 v26 = atoi(v25.pProperties2[1]) & 0xFF;
|
|
141 v18 = atoi(v25.pProperties2[2]);
|
|
142 v2->pMonsters[v2->uNumMonsters].uTintColor = v18 | ((v26 | ((Argsb | (v17 << 8)) << 8)) << 8);
|
|
143 v19 = 0;
|
|
144 do
|
|
145 {
|
|
146 v20 = atoi(v25.pProperties2[v19 + 4]);
|
|
147 v21 = v19++ + 76 * v2->uNumMonsters;
|
|
148 v2->pMonsters->pSoundSampleIDs[v21] = v20;
|
|
149 }
|
|
150 while ( v19 < 4 );
|
|
151 ++v2->uNumMonsters;
|
|
152 }
|
|
153 }
|
|
154 fclose(File);
|
|
155 return 1;
|
|
156 }
|
|
157
|
|
158 //----- (004598AF) --------------------------------------------------------
|
|
159 void MonsterList::FromFile(void *pSerialized)
|
|
160 {
|
|
161 uNumMonsters = *(int *)pSerialized;
|
|
162 pMonsters = (MonsterDesc *)pAllocator->AllocNamedChunk(pMonsters, 152 * uNumMonsters, "Mon Race");
|
|
163 memcpy(pMonsters, (char *)pSerialized + 4, 152 * uNumMonsters);
|
|
164 }
|
|
165
|
|
166 //----- (00459860) --------------------------------------------------------
|
|
167 void MonsterList::ToFile()
|
|
168 {
|
|
169 MonsterList *v1; // esi@1
|
|
170 FILE *v2; // eax@1
|
|
171 FILE *v3; // edi@1
|
|
172
|
|
173 v1 = this;
|
|
174 v2 = fopen("data\\dmonlist.bin", "wb");
|
|
175 v3 = v2;
|
|
176 if ( !v2 )
|
|
177 Abortf("Unable to save dmonlist.bin!");
|
|
178 fwrite(v1, 4u, 1u, v2);
|
|
179 fwrite(v1->pMonsters, 0x98u, v1->uNumMonsters, v3);
|
|
180 fclose(v3);
|
|
181 }
|
|
182
|
|
183
|
|
184 //----- (004563FF) --------------------------------------------------------
|
|
185 signed int MonsterStats::_4563FF(const char *Str2)
|
|
186 {
|
|
187 MonsterStats *v2; // esi@1
|
|
188 signed int v3; // ebx@1
|
|
189 MonsterInfo *v4; // edi@2
|
|
190 signed int result; // eax@6
|
|
191
|
|
192 v2 = this;
|
|
193 v3 = 1;
|
|
194 if ( (signed int)this->uNumMonsters <= 1 )
|
|
195 {
|
|
196 LABEL_6:
|
|
197 result = -1;
|
|
198 }
|
|
199 else
|
|
200 {
|
|
201 v4 = &this->pInfos[1];
|
|
202 while ( !v4->pName || _strcmpi(v4->pTexture, Str2) )
|
|
203 {
|
|
204 ++v3;
|
|
205 ++v4;
|
|
206 if ( v3 >= (signed int)v2->uNumMonsters )
|
|
207 goto LABEL_6;
|
|
208 }
|
|
209 result = v3;
|
|
210 }
|
|
211 return result;
|
|
212 }
|
|
213
|
|
214
|
|
215 //----- (00454F4E) --------------------------------------------------------
|
|
216 void MonsterStats::InitializePlacements()
|
|
217 {
|
|
218 char *v1; // ebx@1
|
|
219 MonsterStats *v2; // edi@1
|
|
220 char *v3; // eax@2
|
|
221 char v4; // dl@3
|
|
222 char *v5; // ecx@3
|
|
223 int v6; // esi@7
|
|
224 signed int v7; // [sp+Ch] [bp-10h]@1
|
|
225 char **v8; // [sp+10h] [bp-Ch]@1
|
|
226 signed int v9; // [sp+14h] [bp-8h]@2
|
|
227 char *v10; // [sp+18h] [bp-4h]@2
|
|
228
|
|
229 v1 = 0;
|
|
230 v2 = this;
|
|
231 pMonsterPlacementTXT_Raw = (char *)pEvents_LOD->LoadRaw("placemon.txt", 0);
|
|
232 strtok(pMonsterPlacementTXT_Raw, "\r");
|
|
233 v2->uNumPlacements = 31;
|
|
234 v8 = v2->pPlacement.pSubstrings;
|
|
235 v7 = 30;
|
|
236 do
|
|
237 {
|
|
238 v3 = strtok(v1, "\r") + 1;
|
|
239 v10 = v1;
|
|
240 v9 = (signed int)v1;
|
|
241 do
|
|
242 {
|
|
243 v4 = *v3;
|
|
244 v5 = 0;
|
|
245 if ( *v3 != 9 )
|
|
246 {
|
|
247 v1 = 0;
|
|
248 do
|
|
249 {
|
|
250 if ( !v4 )
|
|
251 break;
|
|
252 ++v5;
|
|
253 v4 = v3[(unsigned int)v5];
|
|
254 }
|
|
255 while ( v4 != 9 );
|
|
256 }
|
|
257 v6 = (int)&v3[(unsigned int)v5];
|
|
258 if ( v3[(unsigned int)v5] == (unsigned char)v1 )
|
|
259 v9 = 1;
|
|
260 *(unsigned char *)v6 = (unsigned char)v1;
|
|
261 if ( v5 == v1 )
|
|
262 {
|
|
263 v9 = 1;
|
|
264 }
|
|
265 else
|
|
266 {
|
|
267 if ( v10 == (char *)1 )
|
|
268 *v8 = (char *)RemoveQuotes(v3);
|
|
269 }
|
|
270 ++v10;
|
|
271 v3 = (char *)(v6 + 1);
|
|
272 }
|
|
273 while ( (signed int)(v10 - 1) <= 31 && (char *)v9 == v1 );
|
|
274 ++v8;
|
|
275 --v7;
|
|
276 }
|
|
277 while ( v7 );
|
|
278 v2->uNumPlacements = 31;
|
|
279 }
|
|
280
|
|
281 //----- (0045501E) --------------------------------------------------------
|
|
282 void MonsterStats::Initialize()
|
|
283 {
|
|
284 MonsterStats *v1; // ebx@1
|
|
285 int v2; // ebx@4
|
|
286 char v3; // cl@5
|
|
287 int v4; // eax@5
|
|
288 size_t v5; // eax@19
|
|
289 signed int v6; // edi@19
|
|
290 MonsterStats *v7; // ecx@23
|
|
291 int v8; // eax@23
|
|
292 unsigned int *pHP; // esi@23
|
|
293 size_t v10; // eax@29
|
|
294 signed int v11; // edi@29
|
|
295 MonsterStats *v12; // ecx@33
|
|
296 int v13; // eax@33
|
|
297 unsigned int *pExp; // esi@33
|
|
298 signed int v15; // edi@36
|
|
299 size_t v16; // esi@36
|
|
300 int v17; // eax@37
|
|
301 MonsterInfo *v18; // esi@45
|
|
302 size_t v19; // edi@50
|
|
303 int v20; // eax@51
|
|
304 unsigned __int8 v21; // al@55
|
|
305 size_t v22; // edi@59
|
|
306 char v23; // cl@63
|
|
307 const char *v24; // edi@63
|
|
308 unsigned __int16 *v25; // esi@114
|
|
309 int v26; // eax@118
|
|
310 size_t v27; // eax@136
|
|
311 int v28; // edi@137
|
|
312 MonsterStats *v29; // esi@137
|
|
313 int v30; // eax@138
|
|
314 int v31; // eax@142
|
|
315 int v32; // eax@143
|
|
316 int v33; // eax@144
|
|
317 int v34; // eax@151
|
|
318 int v35; // eax@152
|
|
319 int v36; // eax@153
|
|
320 int v37; // eax@162
|
|
321 int v38; // eax@163
|
|
322 int v39; // eax@164
|
|
323 int v40; // eax@171
|
|
324 int v41; // eax@172
|
|
325 size_t v42; // eax@180
|
|
326 int v43; // edi@180
|
|
327 MonsterInfo *v44; // esi@180
|
|
328 int v45; // edi@184
|
|
329 MonsterInfo *v46; // eax@232
|
|
330 char *v47; // edx@232
|
|
331 char *v48; // ecx@232
|
|
332 MonsterInfo *v49; // eax@236
|
|
333 FrameTableTxtLine *v50; // esi@240
|
|
334 int v51; // eax@240
|
|
335 int v52; // eax@241
|
|
336 int v53; // esi@242
|
|
337 int v54; // edi@242
|
|
338 char v55; // al@242
|
|
339 char *v56; // edi@242
|
|
340 FrameTableTxtLine *v57; // esi@249
|
|
341 int v58; // eax@249
|
|
342 MonsterInfo *v59; // eax@250
|
|
343 MonsterInfo *v60; // esi@251
|
|
344 int v61; // edi@251
|
|
345 char v62; // al@251
|
|
346 char *v63; // edi@251
|
|
347 char v64; // al@258
|
|
348 char v65; // al@262
|
|
349 char v66; // al@266
|
|
350 char v67; // al@270
|
|
351 char v68; // al@274
|
|
352 char v69; // al@278
|
|
353 char v70; // al@282
|
|
354 char v71; // al@286
|
|
355 char v72; // al@290
|
|
356 unsigned __int8 v73; // al@294
|
|
357 int v74; // edi@298
|
|
358 MonsterInfo *v75; // esi@300
|
|
359 MonsterInfo *v76; // esi@302
|
|
360 char **v77; // edi@306
|
|
361 __int16 v78; // ax@316
|
|
362 MonsterInfo *v79; // esi@323
|
|
363 const char *v80; // ecx@323
|
|
364 std::string v81; // [sp-14h] [bp-46Ch]@317
|
|
365 const char *v82; // [sp-8h] [bp-460h]@306
|
|
366 char *v83; // [sp-4h] [bp-45Ch]@23
|
|
367 char *v84; // [sp+0h] [bp-458h]@37
|
|
368 FrameTableTxtLine v85; // [sp+10h] [bp-448h]@297
|
|
369 FrameTableTxtLine v86; // [sp+8Ch] [bp-3CCh]@249
|
|
370 FrameTableTxtLine v87; // [sp+108h] [bp-350h]@240
|
|
371 char Src[120]; // [sp+184h] [bp-2D4h]@317
|
|
372 FrameTableTxtLine v89; // [sp+1FCh] [bp-25Ch]@249
|
|
373 FrameTableTxtLine v90; // [sp+278h] [bp-1E0h]@240
|
|
374 char Str[64]; // [sp+2F4h] [bp-164h]@240
|
|
375 char Dest[64]; // [sp+334h] [bp-124h]@249
|
|
376 char v93[64]; // [sp+374h] [bp-E4h]@297
|
|
377 FrameTableTxtLine v94; // [sp+3B4h] [bp-A4h]@297
|
|
378 int v95; // [sp+430h] [bp-28h]@317
|
|
379 int v96; // [sp+434h] [bp-24h]@9
|
|
380 int v97; // [sp+438h] [bp-20h]@4
|
|
381 char a3[5]; // [sp+43Fh] [bp-19h]@4
|
|
382 int a2; // [sp+444h] [bp-14h]@36
|
|
383 int v100; // [sp+448h] [bp-10h]@36
|
|
384 size_t v101; // [sp+44Ch] [bp-Ch]@19
|
|
385 MonsterStats *v102; // [sp+450h] [bp-8h]@1
|
|
386 int v103; // [sp+454h] [bp-4h]@3
|
|
387
|
|
388 v1 = this;
|
|
389 v102 = this;
|
|
390 if ( pMonstersTXT_Raw )
|
|
391 pAllocator->FreeChunk(pMonstersTXT_Raw);
|
|
392 pMonstersTXT_Raw = 0;
|
|
393 pMonstersTXT_Raw = (char *)pEvents_LOD->LoadRaw("monsters.txt", 0);
|
|
394 strtok(pMonstersTXT_Raw, "\r");
|
|
395 strtok(0, "\r");
|
|
396 strtok(0, "\r");
|
|
397 strtok(0, "\r");
|
|
398 v103 = 0;
|
|
399 v1->uNumMonsters = 265;
|
|
400 do
|
|
401 {
|
|
402 v2 = (int)(strtok(0, "\r") + 1);
|
|
403 *(_DWORD *)&a3[1] = 0;
|
|
404 v97 = 0;
|
|
405 do
|
|
406 {
|
|
407 v3 = *(_BYTE *)v2;
|
|
408 v4 = 0;
|
|
409 while ( v3 != 9 && v3 )
|
|
410 {
|
|
411 ++v4;
|
|
412 v3 = *(_BYTE *)(v4 + v2);
|
|
413 }
|
|
414 v96 = v4 + v2;
|
|
415 if ( !*(_BYTE *)(v4 + v2) )
|
|
416 v97 = 1;
|
|
417 *(_BYTE *)(v4 + v2) = 0;
|
|
418 if ( v4 )
|
|
419 {
|
|
420 switch ( *(_DWORD *)&a3[1] )
|
|
421 {
|
|
422 case 0:
|
|
423 v103 = atoi((const char *)v2);
|
|
424 v102->pInfos[v103].uID = v103;
|
|
425 goto LABEL_325;
|
|
426 case 2:
|
|
427 v102->pInfos[v103].pTexture = RemoveQuotes((char *)v2);
|
|
428 goto LABEL_325;
|
|
429 case 1:
|
|
430 v102->pInfos[v103].pName = RemoveQuotes((char *)v2);
|
|
431 goto LABEL_325;
|
|
432 case 3:
|
|
433 v102->pInfos[v103].uLevel = atoi((const char *)v2);
|
|
434 goto LABEL_325;
|
|
435 case 4:
|
|
436 if ( *(_BYTE *)v2 == 34 )
|
|
437 *(_BYTE *)v2 = 32;
|
|
438 v5 = strlen((const char *)v2);
|
|
439 v6 = 0;
|
|
440 v101 = v5;
|
|
441 if ( (signed int)v5 <= 0 )
|
|
442 goto LABEL_24;
|
|
443 while ( *(_BYTE *)(v6 + v2) != 44 )
|
|
444 {
|
|
445 ++v6;
|
|
446 if ( v6 >= (signed int)v5 )
|
|
447 goto LABEL_24;
|
|
448 }
|
|
449 v7 = v102;
|
|
450 v8 = v103;
|
|
451 *(_BYTE *)(v6 + v2) = 0;
|
|
452 pHP = &v7->pInfos[v8].uHP;
|
|
453 *pHP = 1000 * atoi((const char *)v2);
|
|
454 v83 = (char *)(v6 + v2 + 1);
|
|
455 *(_BYTE *)(v6 + v2) = 44;
|
|
456 *pHP += atoi(v83);
|
|
457 LABEL_24:
|
|
458 if ( v6 == v101 )
|
|
459 v102->pInfos[v103].uHP = atoi((const char *)v2);
|
|
460 goto LABEL_325;
|
|
461 case 5:
|
|
462 v102->pInfos[v103].uAC = atoi((const char *)v2);
|
|
463 goto LABEL_325;
|
|
464 case 6:
|
|
465 if ( *(_BYTE *)v2 == 34 )
|
|
466 *(_BYTE *)v2 = 32;
|
|
467 v10 = strlen((const char *)v2);
|
|
468 v11 = 0;
|
|
469 v101 = v10;
|
|
470 if ( (signed int)v10 <= 0 )
|
|
471 goto LABEL_34;
|
|
472 while ( *(_BYTE *)(v11 + v2) != 44 )
|
|
473 {
|
|
474 ++v11;
|
|
475 if ( v11 >= (signed int)v10 )
|
|
476 goto LABEL_34;
|
|
477 }
|
|
478 v12 = v102;
|
|
479 v13 = v103;
|
|
480 *(_BYTE *)(v11 + v2) = 0;
|
|
481 pExp = &v12->pInfos[v13].uExp;
|
|
482 *pExp = 1000 * atoi((const char *)v2);
|
|
483 v83 = (char *)(v11 + v2 + 1);
|
|
484 *(_BYTE *)(v11 + v2) = 44;
|
|
485 *pExp += atoi(v83);
|
|
486 LABEL_34:
|
|
487 if ( v11 == v101 )
|
|
488 v102->pInfos[v103].uExp = atoi((const char *)v2);
|
|
489 goto LABEL_325;
|
|
490 case 7:
|
|
491 v15 = 0;
|
|
492 a2 = 0;
|
|
493 v100 = 0;
|
|
494 v16 = 0;
|
|
495 v101 = strlen((const char *)v2);
|
|
496 if ( (signed int)v101 <= 0 )
|
|
497 goto LABEL_325;
|
|
498 do
|
|
499 {
|
|
500 v84 = (char *)*(_BYTE *)(v16 + v2);
|
|
501 v17 = tolower((int)v84);
|
|
502 switch ( v17 )
|
|
503 {
|
|
504 case 37:
|
|
505 v15 = 1;
|
|
506 break;
|
|
507 case 100:
|
|
508 v100 = 1;
|
|
509 break;
|
|
510 case 108:
|
|
511 a2 = 1;
|
|
512 break;
|
|
513 }
|
|
514 ++v16;
|
|
515 }
|
|
516 while ( (signed int)v16 < (signed int)v101 );
|
|
517 if ( v15 )
|
|
518 {
|
|
519 v18 = &v102->pInfos[v103];
|
|
520 v18->uTreasureDropChance = atoi((const char *)v2);
|
|
521 }
|
|
522 else
|
|
523 {
|
|
524 if ( !v100 && !a2 )
|
|
525 goto LABEL_325;
|
|
526 v18 = &v102->pInfos[v103];
|
|
527 v18->uTreasureDropChance = 100;
|
|
528 }
|
|
529 if ( v100 )
|
|
530 {
|
|
531 v19 = 0;
|
|
532 v100 = 0;
|
|
533 do
|
|
534 {
|
|
535 v84 = (char *)*(_BYTE *)(v19 + v2);
|
|
536 v20 = tolower((int)v84);
|
|
537 if ( v20 == 37 )
|
|
538 {
|
|
539 v84 = (char *)(v19 + v2 + 1);
|
|
540 v18->uTreasureDiceRolls = atoi(v84);
|
|
541 v100 = 1;
|
|
542 }
|
|
543 else
|
|
544 {
|
|
545 if ( v20 == 100 )
|
|
546 {
|
|
547 if ( !v100 )
|
|
548 v18->uTreasureDiceRolls = atoi((const char *)v2);
|
|
549 v84 = (char *)(v19 + v2 + 1);
|
|
550 v21 = atoi(v84);
|
|
551 v19 = v101;
|
|
552 v18->uTreasureDiceSides = v21;
|
|
553 }
|
|
554 }
|
|
555 ++v19;
|
|
556 }
|
|
557 while ( (signed int)v19 < (signed int)v101 );
|
|
558 }
|
|
559 if ( a2 )
|
|
560 {
|
|
561 v22 = 0;
|
|
562 while ( 1 )
|
|
563 {
|
|
564 v84 = (char *)*(_BYTE *)(v22 + v2);
|
|
565 if ( tolower((int)v84) == 108 )
|
|
566 break;
|
|
567 ++v22;
|
|
568 if ( (signed int)v22 >= (signed int)v101 )
|
|
569 goto LABEL_325;
|
|
570 }
|
|
571 v23 = *(_BYTE *)(v22 + v2 + 1);
|
|
572 v24 = (const char *)(v22 + v2 + 2);
|
|
573 v18->uTreasureLevel = v23 - 48;
|
|
574 if ( *v24 )
|
|
575 {
|
|
576 if ( _strcmpi(v24, "WEAPON") )
|
|
577 {
|
|
578 if ( _strcmpi(v24, "ARMOR") )
|
|
579 {
|
|
580 if ( _strcmpi(v24, "MISC") )
|
|
581 {
|
|
582 if ( _strcmpi(v24, "SWORD") )
|
|
583 {
|
|
584 if ( _strcmpi(v24, "DAGGER") )
|
|
585 {
|
|
586 if ( _strcmpi(v24, "AXE") )
|
|
587 {
|
|
588 if ( _strcmpi(v24, "SPEAR") )
|
|
589 {
|
|
590 if ( _strcmpi(v24, "BOW") )
|
|
591 {
|
|
592 if ( _strcmpi(v24, "MACE") )
|
|
593 {
|
|
594 if ( _strcmpi(v24, "CLUB") )
|
|
595 {
|
|
596 if ( _strcmpi(v24, "STAFF") )
|
|
597 {
|
|
598 if ( _strcmpi(v24, "LEATHER") )
|
|
599 {
|
|
600 if ( _strcmpi(v24, "CHAIN") )
|
|
601 {
|
|
602 if ( _strcmpi(v24, "PLATE") )
|
|
603 {
|
|
604 if ( _strcmpi(v24, "SHIELD") )
|
|
605 {
|
|
606 if ( _strcmpi(v24, "HELM") )
|
|
607 {
|
|
608 if ( _strcmpi(v24, "BELT") )
|
|
609 {
|
|
610 if ( _strcmpi(v24, "CAPE") )
|
|
611 {
|
|
612 if ( _strcmpi(v24, "GAUNTLETS") )
|
|
613 {
|
|
614 if ( _strcmpi(v24, "BOOTS") )
|
|
615 {
|
|
616 if ( _strcmpi(v24, "RING") )
|
|
617 {
|
|
618 if ( _strcmpi(v24, "AMULET") )
|
|
619 {
|
|
620 if ( _strcmpi(v24, "WAND") )
|
|
621 {
|
|
622 if ( _strcmpi(v24, "SCROLL") )
|
|
623 {
|
|
624 if ( !_strcmpi(v24, "GEM") )
|
|
625 v18->uTreasureType = 46;
|
|
626 }
|
|
627 else
|
|
628 {
|
|
629 v18->uTreasureType = 43;
|
|
630 }
|
|
631 }
|
|
632 else
|
|
633 {
|
|
634 v18->uTreasureType = 42;
|
|
635 }
|
|
636 }
|
|
637 else
|
|
638 {
|
|
639 v18->uTreasureType = 41;
|
|
640 }
|
|
641 }
|
|
642 else
|
|
643 {
|
|
644 v18->uTreasureType = 40;
|
|
645 }
|
|
646 }
|
|
647 else
|
|
648 {
|
|
649 v18->uTreasureType = 39;
|
|
650 }
|
|
651 }
|
|
652 else
|
|
653 {
|
|
654 v18->uTreasureType = 38;
|
|
655 }
|
|
656 }
|
|
657 else
|
|
658 {
|
|
659 v18->uTreasureType = 37;
|
|
660 }
|
|
661 }
|
|
662 else
|
|
663 {
|
|
664 v18->uTreasureType = 36;
|
|
665 }
|
|
666 }
|
|
667 else
|
|
668 {
|
|
669 v18->uTreasureType = 35;
|
|
670 }
|
|
671 }
|
|
672 else
|
|
673 {
|
|
674 v18->uTreasureType = 34;
|
|
675 }
|
|
676 }
|
|
677 else
|
|
678 {
|
|
679 v18->uTreasureType = 33;
|
|
680 }
|
|
681 }
|
|
682 else
|
|
683 {
|
|
684 v18->uTreasureType = 32;
|
|
685 }
|
|
686 }
|
|
687 else
|
|
688 {
|
|
689 v18->uTreasureType = 31;
|
|
690 }
|
|
691 }
|
|
692 else
|
|
693 {
|
|
694 v18->uTreasureType = 30;
|
|
695 }
|
|
696 }
|
|
697 else
|
|
698 {
|
|
699 v18->uTreasureType = 29;
|
|
700 }
|
|
701 }
|
|
702 else
|
|
703 {
|
|
704 v18->uTreasureType = 28;
|
|
705 }
|
|
706 }
|
|
707 else
|
|
708 {
|
|
709 v18->uTreasureType = 27;
|
|
710 }
|
|
711 }
|
|
712 else
|
|
713 {
|
|
714 v18->uTreasureType = 26;
|
|
715 }
|
|
716 }
|
|
717 else
|
|
718 {
|
|
719 v18->uTreasureType = 25;
|
|
720 }
|
|
721 }
|
|
722 else
|
|
723 {
|
|
724 v18->uTreasureType = 24;
|
|
725 }
|
|
726 }
|
|
727 else
|
|
728 {
|
|
729 v18->uTreasureType = 23;
|
|
730 }
|
|
731 }
|
|
732 else
|
|
733 {
|
|
734 v18->uTreasureType = 22;
|
|
735 }
|
|
736 }
|
|
737 else
|
|
738 {
|
|
739 v18->uTreasureType = 21;
|
|
740 }
|
|
741 }
|
|
742 else
|
|
743 {
|
|
744 v18->uTreasureType = 20;
|
|
745 }
|
|
746 }
|
|
747 }
|
|
748 goto LABEL_325;
|
|
749 case 8:
|
|
750 v84 = (char *)v2;
|
|
751 v25 = &v102->pInfos[v103].bQuestMonster;
|
|
752 *v25 = 0;
|
|
753 if ( atoi(v84) )
|
|
754 *(_BYTE *)v25 |= 1u;
|
|
755 goto LABEL_325;
|
|
756 case 9:
|
|
757 v102->pInfos[v103].uFlying = _strnicmp((const char *)v2, "n", 1u);
|
|
758 goto LABEL_325;
|
|
759 case 0xA:
|
|
760 v84 = (char *)*(_BYTE *)v2;
|
|
761 v101 = 4;
|
|
762 if ( tolower((int)v84) == 's' )
|
|
763 {
|
|
764 v84 = (char *)*(_BYTE *)(v2 + 1);
|
|
765 v26 = tolower((int)v84) != 'h' ? 5 : 0;
|
|
766 }
|
|
767 else
|
|
768 {
|
|
769 v84 = (char *)*(_BYTE *)v2;
|
|
770 if ( tolower((int)v84) == 'm' )
|
|
771 {
|
|
772 v101 = 1;
|
|
773 }
|
|
774 else
|
|
775 {
|
|
776 v84 = (char *)*(_BYTE *)v2;
|
|
777 if ( tolower((int)v84) == 'l' )
|
|
778 {
|
|
779 v101 = 2;
|
|
780 }
|
|
781 else
|
|
782 {
|
|
783 v84 = (char *)*(_BYTE *)v2;
|
|
784 if ( tolower((int)v84) == 'g' )
|
|
785 v101 = 3;
|
|
786 }
|
|
787 }
|
|
788 LOBYTE(v26) = v101;
|
|
789 }
|
|
790 v102->pInfos[v103].uMovementType = v26;
|
|
791 goto LABEL_325;
|
|
792 case 0xB:
|
|
793 v84 = (char *)*(_BYTE *)v2;
|
|
794 v101 = 3;
|
|
795 if ( tolower((int)v84) == 's' )
|
|
796 {
|
|
797 v101 = 0;
|
|
798 }
|
|
799 else
|
|
800 {
|
|
801 v84 = (char *)*(_BYTE *)v2;
|
|
802 if ( tolower((int)v84) == 'w' )
|
|
803 {
|
|
804 v101 = 1;
|
|
805 }
|
|
806 else
|
|
807 {
|
|
808 v84 = (char *)*(_BYTE *)v2;
|
|
809 if ( tolower((int)v84) == 'n' )
|
|
810 v101 = 2;
|
|
811 }
|
|
812 }
|
|
813 v102->pInfos[v103].uAIType = v101;
|
|
814 goto LABEL_325;
|
|
815 case 0xC:
|
29
|
816 v102->pInfos[v103].uHostilityType = (MonsterInfo::HostilityRadius)atoi((const char *)v2);
|
0
|
817 goto LABEL_325;
|
|
818 case 0xD:
|
|
819 v102->pInfos[v103].uBaseSpeed = atoi((const char *)v2);
|
|
820 goto LABEL_325;
|
|
821 case 0xF:
|
|
822 v27 = strlen((const char *)v2);
|
|
823 v100 = 0;
|
|
824 v101 = v27;
|
|
825 if ( (signed int)v27 > 0 )
|
|
826 {
|
|
827 v28 = v103;
|
|
828 v29 = v102;
|
|
829 do
|
|
830 {
|
|
831 v84 = (char *)*(_BYTE *)(v100 + v2);
|
|
832 v30 = tolower((int)v84);
|
|
833 if ( v30 > 107 )
|
|
834 {
|
|
835 if ( v30 > 115 )
|
|
836 {
|
|
837 v40 = v30 - 116;
|
|
838 if ( v40 )
|
|
839 {
|
|
840 v41 = v40 - 3;
|
|
841 if ( v41 )
|
|
842 {
|
|
843 if ( v41 == 1 )
|
|
844 BYTE1(v29->pInfos[v28].uAttackPreference) |= 2u;
|
|
845 }
|
|
846 else
|
|
847 {
|
|
848 BYTE1(v29->pInfos[v28].uAttackPreference) |= 0x20u;
|
|
849 }
|
|
850 }
|
|
851 else
|
|
852 {
|
|
853 LOBYTE(v29->pInfos[v28].uAttackPreference) |= 0x80u;
|
|
854 }
|
|
855 }
|
|
856 else
|
|
857 {
|
|
858 if ( v30 == 115 )
|
|
859 {
|
|
860 v29->pInfos[v28].uAttackPreference |= 0x20u;
|
|
861 }
|
|
862 else
|
|
863 {
|
|
864 v37 = v30 - 109;
|
|
865 if ( v37 )
|
|
866 {
|
|
867 v38 = v37 - 2;
|
|
868 if ( v38 )
|
|
869 {
|
|
870 v39 = v38 - 1;
|
|
871 if ( v39 )
|
|
872 {
|
|
873 if ( v39 == 2 )
|
|
874 v29->pInfos[v28].uAttackPreference |= 0x40u;
|
|
875 }
|
|
876 else
|
|
877 {
|
|
878 v29->pInfos[v28].uAttackPreference |= 2u;
|
|
879 }
|
|
880 }
|
|
881 else
|
|
882 {
|
|
883 BYTE1(v29->pInfos[v28].uAttackPreference) |= 4u;
|
|
884 }
|
|
885 }
|
|
886 else
|
|
887 {
|
|
888 BYTE1(v29->pInfos[v28].uAttackPreference) |= 1u;
|
|
889 }
|
|
890 }
|
|
891 }
|
|
892 }
|
|
893 else
|
|
894 {
|
|
895 if ( v30 == 107 )
|
|
896 {
|
|
897 v29->pInfos[v28].uAttackPreference |= 1u;
|
|
898 }
|
|
899 else
|
|
900 {
|
|
901 if ( v30 > 99 )
|
|
902 {
|
|
903 v34 = v30 - 100;
|
|
904 if ( v34 )
|
|
905 {
|
|
906 v35 = v34 - 1;
|
|
907 if ( v35 )
|
|
908 {
|
|
909 v36 = v35 - 2;
|
|
910 if ( v36 )
|
|
911 {
|
|
912 if ( v36 == 1 )
|
|
913 BYTE1(v29->pInfos[v28].uAttackPreference) |= 8u;
|
|
914 }
|
|
915 else
|
|
916 {
|
|
917 BYTE1(v29->pInfos[v28].uAttackPreference) |= 0x40u;
|
|
918 }
|
|
919 }
|
|
920 else
|
|
921 {
|
|
922 BYTE1(v29->pInfos[v28].uAttackPreference) |= 0x10u;
|
|
923 }
|
|
924 }
|
|
925 else
|
|
926 {
|
|
927 v29->pInfos[v28].uAttackPreference |= 8u;
|
|
928 }
|
|
929 }
|
|
930 else
|
|
931 {
|
|
932 if ( v30 == 99 )
|
|
933 {
|
|
934 v29->pInfos[v28].uAttackPreference |= 0x10u;
|
|
935 }
|
|
936 else
|
|
937 {
|
|
938 v31 = v30 - 50;
|
|
939 if ( v31 )
|
|
940 {
|
|
941 v32 = v31 - 1;
|
|
942 if ( v32 )
|
|
943 {
|
|
944 v33 = v32 - 1;
|
|
945 if ( v33 )
|
|
946 {
|
|
947 if ( v33 == 45 )
|
|
948 v29->pInfos[v28].uAttackPreference |= 4u;
|
|
949 }
|
|
950 else
|
|
951 {
|
|
952 v29->pInfos[v28].uNumCharactersAttackedPerSpecialAbility = 4;
|
|
953 }
|
|
954 }
|
|
955 else
|
|
956 {
|
|
957 v29->pInfos[v28].uNumCharactersAttackedPerSpecialAbility = 3;
|
|
958 }
|
|
959 }
|
|
960 else
|
|
961 {
|
|
962 v29->pInfos[v28].uNumCharactersAttackedPerSpecialAbility = 2;
|
|
963 }
|
|
964 }
|
|
965 }
|
|
966 }
|
|
967 }
|
|
968 ++v100;
|
|
969 }
|
|
970 while ( v100 < (signed int)v101 );
|
|
971 }
|
|
972 goto LABEL_325;
|
|
973 case 0xE:
|
|
974 v102->pInfos[v103].uRecoveryTime = atoi((const char *)v2);
|
|
975 goto LABEL_325;
|
|
976 case 0x10:
|
|
977 v42 = strlen((const char *)v2);
|
|
978 v43 = 0;
|
|
979 v44 = &v102->pInfos[v103];
|
|
980 v100 = v42;
|
|
981 v44->uSpecialAttackType = 1;
|
|
982 if ( (signed int)v42 <= 0 )
|
|
983 goto LABEL_185;
|
|
984 break;
|
|
985 case 0x11:
|
|
986 v102->pInfos[v103].uAttack1Type = ParseAttackType((unsigned __int8 *)v2);
|
|
987 goto LABEL_325;
|
|
988 case 0x12:
|
|
989 v46 = &v102->pInfos[v103];
|
|
990 v47 = (char *)&v46->uAttack1DamageDiceRolls;
|
|
991 v84 = (char *)&v46->uAttack1DamageBonus;
|
|
992 v48 = (char *)&v46->uAttack1DamageDiceSides;
|
|
993 goto LABEL_237;
|
|
994 case 0x13:
|
|
995 v102->pInfos[v103].uMissleAttack1Type = ParseMissleAttackType((const char *)v2);
|
|
996 goto LABEL_325;
|
|
997 case 0x14:
|
|
998 v102->pInfos[v103].uAttack2Chance = atoi((const char *)v2);
|
|
999 goto LABEL_325;
|
|
1000 case 0x15:
|
|
1001 v102->pInfos[v103].uAttack2Type = ParseAttackType((unsigned __int8 *)v2);
|
|
1002 goto LABEL_325;
|
|
1003 case 0x16:
|
|
1004 v49 = &v102->pInfos[v103];
|
|
1005 v47 = (char *)&v49->uAttack2DamageDiceRolls;
|
|
1006 v84 = (char *)&v49->uAttack2DamageBonus;
|
|
1007 v48 = (char *)&v49->uAttack2DamageDiceSides;
|
|
1008 LABEL_237:
|
|
1009 ParseDamage((const char *)v2, (int)v47, (int)v48, (int)v84);
|
|
1010 goto LABEL_325;
|
|
1011 case 0x17:
|
|
1012 v102->pInfos[v103].uMissleAttack2Type = ParseMissleAttackType((const char *)v2);
|
|
1013 goto LABEL_325;
|
|
1014 case 0x18:
|
|
1015 v102->pInfos[v103].uSpell1UseChance = atoi((const char *)v2);
|
|
1016 goto LABEL_325;
|
|
1017 case 0x19:
|
|
1018 strcpy(Str, (const char *)v2);
|
|
1019 Str[0] = ' ';
|
|
1020 Str[strlen(Str) - 1] = ' ';
|
|
1021 v50 = texture_frame_table_txt_parser(Str, &v87);
|
|
1022 v51 = 88 * v103;
|
|
1023 memcpy(&v90, v50, sizeof(v90));
|
|
1024 if ( v90.field_0 >= 3 )
|
|
1025 {
|
|
1026 v53 = (int)((char *)v102 + v51);
|
|
1027 a2 = 1;
|
|
1028 v102->pInfos[v51 / 0x58u].uSpell1ID = ParseSpellType(&v90, (int)&a2);
|
|
1029 v54 = a2;
|
|
1030 v84 = (char *)v90.pProperties[a2 + 1];
|
|
1031 v55 = atoi(v84);
|
|
1032 v56 = (char *)v90.pProperties[v54];
|
|
1033 v84 = "E";
|
|
1034 v83 = v56;
|
|
1035 *(_WORD *)(v53 + 56) = v55 & 0x3F;
|
|
1036 if ( _strcmpi(v83, v84) )
|
|
1037 {
|
|
1038 if ( _strcmpi(v56, "M") )
|
|
1039 {
|
|
1040 if ( !_strcmpi(v56, "G") )
|
|
1041 *(_BYTE *)(v53 + 57) |= 1u;
|
|
1042 }
|
|
1043 else
|
|
1044 {
|
|
1045 *(_BYTE *)(v53 + 56) |= 0x80u;
|
|
1046 }
|
|
1047 }
|
|
1048 else
|
|
1049 {
|
|
1050 *(_BYTE *)(v53 + 56) |= 0x40u;
|
|
1051 }
|
|
1052 }
|
|
1053 else
|
|
1054 {
|
|
1055 v52 = (int)((char *)v102 + v51);
|
|
1056 *(_BYTE *)(v52 + 33) = 0;
|
|
1057 *(_WORD *)(v52 + 56) = 0;
|
|
1058 }
|
|
1059 goto LABEL_325;
|
|
1060 case 0x1A:
|
|
1061 v102->pInfos[v103].uSpell2UseChance = atoi((const char *)v2);
|
|
1062 goto LABEL_325;
|
|
1063 case 0x1B:
|
|
1064 strcpy(Dest, (const char *)v2);
|
|
1065 Dest[0] = ' ';
|
|
1066 Dest[strlen(Dest) - 1] = ' ';
|
|
1067 v57 = texture_frame_table_txt_parser(Dest, &v86);
|
|
1068 v58 = v103;
|
|
1069 memcpy(&v89, v57, sizeof(v89));
|
|
1070 if ( v89.field_0 >= 3 )
|
|
1071 {
|
|
1072 v60 = &v102->pInfos[v58];
|
|
1073 a2 = 1;
|
|
1074 v102->pInfos[v58].uSpell2ID = ParseSpellType(&v89, (int)&a2);
|
|
1075 v61 = a2;
|
|
1076 v84 = (char *)v89.pProperties[a2 + 1];
|
|
1077 v62 = atoi(v84);
|
|
1078 v63 = (char *)v89.pProperties[v61];
|
|
1079 v84 = "E";
|
|
1080 v83 = v63;
|
|
1081 v60->uSpellSkillAndMastery2 = v62 & 0x3F;
|
|
1082 if ( _strcmpi(v83, v84) )
|
|
1083 {
|
|
1084 if ( _strcmpi(v63, "M") )
|
|
1085 {
|
|
1086 if ( !_strcmpi(v63, "G") )
|
|
1087 HIBYTE(v60->uSpellSkillAndMastery2) |= 1u;
|
|
1088 }
|
|
1089 else
|
|
1090 {
|
|
1091 LOBYTE(v60->uSpellSkillAndMastery2) |= 0x80u;
|
|
1092 }
|
|
1093 }
|
|
1094 else
|
|
1095 {
|
|
1096 LOBYTE(v60->uSpellSkillAndMastery2) |= 0x40u;
|
|
1097 }
|
|
1098 }
|
|
1099 else
|
|
1100 {
|
|
1101 v59 = &v102->pInfos[v58];
|
|
1102 v59->uSpell2ID = 0;
|
|
1103 v59->uSpellSkillAndMastery2 = 0;
|
|
1104 }
|
|
1105 goto LABEL_325;
|
|
1106 case 0x1C:
|
|
1107 v84 = (char *)*(_BYTE *)v2;
|
|
1108 if ( tolower((int)v84) == 'i' )
|
|
1109 v64 = 200;
|
|
1110 else
|
|
1111 v64 = atoi((const char *)v2);
|
|
1112 v102->pInfos[v103].uResFire = v64;
|
|
1113 goto LABEL_325;
|
|
1114 case 0x1D:
|
|
1115 v84 = (char *)*(_BYTE *)v2;
|
|
1116 if ( tolower((int)v84) == 'i' )
|
|
1117 v65 = 200;
|
|
1118 else
|
|
1119 v65 = atoi((const char *)v2);
|
|
1120 v102->pInfos[v103].uResAir = v65;
|
|
1121 goto LABEL_325;
|
|
1122 case 0x1E:
|
|
1123 v84 = (char *)*(_BYTE *)v2;
|
|
1124 if ( tolower((int)v84) == 'i' )
|
|
1125 v66 = 200;
|
|
1126 else
|
|
1127 v66 = atoi((const char *)v2);
|
|
1128 v102->pInfos[v103].uResWater = v66;
|
|
1129 goto LABEL_325;
|
|
1130 case 0x1F:
|
|
1131 v84 = (char *)*(_BYTE *)v2;
|
|
1132 if ( tolower((int)v84) == 'i' )
|
|
1133 v67 = 200;
|
|
1134 else
|
|
1135 v67 = atoi((const char *)v2);
|
|
1136 v102->pInfos[v103].uResEarth = v67;
|
|
1137 goto LABEL_325;
|
|
1138 case 0x20:
|
|
1139 v84 = (char *)*(_BYTE *)v2;
|
|
1140 if ( tolower((int)v84) == 'i' )
|
|
1141 v68 = 200;
|
|
1142 else
|
|
1143 v68 = atoi((const char *)v2);
|
|
1144 v102->pInfos[v103].uResMind = v68;
|
|
1145 goto LABEL_325;
|
|
1146 case 0x21:
|
|
1147 v84 = (char *)*(_BYTE *)v2;
|
|
1148 if ( tolower((int)v84) == 'i' )
|
|
1149 v69 = 200;
|
|
1150 else
|
|
1151 v69 = atoi((const char *)v2);
|
|
1152 v102->pInfos[v103].uResSpirit = v69;
|
|
1153 goto LABEL_325;
|
|
1154 case 0x22:
|
|
1155 v84 = (char *)*(_BYTE *)v2;
|
|
1156 if ( tolower((int)v84) == 'i' )
|
|
1157 v70 = 200;
|
|
1158 else
|
|
1159 v70 = atoi((const char *)v2);
|
|
1160 v102->pInfos[v103].uResBody = v70;
|
|
1161 goto LABEL_325;
|
|
1162 case 0x23:
|
|
1163 v84 = (char *)*(_BYTE *)v2;
|
|
1164 if ( tolower((int)v84) == 'i' )
|
|
1165 v71 = 200;
|
|
1166 else
|
|
1167 v71 = atoi((const char *)v2);
|
|
1168 v102->pInfos[v103].uResLight = v71;
|
|
1169 goto LABEL_325;
|
|
1170 case 0x24:
|
|
1171 v84 = (char *)*(_BYTE *)v2;
|
|
1172 if ( tolower((int)v84) == 'i' )
|
|
1173 v72 = 200;
|
|
1174 else
|
|
1175 v72 = atoi((const char *)v2);
|
|
1176 v102->pInfos[v103].uResDark = v72;
|
|
1177 goto LABEL_325;
|
|
1178 case 0x25:
|
|
1179 v84 = (char *)*(_BYTE *)v2;
|
|
1180 if ( tolower((int)v84) == 'i' )
|
|
1181 v73 = 200;
|
|
1182 else
|
|
1183 v73 = atoi((const char *)v2);
|
|
1184 v102->pInfos[v103].uResPhysical = v73;
|
|
1185 goto LABEL_325;
|
|
1186 case 0x26:
|
|
1187 strcpy(v93, (const char *)v2);
|
|
1188 v93[0] = ' ';
|
|
1189 v93[strlen(v93) - 1] = ' ';
|
|
1190 memcpy(&v94, texture_frame_table_txt_parser(v93, &v85), sizeof(v94));
|
|
1191 if ( v94.field_0 )
|
|
1192 {
|
|
1193 v74 = v94.field_0;
|
|
1194 if ( v94.field_0 < 10 )
|
|
1195 {
|
|
1196 if ( _strcmpi(v94.pProperties[0], "shot") )
|
|
1197 {
|
|
1198 if ( _strcmpi(v94.pProperties[0], "summon") )
|
|
1199 {
|
|
1200 if ( !_strcmpi(v94.pProperties[0], "explode") )
|
|
1201 {
|
|
1202 v79 = &v102->pInfos[v103];
|
|
1203 v80 = v94.pProperties[1];
|
|
1204 v84 = (char *)&v79->uSpecialAbilityDamageDiceBonus;
|
|
1205 v83 = (char *)&v79->uSpecialAbilityDamageDiceSides;
|
|
1206 v79->uSpecialAbilityType = 3;
|
|
1207 ParseDamage(v80, (int)&v79->uSpecialAbilityDamageDiceRolls, (int)v83, (int)v84);
|
|
1208 v79->field_3C_some_special_attack = ParseAttackType((unsigned __int8 *)v2);
|
|
1209 }
|
|
1210 }
|
|
1211 else
|
|
1212 {
|
|
1213 v76 = &v102->pInfos[v103];
|
|
1214 v76->uSpecialAbilityType = 2;
|
|
1215 if ( v74 > 1 )
|
|
1216 {
|
|
1217 pTmpBuf[0] = 0;
|
|
1218 strcpy(pTmpBuf, v94.pProperties[2]);
|
|
1219 if ( v74 > 2 )
|
|
1220 {
|
|
1221 v100 = 3;
|
|
1222 if ( v74 > 3 )
|
|
1223 {
|
|
1224 do
|
|
1225 {
|
|
1226 strcat(pTmpBuf, " ");
|
|
1227 v77 = (char **)v94.pProperties[v100];
|
|
1228 v82 = v94.pProperties[v100];
|
|
1229 strcat(pTmpBuf, v82);
|
|
1230 if ( v100 == v94.field_0 - 1 )
|
|
1231 {
|
|
1232 v84 = (char *)*(_BYTE *)v77;
|
|
1233 if ( tolower((int)v84) == 'a' )
|
|
1234 {
|
|
1235 v76->uSpecialAbilityDamageDiceRolls = 1;
|
|
1236 }
|
|
1237 else
|
|
1238 {
|
|
1239 v84 = (char *)*(_BYTE *)v77;
|
|
1240 if ( tolower((int)v84) == 'b' )
|
|
1241 {
|
|
1242 v76->uSpecialAbilityDamageDiceRolls = 2;
|
|
1243 }
|
|
1244 else
|
|
1245 {
|
|
1246 v84 = (char *)*(_BYTE *)v77;
|
|
1247 if ( tolower((int)v84) == 'c' )
|
|
1248 v76->uSpecialAbilityDamageDiceRolls = 3;
|
|
1249 else
|
|
1250 v76->uSpecialAbilityDamageDiceRolls = 0;
|
|
1251 }
|
|
1252 }
|
|
1253 }
|
|
1254 ++v100;
|
|
1255 }
|
|
1256 while ( v100 < v94.field_0 );
|
|
1257 }
|
|
1258 }
|
|
1259 else
|
|
1260 {
|
|
1261 v76->uSpecialAbilityDamageDiceRolls = 0;
|
|
1262 }
|
|
1263 if ( pMonsterList->uNumMonsters )
|
|
1264 {
|
|
1265 v78 = pMonsterList->GetMonsterByName(pTmpBuf) + 1;
|
|
1266 v76->field_3C_some_special_attack = v78;
|
|
1267 if ( v78 == -1 )
|
|
1268 {
|
96
|
1269 sprintf(Src, "Can't create random monster: '%s' See MapStats!", Src);
|
0
|
1270 MessageBoxA(nullptr, Src, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:2239", 0);
|
|
1271 }
|
|
1272 }
|
|
1273 v76->uSpecialAbilityDamageDiceSides = 0;
|
|
1274 if ( !_strcmpi(v94.pProperties[1], "ground") )
|
|
1275 v76->uSpecialAbilityDamageDiceSides = 1;
|
|
1276 if ( v76->field_3C_some_special_attack == -1 )
|
|
1277 v76->uSpecialAbilityType = 0;
|
|
1278 }
|
|
1279 }
|
|
1280 }
|
|
1281 else
|
|
1282 {
|
|
1283 v75 = &v102->pInfos[v103];
|
|
1284 v84 = (char *)(v94.pProperties[1] + 1);
|
|
1285 v75->uSpecialAbilityType = 1;
|
|
1286 v75->uSpecialAbilityDamageDiceBonus = atoi(v84);
|
|
1287 }
|
|
1288 }
|
|
1289 }
|
|
1290 goto LABEL_325;
|
|
1291 default:
|
|
1292 goto LABEL_325;
|
|
1293 }
|
|
1294 while ( 1 )
|
|
1295 {
|
|
1296 v84 = (char *)*(_BYTE *)(v43 + v2);
|
|
1297 if ( tolower((int)v84) == 'x' )
|
|
1298 break;
|
|
1299 ++v43;
|
|
1300 if ( v43 >= v100 )
|
|
1301 goto LABEL_185;
|
|
1302 }
|
|
1303 v45 = v2 + v43;
|
|
1304 *(_BYTE *)v45 = 0;
|
|
1305 v44->uSpecialAttackType = atoi((const char *)(v45 + 1));
|
|
1306 *(_BYTE *)v45 = 100;
|
|
1307 LABEL_185:
|
|
1308 _strlwr((char *)v2);
|
|
1309 if ( strstr((const char *)v2, "curse") )
|
|
1310 {
|
|
1311 v44->uSpecialAttack = 1;
|
|
1312 }
|
|
1313 else
|
|
1314 {
|
|
1315 if ( strstr((const char *)v2, "weak") )
|
|
1316 {
|
|
1317 v44->uSpecialAttack = 2;
|
|
1318 }
|
|
1319 else
|
|
1320 {
|
|
1321 if ( strstr((const char *)v2, "asleep") )
|
|
1322 {
|
|
1323 v44->uSpecialAttack = 3;
|
|
1324 }
|
|
1325 else
|
|
1326 {
|
|
1327 if ( strstr((const char *)v2, "afraid") )
|
|
1328 {
|
|
1329 v44->uSpecialAttack = 23;
|
|
1330 }
|
|
1331 else
|
|
1332 {
|
|
1333 if ( strstr((const char *)v2, "drunk") )
|
|
1334 {
|
|
1335 v44->uSpecialAttack = 4;
|
|
1336 }
|
|
1337 else
|
|
1338 {
|
|
1339 if ( strstr((const char *)v2, "insane") )
|
|
1340 {
|
|
1341 v44->uSpecialAttack = 5;
|
|
1342 }
|
|
1343 else
|
|
1344 {
|
|
1345 if ( strstr((const char *)v2, "poison1") )
|
|
1346 {
|
|
1347 v44->uSpecialAttack = 6;
|
|
1348 }
|
|
1349 else
|
|
1350 {
|
|
1351 if ( strstr((const char *)v2, "poison2") )
|
|
1352 {
|
|
1353 v44->uSpecialAttack = 7;
|
|
1354 }
|
|
1355 else
|
|
1356 {
|
|
1357 if ( strstr((const char *)v2, "poison3") )
|
|
1358 {
|
|
1359 v44->uSpecialAttack = 8;
|
|
1360 }
|
|
1361 else
|
|
1362 {
|
|
1363 if ( strstr((const char *)v2, "disease1") )
|
|
1364 {
|
|
1365 v44->uSpecialAttack = 9;
|
|
1366 }
|
|
1367 else
|
|
1368 {
|
|
1369 if ( strstr((const char *)v2, "disease2") )
|
|
1370 {
|
|
1371 v44->uSpecialAttack = 10;
|
|
1372 }
|
|
1373 else
|
|
1374 {
|
|
1375 if ( strstr((const char *)v2, "disease3") )
|
|
1376 {
|
|
1377 v44->uSpecialAttack = 11;
|
|
1378 }
|
|
1379 else
|
|
1380 {
|
|
1381 if ( strstr((const char *)v2, "paralyze") )
|
|
1382 {
|
|
1383 v44->uSpecialAttack = 12;
|
|
1384 }
|
|
1385 else
|
|
1386 {
|
|
1387 if ( strstr((const char *)v2, "uncon") )
|
|
1388 {
|
|
1389 v44->uSpecialAttack = 13;
|
|
1390 }
|
|
1391 else
|
|
1392 {
|
|
1393 if ( strstr((const char *)v2, "dead") )
|
|
1394 {
|
|
1395 v44->uSpecialAttack = 14;
|
|
1396 }
|
|
1397 else
|
|
1398 {
|
|
1399 if ( strstr((const char *)v2, "stone") )
|
|
1400 {
|
|
1401 v44->uSpecialAttack = 15;
|
|
1402 }
|
|
1403 else
|
|
1404 {
|
|
1405 if ( strstr((const char *)v2, "errad") )
|
|
1406 {
|
|
1407 v44->uSpecialAttack = 16;
|
|
1408 }
|
|
1409 else
|
|
1410 {
|
|
1411 if ( strstr((const char *)v2, "brkitem") )
|
|
1412 {
|
|
1413 v44->uSpecialAttack = 17;
|
|
1414 }
|
|
1415 else
|
|
1416 {
|
|
1417 if ( strstr((const char *)v2, "brkarmor") )
|
|
1418 {
|
|
1419 v44->uSpecialAttack = 18;
|
|
1420 }
|
|
1421 else
|
|
1422 {
|
|
1423 if ( strstr((const char *)v2, "brkweapon") )
|
|
1424 {
|
|
1425 v44->uSpecialAttack = 19;
|
|
1426 }
|
|
1427 else
|
|
1428 {
|
|
1429 if ( strstr((const char *)v2, "steal") )
|
|
1430 {
|
|
1431 v44->uSpecialAttack = 20;
|
|
1432 }
|
|
1433 else
|
|
1434 {
|
|
1435 if ( strstr((const char *)v2, off_4E8910) )
|
|
1436 {
|
|
1437 v44->uSpecialAttack = 21;
|
|
1438 }
|
|
1439 else
|
|
1440 {
|
|
1441 if ( strstr((const char *)v2, "drainsp") )
|
|
1442 v44->uSpecialAttack = 22;
|
|
1443 }
|
|
1444 }
|
|
1445 }
|
|
1446 }
|
|
1447 }
|
|
1448 }
|
|
1449 }
|
|
1450 }
|
|
1451 }
|
|
1452 }
|
|
1453 }
|
|
1454 }
|
|
1455 }
|
|
1456 }
|
|
1457 }
|
|
1458 }
|
|
1459 }
|
|
1460 }
|
|
1461 }
|
|
1462 }
|
|
1463 }
|
|
1464 }
|
|
1465 }
|
|
1466 else
|
|
1467 {
|
|
1468 v97 = 1;
|
|
1469 }
|
|
1470 LABEL_325:
|
|
1471 ++*(_DWORD *)&a3[1];
|
|
1472 v2 = v96 + 1;
|
|
1473 }
|
|
1474 while ( *(_DWORD *)&a3[1] - 1 <= (signed int)v102->uNumMonsters && !v97 );
|
|
1475 ++v103;
|
|
1476 }
|
|
1477 while ( v103 < 265 );
|
|
1478 v102->uNumMonsters = v103;
|
|
1479 }
|
|
1480
|
|
1481
|
|
1482
|
|
1483
|
|
1484 //----- (0044FA08) --------------------------------------------------------
|
|
1485 unsigned __int16 MonsterList::GetMonsterByName(const char *pMonsterName)
|
|
1486 {
|
|
1487 signed int v2; // ebx@1
|
|
1488 MonsterList *v3; // esi@1
|
|
1489 int v4; // edi@3
|
|
1490 unsigned __int16 result; // ax@6
|
|
1491
|
|
1492 v2 = 0;
|
|
1493 v3 = this;
|
|
1494 if ( pMonsterName && (signed int)this->uNumMonsters > 0 )
|
|
1495 {
|
|
1496 v4 = 0;
|
|
1497 while ( _strcmpi(pMonsterName, v3->pMonsters[v4].pMonsterName) )
|
|
1498 {
|
|
1499 ++v2;
|
|
1500 ++v4;
|
|
1501 if ( v2 >= (signed int)v3->uNumMonsters )
|
|
1502 goto LABEL_6;
|
|
1503 }
|
|
1504 result = v2;
|
|
1505 }
|
|
1506 else
|
|
1507 {
|
|
1508 LABEL_6:
|
|
1509 result = -1;
|
|
1510 }
|
|
1511 return result;
|
|
1512 }
|