Mercurial > mm7
annotate Monsters.cpp @ 2438:c10c639f8365
* Fixed releasing movie for movie-less transitions.
author | a.parshin |
---|---|
date | Thu, 24 Jul 2014 00:31:49 +0300 |
parents | f4af3b203f65 |
children | 85a12b497698 |
rev | line source |
---|---|
2415 | 1 #define _CRTDBG_MAP_ALLOC |
2 #include <stdlib.h> | |
3 #include <crtdbg.h> | |
4 | |
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2187
diff
changeset
|
5 #define _CRT_SECURE_NO_WARNINGS |
0 | 6 #include <stdlib.h> |
7 #include <stdio.h> | |
8 #include <string.h> | |
2336 | 9 #include "ErrorHandling.h" |
0 | 10 |
11 #include "Monsters.h" | |
12 #include "FrameTableInc.h" | |
13 #include "LOD.h" | |
189 | 14 #include "texts.h" |
0 | 15 #include "mm7_data.h" |
16 | |
17 | |
18 | |
19 | |
20 | |
21 struct MonsterStats *pMonsterStats; | |
22 struct MonsterList *pMonsterList; | |
23 | |
703 | 24 unsigned int ParseSpellType(struct FrameTableTxtLine* tbl, int* next_token); |
698 | 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) -------------------------------------------------------- | |
703 | 32 unsigned int ParseSpellType( struct FrameTableTxtLine * tbl, int* next_token ) |
698 | 33 { |
34 | |
703 | 35 if (!tbl->pProperties[0] ) |
36 { | |
37 ++*next_token; | |
38 return 0; | |
39 } | |
1104 | 40 if ( !_stricmp(tbl->pProperties[0], "Dispel") ) //dispel magic |
703 | 41 { |
42 ++*next_token; | |
43 return 80; | |
44 } | |
1104 | 45 else if ( !_stricmp(tbl->pProperties[0], "Day") ) //day of protection |
703 | 46 { |
47 *next_token+=2;; | |
48 return 85; | |
49 } | |
1104 | 50 else if ( !_stricmp(tbl->pProperties[0], "Hour") ) //hour of power |
703 | 51 { |
52 *next_token+=2;; | |
53 return 86; | |
54 } | |
1104 | 55 else if ( !_stricmp(tbl->pProperties[0], "Shield") ) |
703 | 56 return 17; |
1104 | 57 else if ( !_stricmp(tbl->pProperties[0], "Spirit") ) |
703 | 58 { |
59 ++*next_token; | |
60 return 52; | |
61 } | |
1104 | 62 else if ( !_stricmp(tbl->pProperties[0], "Power") ) //power cure |
703 | 63 { |
64 ++*next_token; | |
65 return 77; | |
66 } | |
1104 | 67 else if ( !_stricmp(tbl->pProperties[0], "Meteor") ) //meteot shower |
703 | 68 { |
69 ++*next_token; | |
70 return 9; | |
71 } | |
1104 | 72 else if ( !_stricmp(tbl->pProperties[0], "Lightning") ) //Lightning bolt |
703 | 73 { |
74 ++*next_token; | |
75 return 18; | |
76 } | |
1104 | 77 else if ( !_stricmp(tbl->pProperties[0], "Implosion") ) |
703 | 78 return 20; |
1104 | 79 else if ( !_stricmp(tbl->pProperties[0], "Stone") ) |
703 | 80 { |
81 ++*next_token; | |
82 return 38; | |
83 } | |
1104 | 84 else if ( !_stricmp(tbl->pProperties[0], "Haste") ) |
703 | 85 return 5; |
1104 | 86 else if ( !_stricmp(tbl->pProperties[0], "Heroism") ) |
703 | 87 return 51; |
1104 | 88 else if ( !_stricmp(tbl->pProperties[0], "Pain") ) //pain reflection |
703 | 89 { |
90 ++*next_token; | |
91 return 95; | |
92 } | |
1104 | 93 else if ( !_stricmp(tbl->pProperties[0], "Sparks") ) |
703 | 94 return 15; |
1104 | 95 else if ( !_stricmp(tbl->pProperties[0], "Light") ) |
703 | 96 { |
97 ++*next_token; | |
98 return 78; | |
99 } | |
1104 | 100 else if ( !_stricmp(tbl->pProperties[0], "Toxic") ) //toxic cloud |
698 | 101 { |
703 | 102 ++*next_token; |
103 return 90; | |
104 } | |
1104 | 105 else if ( !_stricmp(tbl->pProperties[0], "ShrapMetal") ) |
703 | 106 return 93; |
1104 | 107 else if ( !_stricmp(tbl->pProperties[0], "Paralyze") ) |
703 | 108 return 81; |
1104 | 109 else if ( !_stricmp(tbl->pProperties[0], "Fireball") ) |
703 | 110 return 6; |
1104 | 111 else if ( !_stricmp(tbl->pProperties[0], "Incinerate") ) |
703 | 112 return 11; |
1104 | 113 else if ( !_stricmp(tbl->pProperties[0], "Fire") ) |
703 | 114 { |
115 ++*next_token; | |
116 return 2; | |
117 } | |
1104 | 118 else if ( !_stricmp(tbl->pProperties[0], "Rock") ) |
703 | 119 { |
120 ++*next_token; | |
121 return 41; | |
122 } | |
1104 | 123 else if ( !_stricmp(tbl->pProperties[0], "Mass") ) |
703 | 124 { |
125 ++*next_token; | |
126 return 44; | |
127 } | |
1104 | 128 else if ( !_stricmp(tbl->pProperties[0], "Ice") ) |
703 | 129 { |
130 ++*next_token; | |
131 return 26; | |
132 } | |
1104 | 133 else if ( !_stricmp(tbl->pProperties[0], "Acid") ) |
703 | 134 { |
135 ++*next_token; | |
136 return 29; | |
698 | 137 } |
1104 | 138 else if ( !_stricmp(tbl->pProperties[0], "Bless") ) |
703 | 139 return 46; |
1104 | 140 else if ( !_stricmp(tbl->pProperties[0], "Dragon") ) |
703 | 141 { |
142 ++*next_token; | |
143 return 97; | |
144 } | |
1104 | 145 else if ( !_stricmp(tbl->pProperties[0], "Reanimate") ) |
703 | 146 return 89; |
1104 | 147 else if ( !_stricmp(tbl->pProperties[0], "Summon") ) |
703 | 148 { |
149 ++*next_token; | |
150 return 82; | |
151 } | |
1104 | 152 else if ( !_stricmp(tbl->pProperties[0], "Fate") ) |
703 | 153 return 47; |
1104 | 154 else if ( !_stricmp(tbl->pProperties[0], "Harm") ) |
703 | 155 return 70; |
1104 | 156 else if ( !_stricmp(tbl->pProperties[0], "Mind") ) |
703 | 157 { |
158 ++*next_token; | |
159 return 57; | |
160 } | |
1104 | 161 else if ( !_stricmp(tbl->pProperties[0], "Blades") ) |
703 | 162 return 39; |
1104 | 163 else if ( !_stricmp(tbl->pProperties[0], "Psychic") ) |
703 | 164 { |
165 ++*next_token; | |
166 return 65; | |
167 } | |
1104 | 168 else if ( !_stricmp(tbl->pProperties[0], "Hammerhands") ) |
703 | 169 return 73; |
170 else | |
171 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1165
diff
changeset
|
172 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
|
173 MessageBoxA(nullptr, pTmpBuf.data(), "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0); |
703 | 174 ++*next_token; |
175 return 0; | |
176 } | |
698 | 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 { | |
1104 | 241 if ( !_stricmp(missle_attack_str, "ARROW") ) |
698 | 242 return 1; |
1104 | 243 else if ( !_stricmp(missle_attack_str, "ARROWF") ) |
698 | 244 return 2; |
1104 | 245 else if ( !_stricmp(missle_attack_str, "FIRE") ) |
698 | 246 return 3; |
1104 | 247 else if ( !_stricmp(missle_attack_str, "AIR") ) |
698 | 248 return 4; |
1104 | 249 else if ( !_stricmp(missle_attack_str, "WATER") ) |
698 | 250 return 5; |
1104 | 251 else if ( !_stricmp(missle_attack_str, "EARTH") ) |
698 | 252 return 6; |
1104 | 253 else if ( !_stricmp(missle_attack_str, "SPIRIT") ) |
698 | 254 return 7; |
1104 | 255 else if ( !_stricmp(missle_attack_str, "MIND") ) |
698 | 256 return 8; |
1104 | 257 else if ( !_stricmp(missle_attack_str, "BODY") ) |
698 | 258 return 9; |
1104 | 259 else if ( !_stricmp(missle_attack_str, "LIGHT") ) |
698 | 260 return 10; |
1104 | 261 else if ( !_stricmp(missle_attack_str, "DARK") ) |
698 | 262 return 11; |
1104 | 263 else if ( !_stricmp(missle_attack_str, "ENER") ) |
698 | 264 return 13; |
265 else return 0; | |
266 } | |
267 | |
268 | |
703 | 269 int ParseSpecialAttack(char *spec_att_str) |
698 | 270 { |
703 | 271 _strlwr(spec_att_str); |
698 | 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; | |
2187 | 284 else if ( strstr(spec_att_str, "poison weak") ) |
698 | 285 return 6; |
2187 | 286 else if ( strstr(spec_att_str, "poison medium") ) |
698 | 287 return 7; |
2187 | 288 else if ( strstr(spec_att_str, "poison severe") ) |
698 | 289 return 8; |
2187 | 290 else if ( strstr(spec_att_str, "disease weak") ) |
698 | 291 return 9; |
2187 | 292 else if ( strstr(spec_att_str, "disease medium") ) |
698 | 293 return 10; |
2187 | 294 else if ( strstr(spec_att_str, "disease severe") ) |
698 | 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 } | |
0 | 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 ) | |
1545 | 372 Error("MonsterRaceListStruct::load - Unable to open file: %s."); |
373 | |
0 | 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)); | |
701 | 382 if ( v25.uPropCount && *v25.pProperties[0] != 47 ) |
0 | 383 ++Argsa; |
384 } | |
385 while ( fgets(&Buf, 490, File) ); | |
386 v4 = Argsa; | |
387 } | |
388 v2->uNumMonsters = v4; | |
1583 | 389 v5 = malloc(152 * v4); |
0 | 390 v2->pMonsters = (MonsterDesc *)v5; |
391 if ( !v5 ) | |
1545 | 392 Error("MonsterRaceListStruct::load - Out of Memory!"); |
393 | |
0 | 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; | |
701 | 402 if ( v25.uPropCount && *v25.pProperties[0] != 47 ) |
0 | 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); | |
701 | 442 Argsb = atoi(v25.pProperties[13]) & 0xFF; |
443 v26 = atoi(v25.pProperties[14]) & 0xFF; | |
444 v18 = atoi(v25.pProperties[15]); | |
2006 | 445 v2->pMonsters[v2->uNumMonsters].sTintColor = v18 | ((v26 | ((Argsb | (v17 << 8)) << 8)) << 8); |
0 | 446 v19 = 0; |
447 do | |
448 { | |
701 | 449 v20 = atoi(v25.pProperties[v19 + 16]); |
450 v21 = v19++ ; | |
451 v2->pMonsters[v2->uNumMonsters].pSoundSampleIDs[v21] = v20; | |
0 | 452 } |
453 while ( v19 < 4 ); | |
454 ++v2->uNumMonsters; | |
455 } | |
456 } | |
457 fclose(File); | |
458 return 1; | |
459 } | |
460 | |
461 //----- (004598AF) -------------------------------------------------------- | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
462 void MonsterList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) |
0 | 463 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
464 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
|
465 num_mm7_monsters = data_mm7 ? *(int *)data_mm7 : 0, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
466 num_mm8_monsters = data_mm8 ? *(int *)data_mm8 : 0; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
467 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
468 uNumMonsters = num_mm6_monsters + num_mm7_monsters + num_mm8_monsters; |
1545 | 469 Assert(uNumMonsters); |
470 Assert(!num_mm8_monsters); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
471 |
1583 | 472 pMonsters = (MonsterDesc *)malloc(sizeof(MonsterDesc) * uNumMonsters); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
473 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
|
474 for (uint i = 0; i < num_mm6_monsters; ++i) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
475 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
476 auto src = (MonsterDesc_mm6 *)((char *)data_mm6 + 4) + i; |
1980 | 477 MonsterDesc* dst = &pMonsters[num_mm7_monsters + i]; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
478 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
479 dst->uMonsterHeight = src->uMonsterHeight; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
480 dst->uMonsterRadius = src->uMonsterRadius; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
481 dst->uMovementSpeed = src->uMovementSpeed; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
482 dst->uToHitRadius = src->uToHitRadius; |
2006 | 483 dst->sTintColor = -1; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
484 memcpy(dst->pSoundSampleIDs, src->pSoundSampleIDs, sizeof(src->pSoundSampleIDs)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
485 memcpy(dst->pMonsterName, src->pMonsterName, sizeof(src->pMonsterName)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
486 memcpy(dst->pSpriteNames, src->pSpriteNames, sizeof(src->pSpriteNames)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
487 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1456
diff
changeset
|
488 memcpy(pMonsters + num_mm6_monsters + num_mm7_monsters, (char *)data_mm8 + 4, num_mm8_monsters * sizeof(MonsterDesc)); |
0 | 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 ) | |
1545 | 502 Error("Unable to save dmonlist.bin!"); |
0 | 503 fwrite(v1, 4u, 1u, v2); |
504 fwrite(v1->pMonsters, 0x98u, v1->uNumMonsters, v3); | |
505 fclose(v3); | |
506 } | |
507 | |
508 | |
509 //----- (004563FF) -------------------------------------------------------- | |
751 | 510 signed int MonsterStats::FindMonsterByTextureName(const char *monster_textr_name) |
0 | 511 { |
751 | 512 for (int i=1; i<uNumMonsters; ++i) |
694 | 513 { |
1104 | 514 if((pInfos[i].pName )&& (!_stricmp(pInfos[i].pPictureName, monster_textr_name))) |
694 | 515 return i; |
516 } | |
517 return -1; | |
0 | 518 } |
519 | |
520 | |
521 //----- (00454F4E) -------------------------------------------------------- | |
522 void MonsterStats::InitializePlacements() | |
523 { | |
237 | 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; | |
2334 | 531 // int item_counter; |
0 | 532 |
533 pMonsterPlacementTXT_Raw = (char *)pEvents_LOD->LoadRaw("placemon.txt", 0); | |
534 strtok(pMonsterPlacementTXT_Raw, "\r"); | |
237 | 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; | |
0 | 567 } |
568 | |
569 //----- (0045501E) -------------------------------------------------------- | |
570 void MonsterStats::Initialize() | |
694 | 571 { |
2334 | 572 int i;//,j; |
694 | 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; | |
2334 | 579 // int item_counter; |
694 | 580 int curr_rec_num; |
703 | 581 char parse_str[64]; |
751 | 582 char Src[120]; |
583 FrameTableTxtLine parsed_field; | |
694 | 584 |
2369
bddcaf5d5db2
removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
Grumpy7
parents:
2338
diff
changeset
|
585 free(pMonstersTXT_Raw); |
694 | 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 { | |
2334 | 1089 // int param_num; |
1090 // char type_flag; | |
751 | 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; | |
2338
1e865e8690ba
Moving some function declarations from unsorted subs to Actor.h and SpriteObject.h
Grumpy7
parents:
2336
diff
changeset
|
1280 } |
1e865e8690ba
Moving some function declarations from unsorted subs to Actor.h and SpriteObject.h
Grumpy7
parents:
2336
diff
changeset
|
1281 |