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