Mercurial > mm7
view Monsters.cpp @ 726:9d13d2ec35a6
Слияние
author | Ritor1 |
---|---|
date | Fri, 22 Mar 2013 01:29:46 +0600 |
parents | a9c1fb7483c2 |
children | 6005142abce0 |
line wrap: on
line source
#include <stdlib.h> #include <stdio.h> #include <string.h> #include "Monsters.h" #include "FrameTableInc.h" #include "Allocator.h" #include "LOD.h" #include "texts.h" #include "mm7_data.h" struct MonsterStats *pMonsterStats; struct MonsterList *pMonsterList; unsigned int ParseSpellType(struct FrameTableTxtLine* tbl, int* next_token); int ParseAttackType(const char *damage_type_str); void ParseDamage( char *damage_str, unsigned __int8* dice_rolls, unsigned __int8* dice_sides, unsigned __int8* dmg_bonus ); int ParseMissleAttackType(const char *missle_attack_str); int ParseSpecialAttack(const char *spec_att_str); //----- (004548E2) -------------------------------------------------------- unsigned int ParseSpellType( struct FrameTableTxtLine * tbl, int* next_token ) { if (!tbl->pProperties[0] ) { ++*next_token; return 0; } if ( !_strcmpi(tbl->pProperties[0], "Dispel") ) //dispel magic { ++*next_token; return 80; } else if ( !_strcmpi(tbl->pProperties[0], "Day") ) //day of protection { *next_token+=2;; return 85; } else if ( !_strcmpi(tbl->pProperties[0], "Hour") ) //hour of power { *next_token+=2;; return 86; } else if ( !_strcmpi(tbl->pProperties[0], "Shield") ) return 17; else if ( !_strcmpi(tbl->pProperties[0], "Spirit") ) { ++*next_token; return 52; } else if ( !_strcmpi(tbl->pProperties[0], "Power") ) //power cure { ++*next_token; return 77; } else if ( !_strcmpi(tbl->pProperties[0], "Meteor") ) //meteot shower { ++*next_token; return 9; } else if ( !_strcmpi(tbl->pProperties[0], "Lightning") ) //Lightning bolt { ++*next_token; return 18; } else if ( !_strcmpi(tbl->pProperties[0], "Implosion") ) return 20; else if ( !_strcmpi(tbl->pProperties[0], "Stone") ) { ++*next_token; return 38; } else if ( !_strcmpi(tbl->pProperties[0], "Haste") ) return 5; else if ( !_strcmpi(tbl->pProperties[0], "Heroism") ) return 51; else if ( !_strcmpi(tbl->pProperties[0], "Pain") ) //pain reflection { ++*next_token; return 95; } else if ( !_strcmpi(tbl->pProperties[0], "Sparks") ) return 15; else if ( !_strcmpi(tbl->pProperties[0], "Light") ) { ++*next_token; return 78; } else if ( !_strcmpi(tbl->pProperties[0], "Toxic") ) //toxic cloud { ++*next_token; return 90; } else if ( !_strcmpi(tbl->pProperties[0], "ShrapMetal") ) return 93; else if ( !_strcmpi(tbl->pProperties[0], "Paralyze") ) return 81; else if ( !_strcmpi(tbl->pProperties[0], "Fireball") ) return 6; else if ( !_strcmpi(tbl->pProperties[0], "Incinerate") ) return 11; else if ( !_strcmpi(tbl->pProperties[0], "Fire") ) { ++*next_token; return 2; } else if ( !_strcmpi(tbl->pProperties[0], "Rock") ) { ++*next_token; return 41; } else if ( !_strcmpi(tbl->pProperties[0], "Mass") ) { ++*next_token; return 44; } else if ( !_strcmpi(tbl->pProperties[0], "Ice") ) { ++*next_token; return 26; } else if ( !_strcmpi(tbl->pProperties[0], "Acid") ) { ++*next_token; return 29; } else if ( !_strcmpi(tbl->pProperties[0], "Bless") ) return 46; else if ( !_strcmpi(tbl->pProperties[0], "Dragon") ) { ++*next_token; return 97; } else if ( !_strcmpi(tbl->pProperties[0], "Reanimate") ) return 89; else if ( !_strcmpi(tbl->pProperties[0], "Summon") ) { ++*next_token; return 82; } else if ( !_strcmpi(tbl->pProperties[0], "Fate") ) return 47; else if ( !_strcmpi(tbl->pProperties[0], "Harm") ) return 70; else if ( !_strcmpi(tbl->pProperties[0], "Mind") ) { ++*next_token; return 57; } else if ( !_strcmpi(tbl->pProperties[0], "Blades") ) return 39; else if ( !_strcmpi(tbl->pProperties[0], "Psychic") ) { ++*next_token; return 65; } else if ( !_strcmpi(tbl->pProperties[0], "Hammerhands") ) return 73; else { sprintf(pTmpBuf, "Unknown monster spell %s", tbl->pProperties[0]); MessageBoxA(nullptr, pTmpBuf, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0); ++*next_token; return 0; } } //----- (00454CB4) -------------------------------------------------------- int ParseAttackType( const char *damage_type_str ) { switch (tolower(*damage_type_str)) { case 'f': return 0; //fire case 'a': return 1; //air case 'w': return 2; //water case 'e': return 3; //earth case 's': return 6; //spirit case 'm': return 7; //mind //m ?? 8 case 'l': return 9; //light case 'd': return 10; //dark // d?? 11 } return 4; //phis } //----- (00454D7D) -------------------------------------------------------- void ParseDamage( char *damage_str, unsigned __int8* dice_rolls, unsigned __int8* dice_sides, unsigned __int8* dmg_bonus ) { int str_len=0; int str_pos=0; bool dice_flag=false; *dice_rolls = 0; *dice_sides = 1; *dmg_bonus = 0; str_len = strlen(damage_str); if (str_len<=0) return; for (str_pos=0;str_pos<str_len;++str_pos ) { if (tolower(damage_str[str_pos])=='d') { damage_str[str_pos]='\0'; *dice_rolls=atoi(damage_str); *dice_sides=atoi(&damage_str[str_pos+1]); dice_flag=true; damage_str[str_pos]='d'; } else if (tolower(damage_str[str_pos])=='+') *dmg_bonus=atoi(&damage_str[str_pos+1]); } if (!dice_flag) { if ((*damage_str>='0')&&(*damage_str<='9')) { *dice_rolls =atoi(damage_str); *dice_sides = 1; } } } //----- (00454E3A) -------------------------------------------------------- int ParseMissleAttackType(const char *missle_attack_str) { if ( !_strcmpi(missle_attack_str, "ARROW") ) return 1; else if ( !_strcmpi(missle_attack_str, "ARROWF") ) return 2; else if ( !_strcmpi(missle_attack_str, "FIRE") ) return 3; else if ( !_strcmpi(missle_attack_str, "AIR") ) return 4; else if ( !_strcmpi(missle_attack_str, "WATER") ) return 5; else if ( !_strcmpi(missle_attack_str, "EARTH") ) return 6; else if ( !_strcmpi(missle_attack_str, "SPIRIT") ) return 7; else if ( !_strcmpi(missle_attack_str, "MIND") ) return 8; else if ( !_strcmpi(missle_attack_str, "BODY") ) return 9; else if ( !_strcmpi(missle_attack_str, "LIGHT") ) return 10; else if ( !_strcmpi(missle_attack_str, "DARK") ) return 11; else if ( !_strcmpi(missle_attack_str, "ENER") ) return 13; else return 0; } int ParseSpecialAttack(char *spec_att_str) { _strlwr(spec_att_str); if ( strstr(spec_att_str, "curse") ) return 1; else if ( strstr(spec_att_str, "weak") ) return 2; else if ( strstr(spec_att_str, "asleep") ) return 3; else if ( strstr(spec_att_str, "afraid") ) return 23; else if ( strstr(spec_att_str, "drunk") ) return 4; else if ( strstr(spec_att_str, "insane") ) return 5; else if ( strstr(spec_att_str, "poison1") ) return 6; else if ( strstr(spec_att_str, "poison2") ) return 7; else if ( strstr(spec_att_str, "poison3") ) return 8; else if ( strstr(spec_att_str, "disease1") ) return 9; else if ( strstr(spec_att_str, "disease2") ) return 10; else if ( strstr(spec_att_str, "disease3") ) return 11; else if ( strstr(spec_att_str, "paralyze") ) return 12; else if ( strstr(spec_att_str, "uncon") ) return 13; else if ( strstr(spec_att_str, "dead") ) return 14; else if ( strstr(spec_att_str, "stone") ) return 15; else if ( strstr(spec_att_str, "errad") ) return 16; else if ( strstr(spec_att_str, "brkitem") ) return 17; else if ( strstr(spec_att_str, "brkarmor") ) return 18; else if ( strstr(spec_att_str, "brkweapon") ) return 19; else if ( strstr(spec_att_str, "steal") ) return 20; else if ( strstr(spec_att_str, "age") ) return 21; else if ( strstr(spec_att_str, "drainsp") ) return 22; else return 0; } //----- (004598FC) -------------------------------------------------------- bool MonsterList::FromFileTxt(const char *Args) { MonsterList *v2; // ebx@1 FILE *v3; // eax@1 unsigned int v4; // esi@3 void *v5; // eax@9 FILE *v6; // ST14_4@11 char *i; // eax@11 signed int v8; // esi@12 unsigned __int16 v9; // ax@16 const char *v10; // ST18_4@16 unsigned __int16 v11; // ax@16 const char *v12; // ST14_4@16 unsigned __int16 v13; // ax@16 const char *v14; // ST10_4@16 __int16 v15; // ax@16 const char *v16; // ST0C_4@16 int v17; // esi@16 unsigned __int8 v18; // al@16 signed int v19; // esi@16 unsigned __int16 v20; // ax@17 int v21; // ecx@17 char Buf; // [sp+4h] [bp-304h]@3 FrameTableTxtLine v24; // [sp+1F8h] [bp-110h]@4 FrameTableTxtLine v25; // [sp+274h] [bp-94h]@4 int v26; // [sp+2F0h] [bp-18h]@16 char v27; // [sp+2F4h] [bp-14h]@14 char v28; // [sp+2F5h] [bp-13h]@14 char v29; // [sp+2F6h] [bp-12h]@14 char v30; // [sp+2F7h] [bp-11h]@14 char v31; // [sp+2F8h] [bp-10h]@14 char v32; // [sp+2F9h] [bp-Fh]@14 char v33; // [sp+2FAh] [bp-Eh]@14 char v34; // [sp+2FBh] [bp-Dh]@14 char v35; // [sp+2FCh] [bp-Ch]@14 char v36; // [sp+2FDh] [bp-Bh]@14 char v37; // [sp+2FEh] [bp-Ah]@14 char v38; // [sp+2FFh] [bp-9h]@14 char v39; // [sp+300h] [bp-8h]@14 char v40; // [sp+301h] [bp-7h]@14 char v41; // [sp+302h] [bp-6h]@14 char v42; // [sp+303h] [bp-5h]@14 FILE *File; // [sp+304h] [bp-4h]@1 unsigned int Argsa; // [sp+310h] [bp+8h]@3 int Argsb; // [sp+310h] [bp+8h]@16 v2 = this; v3 = fopen(Args, "r"); File = v3; if ( !v3 ) Abortf("MonsterRaceListStruct::load - Unable to open file: %s."); v4 = 0; Argsa = 0; if ( fgets(&Buf, 490, v3) ) { do { *strchr(&Buf, 10) = 0; memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25)); if ( v25.uPropCount && *v25.pProperties[0] != 47 ) ++Argsa; } while ( fgets(&Buf, 490, File) ); v4 = Argsa; } v2->uNumMonsters = v4; v5 = pAllocator->AllocNamedChunk(v2->pMonsters, 152 * v4, "Mon Race"); v2->pMonsters = (MonsterDesc *)v5; if ( !v5 ) Abortf("MonsterRaceListStruct::load - Out of Memory!"); v6 = File; v2->uNumMonsters = 0; fseek(v6, 0, 0); for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) { *strchr(&Buf, 10) = 0; memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25)); v8 = 0; if ( v25.uPropCount && *v25.pProperties[0] != 47 ) { strcpy(v2->pMonsters[v2->uNumMonsters].pMonsterName, v25.pProperties[0]); v35 = 0; v36 = 1; v37 = 7; v38 = 2; v39 = 3; v40 = 4; v41 = 5; v42 = 6; v27 = 1; v28 = 2; v29 = 3; v30 = 4; v31 = 4; v32 = 5; v33 = 6; v34 = 7; do { strcpy( v2->pMonsters[v2->uNumMonsters].pSpriteNames[(unsigned __int8)*(&v35 + v8)], v25.pProperties[(unsigned __int8)*(&v27 + v8)]); ++v8; } while ( v8 < 8 ); v9 = atoi(v25.pProperties[8]); v10 = v25.pProperties[9]; v2->pMonsters[v2->uNumMonsters].uMonsterHeight = v9; v11 = atoi(v10); v12 = v25.pProperties[10]; v2->pMonsters[v2->uNumMonsters].uMovementSpeed = v11; v13 = atoi(v12); v14 = v25.pProperties[11]; v2->pMonsters[v2->uNumMonsters].uMonsterRadius = v13; v15 = atoi(v14); v16 = v25.pProperties[12]; v2->pMonsters[v2->uNumMonsters].uToHitRadius = v15; v17 = (unsigned __int8)atoi(v16); Argsb = atoi(v25.pProperties[13]) & 0xFF; v26 = atoi(v25.pProperties[14]) & 0xFF; v18 = atoi(v25.pProperties[15]); v2->pMonsters[v2->uNumMonsters].uTintColor = v18 | ((v26 | ((Argsb | (v17 << 8)) << 8)) << 8); v19 = 0; do { v20 = atoi(v25.pProperties[v19 + 16]); v21 = v19++ ; v2->pMonsters[v2->uNumMonsters].pSoundSampleIDs[v21] = v20; } while ( v19 < 4 ); ++v2->uNumMonsters; } } fclose(File); return 1; } //----- (004598AF) -------------------------------------------------------- void MonsterList::FromFile(void *pSerialized) { uNumMonsters = *(int *)pSerialized; pMonsters = (MonsterDesc *)pAllocator->AllocNamedChunk(pMonsters, sizeof(MonsterDesc) * uNumMonsters, "Mon Race"); memcpy(pMonsters, (char *)pSerialized + 4, sizeof(MonsterDesc) * uNumMonsters); } //----- (00459860) -------------------------------------------------------- void MonsterList::ToFile() { MonsterList *v1; // esi@1 FILE *v2; // eax@1 FILE *v3; // edi@1 v1 = this; v2 = fopen("data\\dmonlist.bin", "wb"); v3 = v2; if ( !v2 ) Abortf("Unable to save dmonlist.bin!"); fwrite(v1, 4u, 1u, v2); fwrite(v1->pMonsters, 0x98u, v1->uNumMonsters, v3); fclose(v3); } //----- (004563FF) -------------------------------------------------------- signed int MonsterStats::FindMonsterByName(const char *Str2) { MonsterStats *v2; // esi@1 signed int v3; // ebx@1 MonsterInfo *v4; // edi@2 signed int result; // eax@6 /* for (int i=1; i<=uNumMonsters; ++i) { if() return i; } return -1; */ v2 = this; v3 = 1; if ( (signed int)this->uNumMonsters <= 1 ) { LABEL_6: result = -1; } else { v4 = &this->pInfos[1]; while ( !v4->pName || _strcmpi(v4->pPictureName, Str2) ) { ++v3; ++v4; if ( v3 >= (signed int)v2->uNumMonsters ) goto LABEL_6; } result = v3; } return result; } //----- (00454F4E) -------------------------------------------------------- void MonsterStats::InitializePlacements() { int i; char* test_string; unsigned char c; bool break_loop; unsigned int temp_str_len; char* tmp_pos; int decode_step; int item_counter; pMonsterPlacementTXT_Raw = (char *)pEvents_LOD->LoadRaw("placemon.txt", 0); strtok(pMonsterPlacementTXT_Raw, "\r"); for (i=1; i<31; ++i) { test_string = strtok(NULL, "\r") + 1; break_loop = false; decode_step=0; do { c = *(unsigned char*)test_string; temp_str_len = 0; while((c!='\t')&&(c>0)) { ++temp_str_len; c=test_string[temp_str_len]; } tmp_pos=test_string+temp_str_len; if (*tmp_pos == 0) break_loop = true; *tmp_pos = 0; if (temp_str_len) { if (decode_step==1) pPlaceStrings[i]=RemoveQuotes(test_string); } else { break_loop = true; } ++decode_step; test_string=tmp_pos+1; } while ((decode_step<3)&&!break_loop); } uNumPlacements = 31; } //----- (0045501E) -------------------------------------------------------- void MonsterStats::Initialize() { MonsterStats *v1; // ebx@1 int v2; // ebx@4 char v3; // cl@5 int v4; // eax@5 size_t v5; // eax@19 signed int v6; // edi@19 MonsterStats *v7; // ecx@23 int v8; // eax@23 unsigned int *pHP; // esi@23 size_t v10; // eax@29 signed int v11; // edi@29 MonsterStats *v12; // ecx@33 int v13; // eax@33 unsigned int *pExp; // esi@33 signed int v15; // edi@36 size_t v16; // esi@36 int v17; // eax@37 MonsterInfo *v18; // esi@45 size_t v19; // edi@50 int v20; // eax@51 unsigned __int8 v21; // al@55 size_t v22; // edi@59 char v23; // cl@63 const char *v24; // edi@63 unsigned __int16 *v25; // esi@114 int v26; // eax@118 size_t v27; // eax@136 int v28; // edi@137 MonsterStats *v29; // esi@137 int v30; // eax@138 int v31; // eax@142 int v32; // eax@143 int v33; // eax@144 int v34; // eax@151 int v35; // eax@152 int v36; // eax@153 int v37; // eax@162 int v38; // eax@163 int v39; // eax@164 int v40; // eax@171 int v41; // eax@172 size_t v42; // eax@180 int v43; // edi@180 MonsterInfo *v44; // esi@180 int v45; // edi@184 MonsterInfo *v46; // eax@232 char *v47; // edx@232 char *v48; // ecx@232 MonsterInfo *v49; // eax@236 FrameTableTxtLine *v50; // esi@240 int v51; // eax@240 int v52; // eax@241 int v53; // esi@242 int v54; // edi@242 char v55; // al@242 char *v56; // edi@242 FrameTableTxtLine *v57; // esi@249 int v58; // eax@249 MonsterInfo *v59; // eax@250 MonsterInfo *v60; // esi@251 int v61; // edi@251 char v62; // al@251 char *v63; // edi@251 char v64; // al@258 char v65; // al@262 char v66; // al@266 char v67; // al@270 char v68; // al@274 char v69; // al@278 char v70; // al@282 char v71; // al@286 char v72; // al@290 unsigned __int8 v73; // al@294 int v74; // edi@298 MonsterInfo *v75; // esi@300 MonsterInfo *v76; // esi@302 char **v77; // edi@306 __int16 v78; // ax@316 MonsterInfo *v79; // esi@323 const char *v80; // ecx@323 std::string v81; // [sp-14h] [bp-46Ch]@317 const char *v82; // [sp-8h] [bp-460h]@306 char *v83; // [sp-4h] [bp-45Ch]@23 char *v84; // [sp+0h] [bp-458h]@37 FrameTableTxtLine v85; // [sp+10h] [bp-448h]@297 FrameTableTxtLine v86; // [sp+8Ch] [bp-3CCh]@249 FrameTableTxtLine v87; // [sp+108h] [bp-350h]@240 char Src[120]; // [sp+184h] [bp-2D4h]@317 FrameTableTxtLine v89; // [sp+1FCh] [bp-25Ch]@249 FrameTableTxtLine v90; // [sp+278h] [bp-1E0h]@240 char Dest[64]; // [sp+334h] [bp-124h]@249 char v93[64]; // [sp+374h] [bp-E4h]@297 FrameTableTxtLine v94; // [sp+3B4h] [bp-A4h]@297 int v95; // [sp+430h] [bp-28h]@317 int v96; // [sp+434h] [bp-24h]@9 int v97; // [sp+438h] [bp-20h]@4 char a3[5]; // [sp+43Fh] [bp-19h]@4 int a2; // [sp+444h] [bp-14h]@36 int v100; // [sp+448h] [bp-10h]@36 size_t v101; // [sp+44Ch] [bp-Ch]@19 MonsterStats *v102; // [sp+450h] [bp-8h]@1 int v103; // [sp+454h] [bp-4h]@3 int i,j; char* test_string; unsigned char c; bool break_loop; unsigned int temp_str_len; char* tmp_pos; int decode_step; int item_counter; int curr_rec_num; char parse_str[64]; v1 = this; v102 = this; if ( pMonstersTXT_Raw ) pAllocator->FreeChunk(pMonstersTXT_Raw); pMonstersTXT_Raw = NULL; pMonstersTXT_Raw = (char *)pEvents_LOD->LoadRaw("monsters.txt", 0); strtok(pMonstersTXT_Raw, "\r"); strtok(NULL, "\r"); strtok(NULL, "\r"); strtok(NULL, "\r"); uNumMonsters = 265; curr_rec_num=0; for (i=0;i<uNumMonsters-1;++i) { test_string = strtok(NULL, "\r") + 1; break_loop = false; decode_step=0; do { c = *(unsigned char*)test_string; temp_str_len = 0; while((c!='\t')&&(c>0)) { ++temp_str_len; c=test_string[temp_str_len]; } tmp_pos=test_string+temp_str_len; if (*tmp_pos == 0) break_loop = true; *tmp_pos = 0; if (temp_str_len) { switch (decode_step) { case 0: curr_rec_num=atoi(test_string); pInfos[curr_rec_num].uID=curr_rec_num; break; case 1: pInfos[curr_rec_num].pName=RemoveQuotes(test_string); break; case 2: pInfos[curr_rec_num].pPictureName=RemoveQuotes(test_string); break; case 3: pInfos[curr_rec_num].uLevel=atoi(test_string); break; case 4: { int str_len=0; int str_pos=0; pInfos[curr_rec_num].uHP=0; if (test_string[0]=='"') test_string[0]=' '; str_len=strlen(test_string); if (str_len==0) break; while ((test_string[str_pos]!=',')&&(str_pos<str_len)) ++str_pos; if (str_len==str_pos) pInfos[curr_rec_num].uHP=atoi(test_string); else { test_string[str_pos]='\0'; pInfos[curr_rec_num].uHP=1000*atoi(test_string); pInfos[curr_rec_num].uHP+=atoi(&test_string[str_pos+1]); test_string[str_pos]=','; } } break; case 5: pInfos[curr_rec_num].uAC=atoi(test_string); break; case 6: { int str_len=0; int str_pos=0; pInfos[curr_rec_num].uExp=0; if (test_string[0]=='"') test_string[0]=' '; str_len=strlen(test_string); if (str_len==0) break; while ((test_string[str_pos]!=',')&&(str_pos<str_len)) ++str_pos; if (str_len==str_pos) pInfos[curr_rec_num].uExp=atoi(test_string); else { test_string[str_pos]='\0'; pInfos[curr_rec_num].uExp=1000*atoi(test_string); pInfos[curr_rec_num].uExp+=atoi(&test_string[str_pos+1]); test_string[str_pos]=','; } } break; case 7: { int str_len=0; int str_pos=0; bool chance_flag=false; bool dice_flag=false; bool item_type_flag=false; char* item_name; pInfos[curr_rec_num].uTreasureDropChance=0; pInfos[curr_rec_num].uTreasureDiceRolls=0; pInfos[curr_rec_num].uTreasureDiceSides=0; pInfos[curr_rec_num].uTreasureType=0; pInfos[curr_rec_num].uTreasureLevel=0; if (test_string[0]=='"') test_string[0]=' '; str_len=strlen(test_string); do { switch(tolower(test_string[str_pos])) { case '%': chance_flag=true; break; case 'd': dice_flag=true; break; case 'l': item_type_flag=true; break; } ++str_pos; } while(str_pos<str_len); if (chance_flag) { pInfos[curr_rec_num].uTreasureDropChance=atoi(test_string); } else { if ((!dice_flag)&&(!item_type_flag)) break; pInfos[curr_rec_num].uTreasureDropChance=100; } if (dice_flag) { str_pos=0; dice_flag=false; do { switch(tolower(test_string[str_pos])) { case '%': pInfos[curr_rec_num].uTreasureDiceRolls=atoi(&test_string[str_pos+1]); dice_flag=true; break; case 'd': if(!dice_flag) pInfos[curr_rec_num].uTreasureDiceRolls=atoi(test_string); pInfos[curr_rec_num].uTreasureDiceSides=atoi(&test_string[str_pos+1]); str_pos=str_len; break; } ++str_pos; } while(str_pos<str_len); } if (item_type_flag) { str_pos=0; do { if (tolower(test_string[str_pos])=='l') break; ++str_pos; } while(str_pos<str_len); pInfos[curr_rec_num].uTreasureLevel=test_string[str_pos+1]-'0'; item_name=&test_string[str_pos+2]; if (*item_name) { if ( !_strcmpi(item_name, "WEAPON")) pInfos[curr_rec_num].uTreasureType= 20; else if ( !_strcmpi(item_name, "ARMOR")) pInfos[curr_rec_num].uTreasureType= 21; else if ( !_strcmpi(item_name, "MISC")) pInfos[curr_rec_num].uTreasureType= 22; else if ( !_strcmpi(item_name, "SWORD")) pInfos[curr_rec_num].uTreasureType= 23; else if ( !_strcmpi(item_name, "DAGGER")) pInfos[curr_rec_num].uTreasureType= 24; else if ( !_strcmpi(item_name, "AXE")) pInfos[curr_rec_num].uTreasureType= 25; else if ( !_strcmpi(item_name, "SPEAR")) pInfos[curr_rec_num].uTreasureType= 26; else if ( !_strcmpi(item_name, "BOW")) pInfos[curr_rec_num].uTreasureType= 27; else if ( !_strcmpi(item_name, "MACE")) pInfos[curr_rec_num].uTreasureType= 28; else if ( !_strcmpi(item_name, "CLUB")) pInfos[curr_rec_num].uTreasureType= 29; else if ( !_strcmpi(item_name, "STAFF")) pInfos[curr_rec_num].uTreasureType= 30; else if ( !_strcmpi(item_name, "LEATHER")) pInfos[curr_rec_num].uTreasureType= 31; else if ( !_strcmpi(item_name, "CHAIN")) pInfos[curr_rec_num].uTreasureType= 32; else if ( !_strcmpi(item_name, "PLATE")) pInfos[curr_rec_num].uTreasureType= 33; else if ( !_strcmpi(item_name, "SHIELD")) pInfos[curr_rec_num].uTreasureType= 34; else if ( !_strcmpi(item_name, "HELM")) pInfos[curr_rec_num].uTreasureType= 35; else if ( !_strcmpi(item_name, "BELT")) pInfos[curr_rec_num].uTreasureType= 36; else if ( !_strcmpi(item_name, "CAPE")) pInfos[curr_rec_num].uTreasureType= 37; else if ( !_strcmpi(item_name, "GAUNTLETS")) pInfos[curr_rec_num].uTreasureType= 38; else if ( !_strcmpi(item_name, "BOOTS")) pInfos[curr_rec_num].uTreasureType= 39; else if ( !_strcmpi(item_name, "RING")) pInfos[curr_rec_num].uTreasureType= 40; else if ( !_strcmpi(item_name, "AMULET")) pInfos[curr_rec_num].uTreasureType= 41; else if ( !_strcmpi(item_name, "WAND")) pInfos[curr_rec_num].uTreasureType= 42; else if ( !_strcmpi(item_name, "SCROLL")) pInfos[curr_rec_num].uTreasureType= 43; else if ( !_strcmpi(item_name, "GEM")) pInfos[curr_rec_num].uTreasureType= 46; } } } break; case 8: { pInfos[curr_rec_num].bQuestMonster=0; if (atoi(test_string)) pInfos[curr_rec_num].bQuestMonster=1; } break; case 9: { pInfos[curr_rec_num].uFlying=false; if (_strnicmp(test_string, "n",1)) pInfos[curr_rec_num].uFlying=true; } break; case 10: { switch(tolower(test_string[0])) { case 's': pInfos[curr_rec_num].uMovementType=0;// short if (tolower(test_string[1])!='h') pInfos[curr_rec_num].uMovementType=5; //?? break; //short case 'l': pInfos[curr_rec_num].uMovementType=2; break; //long case 'm': pInfos[curr_rec_num].uMovementType=1; break; //med case 'g': pInfos[curr_rec_num].uMovementType=3; break; //??? default: pInfos[curr_rec_num].uMovementType=4; //free } } break; case 11: { switch(tolower(test_string[0])) { case 's': pInfos[curr_rec_num].uAIType=0; break; // suicide case 'w': pInfos[curr_rec_num].uAIType=1; break; //wimp case 'n': pInfos[curr_rec_num].uAIType=2; break; //normal default: pInfos[curr_rec_num].uAIType=3; //Agress } } break; case 12: pInfos[curr_rec_num].uHostilityType=(MonsterInfo::HostilityRadius)atoi(test_string); break; case 13: pInfos[curr_rec_num].uBaseSpeed=atoi(test_string); break; case 14: pInfos[curr_rec_num].uRecoveryTime=atoi(test_string); break; case 15: { int str_len=0; int str_pos=0; pInfos[curr_rec_num].uAttackPreference=0; pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=0; str_len=strlen(test_string); for (str_pos=0;str_pos<str_len;++str_pos ) { switch(tolower(test_string[str_pos])) { case '0': pInfos[curr_rec_num].uAttackPreference|=0x0004; break; case '2': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=2; break; case '3': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=3; break; case '4': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=4; break; case 'c': pInfos[curr_rec_num].uAttackPreference|=0x0010; break; case 'd': pInfos[curr_rec_num].uAttackPreference|=0x0008; break; case 'e': pInfos[curr_rec_num].uAttackPreference|=0x1000; break; case 'f': pInfos[curr_rec_num].uAttackPreference|=0x0400; break; case 'h': pInfos[curr_rec_num].uAttackPreference|=0x0800; break; case 'k': pInfos[curr_rec_num].uAttackPreference|=0x0001; break; case 'm': pInfos[curr_rec_num].uAttackPreference|=0x0100; break; case 'o': pInfos[curr_rec_num].uAttackPreference|=0x0400; break; case 'p': pInfos[curr_rec_num].uAttackPreference|=0x0002; break; case 'r': pInfos[curr_rec_num].uAttackPreference|=0x0040; break; case 's': pInfos[curr_rec_num].uAttackPreference|=0x0020; break; case 't': pInfos[curr_rec_num].uAttackPreference|=0x0080; break; case 'w': pInfos[curr_rec_num].uAttackPreference|=0x2000; break; case 'x': pInfos[curr_rec_num].uAttackPreference|=0x0200; break; } } } break; case 16: { int str_len=0; int str_pos=0; pInfos[curr_rec_num].uSpecialAttackType=1; pInfos[curr_rec_num].uSpecialAttack=0; str_len=strlen(test_string); if (str_len>1) { for (str_pos=0;str_pos<str_len;++str_pos ) { if (tolower(test_string[str_pos])=='x') { test_string[str_pos]='\0'; pInfos[curr_rec_num].uSpecialAttackType=atoi(&test_string[str_pos+1]); test_string[str_pos]='x'; break; } } pInfos[curr_rec_num].uSpecialAttack=ParseSpecialAttack(test_string); } } break; case 17: pInfos[curr_rec_num].uAttack1Type=ParseAttackType(test_string); break; case 18: { ParseDamage(test_string, &pInfos[curr_rec_num].uAttack1DamageDiceRolls, &pInfos[curr_rec_num].uAttack1DamageDiceSides, &pInfos[curr_rec_num].uAttack1DamageBonus); } break; case 19: pInfos[curr_rec_num].uMissleAttack1Type=ParseMissleAttackType(test_string); break; case 20: pInfos[curr_rec_num].uAttack2Chance=atoi(test_string); break; case 21: pInfos[curr_rec_num].uAttack2Type=ParseAttackType(test_string); break; case 22: { ParseDamage(test_string, &pInfos[curr_rec_num].uAttack2DamageDiceRolls, &pInfos[curr_rec_num].uAttack2DamageDiceSides, &pInfos[curr_rec_num].uAttack2DamageBonus); } break; case 23: pInfos[curr_rec_num].uMissleAttack2Type=ParseMissleAttackType(test_string); break; case 24: pInfos[curr_rec_num].uSpell1UseChance=atoi(test_string); break; case 25: { int param_num; char type_flag; strcpy(parse_str,test_string); parse_str[0]=' '; parse_str[strlen(parse_str)-1]=' '; frame_table_txt_parser(parse_str,&v85); if (v85.uPropCount>2) { param_num=1; pInfos[curr_rec_num].uSpell1ID=ParseSpellType(&v85,¶m_num); type_flag=*v85.pProperties[param_num]; pInfos[curr_rec_num].uSpellSkillAndMastery1=atoi(v85.pProperties[param_num+1])&0x003F; switch(type_flag) { case 'E': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0040; break; case 'M': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0080; break; case 'G': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0100; break; } } else { pInfos[curr_rec_num].uSpell1ID=0; pInfos[curr_rec_num].uSpellSkillAndMastery1=0; } } break; case 26: pInfos[curr_rec_num].uSpell2UseChance=atoi(test_string); break; case 27: { int param_num; char type_flag; strcpy(parse_str,test_string); parse_str[0]=' '; parse_str[strlen(parse_str)-1]=' '; frame_table_txt_parser(parse_str,&v85); if (v85.uPropCount>2) { param_num=1; pInfos[curr_rec_num].uSpell2ID=ParseSpellType(&v85,¶m_num); type_flag=*v85.pProperties[param_num]; pInfos[curr_rec_num].uSpellSkillAndMastery2=atoi(v85.pProperties[param_num+1])&0x003F; switch(type_flag) { case 'E': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0040; break; case 'M': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0080; break; case 'G': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0100; break; } } else { pInfos[curr_rec_num].uSpell2ID=0; pInfos[curr_rec_num].uSpellSkillAndMastery2=0; } } break; case 28: { if (tolower(test_string[0])=='i') pInfos[curr_rec_num].uResFire=200; else pInfos[curr_rec_num].uResFire=atoi(test_string); } break; case 29: { if (tolower(test_string[0])=='i') pInfos[curr_rec_num].uResAir=200; else pInfos[curr_rec_num].uResAir=atoi(test_string); } break; case 30: { if (tolower(test_string[0])=='i') pInfos[curr_rec_num].uResWater=200; else pInfos[curr_rec_num].uResWater=atoi(test_string); } break; case 31: { if (tolower(test_string[0])=='i') pInfos[curr_rec_num].uResEarth=200; else pInfos[curr_rec_num].uResEarth=atoi(test_string); } break; case 32: { if (tolower(test_string[0])=='i') pInfos[curr_rec_num].uResMind=200; else pInfos[curr_rec_num].uResMind=atoi(test_string); } break; case 33: { if (tolower(test_string[0])=='i') pInfos[curr_rec_num].uResSpirit=200; else pInfos[curr_rec_num].uResSpirit=atoi(test_string); } break; case 34: { if (tolower(test_string[0])=='i') pInfos[curr_rec_num].uResBody=200; else pInfos[curr_rec_num].uResBody=atoi(test_string); } break; case 35: { if (tolower(test_string[0])=='i') pInfos[curr_rec_num].uResLight=200; else pInfos[curr_rec_num].uResLight=atoi(test_string); } break; case 36: { if (tolower(test_string[0])=='i') pInfos[curr_rec_num].uResDark=200; else pInfos[curr_rec_num].uResDark=atoi(test_string); } break; case 37: { if (tolower(test_string[0])=='i') pInfos[curr_rec_num].uResPhysical=200; else pInfos[curr_rec_num].uResPhysical=atoi(test_string); } break; case 38: { } break; } } else { break_loop = true; } ++decode_step; test_string=tmp_pos+1; } while ((decode_step<39)&&!break_loop); } uNumMonsters = i; /* v103 = 0; v1->uNumMonsters = 265; do { v2 = (int)(strtok(NULL, "\r") + 1); *(_DWORD *)&a3[1] = 0; v97 = 0; do { v3 = *(_BYTE *)v2; v4 = 0; while ( v3 != 9 && v3 ) { ++v4; v3 = *(_BYTE *)(v4 + v2); } v96 = v4 + v2; if ( !*(_BYTE *)(v4 + v2) ) v97 = 1; *(_BYTE *)(v4 + v2) = 0; if ( v4 ) { switch ( *(_DWORD *)&a3[1] ) { /* case 0: v103 = atoi((const char *)v2); v102->pInfos[v103].uID = v103; goto LABEL_325; case 2: v102->pInfos[v103].pPictureName = RemoveQuotes((char *)v2); goto LABEL_325; case 1: v102->pInfos[v103].pName = RemoveQuotes((char *)v2); goto LABEL_325; case 3: v102->pInfos[v103].uLevel = atoi((const char *)v2); goto LABEL_325; case 4: if ( *(_BYTE *)v2 == 34 ) *(_BYTE *)v2 = 32; v5 = strlen((const char *)v2); v6 = 0; v101 = v5; if ( (signed int)v5 <= 0 ) goto LABEL_24; while ( *(_BYTE *)(v6 + v2) != 44 ) { ++v6; if ( v6 >= (signed int)v5 ) goto LABEL_24; } v7 = v102; v8 = v103; *(_BYTE *)(v6 + v2) = 0; pHP = &v7->pInfos[v8].uHP; *pHP = 1000 * atoi((const char *)v2); v83 = (char *)(v6 + v2 + 1); *(_BYTE *)(v6 + v2) = 44; *pHP += atoi(v83); LABEL_24: if ( v6 == v101 ) v102->pInfos[v103].uHP = atoi((const char *)v2); goto LABEL_325; case 5: v102->pInfos[v103].uAC = atoi((const char *)v2); goto LABEL_325; case 6: if ( *(_BYTE *)v2 == 34 ) *(_BYTE *)v2 = 32; v10 = strlen((const char *)v2); v11 = 0; v101 = v10; if ( (signed int)v10 <= 0 ) goto LABEL_34; while ( *(_BYTE *)(v11 + v2) != 44 ) { ++v11; if ( v11 >= (signed int)v10 ) goto LABEL_34; } v12 = v102; v13 = v103; *(_BYTE *)(v11 + v2) = 0; pExp = &v12->pInfos[v13].uExp; *pExp = 1000 * atoi((const char *)v2); v83 = (char *)(v11 + v2 + 1); *(_BYTE *)(v11 + v2) = 44; *pExp += atoi(v83); LABEL_34: if ( v11 == v101 ) v102->pInfos[v103].uExp = atoi((const char *)v2); goto LABEL_325; case 7: v15 = 0; a2 = 0; v100 = 0; v16 = 0; v101 = strlen((const char *)v2); if ( (signed int)v101 <= 0 ) goto LABEL_325; do { v84 = (char *)*(_BYTE *)(v16 + v2); v17 = tolower((int)v84); switch ( v17 ) { case 37: v15 = 1; break; case 100: v100 = 1; break; case 108: a2 = 1; break; } ++v16; } while ( (signed int)v16 < (signed int)v101 ); if ( v15 ) { v18 = &v102->pInfos[v103]; v18->uTreasureDropChance = atoi((const char *)v2); } else { if ( !v100 && !a2 ) goto LABEL_325; v18 = &v102->pInfos[v103]; v18->uTreasureDropChance = 100; } if ( v100 ) { v19 = 0; v100 = 0; do { v84 = (char *)*(_BYTE *)(v19 + v2); v20 = tolower((int)v84); if ( v20 == 37 ) { v84 = (char *)(v19 + v2 + 1); v18->uTreasureDiceRolls = atoi(v84); v100 = 1; } else { if ( v20 == 100 ) { if ( !v100 ) v18->uTreasureDiceRolls = atoi((const char *)v2); v84 = (char *)(v19 + v2 + 1); v21 = atoi(v84); v19 = v101; v18->uTreasureDiceSides = v21; } } ++v19; } while ( (signed int)v19 < (signed int)v101 ); } if ( a2 ) { v22 = 0; while ( 1 ) { v84 = (char *)*(_BYTE *)(v22 + v2); if ( tolower((int)v84) == 108 ) break; ++v22; if ( (signed int)v22 >= (signed int)v101 ) goto LABEL_325; } v23 = *(_BYTE *)(v22 + v2 + 1); v24 = (const char *)(v22 + v2 + 2); v18->uTreasureLevel = v23 - 48; if ( *v24 ) { if ( _strcmpi(v24, "WEAPON") ) { if ( _strcmpi(v24, "ARMOR") ) { if ( _strcmpi(v24, "MISC") ) { if ( _strcmpi(v24, "SWORD") ) { if ( _strcmpi(v24, "DAGGER") ) { if ( _strcmpi(v24, "AXE") ) { if ( _strcmpi(v24, "SPEAR") ) { if ( _strcmpi(v24, "BOW") ) { if ( _strcmpi(v24, "MACE") ) { if ( _strcmpi(v24, "CLUB") ) { if ( _strcmpi(v24, "STAFF") ) { if ( _strcmpi(v24, "LEATHER") ) { if ( _strcmpi(v24, "CHAIN") ) { if ( _strcmpi(v24, "PLATE") ) { if ( _strcmpi(v24, "SHIELD") ) { if ( _strcmpi(v24, "HELM") ) { if ( _strcmpi(v24, "BELT") ) { if ( _strcmpi(v24, "CAPE") ) { if ( _strcmpi(v24, "GAUNTLETS") ) { if ( _strcmpi(v24, "BOOTS") ) { if ( _strcmpi(v24, "RING") ) { if ( _strcmpi(v24, "AMULET") ) { if ( _strcmpi(v24, "WAND") ) { if ( _strcmpi(v24, "SCROLL") ) { if ( !_strcmpi(v24, "GEM") ) v18->uTreasureType = 46; } else { v18->uTreasureType = 43; } } else { v18->uTreasureType = 42; } } else { v18->uTreasureType = 41; } } else { v18->uTreasureType = 40; } } else { v18->uTreasureType = 39; } } else { v18->uTreasureType = 38; } } else { v18->uTreasureType = 37; } } else { v18->uTreasureType = 36; } } else { v18->uTreasureType = 35; } } else { v18->uTreasureType = 34; } } else { v18->uTreasureType = 33; } } else { v18->uTreasureType = 32; } } else { v18->uTreasureType = 31; } } else { v18->uTreasureType = 30; } } else { v18->uTreasureType = 29; } } else { v18->uTreasureType = 28; } } else { v18->uTreasureType = 27; } } else { v18->uTreasureType = 26; } } else { v18->uTreasureType = 25; } } else { v18->uTreasureType = 24; } } else { v18->uTreasureType = 23; } } else { v18->uTreasureType = 22; } } else { v18->uTreasureType = 21; } } else { v18->uTreasureType = 20; } } } goto LABEL_325; case 8: v84 = (char *)v2; v25 = &v102->pInfos[v103].bQuestMonster; *v25 = 0; if ( atoi(v84) ) *(_BYTE *)v25 |= 1u; goto LABEL_325; case 9: v102->pInfos[v103].uFlying = _strnicmp((const char *)v2, "n", 1u); goto LABEL_325; case 0xA: v84 = (char *)*(_BYTE *)v2; v101 = 4; if ( tolower((int)v84) == 's' ) { v84 = (char *)*(_BYTE *)(v2 + 1); v26 = tolower((int)v84) != 'h' ? 5 : 0; } else { v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'm' ) { v101 = 1; } else { v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'l' ) { v101 = 2; } else { v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'g' ) v101 = 3; } } LOBYTE(v26) = v101; } v102->pInfos[v103].uMovementType = v26; goto LABEL_325; case 0xB: v84 = (char *)*(_BYTE *)v2; v101 = 3; if ( tolower((int)v84) == 's' ) { v101 = 0; } else { v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'w' ) { v101 = 1; } else { v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'n' ) v101 = 2; } } v102->pInfos[v103].uAIType = v101; goto LABEL_325; case 0xC: v102->pInfos[v103].uHostilityType = (MonsterInfo::HostilityRadius)atoi((const char *)v2); goto LABEL_325; case 0xD: v102->pInfos[v103].uBaseSpeed = atoi((const char *)v2); goto LABEL_325; case 0xF: v27 = strlen((const char *)v2); v100 = 0; v101 = v27; if ( (signed int)v27 > 0 ) { v28 = v103; v29 = v102; do { v84 = (char *)*(_BYTE *)(v100 + v2); v30 = tolower((int)v84); if ( v30 > 107 ) { if ( v30 > 115 ) { v40 = v30 - 116; if ( v40 ) { v41 = v40 - 3; if ( v41 ) { if ( v41 == 1 ) BYTE1(v29->pInfos[v28].uAttackPreference) |= 2u; } else { BYTE1(v29->pInfos[v28].uAttackPreference) |= 0x20u; } } else { LOBYTE(v29->pInfos[v28].uAttackPreference) |= 0x80u; } } else { if ( v30 == 115 ) { v29->pInfos[v28].uAttackPreference |= 0x20u; } else { v37 = v30 - 109; if ( v37 ) { v38 = v37 - 2; if ( v38 ) { v39 = v38 - 1; if ( v39 ) { if ( v39 == 2 ) v29->pInfos[v28].uAttackPreference |= 0x40u; } else { v29->pInfos[v28].uAttackPreference |= 2u; } } else { BYTE1(v29->pInfos[v28].uAttackPreference) |= 4u; } } else { BYTE1(v29->pInfos[v28].uAttackPreference) |= 1u; } } } } else { if ( v30 == 107 ) { v29->pInfos[v28].uAttackPreference |= 1u; } else { if ( v30 > 99 ) { v34 = v30 - 100; if ( v34 ) { v35 = v34 - 1; if ( v35 ) { v36 = v35 - 2; if ( v36 ) { if ( v36 == 1 ) BYTE1(v29->pInfos[v28].uAttackPreference) |= 8u; } else { BYTE1(v29->pInfos[v28].uAttackPreference) |= 0x40u; } } else { BYTE1(v29->pInfos[v28].uAttackPreference) |= 0x10u; } } else { v29->pInfos[v28].uAttackPreference |= 8u; } } else { if ( v30 == 99 ) { v29->pInfos[v28].uAttackPreference |= 0x10u; } else { v31 = v30 - 50; if ( v31 ) { v32 = v31 - 1; if ( v32 ) { v33 = v32 - 1; if ( v33 ) { if ( v33 == 45 ) v29->pInfos[v28].uAttackPreference |= 4u; } else { v29->pInfos[v28].uNumCharactersAttackedPerSpecialAbility = 4; } } else { v29->pInfos[v28].uNumCharactersAttackedPerSpecialAbility = 3; } } else { v29->pInfos[v28].uNumCharactersAttackedPerSpecialAbility = 2; } } } } } ++v100; } while ( v100 < (signed int)v101 ); } goto LABEL_325; case 0xE: v102->pInfos[v103].uRecoveryTime = atoi((const char *)v2); goto LABEL_325; case 0x10: v42 = strlen((const char *)v2); v43 = 0; v44 = &v102->pInfos[v103]; v100 = v42; v44->uSpecialAttackType = 1; if ( (signed int)v42 <= 0 ) goto LABEL_185; break; case 0x11: v102->pInfos[v103].uAttack1Type = ParseAttackType((unsigned __int8 *)v2); goto LABEL_325; case 0x12: v46 = &v102->pInfos[v103]; v47 = (char *)&v46->uAttack1DamageDiceRolls; v84 = (char *)&v46->uAttack1DamageBonus; v48 = (char *)&v46->uAttack1DamageDiceSides; goto LABEL_237; case 0x13: v102->pInfos[v103].uMissleAttack1Type = ParseMissleAttackType((const char *)v2); goto LABEL_325; case 0x14: v102->pInfos[v103].uAttack2Chance = atoi((const char *)v2); goto LABEL_325; case 0x15: v102->pInfos[v103].uAttack2Type = ParseAttackType((unsigned __int8 *)v2); goto LABEL_325; case 0x16: v49 = &v102->pInfos[v103]; v47 = (char *)&v49->uAttack2DamageDiceRolls; v84 = (char *)&v49->uAttack2DamageBonus; v48 = (char *)&v49->uAttack2DamageDiceSides; LABEL_237: ParseDamage((const char *)v2, (int)v47, (int)v48, (int)v84); goto LABEL_325; case 0x17: v102->pInfos[v103].uMissleAttack2Type = ParseMissleAttackType((const char *)v2); goto LABEL_325; case 0x18: v102->pInfos[v103].uSpell1UseChance = atoi((const char *)v2); goto LABEL_325; case 0x19: strcpy(Str, (const char *)v2); Str[0] = ' '; Str[strlen(Str) - 1] = ' '; v50 = texture_frame_table_txt_parser(Str, &v87); v51 = 88 * v103; memcpy(&v90, v50, sizeof(v90)); if ( v90.field_0 >= 3 ) { v53 = (int)((char *)v102 + v51); a2 = 1; v102->pInfos[v51 / 0x58u].uSpell1ID = ParseSpellType(&v90, (int)&a2); v54 = a2; v84 = (char *)v90.pProperties[a2 + 1]; v55 = atoi(v84); v56 = (char *)v90.pProperties[v54]; v84 = "E"; v83 = v56; *(_WORD *)(v53 + 56) = v55 & 0x3F; if ( _strcmpi(v83, v84) ) { if ( _strcmpi(v56, "M") ) { if ( !_strcmpi(v56, "G") ) *(_BYTE *)(v53 + 57) |= 1u; } else { *(_BYTE *)(v53 + 56) |= 0x80u; } } else { *(_BYTE *)(v53 + 56) |= 0x40u; } } else { v52 = (int)((char *)v102 + v51); *(_BYTE *)(v52 + 33) = 0; *(_WORD *)(v52 + 56) = 0; } goto LABEL_325; case 0x1A: v102->pInfos[v103].uSpell2UseChance = atoi((const char *)v2); goto LABEL_325; case 0x1B: strcpy(Dest, (const char *)v2); Dest[0] = ' '; Dest[strlen(Dest) - 1] = ' '; v57 = texture_frame_table_txt_parser(Dest, &v86); v58 = v103; memcpy(&v89, v57, sizeof(v89)); if ( v89.field_0 >= 3 ) { v60 = &v102->pInfos[v58]; a2 = 1; v102->pInfos[v58].uSpell2ID = ParseSpellType(&v89, (int)&a2); v61 = a2; v84 = (char *)v89.pProperties[a2 + 1]; v62 = atoi(v84); v63 = (char *)v89.pProperties[v61]; v84 = "E"; v83 = v63; v60->uSpellSkillAndMastery2 = v62 & 0x3F; if ( _strcmpi(v83, v84) ) { if ( _strcmpi(v63, "M") ) { if ( !_strcmpi(v63, "G") ) HIBYTE(v60->uSpellSkillAndMastery2) |= 1u; } else { LOBYTE(v60->uSpellSkillAndMastery2) |= 0x80u; } } else { LOBYTE(v60->uSpellSkillAndMastery2) |= 0x40u; } } else { v59 = &v102->pInfos[v58]; v59->uSpell2ID = 0; v59->uSpellSkillAndMastery2 = 0; } goto LABEL_325; case 0x1C: v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'i' ) v64 = 200; else v64 = atoi((const char *)v2); v102->pInfos[v103].uResFire = v64; goto LABEL_325; case 0x1D: v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'i' ) v65 = 200; else v65 = atoi((const char *)v2); v102->pInfos[v103].uResAir = v65; goto LABEL_325; case 0x1E: v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'i' ) v66 = 200; else v66 = atoi((const char *)v2); v102->pInfos[v103].uResWater = v66; goto LABEL_325; case 0x1F: v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'i' ) v67 = 200; else v67 = atoi((const char *)v2); v102->pInfos[v103].uResEarth = v67; goto LABEL_325; case 0x20: v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'i' ) v68 = 200; else v68 = atoi((const char *)v2); v102->pInfos[v103].uResMind = v68; goto LABEL_325; case 0x21: v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'i' ) v69 = 200; else v69 = atoi((const char *)v2); v102->pInfos[v103].uResSpirit = v69; goto LABEL_325; case 0x22: v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'i' ) v70 = 200; else v70 = atoi((const char *)v2); v102->pInfos[v103].uResBody = v70; goto LABEL_325; case 0x23: v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'i' ) v71 = 200; else v71 = atoi((const char *)v2); v102->pInfos[v103].uResLight = v71; goto LABEL_325; case 0x24: v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'i' ) v72 = 200; else v72 = atoi((const char *)v2); v102->pInfos[v103].uResDark = v72; goto LABEL_325; case 0x25: v84 = (char *)*(_BYTE *)v2; if ( tolower((int)v84) == 'i' ) v73 = 200; else v73 = atoi((const char *)v2); v102->pInfos[v103].uResPhysical = v73; goto LABEL_325; case 0x26: strcpy(v93, (const char *)v2); v93[0] = ' '; v93[strlen(v93) - 1] = ' '; memcpy(&v94, texture_frame_table_txt_parser(v93, &v85), sizeof(v94)); if ( v94.field_0 ) { v74 = v94.field_0; if ( v94.field_0 < 10 ) { if ( _strcmpi(v94.pProperties[0], "shot") ) { if ( _strcmpi(v94.pProperties[0], "summon") ) { if ( !_strcmpi(v94.pProperties[0], "explode") ) { v79 = &v102->pInfos[v103]; v80 = v94.pProperties[1]; v84 = (char *)&v79->uSpecialAbilityDamageDiceBonus; v83 = (char *)&v79->uSpecialAbilityDamageDiceSides; v79->uSpecialAbilityType = 3; ParseDamage(v80, (int)&v79->uSpecialAbilityDamageDiceRolls, (int)v83, (int)v84); v79->field_3C_some_special_attack = ParseAttackType((unsigned __int8 *)v2); } } else { v76 = &v102->pInfos[v103]; v76->uSpecialAbilityType = 2; if ( v74 > 1 ) { pTmpBuf[0] = 0; strcpy(pTmpBuf, v94.pProperties[2]); if ( v74 > 2 ) { v100 = 3; if ( v74 > 3 ) { do { strcat(pTmpBuf, " "); v77 = (char **)v94.pProperties[v100]; v82 = v94.pProperties[v100]; strcat(pTmpBuf, v82); if ( v100 == v94.field_0 - 1 ) { v84 = (char *)*(_BYTE *)v77; if ( tolower((int)v84) == 'a' ) { v76->uSpecialAbilityDamageDiceRolls = 1; } else { v84 = (char *)*(_BYTE *)v77; if ( tolower((int)v84) == 'b' ) { v76->uSpecialAbilityDamageDiceRolls = 2; } else { v84 = (char *)*(_BYTE *)v77; if ( tolower((int)v84) == 'c' ) v76->uSpecialAbilityDamageDiceRolls = 3; else v76->uSpecialAbilityDamageDiceRolls = 0; } } } ++v100; } while ( v100 < v94.field_0 ); } } else { v76->uSpecialAbilityDamageDiceRolls = 0; } if ( pMonsterList->uNumMonsters ) { v78 = pMonsterList->GetMonsterByName(pTmpBuf) + 1; v76->field_3C_some_special_attack = v78; if ( v78 == -1 ) { sprintf(Src, "Can't create random monster: '%s' See MapStats!", Src); MessageBoxA(nullptr, Src, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:2239", 0); } } v76->uSpecialAbilityDamageDiceSides = 0; if ( !_strcmpi(v94.pProperties[1], "ground") ) v76->uSpecialAbilityDamageDiceSides = 1; if ( v76->field_3C_some_special_attack == -1 ) v76->uSpecialAbilityType = 0; } } } else { v75 = &v102->pInfos[v103]; v84 = (char *)(v94.pProperties[1] + 1); v75->uSpecialAbilityType = 1; v75->uSpecialAbilityDamageDiceBonus = atoi(v84); } } } goto LABEL_325; default: goto LABEL_325; } while ( 1 ) { v84 = (char *)*(_BYTE *)(v43 + v2); if ( tolower((int)v84) == 'x' ) break; ++v43; if ( v43 >= v100 ) goto LABEL_185; } v45 = v2 + v43; *(_BYTE *)v45 = 0; v44->uSpecialAttackType = atoi((const char *)(v45 + 1)); *(_BYTE *)v45 = 100; LABEL_185: _strlwr((char *)v2); if ( strstr((const char *)v2, "curse") ) { v44->uSpecialAttack = 1; } else { if ( strstr((const char *)v2, "weak") ) { v44->uSpecialAttack = 2; } else { if ( strstr((const char *)v2, "asleep") ) { v44->uSpecialAttack = 3; } else { if ( strstr((const char *)v2, "afraid") ) { v44->uSpecialAttack = 23; } else { if ( strstr((const char *)v2, "drunk") ) { v44->uSpecialAttack = 4; } else { if ( strstr((const char *)v2, "insane") ) { v44->uSpecialAttack = 5; } else { if ( strstr((const char *)v2, "poison1") ) { v44->uSpecialAttack = 6; } else { if ( strstr((const char *)v2, "poison2") ) { v44->uSpecialAttack = 7; } else { if ( strstr((const char *)v2, "poison3") ) { v44->uSpecialAttack = 8; } else { if ( strstr((const char *)v2, "disease1") ) { v44->uSpecialAttack = 9; } else { if ( strstr((const char *)v2, "disease2") ) { v44->uSpecialAttack = 10; } else { if ( strstr((const char *)v2, "disease3") ) { v44->uSpecialAttack = 11; } else { if ( strstr((const char *)v2, "paralyze") ) { v44->uSpecialAttack = 12; } else { if ( strstr((const char *)v2, "uncon") ) { v44->uSpecialAttack = 13; } else { if ( strstr((const char *)v2, "dead") ) { v44->uSpecialAttack = 14; } else { if ( strstr((const char *)v2, "stone") ) { v44->uSpecialAttack = 15; } else { if ( strstr((const char *)v2, "errad") ) { v44->uSpecialAttack = 16; } else { if ( strstr((const char *)v2, "brkitem") ) { v44->uSpecialAttack = 17; } else { if ( strstr((const char *)v2, "brkarmor") ) { v44->uSpecialAttack = 18; } else { if ( strstr((const char *)v2, "brkweapon") ) { v44->uSpecialAttack = 19; } else { if ( strstr((const char *)v2, "steal") ) { v44->uSpecialAttack = 20; } else { if ( strstr((const char *)v2, "age") ) { v44->uSpecialAttack = 21; } else { if ( strstr((const char *)v2, "drainsp") ) v44->uSpecialAttack = 22; } } } } } } } } } } } } } } } } } } } } } } } else { v97 = 1; } LABEL_325: ++*(_DWORD *)&a3[1]; v2 = v96 + 1; } while ( *(_DWORD *)&a3[1] - 1 <= (signed int)v102->uNumMonsters && !v97 ); ++v103; } while ( v103 < 265 ); v102->uNumMonsters = v103; */ } //----- (0044FA08) -------------------------------------------------------- unsigned __int16 MonsterList::GetMonsterByName(const char *pMonsterName) { signed int v2; // ebx@1 MonsterList *v3; // esi@1 int v4; // edi@3 unsigned __int16 result; // ax@6 v2 = 0; v3 = this; if ( pMonsterName && (signed int)this->uNumMonsters > 0 ) { v4 = 0; while ( _strcmpi(pMonsterName, v3->pMonsters[v4].pMonsterName) ) { ++v2; ++v4; if ( v2 >= (signed int)v3->uNumMonsters ) goto LABEL_6; } result = v2; } else { LABEL_6: result = -1; } return result; }