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