Mercurial > mm7
annotate Monsters.cpp @ 1953:23cb27a497a0
pActorBuffs[9] to pActorBuffs[ACTOR_BUFF_BERSERK]
author | Grumpy7 |
---|---|
date | Fri, 25 Oct 2013 11:15:18 -0700 |
parents | 33df22a5e376 |
children | c1c74df0a33e |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1113
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1113
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1113
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1113
diff
changeset
|
4 |
0 | 5 #include <stdlib.h> |
6 #include <stdio.h> | |
7 #include <string.h> | |
8 | |
9 #include "Monsters.h" | |
10 #include "FrameTableInc.h" | |
11 #include "LOD.h" | |
189 | 12 #include "texts.h" |
0 | 13 #include "mm7_data.h" |
14 | |
15 | |
16 | |
17 | |
18 | |
19 struct MonsterStats *pMonsterStats; | |
20 struct MonsterList *pMonsterList; | |
21 | |
703 | 22 unsigned int ParseSpellType(struct FrameTableTxtLine* tbl, int* next_token); |
698 | 23 |
24 int ParseAttackType(const char *damage_type_str); | |
25 void ParseDamage( char *damage_str, unsigned __int8* dice_rolls, unsigned __int8* dice_sides, unsigned __int8* dmg_bonus ); | |
26 int ParseMissleAttackType(const char *missle_attack_str); | |
27 int ParseSpecialAttack(const char *spec_att_str); | |
28 | |
29 //----- (004548E2) -------------------------------------------------------- | |
703 | 30 unsigned int ParseSpellType( struct FrameTableTxtLine * tbl, int* next_token ) |
698 | 31 { |
32 | |
703 | 33 if (!tbl->pProperties[0] ) |
34 { | |
35 ++*next_token; | |
36 return 0; | |
37 } | |
1104 | 38 if ( !_stricmp(tbl->pProperties[0], "Dispel") ) //dispel magic |
703 | 39 { |
40 ++*next_token; | |
41 return 80; | |
42 } | |
1104 | 43 else if ( !_stricmp(tbl->pProperties[0], "Day") ) //day of protection |
703 | 44 { |
45 *next_token+=2;; | |
46 return 85; | |
47 } | |
1104 | 48 else if ( !_stricmp(tbl->pProperties[0], "Hour") ) //hour of power |
703 | 49 { |
50 *next_token+=2;; | |
51 return 86; | |
52 } | |
1104 | 53 else if ( !_stricmp(tbl->pProperties[0], "Shield") ) |
703 | 54 return 17; |
1104 | 55 else if ( !_stricmp(tbl->pProperties[0], "Spirit") ) |
703 | 56 { |
57 ++*next_token; | |
58 return 52; | |
59 } | |
1104 | 60 else if ( !_stricmp(tbl->pProperties[0], "Power") ) //power cure |
703 | 61 { |
62 ++*next_token; | |
63 return 77; | |
64 } | |
1104 | 65 else if ( !_stricmp(tbl->pProperties[0], "Meteor") ) //meteot shower |
703 | 66 { |
67 ++*next_token; | |
68 return 9; | |
69 } | |
1104 | 70 else if ( !_stricmp(tbl->pProperties[0], "Lightning") ) //Lightning bolt |
703 | 71 { |
72 ++*next_token; | |
73 return 18; | |
74 } | |
1104 | 75 else if ( !_stricmp(tbl->pProperties[0], "Implosion") ) |
703 | 76 return 20; |
1104 | 77 else if ( !_stricmp(tbl->pProperties[0], "Stone") ) |
703 | 78 { |
79 ++*next_token; | |
80 return 38; | |
81 } | |
1104 | 82 else if ( !_stricmp(tbl->pProperties[0], "Haste") ) |
703 | 83 return 5; |
1104 | 84 else if ( !_stricmp(tbl->pProperties[0], "Heroism") ) |
703 | 85 return 51; |
1104 | 86 else if ( !_stricmp(tbl->pProperties[0], "Pain") ) //pain reflection |
703 | 87 { |
88 ++*next_token; | |
89 return 95; | |
90 } | |
1104 | 91 else if ( !_stricmp(tbl->pProperties[0], "Sparks") ) |
703 | 92 return 15; |
1104 | 93 else if ( !_stricmp(tbl->pProperties[0], "Light") ) |
703 | 94 { |
95 ++*next_token; | |
96 return 78; | |
97 } | |
1104 | 98 else if ( !_stricmp(tbl->pProperties[0], "Toxic") ) //toxic cloud |
698 | 99 { |
703 | 100 ++*next_token; |
101 return 90; | |
102 } | |
1104 | 103 else if ( !_stricmp(tbl->pProperties[0], "ShrapMetal") ) |
703 | 104 return 93; |
1104 | 105 else if ( !_stricmp(tbl->pProperties[0], "Paralyze") ) |
703 | 106 return 81; |
1104 | 107 else if ( !_stricmp(tbl->pProperties[0], "Fireball") ) |
703 | 108 return 6; |
1104 | 109 else if ( !_stricmp(tbl->pProperties[0], "Incinerate") ) |
703 | 110 return 11; |
1104 | 111 else if ( !_stricmp(tbl->pProperties[0], "Fire") ) |
703 | 112 { |
113 ++*next_token; | |
114 return 2; | |
115 } | |
1104 | 116 else if ( !_stricmp(tbl->pProperties[0], "Rock") ) |
703 | 117 { |
118 ++*next_token; | |
119 return 41; | |
120 } | |
1104 | 121 else if ( !_stricmp(tbl->pProperties[0], "Mass") ) |
703 | 122 { |
123 ++*next_token; | |
124 return 44; | |
125 } | |
1104 | 126 else if ( !_stricmp(tbl->pProperties[0], "Ice") ) |
703 | 127 { |
128 ++*next_token; | |
129 return 26; | |
130 } | |
1104 | 131 else if ( !_stricmp(tbl->pProperties[0], "Acid") ) |
703 | 132 { |
133 ++*next_token; | |
134 return 29; | |
698 | 135 } |
1104 | 136 else if ( !_stricmp(tbl->pProperties[0], "Bless") ) |
703 | 137 return 46; |
1104 | 138 else if ( !_stricmp(tbl->pProperties[0], "Dragon") ) |
703 | 139 { |
140 ++*next_token; | |
141 return 97; | |
142 } | |
1104 | 143 else if ( !_stricmp(tbl->pProperties[0], "Reanimate") ) |
703 | 144 return 89; |
1104 | 145 else if ( !_stricmp(tbl->pProperties[0], "Summon") ) |
703 | 146 { |
147 ++*next_token; | |
148 return 82; | |
149 } | |
1104 | 150 else if ( !_stricmp(tbl->pProperties[0], "Fate") ) |
703 | 151 return 47; |
1104 | 152 else if ( !_stricmp(tbl->pProperties[0], "Harm") ) |
703 | 153 return 70; |
1104 | 154 else if ( !_stricmp(tbl->pProperties[0], "Mind") ) |
703 | 155 { |
156 ++*next_token; | |
157 return 57; | |
158 } | |
1104 | 159 else if ( !_stricmp(tbl->pProperties[0], "Blades") ) |
703 | 160 return 39; |
1104 | 161 else if ( !_stricmp(tbl->pProperties[0], "Psychic") ) |
703 | 162 { |
163 ++*next_token; | |
164 return 65; | |
165 } | |
1104 | 166 else if ( !_stricmp(tbl->pProperties[0], "Hammerhands") ) |
703 | 167 return 73; |
168 else | |
169 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1165
diff
changeset
|
170 sprintf(pTmpBuf.data(), "Unknown monster spell %s", tbl->pProperties[0]); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1165
diff
changeset
|
171 MessageBoxA(nullptr, pTmpBuf.data(), "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0); |
703 | 172 ++*next_token; |
173 return 0; | |
174 } | |
698 | 175 } |
176 | |
177 //----- (00454CB4) -------------------------------------------------------- | |
178 int ParseAttackType( const char *damage_type_str ) | |
179 { | |
180 | |
181 switch (tolower(*damage_type_str)) | |
182 { | |
183 case 'f': return 0; //fire | |
184 case 'a': return 1; //air | |
185 case 'w': return 2; //water | |
186 case 'e': return 3; //earth | |
187 | |
188 case 's': return 6; //spirit | |
189 case 'm': return 7; //mind | |
190 //m ?? 8 | |
191 case 'l': return 9; //light | |
192 case 'd': return 10; //dark | |
193 // d?? 11 | |
194 } | |
195 return 4; //phis | |
196 | |
197 } | |
198 | |
199 //----- (00454D7D) -------------------------------------------------------- | |
200 void ParseDamage( char *damage_str, unsigned __int8* dice_rolls, unsigned __int8* dice_sides, unsigned __int8* dmg_bonus ) | |
201 { | |
202 int str_len=0; | |
203 int str_pos=0; | |
204 bool dice_flag=false; | |
205 | |
206 *dice_rolls = 0; | |
207 *dice_sides = 1; | |
208 *dmg_bonus = 0; | |
209 | |
210 str_len = strlen(damage_str); | |
211 if (str_len<=0) | |
212 return; | |
213 for (str_pos=0;str_pos<str_len;++str_pos ) | |
214 { | |
215 if (tolower(damage_str[str_pos])=='d') | |
216 { | |
217 damage_str[str_pos]='\0'; | |
218 *dice_rolls=atoi(damage_str); | |
219 *dice_sides=atoi(&damage_str[str_pos+1]); | |
220 dice_flag=true; | |
221 damage_str[str_pos]='d'; | |
222 } | |
223 else if (tolower(damage_str[str_pos])=='+') | |
224 *dmg_bonus=atoi(&damage_str[str_pos+1]); | |
225 } | |
226 if (!dice_flag) | |
227 { | |
228 if ((*damage_str>='0')&&(*damage_str<='9')) | |
229 { | |
230 *dice_rolls =atoi(damage_str); | |
231 *dice_sides = 1; | |
232 } | |
233 } | |
234 } | |
235 | |
236 //----- (00454E3A) -------------------------------------------------------- | |
237 int ParseMissleAttackType(const char *missle_attack_str) | |
238 { | |
1104 | 239 if ( !_stricmp(missle_attack_str, "ARROW") ) |
698 | 240 return 1; |
1104 | 241 else if ( !_stricmp(missle_attack_str, "ARROWF") ) |
698 | 242 return 2; |
1104 | 243 else if ( !_stricmp(missle_attack_str, "FIRE") ) |
698 | 244 return 3; |
1104 | 245 else if ( !_stricmp(missle_attack_str, "AIR") ) |
698 | 246 return 4; |
1104 | 247 else if ( !_stricmp(missle_attack_str, "WATER") ) |
698 | 248 return 5; |
1104 | 249 else if ( !_stricmp(missle_attack_str, "EARTH") ) |
698 | 250 return 6; |
1104 | 251 else if ( !_stricmp(missle_attack_str, "SPIRIT") ) |
698 | 252 return 7; |
1104 | 253 else if ( !_stricmp(missle_attack_str, "MIND") ) |
698 | 254 return 8; |
1104 | 255 else if ( !_stricmp(missle_attack_str, "BODY") ) |
698 | 256 return 9; |
1104 | 257 else if ( !_stricmp(missle_attack_str, "LIGHT") ) |
698 | 258 return 10; |
1104 | 259 else if ( !_stricmp(missle_attack_str, "DARK") ) |
698 | 260 return 11; |
1104 | 261 else if ( !_stricmp(missle_attack_str, "ENER") ) |
698 | 262 return 13; |
263 else return 0; | |
264 } | |
265 | |
266 | |
703 | 267 int ParseSpecialAttack(char *spec_att_str) |
698 | 268 { |
703 | 269 _strlwr(spec_att_str); |
698 | 270 if ( strstr(spec_att_str, "curse") ) |
271 return 1; | |
272 else if ( strstr(spec_att_str, "weak") ) | |
273 return 2; | |
274 else if ( strstr(spec_att_str, "asleep") ) | |
275 return 3; | |
276 else if ( strstr(spec_att_str, "afraid") ) | |
277 return 23; | |
278 else if ( strstr(spec_att_str, "drunk") ) | |
279 return 4; | |
280 else if ( strstr(spec_att_str, "insane") ) | |
281 return 5; | |
282 else if ( strstr(spec_att_str, "poison1") ) | |
283 return 6; | |
284 else if ( strstr(spec_att_str, "poison2") ) | |
285 return 7; | |
286 else if ( strstr(spec_att_str, "poison3") ) | |
287 return 8; | |
288 else if ( strstr(spec_att_str, "disease1") ) | |
289 return 9; | |
290 else if ( strstr(spec_att_str, "disease2") ) | |
291 return 10; | |
292 else if ( strstr(spec_att_str, "disease3") ) | |
293 return 11; | |
294 else if ( strstr(spec_att_str, "paralyze") ) | |
295 return 12; | |
296 else if ( strstr(spec_att_str, "uncon") ) | |
297 return 13; | |
298 else if ( strstr(spec_att_str, "dead") ) | |
299 return 14; | |
300 else if ( strstr(spec_att_str, "stone") ) | |
301 return 15; | |
302 else if ( strstr(spec_att_str, "errad") ) | |
303 return 16; | |
304 else if ( strstr(spec_att_str, "brkitem") ) | |
305 return 17; | |
306 else if ( strstr(spec_att_str, "brkarmor") ) | |
307 return 18; | |
308 else if ( strstr(spec_att_str, "brkweapon") ) | |
309 return 19; | |
310 else if ( strstr(spec_att_str, "steal") ) | |
311 return 20; | |
312 else if ( strstr(spec_att_str, "age") ) | |
313 return 21; | |
314 else if ( strstr(spec_att_str, "drainsp") ) | |
315 return 22; | |
316 else return 0; | |
317 } | |
0 | 318 |
319 //----- (004598FC) -------------------------------------------------------- | |
320 bool MonsterList::FromFileTxt(const char *Args) | |
321 { | |
322 MonsterList *v2; // ebx@1 | |
323 FILE *v3; // eax@1 | |
324 unsigned int v4; // esi@3 | |
325 void *v5; // eax@9 | |
326 FILE *v6; // ST14_4@11 | |
327 char *i; // eax@11 | |
328 signed int v8; // esi@12 | |
329 unsigned __int16 v9; // ax@16 | |
330 const char *v10; // ST18_4@16 | |
331 unsigned __int16 v11; // ax@16 | |
332 const char *v12; // ST14_4@16 | |
333 unsigned __int16 v13; // ax@16 | |
334 const char *v14; // ST10_4@16 | |
335 __int16 v15; // ax@16 | |
336 const char *v16; // ST0C_4@16 | |
337 int v17; // esi@16 | |
338 unsigned __int8 v18; // al@16 | |
339 signed int v19; // esi@16 | |
340 unsigned __int16 v20; // ax@17 | |
341 int v21; // ecx@17 | |
342 char Buf; // [sp+4h] [bp-304h]@3 | |
343 FrameTableTxtLine v24; // [sp+1F8h] [bp-110h]@4 | |
344 FrameTableTxtLine v25; // [sp+274h] [bp-94h]@4 | |
345 int v26; // [sp+2F0h] [bp-18h]@16 | |
346 char v27; // [sp+2F4h] [bp-14h]@14 | |
347 char v28; // [sp+2F5h] [bp-13h]@14 | |
348 char v29; // [sp+2F6h] [bp-12h]@14 | |
349 char v30; // [sp+2F7h] [bp-11h]@14 | |
350 char v31; // [sp+2F8h] [bp-10h]@14 | |
351 char v32; // [sp+2F9h] [bp-Fh]@14 | |
352 char v33; // [sp+2FAh] [bp-Eh]@14 | |
353 char v34; // [sp+2FBh] [bp-Dh]@14 | |
354 char v35; // [sp+2FCh] [bp-Ch]@14 | |
355 char v36; // [sp+2FDh] [bp-Bh]@14 | |
356 char v37; // [sp+2FEh] [bp-Ah]@14 | |
357 char v38; // [sp+2FFh] [bp-9h]@14 | |
358 char v39; // [sp+300h] [bp-8h]@14 | |
359 char v40; // [sp+301h] [bp-7h]@14 | |
360 char v41; // [sp+302h] [bp-6h]@14 | |
361 char v42; // [sp+303h] [bp-5h]@14 | |
362 FILE *File; // [sp+304h] [bp-4h]@1 | |
363 unsigned int Argsa; // [sp+310h] [bp+8h]@3 | |
364 int Argsb; // [sp+310h] [bp+8h]@16 | |
365 | |
366 v2 = this; | |
367 v3 = fopen(Args, "r"); | |
368 File = v3; | |
369 if ( !v3 ) | |
1545 | 370 Error("MonsterRaceListStruct::load - Unable to open file: %s."); |
371 | |
0 | 372 v4 = 0; |
373 Argsa = 0; | |
374 if ( fgets(&Buf, 490, v3) ) | |
375 { | |
376 do | |
377 { | |
378 *strchr(&Buf, 10) = 0; | |
379 memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25)); | |
701 | 380 if ( v25.uPropCount && *v25.pProperties[0] != 47 ) |
0 | 381 ++Argsa; |
382 } | |
383 while ( fgets(&Buf, 490, File) ); | |
384 v4 = Argsa; | |
385 } | |
386 v2->uNumMonsters = v4; | |
1583 | 387 v5 = malloc(152 * v4); |
0 | 388 v2->pMonsters = (MonsterDesc *)v5; |
389 if ( !v5 ) | |
1545 | 390 Error("MonsterRaceListStruct::load - Out of Memory!"); |
391 | |
0 | 392 v6 = File; |
393 v2->uNumMonsters = 0; | |
394 fseek(v6, 0, 0); | |
395 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
396 { | |
397 *strchr(&Buf, 10) = 0; | |
398 memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25)); | |
399 v8 = 0; | |
701 | 400 if ( v25.uPropCount && *v25.pProperties[0] != 47 ) |
0 | 401 { |
402 strcpy(v2->pMonsters[v2->uNumMonsters].pMonsterName, v25.pProperties[0]); | |
403 v35 = 0; | |
404 v36 = 1; | |
405 v37 = 7; | |
406 v38 = 2; | |
407 v39 = 3; | |
408 v40 = 4; | |
409 v41 = 5; | |
410 v42 = 6; | |
411 v27 = 1; | |
412 v28 = 2; | |
413 v29 = 3; | |
414 v30 = 4; | |
415 v31 = 4; | |
416 v32 = 5; | |
417 v33 = 6; | |
418 v34 = 7; | |
419 do | |
420 { | |
421 strcpy( | |
422 v2->pMonsters[v2->uNumMonsters].pSpriteNames[(unsigned __int8)*(&v35 + v8)], | |
423 v25.pProperties[(unsigned __int8)*(&v27 + v8)]); | |
424 ++v8; | |
425 } | |
426 while ( v8 < 8 ); | |
427 v9 = atoi(v25.pProperties[8]); | |
428 v10 = v25.pProperties[9]; | |
429 v2->pMonsters[v2->uNumMonsters].uMonsterHeight = v9; | |
430 v11 = atoi(v10); | |
431 v12 = v25.pProperties[10]; | |
432 v2->pMonsters[v2->uNumMonsters].uMovementSpeed = v11; | |
433 v13 = atoi(v12); | |
434 v14 = v25.pProperties[11]; | |
435 v2->pMonsters[v2->uNumMonsters].uMonsterRadius = v13; | |
436 v15 = atoi(v14); | |
437 v16 = v25.pProperties[12]; | |
438 v2->pMonsters[v2->uNumMonsters].uToHitRadius = v15; | |
439 v17 = (unsigned __int8)atoi(v16); | |
701 | 440 Argsb = atoi(v25.pProperties[13]) & 0xFF; |
441 v26 = atoi(v25.pProperties[14]) & 0xFF; | |
442 v18 = atoi(v25.pProperties[15]); | |
0 | 443 v2->pMonsters[v2->uNumMonsters].uTintColor = v18 | ((v26 | ((Argsb | (v17 << 8)) << 8)) << 8); |
444 v19 = 0; | |
445 do | |
446 { | |
701 | 447 v20 = atoi(v25.pProperties[v19 + 16]); |
448 v21 = v19++ ; | |
449 v2->pMonsters[v2->uNumMonsters].pSoundSampleIDs[v21] = v20; | |
0 | 450 } |
451 while ( v19 < 4 ); | |
452 ++v2->uNumMonsters; | |
453 } | |
454 } | |
455 fclose(File); | |
456 return 1; | |
457 } | |
458 | |
459 //----- (004598AF) -------------------------------------------------------- | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
460 void MonsterList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) |
0 | 461 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
462 uint num_mm6_monsters = data_mm6 ? *(int *)data_mm6 : 0, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
463 num_mm7_monsters = data_mm7 ? *(int *)data_mm7 : 0, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
464 num_mm8_monsters = data_mm8 ? *(int *)data_mm8 : 0; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
465 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
466 uNumMonsters = num_mm6_monsters + num_mm7_monsters + num_mm8_monsters; |
1545 | 467 Assert(uNumMonsters); |
468 Assert(!num_mm8_monsters); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
469 |
1583 | 470 pMonsters = (MonsterDesc *)malloc(sizeof(MonsterDesc) * uNumMonsters); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
471 memcpy(pMonsters, (char *)data_mm7 + 4, num_mm7_monsters * sizeof(MonsterDesc)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
472 for (uint i = 0; i < num_mm6_monsters; ++i) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
473 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
474 auto src = (MonsterDesc_mm6 *)((char *)data_mm6 + 4) + i; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
475 auto dst = pMonsters + num_mm7_monsters + i; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
476 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
477 dst->uMonsterHeight = src->uMonsterHeight; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
478 dst->uMonsterRadius = src->uMonsterRadius; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
479 dst->uMovementSpeed = src->uMovementSpeed; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
480 dst->uToHitRadius = src->uToHitRadius; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
481 dst->uTintColor = 0xFFFFFFFF; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
482 memcpy(dst->pSoundSampleIDs, src->pSoundSampleIDs, sizeof(src->pSoundSampleIDs)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
483 memcpy(dst->pMonsterName, src->pMonsterName, sizeof(src->pMonsterName)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
484 memcpy(dst->pSpriteNames, src->pSpriteNames, sizeof(src->pSpriteNames)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
485 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
486 memcpy(pMonsters + num_mm6_monsters + num_mm7_monsters, (char *)data_mm8 + 4, num_mm8_monsters * sizeof(MonsterDesc)); |
0 | 487 } |
488 | |
489 //----- (00459860) -------------------------------------------------------- | |
490 void MonsterList::ToFile() | |
491 { | |
492 MonsterList *v1; // esi@1 | |
493 FILE *v2; // eax@1 | |
494 FILE *v3; // edi@1 | |
495 | |
496 v1 = this; | |
497 v2 = fopen("data\\dmonlist.bin", "wb"); | |
498 v3 = v2; | |
499 if ( !v2 ) | |
1545 | 500 Error("Unable to save dmonlist.bin!"); |
0 | 501 fwrite(v1, 4u, 1u, v2); |
502 fwrite(v1->pMonsters, 0x98u, v1->uNumMonsters, v3); | |
503 fclose(v3); | |
504 } | |
505 | |
506 | |
507 //----- (004563FF) -------------------------------------------------------- | |
751 | 508 signed int MonsterStats::FindMonsterByTextureName(const char *monster_textr_name) |
0 | 509 { |
751 | 510 for (int i=1; i<uNumMonsters; ++i) |
694 | 511 { |
1104 | 512 if((pInfos[i].pName )&& (!_stricmp(pInfos[i].pPictureName, monster_textr_name))) |
694 | 513 return i; |
514 } | |
515 return -1; | |
0 | 516 } |
517 | |
518 | |
519 //----- (00454F4E) -------------------------------------------------------- | |
520 void MonsterStats::InitializePlacements() | |
521 { | |
237 | 522 int i; |
523 char* test_string; | |
524 unsigned char c; | |
525 bool break_loop; | |
526 unsigned int temp_str_len; | |
527 char* tmp_pos; | |
528 int decode_step; | |
529 int item_counter; | |
0 | 530 |
531 pMonsterPlacementTXT_Raw = (char *)pEvents_LOD->LoadRaw("placemon.txt", 0); | |
532 strtok(pMonsterPlacementTXT_Raw, "\r"); | |
237 | 533 for (i=1; i<31; ++i) |
534 { | |
535 test_string = strtok(NULL, "\r") + 1; | |
536 break_loop = false; | |
537 decode_step=0; | |
538 do | |
539 { | |
540 c = *(unsigned char*)test_string; | |
541 temp_str_len = 0; | |
542 while((c!='\t')&&(c>0)) | |
543 { | |
544 ++temp_str_len; | |
545 c=test_string[temp_str_len]; | |
546 } | |
547 tmp_pos=test_string+temp_str_len; | |
548 if (*tmp_pos == 0) | |
549 break_loop = true; | |
550 *tmp_pos = 0; | |
551 if (temp_str_len) | |
552 { | |
553 if (decode_step==1) | |
554 pPlaceStrings[i]=RemoveQuotes(test_string); | |
555 } | |
556 else | |
557 { | |
558 break_loop = true; | |
559 } | |
560 ++decode_step; | |
561 test_string=tmp_pos+1; | |
562 } while ((decode_step<3)&&!break_loop); | |
563 } | |
564 uNumPlacements = 31; | |
0 | 565 } |
566 | |
567 //----- (0045501E) -------------------------------------------------------- | |
568 void MonsterStats::Initialize() | |
694 | 569 { |
570 int i,j; | |
571 char* test_string; | |
572 unsigned char c; | |
573 bool break_loop; | |
574 unsigned int temp_str_len; | |
575 char* tmp_pos; | |
576 int decode_step; | |
577 int item_counter; | |
578 int curr_rec_num; | |
703 | 579 char parse_str[64]; |
751 | 580 char Src[120]; |
581 FrameTableTxtLine parsed_field; | |
694 | 582 |
583 if ( pMonstersTXT_Raw ) | |
1583 | 584 free(pMonstersTXT_Raw); |
694 | 585 pMonstersTXT_Raw = NULL; |
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; | |
698 | 688 pInfos[curr_rec_num].uTreasureType=0; |
689 pInfos[curr_rec_num].uTreasureLevel=0; | |
694 | 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; | |
0 | 732 |
694 | 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); | |
698 | 748 |
694 | 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 { | |
1104 | 753 if ( !_stricmp(item_name, "WEAPON")) |
694 | 754 pInfos[curr_rec_num].uTreasureType= 20; |
1104 | 755 else if ( !_stricmp(item_name, "ARMOR")) |
694 | 756 pInfos[curr_rec_num].uTreasureType= 21; |
1104 | 757 else if ( !_stricmp(item_name, "MISC")) |
694 | 758 pInfos[curr_rec_num].uTreasureType= 22; |
1104 | 759 else if ( !_stricmp(item_name, "SWORD")) |
694 | 760 pInfos[curr_rec_num].uTreasureType= 23; |
1104 | 761 else if ( !_stricmp(item_name, "DAGGER")) |
694 | 762 pInfos[curr_rec_num].uTreasureType= 24; |
1104 | 763 else if ( !_stricmp(item_name, "AXE")) |
694 | 764 pInfos[curr_rec_num].uTreasureType= 25; |
1104 | 765 else if ( !_stricmp(item_name, "SPEAR")) |
694 | 766 pInfos[curr_rec_num].uTreasureType= 26; |
1104 | 767 else if ( !_stricmp(item_name, "BOW")) |
694 | 768 pInfos[curr_rec_num].uTreasureType= 27; |
1104 | 769 else if ( !_stricmp(item_name, "MACE")) |
694 | 770 pInfos[curr_rec_num].uTreasureType= 28; |
1104 | 771 else if ( !_stricmp(item_name, "CLUB")) |
694 | 772 pInfos[curr_rec_num].uTreasureType= 29; |
1104 | 773 else if ( !_stricmp(item_name, "STAFF")) |
694 | 774 pInfos[curr_rec_num].uTreasureType= 30; |
1104 | 775 else if ( !_stricmp(item_name, "LEATHER")) |
694 | 776 pInfos[curr_rec_num].uTreasureType= 31; |
1104 | 777 else if ( !_stricmp(item_name, "CHAIN")) |
694 | 778 pInfos[curr_rec_num].uTreasureType= 32; |
1104 | 779 else if ( !_stricmp(item_name, "PLATE")) |
694 | 780 pInfos[curr_rec_num].uTreasureType= 33; |
1104 | 781 else if ( !_stricmp(item_name, "SHIELD")) |
694 | 782 pInfos[curr_rec_num].uTreasureType= 34; |
1104 | 783 else if ( !_stricmp(item_name, "HELM")) |
694 | 784 pInfos[curr_rec_num].uTreasureType= 35; |
1104 | 785 else if ( !_stricmp(item_name, "BELT")) |
694 | 786 pInfos[curr_rec_num].uTreasureType= 36; |
1104 | 787 else if ( !_stricmp(item_name, "CAPE")) |
694 | 788 pInfos[curr_rec_num].uTreasureType= 37; |
1104 | 789 else if ( !_stricmp(item_name, "GAUNTLETS")) |
694 | 790 pInfos[curr_rec_num].uTreasureType= 38; |
1104 | 791 else if ( !_stricmp(item_name, "BOOTS")) |
694 | 792 pInfos[curr_rec_num].uTreasureType= 39; |
1104 | 793 else if ( !_stricmp(item_name, "RING")) |
694 | 794 pInfos[curr_rec_num].uTreasureType= 40; |
1104 | 795 else if ( !_stricmp(item_name, "AMULET")) |
694 | 796 pInfos[curr_rec_num].uTreasureType= 41; |
1104 | 797 else if ( !_stricmp(item_name, "WAND")) |
694 | 798 pInfos[curr_rec_num].uTreasureType= 42; |
1104 | 799 else if ( !_stricmp(item_name, "SCROLL")) |
694 | 800 pInfos[curr_rec_num].uTreasureType= 43; |
1104 | 801 else if ( !_stricmp(item_name, "GEM")) |
694 | 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 { | |
1456 | 826 case 's': pInfos[curr_rec_num].uMovementType=MONSTER_MOVEMENT_TYPE_SHORT;// short |
694 | 827 if (tolower(test_string[1])!='h') |
1456 | 828 pInfos[curr_rec_num].uMovementType=MONSTER_MOVEMENT_TYPE_STAIONARY; //stationary |
694 | 829 break; //short |
830 case 'l': pInfos[curr_rec_num].uMovementType=2; break; //long | |
831 case 'm': pInfos[curr_rec_num].uMovementType=1; break; //med | |
1332 | 832 case 'g': pInfos[curr_rec_num].uMovementType=3; break; //global? |
694 | 833 default: |
834 pInfos[curr_rec_num].uMovementType=4; //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; | |
698 | 876 case 'e': pInfos[curr_rec_num].uAttackPreference|=0x1000; break; |
694 | 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; | |
698 | 892 case 16: |
694 | 893 { |
703 | 894 int str_len=0; |
895 int str_pos=0; | |
1693
861ede68187a
Player::_48DCF6 renamed to Player::ReceiveSpecialAttackEffect, some case reordering, fixing getting only disease3 instead of disease1 and ignoring disease2 and 3, uSpecialAttack to uSpecialAttackType, uSpecialAttackType to uSpecialAttackLevel
Grumpy7
parents:
1583
diff
changeset
|
896 pInfos[curr_rec_num].uSpecialAttackLevel=1; |
1695
33df22a5e376
Player::ReceiveSpecialAttackEffect finishing cleanup, special attack type enum created
Grumpy7
parents:
1693
diff
changeset
|
897 pInfos[curr_rec_num].uSpecialAttackType=(SPECIAL_ATTACK_TYPE)0; |
703 | 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'; | |
1693
861ede68187a
Player::_48DCF6 renamed to Player::ReceiveSpecialAttackEffect, some case reordering, fixing getting only disease3 instead of disease1 and ignoring disease2 and 3, uSpecialAttack to uSpecialAttackType, uSpecialAttackType to uSpecialAttackLevel
Grumpy7
parents:
1583
diff
changeset
|
906 pInfos[curr_rec_num].uSpecialAttackLevel=atoi(&test_string[str_pos+1]); |
703 | 907 test_string[str_pos]='x'; |
908 break; | |
909 } | |
910 } | |
1695
33df22a5e376
Player::ReceiveSpecialAttackEffect finishing cleanup, special attack type enum created
Grumpy7
parents:
1693
diff
changeset
|
911 pInfos[curr_rec_num].uSpecialAttackType=(SPECIAL_ATTACK_TYPE)ParseSpecialAttack(test_string); |
703 | 912 } |
694 | 913 } |
914 break; | |
915 case 17: | |
698 | 916 pInfos[curr_rec_num].uAttack1Type=ParseAttackType(test_string); |
694 | 917 break; |
918 case 18: | |
919 { | |
698 | 920 ParseDamage(test_string, &pInfos[curr_rec_num].uAttack1DamageDiceRolls, |
921 &pInfos[curr_rec_num].uAttack1DamageDiceSides, | |
922 &pInfos[curr_rec_num].uAttack1DamageBonus); | |
694 | 923 } |
924 break; | |
698 | 925 case 19: |
926 pInfos[curr_rec_num].uMissleAttack1Type=ParseMissleAttackType(test_string); | |
694 | 927 break; |
928 case 20: | |
698 | 929 pInfos[curr_rec_num].uAttack2Chance=atoi(test_string); |
694 | 930 break; |
931 case 21: | |
698 | 932 pInfos[curr_rec_num].uAttack2Type=ParseAttackType(test_string); |
694 | 933 break; |
934 case 22: | |
935 { | |
698 | 936 ParseDamage(test_string, &pInfos[curr_rec_num].uAttack2DamageDiceRolls, |
937 &pInfos[curr_rec_num].uAttack2DamageDiceSides, | |
938 &pInfos[curr_rec_num].uAttack2DamageBonus); | |
694 | 939 } |
940 break; | |
941 case 23: | |
698 | 942 pInfos[curr_rec_num].uMissleAttack2Type=ParseMissleAttackType(test_string); |
694 | 943 break; |
944 case 24: | |
698 | 945 pInfos[curr_rec_num].uSpell1UseChance=atoi(test_string); |
694 | 946 break; |
947 case 25: | |
948 { | |
703 | 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]=' '; | |
751 | 954 frame_table_txt_parser(parse_str,&parsed_field); |
955 if (parsed_field.uPropCount>2) | |
703 | 956 { |
957 param_num=1; | |
751 | 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; | |
703 | 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 } | |
694 | 973 |
974 } | |
975 break; | |
976 case 26: | |
698 | 977 pInfos[curr_rec_num].uSpell2UseChance=atoi(test_string); |
694 | 978 break; |
979 case 27: | |
980 { | |
703 | 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]=' '; | |
751 | 986 frame_table_txt_parser(parse_str,&parsed_field); |
987 if (parsed_field.uPropCount>2) | |
703 | 988 { |
989 param_num=1; | |
751 | 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; | |
703 | 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 } | |
694 | 1005 } |
1006 break; | |
1007 case 28: | |
1008 { | |
698 | 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); | |
694 | 1013 } |
1014 break; | |
1015 case 29: | |
1016 { | |
698 | 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); | |
694 | 1021 } |
1022 break; | |
1023 case 30: | |
1024 { | |
698 | 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); | |
694 | 1029 } |
1030 break; | |
1031 case 31: | |
1032 { | |
698 | 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); | |
694 | 1037 } |
1038 break; | |
1039 case 32: | |
1040 { | |
698 | 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); | |
694 | 1045 } |
1046 break; | |
1047 case 33: | |
1048 { | |
698 | 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); | |
694 | 1053 } |
1054 break; | |
1055 case 34: | |
1056 { | |
698 | 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); | |
694 | 1061 } |
1062 break; | |
1063 case 35: | |
1064 { | |
698 | 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); | |
694 | 1069 } |
1070 break; | |
1071 case 36: | |
1072 { | |
698 | 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); | |
694 | 1077 } |
1078 break; | |
1079 case 37: | |
1080 { | |
698 | 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); | |
694 | 1085 } |
1086 break; | |
1087 case 38: | |
1088 { | |
751 | 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 { | |
1104 | 1102 if (! _stricmp(parsed_field.pProperties[0], "shot") ) |
751 | 1103 { |
1104 pInfos[curr_rec_num].uSpecialAbilityType=1; | |
1105 pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus=atoi((char *)(parsed_field.pProperties[1] + 1)); | |
1106 } | |
1104 | 1107 else if (!_stricmp(parsed_field.pProperties[0], "summon") ) |
751 | 1108 { |
1109 pInfos[curr_rec_num].uSpecialAbilityType=2; | |
1110 if ( parsed_field.uPropCount > 1 ) | |
1111 { | |
1112 pTmpBuf[0] = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1165
diff
changeset
|
1113 strcpy(pTmpBuf.data(), parsed_field.pProperties[2]); |
751 | 1114 if ( parsed_field.uPropCount > 2 ) |
1115 { | |
1116 int prop_cnt = 3; | |
1117 if ( parsed_field.uPropCount > 3 ) | |
1118 { | |
1119 do | |
1120 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1165
diff
changeset
|
1121 strcat(pTmpBuf.data(), " "); |
751 | 1122 char test_char = parsed_field.pProperties[prop_cnt][0]; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1165
diff
changeset
|
1123 strcat(pTmpBuf.data(), parsed_field.pProperties[prop_cnt]); |
751 | 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 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1165
diff
changeset
|
1147 pInfos[curr_rec_num].field_3C_some_special_attack = pMonsterList->GetMonsterIDByName(pTmpBuf.data()) + 1; |
751 | 1148 if ( pInfos[curr_rec_num].field_3C_some_special_attack == -1 ) |
1149 { | |
1217 | 1150 sprintf(Src, "Can't create random monster: '%s' See MapStats!", pTmpBuf.data()); |
751 | 1151 MessageBoxA(nullptr, Src, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:2239", 0); |
1152 } | |
1153 } | |
1154 pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides = 0; | |
1104 | 1155 if ( !_stricmp(parsed_field.pProperties[1], "ground") ) |
751 | 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 } | |
1104 | 1161 else if (!_stricmp(parsed_field.pProperties[0], "explode") ) |
751 | 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 } | |
694 | 1171 } |
698 | 1172 break; |
694 | 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; | |
0 | 1184 } |
1185 | |
1186 | |
1187 //----- (0044FA08) -------------------------------------------------------- | |
751 | 1188 signed __int16 MonsterList::GetMonsterIDByName( const char *pMonsterName ) |
0 | 1189 { |
751 | 1190 if (!pMonsterName) |
1191 return -1; | |
1192 for (signed __int16 i=1; i<=uNumMonsters; ++i) | |
1193 { | |
1104 | 1194 if( (!_stricmp(pMonsters[i].pMonsterName, pMonsterName))) |
751 | 1195 return i; |
0 | 1196 } |
1545 | 1197 Error("Monster not found: %s", pMonsterName); |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1104
diff
changeset
|
1198 } |
1297 | 1199 //----- (00438BDF) -------------------------------------------------------- |
1200 bool MonsterStats::BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype) | |
1201 { | |
1202 unsigned __int8 v2; // zf@15 | |
1203 char v3; // sf@15 | |
1204 unsigned __int8 v4; // of@15 | |
1205 bool result; // eax@33 | |
1206 | |
1207 switch ( eSupertype ) | |
1208 { | |
1209 case MONSTER_SUPERTYPE_UNDEAD: | |
1210 if ( (signed int)uMonsterInfoID >= MONSTER_GHOST_1 && (signed int)uMonsterInfoID <= MONSTER_GHOST_3 | |
1211 || (signed int)uMonsterInfoID >= MONSTER_LICH_1 && (signed int)uMonsterInfoID <= MONSTER_LICH_3 | |
1212 || (signed int)uMonsterInfoID >= MONSTER_SKELETON_1 && (signed int)uMonsterInfoID <= MONSTER_SKELETON_3 | |
1213 || (signed int)uMonsterInfoID >= MONSTER_VAMPIRE_1 && (signed int)uMonsterInfoID <= MONSTER_VAMPIRE_3 | |
1214 || (signed int)uMonsterInfoID >= MONSTER_WIGHT_1 && (signed int)uMonsterInfoID <= MONSTER_WIGHT_3 | |
1215 || (signed int)uMonsterInfoID >= MONSTER_ZOMBIE_1 && (signed int)uMonsterInfoID <= MONSTER_ZOMBIE_3 ) | |
1216 goto ret_true; | |
1217 if ( (signed int)uMonsterInfoID < MONSTER_GHOUL_1 ) | |
1218 goto ret_false; | |
1219 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_GHOUL_3); | |
1220 v2 = uMonsterInfoID == MONSTER_GHOUL_3; | |
1221 v3 = ((uMonsterInfoID - MONSTER_GHOUL_3) & 0x80000000u) != 0; | |
1222 goto false_if_outside; | |
1223 case MONSTER_SUPERTYPE_KREEGAN: | |
1224 if ( (signed int)uMonsterInfoID < MONSTER_DEVIL_1 ) | |
1225 goto ret_false; | |
1226 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DEVIL_3); | |
1227 v2 = uMonsterInfoID == MONSTER_DEVIL_3; | |
1228 v3 = ((uMonsterInfoID - MONSTER_DEVIL_3) & 0x80000000u) != 0; | |
1229 goto false_if_outside; | |
1230 case MONSTER_SUPERTYPE_ELF: | |
1231 if ( (signed int)uMonsterInfoID >= MONSTER_PEASANT_ELF_FEMALE_1_1 | |
1232 && (signed int)uMonsterInfoID <= MONSTER_PEASANT_ELF_MALE_3_3 | |
1233 || (signed int)uMonsterInfoID >= MONSTER_ELF_ARCHER_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_ARCHER_3 ) | |
1234 goto ret_true; | |
1235 if ( (signed int)uMonsterInfoID < MONSTER_ELF_SPEARMAN_1 ) | |
1236 goto ret_false; | |
1237 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELF_SPEARMAN_3); | |
1238 v2 = uMonsterInfoID == MONSTER_ELF_SPEARMAN_3; | |
1239 v3 = ((uMonsterInfoID - MONSTER_ELF_SPEARMAN_3) & 0x80000000u) != 0; | |
1240 goto false_if_outside; | |
1241 case MONSTER_SUPERTYPE_DRAGON: | |
1242 if ( (signed int)uMonsterInfoID < MONSTER_DRAGON_1 ) | |
1243 goto ret_false; | |
1244 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DRAGON_3); | |
1245 v2 = uMonsterInfoID == MONSTER_DRAGON_3; | |
1246 v3 = ((uMonsterInfoID - MONSTER_DRAGON_3) & 0x80000000u) != 0; | |
1247 goto false_if_outside; | |
1248 case MONSTER_SUPERTYPE_WATER_ELEMENTAL: | |
1249 if ( (signed int)uMonsterInfoID < MONSTER_ELEMENTAL_WATER_1 ) | |
1250 goto ret_false; | |
1251 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELEMENTAL_WATER_3); | |
1252 v2 = uMonsterInfoID == MONSTER_ELEMENTAL_WATER_3; | |
1253 v3 = ((uMonsterInfoID - MONSTER_ELEMENTAL_WATER_3) & 0x80000000u) != 0; | |
1254 goto false_if_outside; | |
1255 case MONSTER_SUPERTYPE_TREANT: | |
1256 if ( (signed int)uMonsterInfoID < MONSTER_TREANT_1 ) | |
1257 goto ret_false; | |
1258 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TREANT_3); | |
1259 v2 = uMonsterInfoID == MONSTER_TREANT_3; | |
1260 v3 = ((uMonsterInfoID - MONSTER_TREANT_3) & 0x80000000u) != 0; | |
1261 goto false_if_outside; | |
1262 case MONSTER_SUPERTYPE_TITAN: | |
1263 if ( (signed int)uMonsterInfoID < MONSTER_TITAN_1 ) | |
1264 goto ret_false; | |
1265 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TITAN_3); | |
1266 v2 = uMonsterInfoID == MONSTER_TITAN_3; | |
1267 v3 = ((uMonsterInfoID - MONSTER_TITAN_3) & 0x80000000u) != 0; | |
1268 false_if_outside: | |
1269 if ( !((unsigned __int8)(v3 ^ v4) | v2) ) | |
1270 goto ret_false; | |
1271 ret_true: | |
1272 result = 1; | |
1273 break; | |
1274 default: | |
1275 ret_false: | |
1276 result = 0; | |
1277 break; | |
1278 } | |
1279 return result; | |
1280 } |