Mercurial > mm7
annotate Monsters.cpp @ 1152:d8b455c81917
Render::DrawTextureRGB cleanup
author | Grumpy7 |
---|---|
date | Sun, 02 Jun 2013 17:06:38 +0200 |
parents | 39eaa6b00141 |
children | 29a8defbad9e |
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 "Allocator.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 { | |
167 sprintf(pTmpBuf, "Unknown monster spell %s", tbl->pProperties[0]); | |
168 MessageBoxA(nullptr, pTmpBuf, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0); | |
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; | |
279 else if ( strstr(spec_att_str, "poison1") ) | |
280 return 6; | |
281 else if ( strstr(spec_att_str, "poison2") ) | |
282 return 7; | |
283 else if ( strstr(spec_att_str, "poison3") ) | |
284 return 8; | |
285 else if ( strstr(spec_att_str, "disease1") ) | |
286 return 9; | |
287 else if ( strstr(spec_att_str, "disease2") ) | |
288 return 10; | |
289 else if ( strstr(spec_att_str, "disease3") ) | |
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 ) | |
367 Abortf("MonsterRaceListStruct::load - Unable to open file: %s."); | |
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; | |
383 v5 = pAllocator->AllocNamedChunk(v2->pMonsters, 152 * v4, "Mon Race"); | |
384 v2->pMonsters = (MonsterDesc *)v5; | |
385 if ( !v5 ) | |
386 Abortf("MonsterRaceListStruct::load - Out of Memory!"); | |
387 v6 = File; | |
388 v2->uNumMonsters = 0; | |
389 fseek(v6, 0, 0); | |
390 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
391 { | |
392 *strchr(&Buf, 10) = 0; | |
393 memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25)); | |
394 v8 = 0; | |
701 | 395 if ( v25.uPropCount && *v25.pProperties[0] != 47 ) |
0 | 396 { |
397 strcpy(v2->pMonsters[v2->uNumMonsters].pMonsterName, v25.pProperties[0]); | |
398 v35 = 0; | |
399 v36 = 1; | |
400 v37 = 7; | |
401 v38 = 2; | |
402 v39 = 3; | |
403 v40 = 4; | |
404 v41 = 5; | |
405 v42 = 6; | |
406 v27 = 1; | |
407 v28 = 2; | |
408 v29 = 3; | |
409 v30 = 4; | |
410 v31 = 4; | |
411 v32 = 5; | |
412 v33 = 6; | |
413 v34 = 7; | |
414 do | |
415 { | |
416 strcpy( | |
417 v2->pMonsters[v2->uNumMonsters].pSpriteNames[(unsigned __int8)*(&v35 + v8)], | |
418 v25.pProperties[(unsigned __int8)*(&v27 + v8)]); | |
419 ++v8; | |
420 } | |
421 while ( v8 < 8 ); | |
422 v9 = atoi(v25.pProperties[8]); | |
423 v10 = v25.pProperties[9]; | |
424 v2->pMonsters[v2->uNumMonsters].uMonsterHeight = v9; | |
425 v11 = atoi(v10); | |
426 v12 = v25.pProperties[10]; | |
427 v2->pMonsters[v2->uNumMonsters].uMovementSpeed = v11; | |
428 v13 = atoi(v12); | |
429 v14 = v25.pProperties[11]; | |
430 v2->pMonsters[v2->uNumMonsters].uMonsterRadius = v13; | |
431 v15 = atoi(v14); | |
432 v16 = v25.pProperties[12]; | |
433 v2->pMonsters[v2->uNumMonsters].uToHitRadius = v15; | |
434 v17 = (unsigned __int8)atoi(v16); | |
701 | 435 Argsb = atoi(v25.pProperties[13]) & 0xFF; |
436 v26 = atoi(v25.pProperties[14]) & 0xFF; | |
437 v18 = atoi(v25.pProperties[15]); | |
0 | 438 v2->pMonsters[v2->uNumMonsters].uTintColor = v18 | ((v26 | ((Argsb | (v17 << 8)) << 8)) << 8); |
439 v19 = 0; | |
440 do | |
441 { | |
701 | 442 v20 = atoi(v25.pProperties[v19 + 16]); |
443 v21 = v19++ ; | |
444 v2->pMonsters[v2->uNumMonsters].pSoundSampleIDs[v21] = v20; | |
0 | 445 } |
446 while ( v19 < 4 ); | |
447 ++v2->uNumMonsters; | |
448 } | |
449 } | |
450 fclose(File); | |
451 return 1; | |
452 } | |
453 | |
454 //----- (004598AF) -------------------------------------------------------- | |
455 void MonsterList::FromFile(void *pSerialized) | |
456 { | |
457 uNumMonsters = *(int *)pSerialized; | |
698 | 458 pMonsters = (MonsterDesc *)pAllocator->AllocNamedChunk(pMonsters, sizeof(MonsterDesc) * uNumMonsters, "Mon Race"); |
459 memcpy(pMonsters, (char *)pSerialized + 4, sizeof(MonsterDesc) * uNumMonsters); | |
0 | 460 } |
461 | |
462 //----- (00459860) -------------------------------------------------------- | |
463 void MonsterList::ToFile() | |
464 { | |
465 MonsterList *v1; // esi@1 | |
466 FILE *v2; // eax@1 | |
467 FILE *v3; // edi@1 | |
468 | |
469 v1 = this; | |
470 v2 = fopen("data\\dmonlist.bin", "wb"); | |
471 v3 = v2; | |
472 if ( !v2 ) | |
473 Abortf("Unable to save dmonlist.bin!"); | |
474 fwrite(v1, 4u, 1u, v2); | |
475 fwrite(v1->pMonsters, 0x98u, v1->uNumMonsters, v3); | |
476 fclose(v3); | |
477 } | |
478 | |
479 | |
480 //----- (004563FF) -------------------------------------------------------- | |
751 | 481 signed int MonsterStats::FindMonsterByTextureName(const char *monster_textr_name) |
0 | 482 { |
751 | 483 for (int i=1; i<uNumMonsters; ++i) |
694 | 484 { |
1104 | 485 if((pInfos[i].pName )&& (!_stricmp(pInfos[i].pPictureName, monster_textr_name))) |
694 | 486 return i; |
487 } | |
488 return -1; | |
0 | 489 } |
490 | |
491 | |
492 //----- (00454F4E) -------------------------------------------------------- | |
493 void MonsterStats::InitializePlacements() | |
494 { | |
237 | 495 int i; |
496 char* test_string; | |
497 unsigned char c; | |
498 bool break_loop; | |
499 unsigned int temp_str_len; | |
500 char* tmp_pos; | |
501 int decode_step; | |
502 int item_counter; | |
0 | 503 |
504 pMonsterPlacementTXT_Raw = (char *)pEvents_LOD->LoadRaw("placemon.txt", 0); | |
505 strtok(pMonsterPlacementTXT_Raw, "\r"); | |
237 | 506 for (i=1; i<31; ++i) |
507 { | |
508 test_string = strtok(NULL, "\r") + 1; | |
509 break_loop = false; | |
510 decode_step=0; | |
511 do | |
512 { | |
513 c = *(unsigned char*)test_string; | |
514 temp_str_len = 0; | |
515 while((c!='\t')&&(c>0)) | |
516 { | |
517 ++temp_str_len; | |
518 c=test_string[temp_str_len]; | |
519 } | |
520 tmp_pos=test_string+temp_str_len; | |
521 if (*tmp_pos == 0) | |
522 break_loop = true; | |
523 *tmp_pos = 0; | |
524 if (temp_str_len) | |
525 { | |
526 if (decode_step==1) | |
527 pPlaceStrings[i]=RemoveQuotes(test_string); | |
528 } | |
529 else | |
530 { | |
531 break_loop = true; | |
532 } | |
533 ++decode_step; | |
534 test_string=tmp_pos+1; | |
535 } while ((decode_step<3)&&!break_loop); | |
536 } | |
537 uNumPlacements = 31; | |
0 | 538 } |
539 | |
540 //----- (0045501E) -------------------------------------------------------- | |
541 void MonsterStats::Initialize() | |
694 | 542 { |
543 int i,j; | |
544 char* test_string; | |
545 unsigned char c; | |
546 bool break_loop; | |
547 unsigned int temp_str_len; | |
548 char* tmp_pos; | |
549 int decode_step; | |
550 int item_counter; | |
551 int curr_rec_num; | |
703 | 552 char parse_str[64]; |
751 | 553 char Src[120]; |
554 FrameTableTxtLine parsed_field; | |
694 | 555 |
556 if ( pMonstersTXT_Raw ) | |
557 pAllocator->FreeChunk(pMonstersTXT_Raw); | |
558 pMonstersTXT_Raw = NULL; | |
559 pMonstersTXT_Raw = (char *)pEvents_LOD->LoadRaw("monsters.txt", 0); | |
560 strtok(pMonstersTXT_Raw, "\r"); | |
561 strtok(NULL, "\r"); | |
562 strtok(NULL, "\r"); | |
563 strtok(NULL, "\r"); | |
564 uNumMonsters = 265; | |
565 curr_rec_num=0; | |
566 for (i=0;i<uNumMonsters-1;++i) | |
567 { | |
568 test_string = strtok(NULL, "\r") + 1; | |
569 break_loop = false; | |
570 decode_step=0; | |
571 do | |
572 { | |
573 c = *(unsigned char*)test_string; | |
574 temp_str_len = 0; | |
575 while((c!='\t')&&(c>0)) | |
576 { | |
577 ++temp_str_len; | |
578 c=test_string[temp_str_len]; | |
579 } | |
580 tmp_pos=test_string+temp_str_len; | |
581 if (*tmp_pos == 0) | |
582 break_loop = true; | |
583 *tmp_pos = 0; | |
584 if (temp_str_len) | |
585 { | |
586 switch (decode_step) | |
587 { | |
588 case 0: | |
589 curr_rec_num=atoi(test_string); | |
590 pInfos[curr_rec_num].uID=curr_rec_num; | |
591 break; | |
592 case 1: | |
593 pInfos[curr_rec_num].pName=RemoveQuotes(test_string); | |
594 break; | |
595 case 2: | |
596 pInfos[curr_rec_num].pPictureName=RemoveQuotes(test_string); | |
597 break; | |
598 case 3: | |
599 pInfos[curr_rec_num].uLevel=atoi(test_string); | |
600 break; | |
601 case 4: | |
602 { | |
603 int str_len=0; | |
604 int str_pos=0; | |
605 pInfos[curr_rec_num].uHP=0; | |
606 if (test_string[0]=='"') | |
607 test_string[0]=' '; | |
608 str_len=strlen(test_string); | |
609 if (str_len==0) | |
610 break; | |
611 while ((test_string[str_pos]!=',')&&(str_pos<str_len)) | |
612 ++str_pos; | |
613 if (str_len==str_pos) | |
614 pInfos[curr_rec_num].uHP=atoi(test_string); | |
615 else | |
616 { | |
617 test_string[str_pos]='\0'; | |
618 pInfos[curr_rec_num].uHP=1000*atoi(test_string); | |
619 pInfos[curr_rec_num].uHP+=atoi(&test_string[str_pos+1]); | |
620 test_string[str_pos]=','; | |
621 } | |
622 } | |
623 break; | |
624 case 5: | |
625 pInfos[curr_rec_num].uAC=atoi(test_string); | |
626 break; | |
627 case 6: | |
628 { | |
629 int str_len=0; | |
630 int str_pos=0; | |
631 pInfos[curr_rec_num].uExp=0; | |
632 if (test_string[0]=='"') | |
633 test_string[0]=' '; | |
634 str_len=strlen(test_string); | |
635 if (str_len==0) | |
636 break; | |
637 while ((test_string[str_pos]!=',')&&(str_pos<str_len)) | |
638 ++str_pos; | |
639 if (str_len==str_pos) | |
640 pInfos[curr_rec_num].uExp=atoi(test_string); | |
641 else | |
642 { | |
643 test_string[str_pos]='\0'; | |
644 pInfos[curr_rec_num].uExp=1000*atoi(test_string); | |
645 pInfos[curr_rec_num].uExp+=atoi(&test_string[str_pos+1]); | |
646 test_string[str_pos]=','; | |
647 } | |
648 } | |
649 break; | |
650 case 7: | |
651 { | |
652 int str_len=0; | |
653 int str_pos=0; | |
654 bool chance_flag=false; | |
655 bool dice_flag=false; | |
656 bool item_type_flag=false; | |
657 char* item_name; | |
658 pInfos[curr_rec_num].uTreasureDropChance=0; | |
659 pInfos[curr_rec_num].uTreasureDiceRolls=0; | |
660 pInfos[curr_rec_num].uTreasureDiceSides=0; | |
698 | 661 pInfos[curr_rec_num].uTreasureType=0; |
662 pInfos[curr_rec_num].uTreasureLevel=0; | |
694 | 663 if (test_string[0]=='"') |
664 test_string[0]=' '; | |
665 str_len=strlen(test_string); | |
666 do | |
667 { | |
668 switch(tolower(test_string[str_pos])) | |
669 { | |
670 case '%': chance_flag=true; break; | |
671 case 'd': dice_flag=true; break; | |
672 case 'l': item_type_flag=true; break; | |
673 } | |
674 ++str_pos; | |
675 } | |
676 while(str_pos<str_len); | |
677 if (chance_flag) | |
678 { | |
679 pInfos[curr_rec_num].uTreasureDropChance=atoi(test_string); | |
680 } | |
681 else | |
682 { | |
683 if ((!dice_flag)&&(!item_type_flag)) | |
684 break; | |
685 pInfos[curr_rec_num].uTreasureDropChance=100; | |
686 } | |
687 if (dice_flag) | |
688 { | |
689 str_pos=0; | |
690 dice_flag=false; | |
691 do | |
692 { | |
693 switch(tolower(test_string[str_pos])) | |
694 { | |
695 case '%': | |
696 pInfos[curr_rec_num].uTreasureDiceRolls=atoi(&test_string[str_pos+1]); | |
697 dice_flag=true; | |
698 break; | |
699 case 'd': | |
700 if(!dice_flag) | |
701 pInfos[curr_rec_num].uTreasureDiceRolls=atoi(test_string); | |
702 pInfos[curr_rec_num].uTreasureDiceSides=atoi(&test_string[str_pos+1]); | |
703 str_pos=str_len; | |
704 break; | |
0 | 705 |
694 | 706 } |
707 ++str_pos; | |
708 } | |
709 while(str_pos<str_len); | |
710 } | |
711 if (item_type_flag) | |
712 { | |
713 str_pos=0; | |
714 do | |
715 { | |
716 if (tolower(test_string[str_pos])=='l') | |
717 break; | |
718 ++str_pos; | |
719 } | |
720 while(str_pos<str_len); | |
698 | 721 |
694 | 722 pInfos[curr_rec_num].uTreasureLevel=test_string[str_pos+1]-'0'; |
723 item_name=&test_string[str_pos+2]; | |
724 if (*item_name) | |
725 { | |
1104 | 726 if ( !_stricmp(item_name, "WEAPON")) |
694 | 727 pInfos[curr_rec_num].uTreasureType= 20; |
1104 | 728 else if ( !_stricmp(item_name, "ARMOR")) |
694 | 729 pInfos[curr_rec_num].uTreasureType= 21; |
1104 | 730 else if ( !_stricmp(item_name, "MISC")) |
694 | 731 pInfos[curr_rec_num].uTreasureType= 22; |
1104 | 732 else if ( !_stricmp(item_name, "SWORD")) |
694 | 733 pInfos[curr_rec_num].uTreasureType= 23; |
1104 | 734 else if ( !_stricmp(item_name, "DAGGER")) |
694 | 735 pInfos[curr_rec_num].uTreasureType= 24; |
1104 | 736 else if ( !_stricmp(item_name, "AXE")) |
694 | 737 pInfos[curr_rec_num].uTreasureType= 25; |
1104 | 738 else if ( !_stricmp(item_name, "SPEAR")) |
694 | 739 pInfos[curr_rec_num].uTreasureType= 26; |
1104 | 740 else if ( !_stricmp(item_name, "BOW")) |
694 | 741 pInfos[curr_rec_num].uTreasureType= 27; |
1104 | 742 else if ( !_stricmp(item_name, "MACE")) |
694 | 743 pInfos[curr_rec_num].uTreasureType= 28; |
1104 | 744 else if ( !_stricmp(item_name, "CLUB")) |
694 | 745 pInfos[curr_rec_num].uTreasureType= 29; |
1104 | 746 else if ( !_stricmp(item_name, "STAFF")) |
694 | 747 pInfos[curr_rec_num].uTreasureType= 30; |
1104 | 748 else if ( !_stricmp(item_name, "LEATHER")) |
694 | 749 pInfos[curr_rec_num].uTreasureType= 31; |
1104 | 750 else if ( !_stricmp(item_name, "CHAIN")) |
694 | 751 pInfos[curr_rec_num].uTreasureType= 32; |
1104 | 752 else if ( !_stricmp(item_name, "PLATE")) |
694 | 753 pInfos[curr_rec_num].uTreasureType= 33; |
1104 | 754 else if ( !_stricmp(item_name, "SHIELD")) |
694 | 755 pInfos[curr_rec_num].uTreasureType= 34; |
1104 | 756 else if ( !_stricmp(item_name, "HELM")) |
694 | 757 pInfos[curr_rec_num].uTreasureType= 35; |
1104 | 758 else if ( !_stricmp(item_name, "BELT")) |
694 | 759 pInfos[curr_rec_num].uTreasureType= 36; |
1104 | 760 else if ( !_stricmp(item_name, "CAPE")) |
694 | 761 pInfos[curr_rec_num].uTreasureType= 37; |
1104 | 762 else if ( !_stricmp(item_name, "GAUNTLETS")) |
694 | 763 pInfos[curr_rec_num].uTreasureType= 38; |
1104 | 764 else if ( !_stricmp(item_name, "BOOTS")) |
694 | 765 pInfos[curr_rec_num].uTreasureType= 39; |
1104 | 766 else if ( !_stricmp(item_name, "RING")) |
694 | 767 pInfos[curr_rec_num].uTreasureType= 40; |
1104 | 768 else if ( !_stricmp(item_name, "AMULET")) |
694 | 769 pInfos[curr_rec_num].uTreasureType= 41; |
1104 | 770 else if ( !_stricmp(item_name, "WAND")) |
694 | 771 pInfos[curr_rec_num].uTreasureType= 42; |
1104 | 772 else if ( !_stricmp(item_name, "SCROLL")) |
694 | 773 pInfos[curr_rec_num].uTreasureType= 43; |
1104 | 774 else if ( !_stricmp(item_name, "GEM")) |
694 | 775 pInfos[curr_rec_num].uTreasureType= 46; |
776 } | |
777 } | |
778 | |
779 } | |
780 break; | |
781 case 8: | |
782 { | |
783 pInfos[curr_rec_num].bQuestMonster=0; | |
784 if (atoi(test_string)) | |
785 pInfos[curr_rec_num].bQuestMonster=1; | |
786 } | |
787 break; | |
788 case 9: | |
789 { | |
790 pInfos[curr_rec_num].uFlying=false; | |
791 if (_strnicmp(test_string, "n",1)) | |
792 pInfos[curr_rec_num].uFlying=true; | |
793 } | |
794 break; | |
795 case 10: | |
796 { | |
797 switch(tolower(test_string[0])) | |
798 { | |
799 case 's': pInfos[curr_rec_num].uMovementType=0;// short | |
800 if (tolower(test_string[1])!='h') | |
801 pInfos[curr_rec_num].uMovementType=5; //?? | |
802 break; //short | |
803 case 'l': pInfos[curr_rec_num].uMovementType=2; break; //long | |
804 case 'm': pInfos[curr_rec_num].uMovementType=1; break; //med | |
805 case 'g': pInfos[curr_rec_num].uMovementType=3; break; //??? | |
806 default: | |
807 pInfos[curr_rec_num].uMovementType=4; //free | |
808 } | |
809 } | |
810 break; | |
811 case 11: | |
812 { | |
813 switch(tolower(test_string[0])) | |
814 { | |
815 case 's': pInfos[curr_rec_num].uAIType=0; break; // suicide | |
816 case 'w': pInfos[curr_rec_num].uAIType=1; break; //wimp | |
817 case 'n': pInfos[curr_rec_num].uAIType=2; break; //normal | |
818 default: | |
819 pInfos[curr_rec_num].uAIType=3; //Agress | |
820 } | |
821 } | |
822 break; | |
823 case 12: | |
824 pInfos[curr_rec_num].uHostilityType=(MonsterInfo::HostilityRadius)atoi(test_string); | |
825 break; | |
826 case 13: | |
827 pInfos[curr_rec_num].uBaseSpeed=atoi(test_string); | |
828 break; | |
829 case 14: | |
830 pInfos[curr_rec_num].uRecoveryTime=atoi(test_string); | |
831 break; | |
832 case 15: | |
833 { | |
834 int str_len=0; | |
835 int str_pos=0; | |
836 pInfos[curr_rec_num].uAttackPreference=0; | |
837 pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=0; | |
838 str_len=strlen(test_string); | |
839 for (str_pos=0;str_pos<str_len;++str_pos ) | |
840 { | |
841 switch(tolower(test_string[str_pos])) | |
842 { | |
843 case '0': pInfos[curr_rec_num].uAttackPreference|=0x0004; break; | |
844 case '2': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=2; break; | |
845 case '3': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=3; break; | |
846 case '4': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=4; break; | |
847 case 'c': pInfos[curr_rec_num].uAttackPreference|=0x0010; break; | |
848 case 'd': pInfos[curr_rec_num].uAttackPreference|=0x0008; break; | |
698 | 849 case 'e': pInfos[curr_rec_num].uAttackPreference|=0x1000; break; |
694 | 850 case 'f': pInfos[curr_rec_num].uAttackPreference|=0x0400; break; |
851 case 'h': pInfos[curr_rec_num].uAttackPreference|=0x0800; break; | |
852 case 'k': pInfos[curr_rec_num].uAttackPreference|=0x0001; break; | |
853 case 'm': pInfos[curr_rec_num].uAttackPreference|=0x0100; break; | |
854 case 'o': pInfos[curr_rec_num].uAttackPreference|=0x0400; break; | |
855 case 'p': pInfos[curr_rec_num].uAttackPreference|=0x0002; break; | |
856 case 'r': pInfos[curr_rec_num].uAttackPreference|=0x0040; break; | |
857 case 's': pInfos[curr_rec_num].uAttackPreference|=0x0020; break; | |
858 case 't': pInfos[curr_rec_num].uAttackPreference|=0x0080; break; | |
859 case 'w': pInfos[curr_rec_num].uAttackPreference|=0x2000; break; | |
860 case 'x': pInfos[curr_rec_num].uAttackPreference|=0x0200; break; | |
861 } | |
862 } | |
863 } | |
864 break; | |
698 | 865 case 16: |
694 | 866 { |
703 | 867 int str_len=0; |
868 int str_pos=0; | |
869 pInfos[curr_rec_num].uSpecialAttackType=1; | |
870 pInfos[curr_rec_num].uSpecialAttack=0; | |
871 str_len=strlen(test_string); | |
872 if (str_len>1) | |
873 { | |
874 for (str_pos=0;str_pos<str_len;++str_pos ) | |
875 { | |
876 if (tolower(test_string[str_pos])=='x') | |
877 { | |
878 test_string[str_pos]='\0'; | |
879 pInfos[curr_rec_num].uSpecialAttackType=atoi(&test_string[str_pos+1]); | |
880 test_string[str_pos]='x'; | |
881 break; | |
882 } | |
883 } | |
884 pInfos[curr_rec_num].uSpecialAttack=ParseSpecialAttack(test_string); | |
885 } | |
694 | 886 } |
887 break; | |
888 case 17: | |
698 | 889 pInfos[curr_rec_num].uAttack1Type=ParseAttackType(test_string); |
694 | 890 break; |
891 case 18: | |
892 { | |
698 | 893 ParseDamage(test_string, &pInfos[curr_rec_num].uAttack1DamageDiceRolls, |
894 &pInfos[curr_rec_num].uAttack1DamageDiceSides, | |
895 &pInfos[curr_rec_num].uAttack1DamageBonus); | |
694 | 896 } |
897 break; | |
698 | 898 case 19: |
899 pInfos[curr_rec_num].uMissleAttack1Type=ParseMissleAttackType(test_string); | |
694 | 900 break; |
901 case 20: | |
698 | 902 pInfos[curr_rec_num].uAttack2Chance=atoi(test_string); |
694 | 903 break; |
904 case 21: | |
698 | 905 pInfos[curr_rec_num].uAttack2Type=ParseAttackType(test_string); |
694 | 906 break; |
907 case 22: | |
908 { | |
698 | 909 ParseDamage(test_string, &pInfos[curr_rec_num].uAttack2DamageDiceRolls, |
910 &pInfos[curr_rec_num].uAttack2DamageDiceSides, | |
911 &pInfos[curr_rec_num].uAttack2DamageBonus); | |
694 | 912 } |
913 break; | |
914 case 23: | |
698 | 915 pInfos[curr_rec_num].uMissleAttack2Type=ParseMissleAttackType(test_string); |
694 | 916 break; |
917 case 24: | |
698 | 918 pInfos[curr_rec_num].uSpell1UseChance=atoi(test_string); |
694 | 919 break; |
920 case 25: | |
921 { | |
703 | 922 int param_num; |
923 char type_flag; | |
924 strcpy(parse_str,test_string); | |
925 parse_str[0]=' '; | |
926 parse_str[strlen(parse_str)-1]=' '; | |
751 | 927 frame_table_txt_parser(parse_str,&parsed_field); |
928 if (parsed_field.uPropCount>2) | |
703 | 929 { |
930 param_num=1; | |
751 | 931 pInfos[curr_rec_num].uSpell1ID=ParseSpellType(&parsed_field,¶m_num); |
932 type_flag=*parsed_field.pProperties[param_num]; | |
933 pInfos[curr_rec_num].uSpellSkillAndMastery1=atoi(parsed_field.pProperties[param_num+1])&0x003F; | |
703 | 934 switch(type_flag) |
935 { | |
936 case 'E': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0040; break; | |
937 case 'M': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0080; break; | |
938 case 'G': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0100; break; | |
939 } | |
940 } | |
941 else | |
942 { | |
943 pInfos[curr_rec_num].uSpell1ID=0; | |
944 pInfos[curr_rec_num].uSpellSkillAndMastery1=0; | |
945 } | |
694 | 946 |
947 } | |
948 break; | |
949 case 26: | |
698 | 950 pInfos[curr_rec_num].uSpell2UseChance=atoi(test_string); |
694 | 951 break; |
952 case 27: | |
953 { | |
703 | 954 int param_num; |
955 char type_flag; | |
956 strcpy(parse_str,test_string); | |
957 parse_str[0]=' '; | |
958 parse_str[strlen(parse_str)-1]=' '; | |
751 | 959 frame_table_txt_parser(parse_str,&parsed_field); |
960 if (parsed_field.uPropCount>2) | |
703 | 961 { |
962 param_num=1; | |
751 | 963 pInfos[curr_rec_num].uSpell2ID=ParseSpellType(&parsed_field,¶m_num); |
964 type_flag=*parsed_field.pProperties[param_num]; | |
965 pInfos[curr_rec_num].uSpellSkillAndMastery2=atoi(parsed_field.pProperties[param_num+1])&0x003F; | |
703 | 966 switch(type_flag) |
967 { | |
968 case 'E': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0040; break; | |
969 case 'M': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0080; break; | |
970 case 'G': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0100; break; | |
971 } | |
972 } | |
973 else | |
974 { | |
975 pInfos[curr_rec_num].uSpell2ID=0; | |
976 pInfos[curr_rec_num].uSpellSkillAndMastery2=0; | |
977 } | |
694 | 978 } |
979 break; | |
980 case 28: | |
981 { | |
698 | 982 if (tolower(test_string[0])=='i') |
983 pInfos[curr_rec_num].uResFire=200; | |
984 else | |
985 pInfos[curr_rec_num].uResFire=atoi(test_string); | |
694 | 986 } |
987 break; | |
988 case 29: | |
989 { | |
698 | 990 if (tolower(test_string[0])=='i') |
991 pInfos[curr_rec_num].uResAir=200; | |
992 else | |
993 pInfos[curr_rec_num].uResAir=atoi(test_string); | |
694 | 994 } |
995 break; | |
996 case 30: | |
997 { | |
698 | 998 if (tolower(test_string[0])=='i') |
999 pInfos[curr_rec_num].uResWater=200; | |
1000 else | |
1001 pInfos[curr_rec_num].uResWater=atoi(test_string); | |
694 | 1002 } |
1003 break; | |
1004 case 31: | |
1005 { | |
698 | 1006 if (tolower(test_string[0])=='i') |
1007 pInfos[curr_rec_num].uResEarth=200; | |
1008 else | |
1009 pInfos[curr_rec_num].uResEarth=atoi(test_string); | |
694 | 1010 } |
1011 break; | |
1012 case 32: | |
1013 { | |
698 | 1014 if (tolower(test_string[0])=='i') |
1015 pInfos[curr_rec_num].uResMind=200; | |
1016 else | |
1017 pInfos[curr_rec_num].uResMind=atoi(test_string); | |
694 | 1018 } |
1019 break; | |
1020 case 33: | |
1021 { | |
698 | 1022 if (tolower(test_string[0])=='i') |
1023 pInfos[curr_rec_num].uResSpirit=200; | |
1024 else | |
1025 pInfos[curr_rec_num].uResSpirit=atoi(test_string); | |
694 | 1026 } |
1027 break; | |
1028 case 34: | |
1029 { | |
698 | 1030 if (tolower(test_string[0])=='i') |
1031 pInfos[curr_rec_num].uResBody=200; | |
1032 else | |
1033 pInfos[curr_rec_num].uResBody=atoi(test_string); | |
694 | 1034 } |
1035 break; | |
1036 case 35: | |
1037 { | |
698 | 1038 if (tolower(test_string[0])=='i') |
1039 pInfos[curr_rec_num].uResLight=200; | |
1040 else | |
1041 pInfos[curr_rec_num].uResLight=atoi(test_string); | |
694 | 1042 } |
1043 break; | |
1044 case 36: | |
1045 { | |
698 | 1046 if (tolower(test_string[0])=='i') |
1047 pInfos[curr_rec_num].uResDark=200; | |
1048 else | |
1049 pInfos[curr_rec_num].uResDark=atoi(test_string); | |
694 | 1050 } |
1051 break; | |
1052 case 37: | |
1053 { | |
698 | 1054 if (tolower(test_string[0])=='i') |
1055 pInfos[curr_rec_num].uResPhysical=200; | |
1056 else | |
1057 pInfos[curr_rec_num].uResPhysical=atoi(test_string); | |
694 | 1058 } |
1059 break; | |
1060 case 38: | |
1061 { | |
751 | 1062 int param_num; |
1063 char type_flag; | |
1064 pInfos[curr_rec_num].uSpecialAbilityType=0; | |
1065 pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus=0; | |
1066 strcpy(parse_str,test_string); | |
1067 parse_str[0]=' '; | |
1068 parse_str[strlen(parse_str)-1]=' '; | |
1069 frame_table_txt_parser(parse_str,&parsed_field); | |
1070 if ( parsed_field.uPropCount ) | |
1071 { | |
1072 // v74 = v94.field_0; | |
1073 if ( parsed_field.uPropCount < 10 ) | |
1074 { | |
1104 | 1075 if (! _stricmp(parsed_field.pProperties[0], "shot") ) |
751 | 1076 { |
1077 pInfos[curr_rec_num].uSpecialAbilityType=1; | |
1078 pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus=atoi((char *)(parsed_field.pProperties[1] + 1)); | |
1079 } | |
1104 | 1080 else if (!_stricmp(parsed_field.pProperties[0], "summon") ) |
751 | 1081 { |
1082 pInfos[curr_rec_num].uSpecialAbilityType=2; | |
1083 if ( parsed_field.uPropCount > 1 ) | |
1084 { | |
1085 pTmpBuf[0] = 0; | |
1086 strcpy(pTmpBuf, parsed_field.pProperties[2]); | |
1087 if ( parsed_field.uPropCount > 2 ) | |
1088 { | |
1089 int prop_cnt = 3; | |
1090 if ( parsed_field.uPropCount > 3 ) | |
1091 { | |
1092 do | |
1093 { | |
1094 strcat(pTmpBuf, " "); | |
1095 char test_char = parsed_field.pProperties[prop_cnt][0]; | |
1096 strcat(pTmpBuf, parsed_field.pProperties[prop_cnt]); | |
1097 if ( prop_cnt == (parsed_field.uPropCount - 1) ) | |
1098 { | |
1099 switch (tolower(test_char)) | |
1100 { | |
1101 case 'a': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 1; break; | |
1102 case 'b': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 2; break; | |
1103 case 'c': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 3; break; | |
1104 default: | |
1105 pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 0; | |
1106 } | |
1107 | |
1108 } | |
1109 ++prop_cnt; | |
1110 } | |
1111 while ( prop_cnt < parsed_field.uPropCount ); | |
1112 } | |
1113 } | |
1114 else | |
1115 { | |
1116 pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 0; | |
1117 } | |
1118 if ( pMonsterList->uNumMonsters ) | |
1119 { | |
1120 pInfos[curr_rec_num].field_3C_some_special_attack = pMonsterList->GetMonsterIDByName(pTmpBuf) + 1; | |
1121 if ( pInfos[curr_rec_num].field_3C_some_special_attack == -1 ) | |
1122 { | |
1123 sprintf(Src, "Can't create random monster: '%s' See MapStats!", pTmpBuf); | |
1124 MessageBoxA(nullptr, Src, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:2239", 0); | |
1125 } | |
1126 } | |
1127 pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides = 0; | |
1104 | 1128 if ( !_stricmp(parsed_field.pProperties[1], "ground") ) |
751 | 1129 pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides = 1; |
1130 if ( pInfos[curr_rec_num].field_3C_some_special_attack == -1 ) | |
1131 pInfos[curr_rec_num].uSpecialAbilityType = 0; | |
1132 } | |
1133 } | |
1104 | 1134 else if (!_stricmp(parsed_field.pProperties[0], "explode") ) |
751 | 1135 { |
1136 pInfos[curr_rec_num].uSpecialAbilityType = 3; | |
1137 ParseDamage((char*)parsed_field.pProperties[1], &pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls, | |
1138 &pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides, | |
1139 &pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus); | |
1140 pInfos[curr_rec_num].field_3C_some_special_attack = ParseAttackType(test_string); | |
1141 } | |
1142 } | |
1143 } | |
694 | 1144 } |
698 | 1145 break; |
694 | 1146 } |
1147 } | |
1148 else | |
1149 { | |
1150 break_loop = true; | |
1151 } | |
1152 ++decode_step; | |
1153 test_string=tmp_pos+1; | |
1154 } while ((decode_step<39)&&!break_loop); | |
1155 } | |
1156 uNumMonsters = i; | |
0 | 1157 } |
1158 | |
1159 | |
1160 //----- (0044FA08) -------------------------------------------------------- | |
751 | 1161 signed __int16 MonsterList::GetMonsterIDByName( const char *pMonsterName ) |
0 | 1162 { |
751 | 1163 if (!pMonsterName) |
1164 return -1; | |
1165 for (signed __int16 i=1; i<=uNumMonsters; ++i) | |
1166 { | |
1104 | 1167 if( (!_stricmp(pMonsters[i].pMonsterName, pMonsterName))) |
751 | 1168 return i; |
0 | 1169 } |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1104
diff
changeset
|
1170 assert(false && "Monster not found!"); |
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1104
diff
changeset
|
1171 } |