Mercurial > might-and-magic-trilogy
view Monsters.cpp @ 31:f4450ff595fe
BLV loading (looks like) done.
author | Nomad |
---|---|
date | Fri, 19 Oct 2012 03:36:38 +0200 |
parents | e62134245ab0 |
children | 51a5b0dc3f30 |
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 "mm7_data.h" struct MonsterStats *pMonsterStats; struct MonsterList *pMonsterList; //----- (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.field_0 && *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.field_0 && *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.pProperties2[0]) & 0xFF; v26 = atoi(v25.pProperties2[1]) & 0xFF; v18 = atoi(v25.pProperties2[2]); v2->pMonsters[v2->uNumMonsters].uTintColor = v18 | ((v26 | ((Argsb | (v17 << 8)) << 8)) << 8); v19 = 0; do { v20 = atoi(v25.pProperties2[v19 + 4]); v21 = v19++ + 76 * v2->uNumMonsters; v2->pMonsters->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, 152 * uNumMonsters, "Mon Race"); memcpy(pMonsters, (char *)pSerialized + 4, 152 * 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::_4563FF(const char *Str2) { MonsterStats *v2; // esi@1 signed int v3; // ebx@1 MonsterInfo *v4; // edi@2 signed int result; // eax@6 v2 = this; v3 = 1; if ( (signed int)this->uNumMonsters <= 1 ) { LABEL_6: result = -1; } else { v4 = &this->pInfos[1]; while ( !v4->pName || _strcmpi(v4->pTexture, Str2) ) { ++v3; ++v4; if ( v3 >= (signed int)v2->uNumMonsters ) goto LABEL_6; } result = v3; } return result; } //----- (00454F4E) -------------------------------------------------------- void MonsterStats::InitializePlacements() { char *v1; // ebx@1 MonsterStats *v2; // edi@1 char *v3; // eax@2 char v4; // dl@3 char *v5; // ecx@3 int v6; // esi@7 signed int v7; // [sp+Ch] [bp-10h]@1 char **v8; // [sp+10h] [bp-Ch]@1 signed int v9; // [sp+14h] [bp-8h]@2 char *v10; // [sp+18h] [bp-4h]@2 v1 = 0; v2 = this; pMonsterPlacementTXT_Raw = (char *)pEvents_LOD->LoadRaw("placemon.txt", 0); strtok(pMonsterPlacementTXT_Raw, "\r"); v2->uNumPlacements = 31; v8 = v2->pPlacement.pSubstrings; v7 = 30; do { v3 = strtok(v1, "\r") + 1; v10 = v1; v9 = (signed int)v1; do { v4 = *v3; v5 = 0; if ( *v3 != 9 ) { v1 = 0; do { if ( !v4 ) break; ++v5; v4 = v3[(unsigned int)v5]; } while ( v4 != 9 ); } v6 = (int)&v3[(unsigned int)v5]; if ( v3[(unsigned int)v5] == (unsigned char)v1 ) v9 = 1; *(unsigned char *)v6 = (unsigned char)v1; if ( v5 == v1 ) { v9 = 1; } else { if ( v10 == (char *)1 ) *v8 = (char *)RemoveQuotes(v3); } ++v10; v3 = (char *)(v6 + 1); } while ( (signed int)(v10 - 1) <= 31 && (char *)v9 == v1 ); ++v8; --v7; } while ( v7 ); v2->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 Str[64]; // [sp+2F4h] [bp-164h]@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 v1 = this; v102 = this; if ( pMonstersTXT_Raw ) pAllocator->FreeChunk(pMonstersTXT_Raw); pMonstersTXT_Raw = 0; pMonstersTXT_Raw = (char *)pEvents_LOD->LoadRaw("monsters.txt", 0); strtok(pMonstersTXT_Raw, "\r"); strtok(0, "\r"); strtok(0, "\r"); strtok(0, "\r"); v103 = 0; v1->uNumMonsters = 265; do { v2 = (int)(strtok(0, "\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].pTexture = 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 ) { sprintfex(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, off_4E8910) ) { 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; }