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