2497
|
1 #define _CRTDBG_MAP_ALLOC
|
|
2 #include <stdlib.h>
|
|
3 #include <crtdbg.h>
|
|
4
|
|
5 #define _CRT_SECURE_NO_WARNINGS
|
|
6 #include <stdlib.h>
|
|
7 #include <stdio.h>
|
|
8 #include <string.h>
|
2541
|
9
|
|
10 #include "Engine/Engine.h"
|
2497
|
11
|
|
12 #include "Monsters.h"
|
2499
|
13 #include "../Tables/FrameTableInc.h"
|
|
14 #include "../LOD.h"
|
|
15 #include "../texts.h"
|
2497
|
16
|
|
17
|
|
18
|
|
19
|
|
20
|
|
21 struct MonsterStats *pMonsterStats;
|
|
22 struct MonsterList *pMonsterList;
|
|
23
|
|
24 unsigned int ParseSpellType(struct FrameTableTxtLine* tbl, int* next_token);
|
|
25
|
|
26 int ParseAttackType(const char *damage_type_str);
|
|
27 void ParseDamage( char *damage_str, unsigned __int8* dice_rolls, unsigned __int8* dice_sides, unsigned __int8* dmg_bonus );
|
|
28 int ParseMissleAttackType(const char *missle_attack_str);
|
|
29 int ParseSpecialAttack(const char *spec_att_str);
|
|
30
|
|
31 //----- (004548E2) --------------------------------------------------------
|
|
32 unsigned int ParseSpellType( struct FrameTableTxtLine * tbl, int* next_token )
|
|
33 {
|
|
34
|
|
35 if (!tbl->pProperties[0] )
|
|
36 {
|
|
37 ++*next_token;
|
|
38 return 0;
|
|
39 }
|
|
40 if ( !_stricmp(tbl->pProperties[0], "Dispel") ) //dispel magic
|
|
41 {
|
|
42 ++*next_token;
|
|
43 return 80;
|
|
44 }
|
|
45 else if ( !_stricmp(tbl->pProperties[0], "Day") ) //day of protection
|
|
46 {
|
|
47 *next_token+=2;;
|
|
48 return 85;
|
|
49 }
|
|
50 else if ( !_stricmp(tbl->pProperties[0], "Hour") ) //hour of power
|
|
51 {
|
|
52 *next_token+=2;;
|
|
53 return 86;
|
|
54 }
|
|
55 else if ( !_stricmp(tbl->pProperties[0], "Shield") )
|
|
56 return 17;
|
|
57 else if ( !_stricmp(tbl->pProperties[0], "Spirit") )
|
|
58 {
|
|
59 ++*next_token;
|
|
60 return 52;
|
|
61 }
|
|
62 else if ( !_stricmp(tbl->pProperties[0], "Power") ) //power cure
|
|
63 {
|
|
64 ++*next_token;
|
|
65 return 77;
|
|
66 }
|
|
67 else if ( !_stricmp(tbl->pProperties[0], "Meteor") ) //meteot shower
|
|
68 {
|
|
69 ++*next_token;
|
|
70 return 9;
|
|
71 }
|
|
72 else if ( !_stricmp(tbl->pProperties[0], "Lightning") ) //Lightning bolt
|
|
73 {
|
|
74 ++*next_token;
|
|
75 return 18;
|
|
76 }
|
|
77 else if ( !_stricmp(tbl->pProperties[0], "Implosion") )
|
|
78 return 20;
|
|
79 else if ( !_stricmp(tbl->pProperties[0], "Stone") )
|
|
80 {
|
|
81 ++*next_token;
|
|
82 return 38;
|
|
83 }
|
|
84 else if ( !_stricmp(tbl->pProperties[0], "Haste") )
|
|
85 return 5;
|
|
86 else if ( !_stricmp(tbl->pProperties[0], "Heroism") )
|
|
87 return 51;
|
|
88 else if ( !_stricmp(tbl->pProperties[0], "Pain") ) //pain reflection
|
|
89 {
|
|
90 ++*next_token;
|
|
91 return 95;
|
|
92 }
|
|
93 else if ( !_stricmp(tbl->pProperties[0], "Sparks") )
|
|
94 return 15;
|
|
95 else if ( !_stricmp(tbl->pProperties[0], "Light") )
|
|
96 {
|
|
97 ++*next_token;
|
|
98 return 78;
|
|
99 }
|
|
100 else if ( !_stricmp(tbl->pProperties[0], "Toxic") ) //toxic cloud
|
|
101 {
|
|
102 ++*next_token;
|
|
103 return 90;
|
|
104 }
|
|
105 else if ( !_stricmp(tbl->pProperties[0], "ShrapMetal") )
|
|
106 return 93;
|
|
107 else if ( !_stricmp(tbl->pProperties[0], "Paralyze") )
|
|
108 return 81;
|
|
109 else if ( !_stricmp(tbl->pProperties[0], "Fireball") )
|
|
110 return 6;
|
|
111 else if ( !_stricmp(tbl->pProperties[0], "Incinerate") )
|
|
112 return 11;
|
|
113 else if ( !_stricmp(tbl->pProperties[0], "Fire") )
|
|
114 {
|
|
115 ++*next_token;
|
|
116 return 2;
|
|
117 }
|
|
118 else if ( !_stricmp(tbl->pProperties[0], "Rock") )
|
|
119 {
|
|
120 ++*next_token;
|
|
121 return 41;
|
|
122 }
|
|
123 else if ( !_stricmp(tbl->pProperties[0], "Mass") )
|
|
124 {
|
|
125 ++*next_token;
|
|
126 return 44;
|
|
127 }
|
|
128 else if ( !_stricmp(tbl->pProperties[0], "Ice") )
|
|
129 {
|
|
130 ++*next_token;
|
|
131 return 26;
|
|
132 }
|
|
133 else if ( !_stricmp(tbl->pProperties[0], "Acid") )
|
|
134 {
|
|
135 ++*next_token;
|
|
136 return 29;
|
|
137 }
|
|
138 else if ( !_stricmp(tbl->pProperties[0], "Bless") )
|
|
139 return 46;
|
|
140 else if ( !_stricmp(tbl->pProperties[0], "Dragon") )
|
|
141 {
|
|
142 ++*next_token;
|
|
143 return 97;
|
|
144 }
|
|
145 else if ( !_stricmp(tbl->pProperties[0], "Reanimate") )
|
|
146 return 89;
|
|
147 else if ( !_stricmp(tbl->pProperties[0], "Summon") )
|
|
148 {
|
|
149 ++*next_token;
|
|
150 return 82;
|
|
151 }
|
|
152 else if ( !_stricmp(tbl->pProperties[0], "Fate") )
|
|
153 return 47;
|
|
154 else if ( !_stricmp(tbl->pProperties[0], "Harm") )
|
|
155 return 70;
|
|
156 else if ( !_stricmp(tbl->pProperties[0], "Mind") )
|
|
157 {
|
|
158 ++*next_token;
|
|
159 return 57;
|
|
160 }
|
|
161 else if ( !_stricmp(tbl->pProperties[0], "Blades") )
|
|
162 return 39;
|
|
163 else if ( !_stricmp(tbl->pProperties[0], "Psychic") )
|
|
164 {
|
|
165 ++*next_token;
|
|
166 return 65;
|
|
167 }
|
|
168 else if ( !_stricmp(tbl->pProperties[0], "Hammerhands") )
|
|
169 return 73;
|
|
170 else
|
|
171 {
|
|
172 sprintf(pTmpBuf.data(), "Unknown monster spell %s", tbl->pProperties[0]);
|
|
173 MessageBoxA(nullptr, pTmpBuf.data(), "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0);
|
|
174 ++*next_token;
|
|
175 return 0;
|
|
176 }
|
|
177 }
|
|
178
|
|
179 //----- (00454CB4) --------------------------------------------------------
|
|
180 int ParseAttackType( const char *damage_type_str )
|
|
181 {
|
|
182
|
|
183 switch (tolower(*damage_type_str))
|
|
184 {
|
|
185 case 'f': return 0; //fire
|
|
186 case 'a': return 1; //air
|
|
187 case 'w': return 2; //water
|
|
188 case 'e': return 3; //earth
|
|
189
|
|
190 case 's': return 6; //spirit
|
|
191 case 'm': return 7; //mind
|
|
192 //m ?? 8
|
|
193 case 'l': return 9; //light
|
|
194 case 'd': return 10; //dark
|
|
195 // d?? 11
|
|
196 }
|
|
197 return 4; //phis
|
|
198
|
|
199 }
|
|
200
|
|
201 //----- (00454D7D) --------------------------------------------------------
|
|
202 void ParseDamage( char *damage_str, unsigned __int8* dice_rolls, unsigned __int8* dice_sides, unsigned __int8* dmg_bonus )
|
|
203 {
|
|
204 int str_len=0;
|
|
205 int str_pos=0;
|
|
206 bool dice_flag=false;
|
|
207
|
|
208 *dice_rolls = 0;
|
|
209 *dice_sides = 1;
|
|
210 *dmg_bonus = 0;
|
|
211
|
|
212 str_len = strlen(damage_str);
|
|
213 if (str_len<=0)
|
|
214 return;
|
|
215 for (str_pos=0;str_pos<str_len;++str_pos )
|
|
216 {
|
|
217 if (tolower(damage_str[str_pos])=='d')
|
|
218 {
|
|
219 damage_str[str_pos]='\0';
|
|
220 *dice_rolls=atoi(damage_str);
|
|
221 *dice_sides=atoi(&damage_str[str_pos+1]);
|
|
222 dice_flag=true;
|
|
223 damage_str[str_pos]='d';
|
|
224 }
|
|
225 else if (tolower(damage_str[str_pos])=='+')
|
|
226 *dmg_bonus=atoi(&damage_str[str_pos+1]);
|
|
227 }
|
|
228 if (!dice_flag)
|
|
229 {
|
|
230 if ((*damage_str>='0')&&(*damage_str<='9'))
|
|
231 {
|
|
232 *dice_rolls =atoi(damage_str);
|
|
233 *dice_sides = 1;
|
|
234 }
|
|
235 }
|
|
236 }
|
|
237
|
|
238 //----- (00454E3A) --------------------------------------------------------
|
|
239 int ParseMissleAttackType(const char *missle_attack_str)
|
|
240 {
|
|
241 if ( !_stricmp(missle_attack_str, "ARROW") )
|
|
242 return 1;
|
|
243 else if ( !_stricmp(missle_attack_str, "ARROWF") )
|
|
244 return 2;
|
|
245 else if ( !_stricmp(missle_attack_str, "FIRE") )
|
|
246 return 3;
|
|
247 else if ( !_stricmp(missle_attack_str, "AIR") )
|
|
248 return 4;
|
|
249 else if ( !_stricmp(missle_attack_str, "WATER") )
|
|
250 return 5;
|
|
251 else if ( !_stricmp(missle_attack_str, "EARTH") )
|
|
252 return 6;
|
|
253 else if ( !_stricmp(missle_attack_str, "SPIRIT") )
|
|
254 return 7;
|
|
255 else if ( !_stricmp(missle_attack_str, "MIND") )
|
|
256 return 8;
|
|
257 else if ( !_stricmp(missle_attack_str, "BODY") )
|
|
258 return 9;
|
|
259 else if ( !_stricmp(missle_attack_str, "LIGHT") )
|
|
260 return 10;
|
|
261 else if ( !_stricmp(missle_attack_str, "DARK") )
|
|
262 return 11;
|
|
263 else if ( !_stricmp(missle_attack_str, "ENER") )
|
|
264 return 13;
|
|
265 else return 0;
|
|
266 }
|
|
267
|
|
268
|
|
269 int ParseSpecialAttack(char *spec_att_str)
|
|
270 {
|
|
271 _strlwr(spec_att_str);
|
|
272 if ( strstr(spec_att_str, "curse") )
|
|
273 return 1;
|
|
274 else if ( strstr(spec_att_str, "weak") )
|
|
275 return 2;
|
|
276 else if ( strstr(spec_att_str, "asleep") )
|
|
277 return 3;
|
|
278 else if ( strstr(spec_att_str, "afraid") )
|
|
279 return 23;
|
|
280 else if ( strstr(spec_att_str, "drunk") )
|
|
281 return 4;
|
|
282 else if ( strstr(spec_att_str, "insane") )
|
|
283 return 5;
|
|
284 else if ( strstr(spec_att_str, "poison weak") )
|
|
285 return 6;
|
|
286 else if ( strstr(spec_att_str, "poison medium") )
|
|
287 return 7;
|
|
288 else if ( strstr(spec_att_str, "poison severe") )
|
|
289 return 8;
|
|
290 else if ( strstr(spec_att_str, "disease weak") )
|
|
291 return 9;
|
|
292 else if ( strstr(spec_att_str, "disease medium") )
|
|
293 return 10;
|
|
294 else if ( strstr(spec_att_str, "disease severe") )
|
|
295 return 11;
|
|
296 else if ( strstr(spec_att_str, "paralyze") )
|
|
297 return 12;
|
|
298 else if ( strstr(spec_att_str, "uncon") )
|
|
299 return 13;
|
|
300 else if ( strstr(spec_att_str, "dead") )
|
|
301 return 14;
|
|
302 else if ( strstr(spec_att_str, "stone") )
|
|
303 return 15;
|
|
304 else if ( strstr(spec_att_str, "errad") )
|
|
305 return 16;
|
|
306 else if ( strstr(spec_att_str, "brkitem") )
|
|
307 return 17;
|
|
308 else if ( strstr(spec_att_str, "brkarmor") )
|
|
309 return 18;
|
|
310 else if ( strstr(spec_att_str, "brkweapon") )
|
|
311 return 19;
|
|
312 else if ( strstr(spec_att_str, "steal") )
|
|
313 return 20;
|
|
314 else if ( strstr(spec_att_str, "age") )
|
|
315 return 21;
|
|
316 else if ( strstr(spec_att_str, "drainsp") )
|
|
317 return 22;
|
|
318 else return 0;
|
|
319 }
|
|
320
|
|
321 //----- (004598FC) --------------------------------------------------------
|
|
322 bool MonsterList::FromFileTxt(const char *Args)
|
|
323 {
|
|
324 MonsterList *v2; // ebx@1
|
|
325 FILE *v3; // eax@1
|
|
326 unsigned int v4; // esi@3
|
|
327 void *v5; // eax@9
|
|
328 FILE *v6; // ST14_4@11
|
|
329 char *i; // eax@11
|
|
330 signed int v8; // esi@12
|
|
331 unsigned __int16 v9; // ax@16
|
|
332 const char *v10; // ST18_4@16
|
|
333 unsigned __int16 v11; // ax@16
|
|
334 const char *v12; // ST14_4@16
|
|
335 unsigned __int16 v13; // ax@16
|
|
336 const char *v14; // ST10_4@16
|
|
337 __int16 v15; // ax@16
|
|
338 const char *v16; // ST0C_4@16
|
|
339 int v17; // esi@16
|
|
340 unsigned __int8 v18; // al@16
|
|
341 signed int v19; // esi@16
|
|
342 unsigned __int16 v20; // ax@17
|
|
343 int v21; // ecx@17
|
|
344 char Buf; // [sp+4h] [bp-304h]@3
|
|
345 FrameTableTxtLine v24; // [sp+1F8h] [bp-110h]@4
|
|
346 FrameTableTxtLine v25; // [sp+274h] [bp-94h]@4
|
|
347 int v26; // [sp+2F0h] [bp-18h]@16
|
|
348 char v27; // [sp+2F4h] [bp-14h]@14
|
|
349 char v28; // [sp+2F5h] [bp-13h]@14
|
|
350 char v29; // [sp+2F6h] [bp-12h]@14
|
|
351 char v30; // [sp+2F7h] [bp-11h]@14
|
|
352 char v31; // [sp+2F8h] [bp-10h]@14
|
|
353 char v32; // [sp+2F9h] [bp-Fh]@14
|
|
354 char v33; // [sp+2FAh] [bp-Eh]@14
|
|
355 char v34; // [sp+2FBh] [bp-Dh]@14
|
|
356 char v35; // [sp+2FCh] [bp-Ch]@14
|
|
357 char v36; // [sp+2FDh] [bp-Bh]@14
|
|
358 char v37; // [sp+2FEh] [bp-Ah]@14
|
|
359 char v38; // [sp+2FFh] [bp-9h]@14
|
|
360 char v39; // [sp+300h] [bp-8h]@14
|
|
361 char v40; // [sp+301h] [bp-7h]@14
|
|
362 char v41; // [sp+302h] [bp-6h]@14
|
|
363 char v42; // [sp+303h] [bp-5h]@14
|
|
364 FILE *File; // [sp+304h] [bp-4h]@1
|
|
365 unsigned int Argsa; // [sp+310h] [bp+8h]@3
|
|
366 int Argsb; // [sp+310h] [bp+8h]@16
|
|
367
|
|
368 v2 = this;
|
|
369 v3 = fopen(Args, "r");
|
|
370 File = v3;
|
|
371 if ( !v3 )
|
|
372 Error("MonsterRaceListStruct::load - Unable to open file: %s.");
|
|
373
|
|
374 v4 = 0;
|
|
375 Argsa = 0;
|
|
376 if ( fgets(&Buf, 490, v3) )
|
|
377 {
|
|
378 do
|
|
379 {
|
|
380 *strchr(&Buf, 10) = 0;
|
|
381 memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25));
|
|
382 if ( v25.uPropCount && *v25.pProperties[0] != 47 )
|
|
383 ++Argsa;
|
|
384 }
|
|
385 while ( fgets(&Buf, 490, File) );
|
|
386 v4 = Argsa;
|
|
387 }
|
|
388 v2->uNumMonsters = v4;
|
|
389 v5 = malloc(152 * v4);
|
|
390 v2->pMonsters = (MonsterDesc *)v5;
|
|
391 if ( !v5 )
|
|
392 Error("MonsterRaceListStruct::load - Out of Memory!");
|
|
393
|
|
394 v6 = File;
|
|
395 v2->uNumMonsters = 0;
|
|
396 fseek(v6, 0, 0);
|
|
397 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
|
|
398 {
|
|
399 *strchr(&Buf, 10) = 0;
|
|
400 memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25));
|
|
401 v8 = 0;
|
|
402 if ( v25.uPropCount && *v25.pProperties[0] != 47 )
|
|
403 {
|
|
404 strcpy(v2->pMonsters[v2->uNumMonsters].pMonsterName, v25.pProperties[0]);
|
|
405 v35 = 0;
|
|
406 v36 = 1;
|
|
407 v37 = 7;
|
|
408 v38 = 2;
|
|
409 v39 = 3;
|
|
410 v40 = 4;
|
|
411 v41 = 5;
|
|
412 v42 = 6;
|
|
413 v27 = 1;
|
|
414 v28 = 2;
|
|
415 v29 = 3;
|
|
416 v30 = 4;
|
|
417 v31 = 4;
|
|
418 v32 = 5;
|
|
419 v33 = 6;
|
|
420 v34 = 7;
|
|
421 do
|
|
422 {
|
|
423 strcpy(
|
|
424 v2->pMonsters[v2->uNumMonsters].pSpriteNames[(unsigned __int8)*(&v35 + v8)],
|
|
425 v25.pProperties[(unsigned __int8)*(&v27 + v8)]);
|
|
426 ++v8;
|
|
427 }
|
|
428 while ( v8 < 8 );
|
|
429 v9 = atoi(v25.pProperties[8]);
|
|
430 v10 = v25.pProperties[9];
|
|
431 v2->pMonsters[v2->uNumMonsters].uMonsterHeight = v9;
|
|
432 v11 = atoi(v10);
|
|
433 v12 = v25.pProperties[10];
|
|
434 v2->pMonsters[v2->uNumMonsters].uMovementSpeed = v11;
|
|
435 v13 = atoi(v12);
|
|
436 v14 = v25.pProperties[11];
|
|
437 v2->pMonsters[v2->uNumMonsters].uMonsterRadius = v13;
|
|
438 v15 = atoi(v14);
|
|
439 v16 = v25.pProperties[12];
|
|
440 v2->pMonsters[v2->uNumMonsters].uToHitRadius = v15;
|
|
441 v17 = (unsigned __int8)atoi(v16);
|
|
442 Argsb = atoi(v25.pProperties[13]) & 0xFF;
|
|
443 v26 = atoi(v25.pProperties[14]) & 0xFF;
|
|
444 v18 = atoi(v25.pProperties[15]);
|
|
445 v2->pMonsters[v2->uNumMonsters].sTintColor = v18 | ((v26 | ((Argsb | (v17 << 8)) << 8)) << 8);
|
|
446 v19 = 0;
|
|
447 do
|
|
448 {
|
|
449 v20 = atoi(v25.pProperties[v19 + 16]);
|
|
450 v21 = v19++ ;
|
|
451 v2->pMonsters[v2->uNumMonsters].pSoundSampleIDs[v21] = v20;
|
|
452 }
|
|
453 while ( v19 < 4 );
|
|
454 ++v2->uNumMonsters;
|
|
455 }
|
|
456 }
|
|
457 fclose(File);
|
|
458 return 1;
|
|
459 }
|
|
460
|
|
461 //----- (004598AF) --------------------------------------------------------
|
|
462 void MonsterList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
|
|
463 {
|
|
464 uint num_mm6_monsters = data_mm6 ? *(int *)data_mm6 : 0,
|
|
465 num_mm7_monsters = data_mm7 ? *(int *)data_mm7 : 0,
|
|
466 num_mm8_monsters = data_mm8 ? *(int *)data_mm8 : 0;
|
|
467
|
|
468 uNumMonsters = num_mm6_monsters + num_mm7_monsters + num_mm8_monsters;
|
|
469 Assert(uNumMonsters);
|
|
470 Assert(!num_mm8_monsters);
|
|
471
|
|
472 pMonsters = (MonsterDesc *)malloc(sizeof(MonsterDesc) * uNumMonsters);
|
|
473 memcpy(pMonsters, (char *)data_mm7 + 4, num_mm7_monsters * sizeof(MonsterDesc));
|
|
474 for (uint i = 0; i < num_mm6_monsters; ++i)
|
|
475 {
|
|
476 auto src = (MonsterDesc_mm6 *)((char *)data_mm6 + 4) + i;
|
|
477 MonsterDesc* dst = &pMonsters[num_mm7_monsters + i];
|
|
478
|
|
479 dst->uMonsterHeight = src->uMonsterHeight;
|
|
480 dst->uMonsterRadius = src->uMonsterRadius;
|
|
481 dst->uMovementSpeed = src->uMovementSpeed;
|
|
482 dst->uToHitRadius = src->uToHitRadius;
|
|
483 dst->sTintColor = -1;
|
|
484 memcpy(dst->pSoundSampleIDs, src->pSoundSampleIDs, sizeof(src->pSoundSampleIDs));
|
|
485 memcpy(dst->pMonsterName, src->pMonsterName, sizeof(src->pMonsterName));
|
|
486 memcpy(dst->pSpriteNames, src->pSpriteNames, sizeof(src->pSpriteNames));
|
|
487 }
|
|
488 memcpy(pMonsters + num_mm6_monsters + num_mm7_monsters, (char *)data_mm8 + 4, num_mm8_monsters * sizeof(MonsterDesc));
|
|
489 }
|
|
490
|
|
491 //----- (00459860) --------------------------------------------------------
|
|
492 void MonsterList::ToFile()
|
|
493 {
|
|
494 MonsterList *v1; // esi@1
|
|
495 FILE *v2; // eax@1
|
|
496 FILE *v3; // edi@1
|
|
497
|
|
498 v1 = this;
|
|
499 v2 = fopen("data\\dmonlist.bin", "wb");
|
|
500 v3 = v2;
|
|
501 if ( !v2 )
|
|
502 Error("Unable to save dmonlist.bin!");
|
|
503 fwrite(v1, 4u, 1u, v2);
|
|
504 fwrite(v1->pMonsters, 0x98u, v1->uNumMonsters, v3);
|
|
505 fclose(v3);
|
|
506 }
|
|
507
|
|
508
|
|
509 //----- (004563FF) --------------------------------------------------------
|
|
510 signed int MonsterStats::FindMonsterByTextureName(const char *monster_textr_name)
|
|
511 {
|
|
512 for (int i=1; i<uNumMonsters; ++i)
|
|
513 {
|
|
514 if((pInfos[i].pName )&& (!_stricmp(pInfos[i].pPictureName, monster_textr_name)))
|
|
515 return i;
|
|
516 }
|
|
517 return -1;
|
|
518 }
|
|
519
|
|
520
|
|
521 //----- (00454F4E) --------------------------------------------------------
|
|
522 void MonsterStats::InitializePlacements()
|
|
523 {
|
|
524 int i;
|
|
525 char* test_string;
|
|
526 unsigned char c;
|
|
527 bool break_loop;
|
|
528 unsigned int temp_str_len;
|
|
529 char* tmp_pos;
|
|
530 int decode_step;
|
|
531 // int item_counter;
|
|
532
|
|
533 pMonsterPlacementTXT_Raw = (char *)pEvents_LOD->LoadRaw("placemon.txt", 0);
|
|
534 strtok(pMonsterPlacementTXT_Raw, "\r");
|
|
535 for (i=1; i<31; ++i)
|
|
536 {
|
|
537 test_string = strtok(NULL, "\r") + 1;
|
|
538 break_loop = false;
|
|
539 decode_step=0;
|
|
540 do
|
|
541 {
|
|
542 c = *(unsigned char*)test_string;
|
|
543 temp_str_len = 0;
|
|
544 while((c!='\t')&&(c>0))
|
|
545 {
|
|
546 ++temp_str_len;
|
|
547 c=test_string[temp_str_len];
|
|
548 }
|
|
549 tmp_pos=test_string+temp_str_len;
|
|
550 if (*tmp_pos == 0)
|
|
551 break_loop = true;
|
|
552 *tmp_pos = 0;
|
|
553 if (temp_str_len)
|
|
554 {
|
|
555 if (decode_step==1)
|
|
556 pPlaceStrings[i]=RemoveQuotes(test_string);
|
|
557 }
|
|
558 else
|
|
559 {
|
|
560 break_loop = true;
|
|
561 }
|
|
562 ++decode_step;
|
|
563 test_string=tmp_pos+1;
|
|
564 } while ((decode_step<3)&&!break_loop);
|
|
565 }
|
|
566 uNumPlacements = 31;
|
|
567 }
|
|
568
|
|
569 //----- (0045501E) --------------------------------------------------------
|
|
570 void MonsterStats::Initialize()
|
|
571 {
|
|
572 int i;//,j;
|
|
573 char* test_string;
|
|
574 unsigned char c;
|
|
575 bool break_loop;
|
|
576 unsigned int temp_str_len;
|
|
577 char* tmp_pos;
|
|
578 int decode_step;
|
|
579 // int item_counter;
|
|
580 int curr_rec_num;
|
|
581 char parse_str[64];
|
|
582 char Src[120];
|
|
583 FrameTableTxtLine parsed_field;
|
|
584
|
|
585 free(pMonstersTXT_Raw);
|
|
586 pMonstersTXT_Raw = (char *)pEvents_LOD->LoadRaw("monsters.txt", 0);
|
|
587 strtok(pMonstersTXT_Raw, "\r");
|
|
588 strtok(NULL, "\r");
|
|
589 strtok(NULL, "\r");
|
|
590 strtok(NULL, "\r");
|
|
591 uNumMonsters = 265;
|
|
592 curr_rec_num=0;
|
|
593 for (i=0;i<uNumMonsters-1;++i)
|
|
594 {
|
|
595 test_string = strtok(NULL, "\r") + 1;
|
|
596 break_loop = false;
|
|
597 decode_step=0;
|
|
598 do
|
|
599 {
|
|
600 c = *(unsigned char*)test_string;
|
|
601 temp_str_len = 0;
|
|
602 while((c!='\t')&&(c>0))
|
|
603 {
|
|
604 ++temp_str_len;
|
|
605 c=test_string[temp_str_len];
|
|
606 }
|
|
607 tmp_pos=test_string+temp_str_len;
|
|
608 if (*tmp_pos == 0)
|
|
609 break_loop = true;
|
|
610 *tmp_pos = 0;
|
|
611 if (temp_str_len)
|
|
612 {
|
|
613 switch (decode_step)
|
|
614 {
|
|
615 case 0:
|
|
616 curr_rec_num=atoi(test_string);
|
|
617 pInfos[curr_rec_num].uID=curr_rec_num;
|
|
618 break;
|
|
619 case 1:
|
|
620 pInfos[curr_rec_num].pName=RemoveQuotes(test_string);
|
|
621 break;
|
|
622 case 2:
|
|
623 pInfos[curr_rec_num].pPictureName=RemoveQuotes(test_string);
|
|
624 break;
|
|
625 case 3:
|
|
626 pInfos[curr_rec_num].uLevel=atoi(test_string);
|
|
627 break;
|
|
628 case 4:
|
|
629 {
|
|
630 int str_len=0;
|
|
631 int str_pos=0;
|
|
632 pInfos[curr_rec_num].uHP=0;
|
|
633 if (test_string[0]=='"')
|
|
634 test_string[0]=' ';
|
|
635 str_len=strlen(test_string);
|
|
636 if (str_len==0)
|
|
637 break;
|
|
638 while ((test_string[str_pos]!=',')&&(str_pos<str_len))
|
|
639 ++str_pos;
|
|
640 if (str_len==str_pos)
|
|
641 pInfos[curr_rec_num].uHP=atoi(test_string);
|
|
642 else
|
|
643 {
|
|
644 test_string[str_pos]='\0';
|
|
645 pInfos[curr_rec_num].uHP=1000*atoi(test_string);
|
|
646 pInfos[curr_rec_num].uHP+=atoi(&test_string[str_pos+1]);
|
|
647 test_string[str_pos]=',';
|
|
648 }
|
|
649 }
|
|
650 break;
|
|
651 case 5:
|
|
652 pInfos[curr_rec_num].uAC=atoi(test_string);
|
|
653 break;
|
|
654 case 6:
|
|
655 {
|
|
656 int str_len=0;
|
|
657 int str_pos=0;
|
|
658 pInfos[curr_rec_num].uExp=0;
|
|
659 if (test_string[0]=='"')
|
|
660 test_string[0]=' ';
|
|
661 str_len=strlen(test_string);
|
|
662 if (str_len==0)
|
|
663 break;
|
|
664 while ((test_string[str_pos]!=',')&&(str_pos<str_len))
|
|
665 ++str_pos;
|
|
666 if (str_len==str_pos)
|
|
667 pInfos[curr_rec_num].uExp=atoi(test_string);
|
|
668 else
|
|
669 {
|
|
670 test_string[str_pos]='\0';
|
|
671 pInfos[curr_rec_num].uExp=1000*atoi(test_string);
|
|
672 pInfos[curr_rec_num].uExp+=atoi(&test_string[str_pos+1]);
|
|
673 test_string[str_pos]=',';
|
|
674 }
|
|
675 }
|
|
676 break;
|
|
677 case 7:
|
|
678 {
|
|
679 int str_len=0;
|
|
680 int str_pos=0;
|
|
681 bool chance_flag=false;
|
|
682 bool dice_flag=false;
|
|
683 bool item_type_flag=false;
|
|
684 char* item_name;
|
|
685 pInfos[curr_rec_num].uTreasureDropChance=0;
|
|
686 pInfos[curr_rec_num].uTreasureDiceRolls=0;
|
|
687 pInfos[curr_rec_num].uTreasureDiceSides=0;
|
|
688 pInfos[curr_rec_num].uTreasureType=0;
|
|
689 pInfos[curr_rec_num].uTreasureLevel=0;
|
|
690 if (test_string[0]=='"')
|
|
691 test_string[0]=' ';
|
|
692 str_len=strlen(test_string);
|
|
693 do
|
|
694 {
|
|
695 switch(tolower(test_string[str_pos]))
|
|
696 {
|
|
697 case '%': chance_flag=true; break;
|
|
698 case 'd': dice_flag=true; break;
|
|
699 case 'l': item_type_flag=true; break;
|
|
700 }
|
|
701 ++str_pos;
|
|
702 }
|
|
703 while(str_pos<str_len);
|
|
704 if (chance_flag)
|
|
705 {
|
|
706 pInfos[curr_rec_num].uTreasureDropChance=atoi(test_string);
|
|
707 }
|
|
708 else
|
|
709 {
|
|
710 if ((!dice_flag)&&(!item_type_flag))
|
|
711 break;
|
|
712 pInfos[curr_rec_num].uTreasureDropChance=100;
|
|
713 }
|
|
714 if (dice_flag)
|
|
715 {
|
|
716 str_pos=0;
|
|
717 dice_flag=false;
|
|
718 do
|
|
719 {
|
|
720 switch(tolower(test_string[str_pos]))
|
|
721 {
|
|
722 case '%':
|
|
723 pInfos[curr_rec_num].uTreasureDiceRolls=atoi(&test_string[str_pos+1]);
|
|
724 dice_flag=true;
|
|
725 break;
|
|
726 case 'd':
|
|
727 if(!dice_flag)
|
|
728 pInfos[curr_rec_num].uTreasureDiceRolls=atoi(test_string);
|
|
729 pInfos[curr_rec_num].uTreasureDiceSides=atoi(&test_string[str_pos+1]);
|
|
730 str_pos=str_len;
|
|
731 break;
|
|
732
|
|
733 }
|
|
734 ++str_pos;
|
|
735 }
|
|
736 while(str_pos<str_len);
|
|
737 }
|
|
738 if (item_type_flag)
|
|
739 {
|
|
740 str_pos=0;
|
|
741 do
|
|
742 {
|
|
743 if (tolower(test_string[str_pos])=='l')
|
|
744 break;
|
|
745 ++str_pos;
|
|
746 }
|
|
747 while(str_pos<str_len);
|
|
748
|
|
749 pInfos[curr_rec_num].uTreasureLevel=test_string[str_pos+1]-'0';
|
|
750 item_name=&test_string[str_pos+2];
|
|
751 if (*item_name)
|
|
752 {
|
|
753 if ( !_stricmp(item_name, "WEAPON"))
|
|
754 pInfos[curr_rec_num].uTreasureType= 20;
|
|
755 else if ( !_stricmp(item_name, "ARMOR"))
|
|
756 pInfos[curr_rec_num].uTreasureType= 21;
|
|
757 else if ( !_stricmp(item_name, "MISC"))
|
|
758 pInfos[curr_rec_num].uTreasureType= 22;
|
|
759 else if ( !_stricmp(item_name, "SWORD"))
|
|
760 pInfos[curr_rec_num].uTreasureType= 23;
|
|
761 else if ( !_stricmp(item_name, "DAGGER"))
|
|
762 pInfos[curr_rec_num].uTreasureType= 24;
|
|
763 else if ( !_stricmp(item_name, "AXE"))
|
|
764 pInfos[curr_rec_num].uTreasureType= 25;
|
|
765 else if ( !_stricmp(item_name, "SPEAR"))
|
|
766 pInfos[curr_rec_num].uTreasureType= 26;
|
|
767 else if ( !_stricmp(item_name, "BOW"))
|
|
768 pInfos[curr_rec_num].uTreasureType= 27;
|
|
769 else if ( !_stricmp(item_name, "MACE"))
|
|
770 pInfos[curr_rec_num].uTreasureType= 28;
|
|
771 else if ( !_stricmp(item_name, "CLUB"))
|
|
772 pInfos[curr_rec_num].uTreasureType= 29;
|
|
773 else if ( !_stricmp(item_name, "STAFF"))
|
|
774 pInfos[curr_rec_num].uTreasureType= 30;
|
|
775 else if ( !_stricmp(item_name, "LEATHER"))
|
|
776 pInfos[curr_rec_num].uTreasureType= 31;
|
|
777 else if ( !_stricmp(item_name, "CHAIN"))
|
|
778 pInfos[curr_rec_num].uTreasureType= 32;
|
|
779 else if ( !_stricmp(item_name, "PLATE"))
|
|
780 pInfos[curr_rec_num].uTreasureType= 33;
|
|
781 else if ( !_stricmp(item_name, "SHIELD"))
|
|
782 pInfos[curr_rec_num].uTreasureType= 34;
|
|
783 else if ( !_stricmp(item_name, "HELM"))
|
|
784 pInfos[curr_rec_num].uTreasureType= 35;
|
|
785 else if ( !_stricmp(item_name, "BELT"))
|
|
786 pInfos[curr_rec_num].uTreasureType= 36;
|
|
787 else if ( !_stricmp(item_name, "CAPE"))
|
|
788 pInfos[curr_rec_num].uTreasureType= 37;
|
|
789 else if ( !_stricmp(item_name, "GAUNTLETS"))
|
|
790 pInfos[curr_rec_num].uTreasureType= 38;
|
|
791 else if ( !_stricmp(item_name, "BOOTS"))
|
|
792 pInfos[curr_rec_num].uTreasureType= 39;
|
|
793 else if ( !_stricmp(item_name, "RING"))
|
|
794 pInfos[curr_rec_num].uTreasureType= 40;
|
|
795 else if ( !_stricmp(item_name, "AMULET"))
|
|
796 pInfos[curr_rec_num].uTreasureType= 41;
|
|
797 else if ( !_stricmp(item_name, "WAND"))
|
|
798 pInfos[curr_rec_num].uTreasureType= 42;
|
|
799 else if ( !_stricmp(item_name, "SCROLL"))
|
|
800 pInfos[curr_rec_num].uTreasureType= 43;
|
|
801 else if ( !_stricmp(item_name, "GEM"))
|
|
802 pInfos[curr_rec_num].uTreasureType= 46;
|
|
803 }
|
|
804 }
|
|
805
|
|
806 }
|
|
807 break;
|
|
808 case 8:
|
|
809 {
|
|
810 pInfos[curr_rec_num].bQuestMonster=0;
|
|
811 if (atoi(test_string))
|
|
812 pInfos[curr_rec_num].bQuestMonster=1;
|
|
813 }
|
|
814 break;
|
|
815 case 9:
|
|
816 {
|
|
817 pInfos[curr_rec_num].uFlying=false;
|
|
818 if (_strnicmp(test_string, "n",1))
|
|
819 pInfos[curr_rec_num].uFlying=true;
|
|
820 }
|
|
821 break;
|
|
822 case 10:
|
|
823 {
|
|
824 switch(tolower(test_string[0]))
|
|
825 {
|
|
826 case 's': pInfos[curr_rec_num].uMovementType=MONSTER_MOVEMENT_TYPE_SHORT;// short
|
|
827 if (tolower(test_string[1])!='h')
|
|
828 pInfos[curr_rec_num].uMovementType=MONSTER_MOVEMENT_TYPE_STAIONARY; //stationary
|
|
829 break; //short
|
|
830 case 'l': pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_LONG; break; //long
|
|
831 case 'm': pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_MEDIUM; break; //med
|
|
832 case 'g': pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_GLOBAL; break; //global?
|
|
833 default:
|
|
834 pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_FREE; //free
|
|
835 }
|
|
836 }
|
|
837 break;
|
|
838 case 11:
|
|
839 {
|
|
840 switch(tolower(test_string[0]))
|
|
841 {
|
|
842 case 's': pInfos[curr_rec_num].uAIType=0; break; // suicide
|
|
843 case 'w': pInfos[curr_rec_num].uAIType=1; break; //wimp
|
|
844 case 'n': pInfos[curr_rec_num].uAIType=2; break; //normal
|
|
845 default:
|
|
846 pInfos[curr_rec_num].uAIType=3; //Agress
|
|
847 }
|
|
848 }
|
|
849 break;
|
|
850 case 12:
|
|
851 pInfos[curr_rec_num].uHostilityType=(MonsterInfo::HostilityRadius)atoi(test_string);
|
|
852 break;
|
|
853 case 13:
|
|
854 pInfos[curr_rec_num].uBaseSpeed=atoi(test_string);
|
|
855 break;
|
|
856 case 14:
|
|
857 pInfos[curr_rec_num].uRecoveryTime=atoi(test_string);
|
|
858 break;
|
|
859 case 15:
|
|
860 {
|
|
861 int str_len=0;
|
|
862 int str_pos=0;
|
|
863 pInfos[curr_rec_num].uAttackPreference=0;
|
|
864 pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=0;
|
|
865 str_len=strlen(test_string);
|
|
866 for (str_pos=0;str_pos<str_len;++str_pos )
|
|
867 {
|
|
868 switch(tolower(test_string[str_pos]))
|
|
869 {
|
|
870 case '0': pInfos[curr_rec_num].uAttackPreference|=0x0004; break;
|
|
871 case '2': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=2; break;
|
|
872 case '3': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=3; break;
|
|
873 case '4': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=4; break;
|
|
874 case 'c': pInfos[curr_rec_num].uAttackPreference|=0x0010; break;
|
|
875 case 'd': pInfos[curr_rec_num].uAttackPreference|=0x0008; break;
|
|
876 case 'e': pInfos[curr_rec_num].uAttackPreference|=0x1000; break;
|
|
877 case 'f': pInfos[curr_rec_num].uAttackPreference|=0x0400; break;
|
|
878 case 'h': pInfos[curr_rec_num].uAttackPreference|=0x0800; break;
|
|
879 case 'k': pInfos[curr_rec_num].uAttackPreference|=0x0001; break;
|
|
880 case 'm': pInfos[curr_rec_num].uAttackPreference|=0x0100; break;
|
|
881 case 'o': pInfos[curr_rec_num].uAttackPreference|=0x0400; break;
|
|
882 case 'p': pInfos[curr_rec_num].uAttackPreference|=0x0002; break;
|
|
883 case 'r': pInfos[curr_rec_num].uAttackPreference|=0x0040; break;
|
|
884 case 's': pInfos[curr_rec_num].uAttackPreference|=0x0020; break;
|
|
885 case 't': pInfos[curr_rec_num].uAttackPreference|=0x0080; break;
|
|
886 case 'w': pInfos[curr_rec_num].uAttackPreference|=0x2000; break;
|
|
887 case 'x': pInfos[curr_rec_num].uAttackPreference|=0x0200; break;
|
|
888 }
|
|
889 }
|
|
890 }
|
|
891 break;
|
|
892 case 16:
|
|
893 {
|
|
894 int str_len=0;
|
|
895 int str_pos=0;
|
|
896 pInfos[curr_rec_num].uSpecialAttackLevel=1;
|
|
897 pInfos[curr_rec_num].uSpecialAttackType=(SPECIAL_ATTACK_TYPE)0;
|
|
898 str_len=strlen(test_string);
|
|
899 if (str_len>1)
|
|
900 {
|
|
901 for (str_pos=0;str_pos<str_len;++str_pos )
|
|
902 {
|
|
903 if (tolower(test_string[str_pos])=='x')
|
|
904 {
|
|
905 test_string[str_pos]='\0';
|
|
906 pInfos[curr_rec_num].uSpecialAttackLevel=atoi(&test_string[str_pos+1]);
|
|
907 test_string[str_pos]='x';
|
|
908 break;
|
|
909 }
|
|
910 }
|
|
911 pInfos[curr_rec_num].uSpecialAttackType=(SPECIAL_ATTACK_TYPE)ParseSpecialAttack(test_string);
|
|
912 }
|
|
913 }
|
|
914 break;
|
|
915 case 17:
|
|
916 pInfos[curr_rec_num].uAttack1Type=ParseAttackType(test_string);
|
|
917 break;
|
|
918 case 18:
|
|
919 {
|
|
920 ParseDamage(test_string, &pInfos[curr_rec_num].uAttack1DamageDiceRolls,
|
|
921 &pInfos[curr_rec_num].uAttack1DamageDiceSides,
|
|
922 &pInfos[curr_rec_num].uAttack1DamageBonus);
|
|
923 }
|
|
924 break;
|
|
925 case 19:
|
|
926 pInfos[curr_rec_num].uMissleAttack1Type=ParseMissleAttackType(test_string);
|
|
927 break;
|
|
928 case 20:
|
|
929 pInfos[curr_rec_num].uAttack2Chance=atoi(test_string);
|
|
930 break;
|
|
931 case 21:
|
|
932 pInfos[curr_rec_num].uAttack2Type=ParseAttackType(test_string);
|
|
933 break;
|
|
934 case 22:
|
|
935 {
|
|
936 ParseDamage(test_string, &pInfos[curr_rec_num].uAttack2DamageDiceRolls,
|
|
937 &pInfos[curr_rec_num].uAttack2DamageDiceSides,
|
|
938 &pInfos[curr_rec_num].uAttack2DamageBonus);
|
|
939 }
|
|
940 break;
|
|
941 case 23:
|
|
942 pInfos[curr_rec_num].uMissleAttack2Type=ParseMissleAttackType(test_string);
|
|
943 break;
|
|
944 case 24:
|
|
945 pInfos[curr_rec_num].uSpell1UseChance=atoi(test_string);
|
|
946 break;
|
|
947 case 25:
|
|
948 {
|
|
949 int param_num;
|
|
950 char type_flag;
|
|
951 strcpy(parse_str,test_string);
|
|
952 parse_str[0]=' ';
|
|
953 parse_str[strlen(parse_str)-1]=' ';
|
|
954 frame_table_txt_parser(parse_str,&parsed_field);
|
|
955 if (parsed_field.uPropCount>2)
|
|
956 {
|
|
957 param_num=1;
|
|
958 pInfos[curr_rec_num].uSpell1ID=ParseSpellType(&parsed_field,¶m_num);
|
|
959 type_flag=*parsed_field.pProperties[param_num];
|
|
960 pInfos[curr_rec_num].uSpellSkillAndMastery1=atoi(parsed_field.pProperties[param_num+1])&0x003F;
|
|
961 switch(type_flag)
|
|
962 {
|
|
963 case 'E': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0040; break;
|
|
964 case 'M': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0080; break;
|
|
965 case 'G': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0100; break;
|
|
966 }
|
|
967 }
|
|
968 else
|
|
969 {
|
|
970 pInfos[curr_rec_num].uSpell1ID=0;
|
|
971 pInfos[curr_rec_num].uSpellSkillAndMastery1=0;
|
|
972 }
|
|
973
|
|
974 }
|
|
975 break;
|
|
976 case 26:
|
|
977 pInfos[curr_rec_num].uSpell2UseChance=atoi(test_string);
|
|
978 break;
|
|
979 case 27:
|
|
980 {
|
|
981 int param_num;
|
|
982 char type_flag;
|
|
983 strcpy(parse_str,test_string);
|
|
984 parse_str[0]=' ';
|
|
985 parse_str[strlen(parse_str)-1]=' ';
|
|
986 frame_table_txt_parser(parse_str,&parsed_field);
|
|
987 if (parsed_field.uPropCount>2)
|
|
988 {
|
|
989 param_num=1;
|
|
990 pInfos[curr_rec_num].uSpell2ID=ParseSpellType(&parsed_field,¶m_num);
|
|
991 type_flag=*parsed_field.pProperties[param_num];
|
|
992 pInfos[curr_rec_num].uSpellSkillAndMastery2=atoi(parsed_field.pProperties[param_num+1])&0x003F;
|
|
993 switch(type_flag)
|
|
994 {
|
|
995 case 'E': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0040; break;
|
|
996 case 'M': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0080; break;
|
|
997 case 'G': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0100; break;
|
|
998 }
|
|
999 }
|
|
1000 else
|
|
1001 {
|
|
1002 pInfos[curr_rec_num].uSpell2ID=0;
|
|
1003 pInfos[curr_rec_num].uSpellSkillAndMastery2=0;
|
|
1004 }
|
|
1005 }
|
|
1006 break;
|
|
1007 case 28:
|
|
1008 {
|
|
1009 if (tolower(test_string[0])=='i')
|
|
1010 pInfos[curr_rec_num].uResFire=200;
|
|
1011 else
|
|
1012 pInfos[curr_rec_num].uResFire=atoi(test_string);
|
|
1013 }
|
|
1014 break;
|
|
1015 case 29:
|
|
1016 {
|
|
1017 if (tolower(test_string[0])=='i')
|
|
1018 pInfos[curr_rec_num].uResAir=200;
|
|
1019 else
|
|
1020 pInfos[curr_rec_num].uResAir=atoi(test_string);
|
|
1021 }
|
|
1022 break;
|
|
1023 case 30:
|
|
1024 {
|
|
1025 if (tolower(test_string[0])=='i')
|
|
1026 pInfos[curr_rec_num].uResWater=200;
|
|
1027 else
|
|
1028 pInfos[curr_rec_num].uResWater=atoi(test_string);
|
|
1029 }
|
|
1030 break;
|
|
1031 case 31:
|
|
1032 {
|
|
1033 if (tolower(test_string[0])=='i')
|
|
1034 pInfos[curr_rec_num].uResEarth=200;
|
|
1035 else
|
|
1036 pInfos[curr_rec_num].uResEarth=atoi(test_string);
|
|
1037 }
|
|
1038 break;
|
|
1039 case 32:
|
|
1040 {
|
|
1041 if (tolower(test_string[0])=='i')
|
|
1042 pInfos[curr_rec_num].uResMind=200;
|
|
1043 else
|
|
1044 pInfos[curr_rec_num].uResMind=atoi(test_string);
|
|
1045 }
|
|
1046 break;
|
|
1047 case 33:
|
|
1048 {
|
|
1049 if (tolower(test_string[0])=='i')
|
|
1050 pInfos[curr_rec_num].uResSpirit=200;
|
|
1051 else
|
|
1052 pInfos[curr_rec_num].uResSpirit=atoi(test_string);
|
|
1053 }
|
|
1054 break;
|
|
1055 case 34:
|
|
1056 {
|
|
1057 if (tolower(test_string[0])=='i')
|
|
1058 pInfos[curr_rec_num].uResBody=200;
|
|
1059 else
|
|
1060 pInfos[curr_rec_num].uResBody=atoi(test_string);
|
|
1061 }
|
|
1062 break;
|
|
1063 case 35:
|
|
1064 {
|
|
1065 if (tolower(test_string[0])=='i')
|
|
1066 pInfos[curr_rec_num].uResLight=200;
|
|
1067 else
|
|
1068 pInfos[curr_rec_num].uResLight=atoi(test_string);
|
|
1069 }
|
|
1070 break;
|
|
1071 case 36:
|
|
1072 {
|
|
1073 if (tolower(test_string[0])=='i')
|
|
1074 pInfos[curr_rec_num].uResDark=200;
|
|
1075 else
|
|
1076 pInfos[curr_rec_num].uResDark=atoi(test_string);
|
|
1077 }
|
|
1078 break;
|
|
1079 case 37:
|
|
1080 {
|
|
1081 if (tolower(test_string[0])=='i')
|
|
1082 pInfos[curr_rec_num].uResPhysical=200;
|
|
1083 else
|
|
1084 pInfos[curr_rec_num].uResPhysical=atoi(test_string);
|
|
1085 }
|
|
1086 break;
|
|
1087 case 38:
|
|
1088 {
|
|
1089 // int param_num;
|
|
1090 // char type_flag;
|
|
1091 pInfos[curr_rec_num].uSpecialAbilityType=0;
|
|
1092 pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus=0;
|
|
1093 strcpy(parse_str,test_string);
|
|
1094 parse_str[0]=' ';
|
|
1095 parse_str[strlen(parse_str)-1]=' ';
|
|
1096 frame_table_txt_parser(parse_str,&parsed_field);
|
|
1097 if ( parsed_field.uPropCount )
|
|
1098 {
|
|
1099 // v74 = v94.field_0;
|
|
1100 if ( parsed_field.uPropCount < 10 )
|
|
1101 {
|
|
1102 if (! _stricmp(parsed_field.pProperties[0], "shot") )
|
|
1103 {
|
|
1104 pInfos[curr_rec_num].uSpecialAbilityType=1;
|
|
1105 pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus=atoi((char *)(parsed_field.pProperties[1] + 1));
|
|
1106 }
|
|
1107 else if (!_stricmp(parsed_field.pProperties[0], "summon") )
|
|
1108 {
|
|
1109 pInfos[curr_rec_num].uSpecialAbilityType=2;
|
|
1110 if ( parsed_field.uPropCount > 1 )
|
|
1111 {
|
|
1112 pTmpBuf[0] = 0;
|
|
1113 strcpy(pTmpBuf.data(), parsed_field.pProperties[2]);
|
|
1114 if ( parsed_field.uPropCount > 2 )
|
|
1115 {
|
|
1116 int prop_cnt = 3;
|
|
1117 if ( parsed_field.uPropCount > 3 )
|
|
1118 {
|
|
1119 do
|
|
1120 {
|
|
1121 strcat(pTmpBuf.data(), " ");
|
|
1122 char test_char = parsed_field.pProperties[prop_cnt][0];
|
|
1123 strcat(pTmpBuf.data(), parsed_field.pProperties[prop_cnt]);
|
|
1124 if ( prop_cnt == (parsed_field.uPropCount - 1) )
|
|
1125 {
|
|
1126 switch (tolower(test_char))
|
|
1127 {
|
|
1128 case 'a': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 1; break;
|
|
1129 case 'b': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 2; break;
|
|
1130 case 'c': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 3; break;
|
|
1131 default:
|
|
1132 pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 0;
|
|
1133 }
|
|
1134
|
|
1135 }
|
|
1136 ++prop_cnt;
|
|
1137 }
|
|
1138 while ( prop_cnt < parsed_field.uPropCount );
|
|
1139 }
|
|
1140 }
|
|
1141 else
|
|
1142 {
|
|
1143 pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 0;
|
|
1144 }
|
|
1145 if ( pMonsterList->uNumMonsters )
|
|
1146 {
|
|
1147 pInfos[curr_rec_num].field_3C_some_special_attack = pMonsterList->GetMonsterIDByName(pTmpBuf.data()) + 1;
|
|
1148 if ( pInfos[curr_rec_num].field_3C_some_special_attack == -1 )
|
|
1149 {
|
|
1150 sprintf(Src, "Can't create random monster: '%s' See MapStats!", pTmpBuf.data());
|
|
1151 MessageBoxA(nullptr, Src, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:2239", 0);
|
|
1152 }
|
|
1153 }
|
|
1154 pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides = 0;
|
|
1155 if ( !_stricmp(parsed_field.pProperties[1], "ground") )
|
|
1156 pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides = 1;
|
|
1157 if ( pInfos[curr_rec_num].field_3C_some_special_attack == -1 )
|
|
1158 pInfos[curr_rec_num].uSpecialAbilityType = 0;
|
|
1159 }
|
|
1160 }
|
|
1161 else if (!_stricmp(parsed_field.pProperties[0], "explode") )
|
|
1162 {
|
|
1163 pInfos[curr_rec_num].uSpecialAbilityType = 3;
|
|
1164 ParseDamage((char*)parsed_field.pProperties[1], &pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls,
|
|
1165 &pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides,
|
|
1166 &pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus);
|
|
1167 pInfos[curr_rec_num].field_3C_some_special_attack = ParseAttackType(test_string);
|
|
1168 }
|
|
1169 }
|
|
1170 }
|
|
1171 }
|
|
1172 break;
|
|
1173 }
|
|
1174 }
|
|
1175 else
|
|
1176 {
|
|
1177 break_loop = true;
|
|
1178 }
|
|
1179 ++decode_step;
|
|
1180 test_string=tmp_pos+1;
|
|
1181 } while ((decode_step<39)&&!break_loop);
|
|
1182 }
|
|
1183 uNumMonsters = i;
|
|
1184 }
|
|
1185
|
|
1186
|
|
1187 //----- (0044FA08) --------------------------------------------------------
|
|
1188 signed __int16 MonsterList::GetMonsterIDByName( const char *pMonsterName )
|
|
1189 {
|
|
1190 if (!pMonsterName)
|
|
1191 return -1;
|
|
1192 for (signed __int16 i=1; i<=uNumMonsters; ++i)
|
|
1193 {
|
|
1194 if( (!_stricmp(pMonsters[i].pMonsterName, pMonsterName)))
|
|
1195 return i;
|
|
1196 }
|
|
1197 Error("Monster not found: %s", pMonsterName);
|
|
1198 }
|
|
1199 //----- (00438BDF) --------------------------------------------------------
|
|
1200 bool MonsterStats::BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype)
|
|
1201 {
|
|
1202 switch ( eSupertype )
|
|
1203 {
|
|
1204 case MONSTER_SUPERTYPE_UNDEAD:
|
|
1205 if ( (signed int)uMonsterInfoID >= MONSTER_GHOST_1 && (signed int)uMonsterInfoID <= MONSTER_GHOST_3 //70<=id<=72
|
|
1206 || (signed int)uMonsterInfoID >= MONSTER_LICH_1 && (signed int)uMonsterInfoID <= MONSTER_LICH_3 //91-93
|
|
1207 || (signed int)uMonsterInfoID >= MONSTER_SKELETON_1 && (signed int)uMonsterInfoID <= MONSTER_SKELETON_3 //199-201
|
|
1208 || (signed int)uMonsterInfoID >= MONSTER_VAMPIRE_1 && (signed int)uMonsterInfoID <= MONSTER_VAMPIRE_3 //217-219
|
|
1209 || (signed int)uMonsterInfoID >= MONSTER_WIGHT_1 && (signed int)uMonsterInfoID <= MONSTER_WIGHT_3 //223-225
|
|
1210 || (signed int)uMonsterInfoID >= MONSTER_ZOMBIE_1 && (signed int)uMonsterInfoID <= MONSTER_ZOMBIE_3 //229-231
|
|
1211 || (signed int)uMonsterInfoID >= MONSTER_GHOUL_1 && (signed int)uMonsterInfoID <= MONSTER_GHOUL_3) //256-258
|
|
1212 return true;
|
|
1213 return false;
|
|
1214 case MONSTER_SUPERTYPE_KREEGAN:
|
|
1215 if ( (signed int)uMonsterInfoID >= MONSTER_DEVIL_1 && (signed int)uMonsterInfoID <= MONSTER_DEVIL_3 )//22-24
|
|
1216 return true;
|
|
1217 return false;
|
|
1218 case MONSTER_SUPERTYPE_ELF:
|
|
1219 if ( (signed int)uMonsterInfoID >= MONSTER_PEASANT_ELF_FEMALE_1_1 && (signed int)uMonsterInfoID <= MONSTER_PEASANT_ELF_MALE_3_3//133 - 150
|
|
1220 || (signed int)uMonsterInfoID >= MONSTER_ELF_ARCHER_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_ARCHER_3//49-51
|
|
1221 || (signed int)uMonsterInfoID >= MONSTER_ELF_SPEARMAN_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_SPEARMAN_3)//52-54
|
|
1222 return true;
|
|
1223 return false;
|
|
1224 case MONSTER_SUPERTYPE_DRAGON:
|
|
1225 if ( (signed int)uMonsterInfoID >= MONSTER_DRAGON_1 && (signed int)uMonsterInfoID <= MONSTER_DRAGON_3 )//25-27
|
|
1226 return true;
|
|
1227 return false;
|
|
1228 case MONSTER_SUPERTYPE_WATER_ELEMENTAL:
|
|
1229 if ( (signed int)uMonsterInfoID >= MONSTER_ELEMENTAL_WATER_1 && (signed int)uMonsterInfoID <= MONSTER_ELEMENTAL_WATER_3)//46-48
|
|
1230 return true;
|
|
1231 return false;
|
|
1232 case MONSTER_SUPERTYPE_TREANT:
|
|
1233 if ( (signed int)uMonsterInfoID >= MONSTER_TREANT_1 && (signed int)uMonsterInfoID <= MONSTER_TREANT_3 )//253-255
|
|
1234 return true;
|
|
1235 return false;
|
|
1236 case MONSTER_SUPERTYPE_TITAN:
|
|
1237 if ( (signed int)uMonsterInfoID >= MONSTER_TITAN_1 && (signed int)uMonsterInfoID <= MONSTER_TITAN_3 )//211-213
|
|
1238 return true;
|
|
1239 return false;
|
|
1240 default:
|
|
1241 return false;
|
|
1242 }
|
|
1243 return false;
|
|
1244 }
|
|
1245
|