Mercurial > mm7
changeset 720:05f7a11f4f20
Слияние
author | Ritor1 |
---|---|
date | Tue, 19 Mar 2013 23:41:29 +0600 |
parents | d394cc892106 (current diff) e39702f35283 (diff) |
children | f39d5902c85a |
files | mm7_4.cpp mm7_5.cpp |
diffstat | 17 files changed, 532 insertions(+), 555 deletions(-) [+] |
line wrap: on
line diff
--- a/Allocator.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/Allocator.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -21,6 +21,9 @@ //----- (00426755) -------------------------------------------------------- void *Allocator::AllocNamedChunk(const void *pPrevPtrValue, unsigned int uSize, const char *pName) { + + return malloc(uSize); +/* //Allocator *v4; // esi@1 unsigned int v5; // eax@7 void *result; // eax@8 @@ -83,7 +86,7 @@ uNextFreeOffsetInBigBuffer += aligned_size; } return pMemoryBuffers[uNumBuffersUsed]; - + */ /* //v4 = this; if ( pPrevPtrValue && !aborting_app ) @@ -181,7 +184,9 @@ //----- (00426474) -------------------------------------------------------- void Allocator::FreeChunk(void *ptr) { - Allocator *v2; // esi@1 + free(ptr); + return; +/* Allocator *v2; // esi@1 unsigned int v3; // eax@5 signed int i; // edi@5 unsigned int v5; // eax@13 @@ -201,8 +206,8 @@ for (indx = 0; indx <=uNumBuffersUsed; ++indx) if (pMemoryBuffers[indx] == ptr) break; - if ((indx>uNumBuffersUsed)&& !aborting_app ) - AbortWithError(); //to detect memory problems - uncomment + //if ((indx>uNumBuffersUsed)&& !aborting_app ) + //AbortWithError(); //to detect memory problems - uncomment if (!bUseBigBuffer) free(pMemoryBuffers[indx]); pMemoryBuffers[indx] = NULL; @@ -230,7 +235,7 @@ } } } - + */ /* v2 = this; if ( ptr )
--- a/AudioPlayer.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/AudioPlayer.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -469,8 +469,8 @@ do { *strchr(&Buf, 10) = 0; - memcpy(&v19, texture_frame_table_txt_parser(&Buf, &v18), sizeof(v19)); - if ( v19.field_0 && *v19.pProperties[0] != 47 ) + memcpy(&v19, txt_file_frametable_parser(&Buf, &v18), sizeof(v19)); + if ( v19.uPropCount && *v19.pProperties[0] != 47 ) ++Argsa; } while ( fgets(&Buf, 490, File) ); @@ -489,8 +489,8 @@ for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) { *strchr(&Buf, 10) = 0; - memcpy(&v19, texture_frame_table_txt_parser(&Buf, &v18), sizeof(v19)); - if ( v19.field_0 && *v19.pProperties[0] != 47 ) + memcpy(&v19, txt_file_frametable_parser(&Buf, &v18), sizeof(v19)); + if ( v19.uPropCount && *v19.pProperties[0] != 47 ) { sprintf(v2->pSounds[v2->uNumSounds].pSoundName, "%s", v19.pProperties[0]); v9 = atoi(v19.pProperties[1]); @@ -518,7 +518,7 @@ { v2->pSounds[v2->uNumSounds].eType = SOUND_DESC_SYSTEM; } - if ( v19.field_0 >= 4 && !_strcmpi(v19.pProperties[3], "3D") ) + if ( v19.uPropCount >= 4 && !_strcmpi(v19.pProperties[3], "3D") ) { v15 = (int)&v2->pSounds[v2->uNumSounds].uFlags; *(int *)v15 |= SOUND_DESC_SWAP;
--- a/Chest.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/Chest.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -686,8 +686,8 @@ do { *strchr(&Buf, 10) = 0; - memcpy(&v17, texture_frame_table_txt_parser(&Buf, &v16), sizeof(v17)); - if ( v17.field_0 && *v17.pProperties[0] != 47 ) + memcpy(&v17, txt_file_frametable_parser(&Buf, &v16), sizeof(v17)); + if ( v17.uPropCount && *v17.pProperties[0] != 47 ) ++Argsa; } while ( fgets(&Buf, 490, File) ); @@ -707,8 +707,8 @@ for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) { *strchr(&Buf, 10) = 0; - memcpy(&v17, texture_frame_table_txt_parser(&Buf, &v16), sizeof(v17)); - if ( v17.field_0 && *v17.pProperties[0] != 47 ) + memcpy(&v17, txt_file_frametable_parser(&Buf, &v16), sizeof(v17)); + if ( v17.uPropCount && *v17.pProperties[0] != 47 ) { strcpy(v2->pChests[v2->uNumChests].pName, v17.pProperties[0]); v10 = atoi(v17.pProperties[1]); @@ -726,7 +726,7 @@ //----- (00420B13) -------------------------------------------------------- void __fastcall sub_420B13(int a1, int a2) - { +{ void *v2; // eax@1 ItemGen *v3; // ebx@1 unsigned int v4; // eax@1 @@ -745,16 +745,18 @@ int v17; // [sp+Ch] [bp-14h]@1 int v18; // [sp+10h] [bp-10h]@3 int v19; // [sp+14h] [bp-Ch]@1 - void *v20; // [sp+18h] [bp-8h]@1 + int v20; // [sp+18h] [bp-8h]@1 int v21; // [sp+1Ch] [bp-4h]@5 int v22; // [sp+1Ch] [bp-4h]@8 v19 = a2; v2 = pChestWindow->ptr_1C; - v20 = v2; + v20 = (int)v2; v2 = (void *)(5324 * (int)v2); - v3 = (ItemGen *)((char *)v2 + 36 * a1 + (int)((char *)pChests + 4)); - v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)]; + //v3 = (ItemGen *)((char *)v2 + 36 * a1 + (int)((char *)pChests + 4)); + v3 = &pChests[v20].igChestItems[a1]; + //v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)]; + v17 = pChestWidthsByType[pChests[v20].uChestBitmapID]; v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v3->uItemID].pIconName, TEXTURE_16BIT_PALETTE); v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); v6 = (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureWidth : 24); @@ -769,37 +771,38 @@ v10 = ((v8 - 14) >> 5) + 1; v21 = v10; if ( !areWeLoadingTexture ) - { + { v5->Release(); pIcons_LOD->_40F9C5(); v10 = v21; - } + } if ( v10 > 0 ) - { + { v11 = 0; v22 = v10; do - { + { if ( v9 > 0 ) - { + { v12 = v9; - v13 = &pChests[0].pInventoryIndices[v19 + v11 + 2662 * (int)v20]; + //v13 = &pChests[0].pInventoryIndices[v19 + v11 + 2662 * (int)v20]; + v13 = &pChests[v20].pInventoryIndices[v19 + v11]; v14 = v12 & 1; v12 >>= 1; memset(v13, 0, 4 * v12); v15 = (int)((char *)v13 + 4 * v12); for ( i = v14; i; --i ) - { + { *(short *)v15 = 0; v15 += 2; - } + } v9 = v18; - } + } v11 += v17; --v22; - } - while ( v22 ); } - v3->Reset(); + while ( v22 ); } + v3->Reset(); +} // 506128: using guessed type int areWeLoadingTexture;
--- a/FrameTableInc.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/FrameTableInc.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -1,3 +1,137 @@ #include "FrameTableInc.h" -struct FrameTableTxtLine stru_F8B5E8; // weak +#include <memory.h> +//identical function to work in differnt threads + +//----- (004BE3BF) -------------------------------------------------------- +FrameTableTxtLine* txt_file_frametable_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table) + { + bool new_token_flag; // edx@3 + bool in_quotes; // [sp+Ch] [bp-4h]@3 + char* parse_pos; + unsigned char test_char; + int i; + + static char tokens_buff1[1000]; + static struct FrameTableTxtLine temp_tokens_table1; // weak + + temp_tokens_table1.uPropCount = 0; + if ( str_to_parse && *str_to_parse ) + { + parse_pos=(char*)str_to_parse; + new_token_flag = true; + in_quotes = false; + for(i = 0; (i<1000)&&(temp_tokens_table1.uPropCount < 30) ; ++i) + { + test_char=*parse_pos; + tokens_buff1[i]=test_char; + if ( !test_char ) + break; + if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes ) + { + if ( test_char == '"' ) + { + tokens_buff1[i]= '\0'; + new_token_flag = true; + if ( in_quotes ) + in_quotes = false; + else + { + in_quotes = true; + if ( *(parse_pos+1) == '"' ) + { + temp_tokens_table1.pProperties[temp_tokens_table1.uPropCount] = &tokens_buff1[i]; + ++temp_tokens_table1.uPropCount; + } + } + } + else + { + if ( new_token_flag ) + { + temp_tokens_table1.pProperties[temp_tokens_table1.uPropCount] = &tokens_buff1[i]; + ++temp_tokens_table1.uPropCount; + } + new_token_flag = false; + } + } + else + { + tokens_buff1[i]= '\0'; + new_token_flag = true; + } + ++parse_pos; + } + tokens_buff1[i]= '\0'; + } + memcpy(tokens_table, &temp_tokens_table1, sizeof(FrameTableTxtLine)); + return tokens_table; + } +// F8BA58: using guessed type FrameTableTxtLine static_stru_F8BA58; + +//----- (004BE485) -------------------------------------------------------- +FrameTableTxtLine * frame_table_txt_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table) + { + bool new_token_flag; // edx@3 + bool in_quotes; // [sp+Ch] [bp-4h]@3 + char* parse_pos; + unsigned char test_char; + int i; + + static char tokens_buff2[1000]; + static struct FrameTableTxtLine temp_tokens_table2; // weak + temp_tokens_table2.uPropCount = 0; + + if ( str_to_parse && *str_to_parse ) + { + parse_pos=(char*)str_to_parse; + new_token_flag = true; + in_quotes = false; + for(i = 0; (i<1000)&&(temp_tokens_table2.uPropCount < 30); ++i) + { + test_char=*parse_pos; + tokens_buff2[i]=test_char; + if ( !test_char ) + break; + if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes ) + { + if ( test_char == '"' ) + { + tokens_buff2[i]= '\0'; + new_token_flag = true; + if ( in_quotes ) + in_quotes = false; + else + { + in_quotes = true; + if ( *(parse_pos+1) == '"' ) + { + temp_tokens_table2.pProperties[temp_tokens_table2.uPropCount] = &tokens_buff2[i]; + ++temp_tokens_table2.uPropCount; + } + } + } + else + { + if ( new_token_flag ) + { + temp_tokens_table2.pProperties[temp_tokens_table2.uPropCount] = &tokens_buff2[i]; + ++temp_tokens_table2.uPropCount; + } + new_token_flag = false; + } + } + else + { + tokens_buff2[i]= '\0'; + new_token_flag = true; + } + ++parse_pos; + } + + tokens_buff2[i]= '\0'; + } + memcpy(tokens_table, &temp_tokens_table2, sizeof(FrameTableTxtLine)); + return tokens_table; + } +
--- a/FrameTableInc.h Tue Mar 19 23:41:14 2013 +0600 +++ b/FrameTableInc.h Tue Mar 19 23:41:29 2013 +0600 @@ -13,14 +13,14 @@ /* 359 */ #pragma pack(push, 1) -struct FrameTableTxtLine +struct FrameTableTxtLine //7C { - int field_0; - const char *pProperties[13]; - const char *pProperties2[16]; - int field_78; + int uPropCount; + const char *pProperties[30]; }; #pragma pack(pop) -FrameTableTxtLine *texture_frame_table_txt_parser(const char *_this, FrameTableTxtLine *a2); \ No newline at end of file +FrameTableTxtLine* txt_file_frametable_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table); + +FrameTableTxtLine *frame_table_txt_parser(const char *pString, FrameTableTxtLine *a2); \ No newline at end of file
--- a/GUIButton.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/GUIButton.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -153,7 +153,6 @@ } } --ptr->pParent->uNumControls; - pAllocator->FreeChunk(ptr); } }
--- a/Items.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/Items.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -916,11 +916,6 @@ break; } - if ( pRndItemsTXT_Raw ) - { - pAllocator->FreeChunk(pRndItemsTXT_Raw); - pRndItemsTXT_Raw = NULL; - } //ChanceByTreasureLvl Summ - anti cheating? memset(&uChanceByTreasureLvlSumm, 0, 24); for(i=0;i<6;++i) @@ -1052,6 +1047,12 @@ } while ((decode_step<8)&&!break_loop); } + if ( pRndItemsTXT_Raw ) + { + pAllocator->FreeChunk(pRndItemsTXT_Raw); + pRndItemsTXT_Raw = NULL; + } + pSkillDescTXT_Raw = NULL; pSkillDescTXT_Raw = (char *)pEvents_LOD->LoadRaw("skilldes.txt", 0); strtok(pSkillDescTXT_Raw, "\r");
--- a/LOD.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/LOD.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -2305,11 +2305,11 @@ if ( DstBuf.uDecompressedSize ) { if ( a3 ) - v6 = malloc(DstBuf.uDecompressedSize); + v6 = malloc(DstBuf.uDecompressedSize+1); else - v6 = pAllocator->AllocNamedChunk(0, DstBuf.uDecompressedSize, DstBuf.pName); + v6 = pAllocator->AllocNamedChunk(0, DstBuf.uDecompressedSize+1, DstBuf.pName); v7 = v6; - v8 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize, DstBuf.pName); + v8 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize+1, DstBuf.pName); fread(v8, 1u, Argsa, File); zlib::MemUnzip(v7, &DstBuf.uDecompressedSize, v8, DstBuf.uTextureSize); DstBuf.uTextureSize = DstBuf.uDecompressedSize; @@ -2318,9 +2318,9 @@ else { if ( a3 ) - v9 = malloc(DstBuf.uTextureSize); + v9 = malloc(DstBuf.uTextureSize+1); else - v9 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize, DstBuf.pName); + v9 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize+1, DstBuf.pName); v7 = v9; fread(v9, 1u, Argsa, v5); }
--- a/Monsters.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/Monsters.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -16,7 +16,7 @@ struct MonsterStats *pMonsterStats; struct MonsterList *pMonsterList; -unsigned int __fastcall ParseSpellType(struct FrameTableTxtLine *, int a2); +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 ); @@ -24,238 +24,151 @@ int ParseSpecialAttack(const char *spec_att_str); //----- (004548E2) -------------------------------------------------------- - unsigned int __fastcall ParseSpellType(FrameTableTxtLine *a1, int a2) +unsigned int ParseSpellType( struct FrameTableTxtLine * tbl, int* next_token ) { - int v2; // edi@1 - int v3; // esi@1 - unsigned int result; // eax@1 - std::string v5; // [sp-18h] [bp-28h]@75 - const char *v6; // [sp-8h] [bp-18h]@75 - signed int v7; // [sp-4h] [bp-14h]@3 - std::string *v8; // [sp+8h] [bp-8h]@75 - int a3; // [sp+Fh] [bp-1h]@75 - v2 = (int)a1; - v3 = a2; - result = (int)a1->pProperties[0]; - if ( result ) + 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 { - if ( !_strcmpi((const char *)result, "Dispel") ) - { - v7 = 80; -LABEL_71: - result = v7; -LABEL_76: - ++*(int *)v3; - return result; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Day") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Hour") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Shield") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Spirit") ) - { - v7 = 52; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Power") ) - { - v7 = 77; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Meteor") ) - { - v7 = 9; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Lightning") ) - { - v7 = 18; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Implosion") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Stone") ) - { - v7 = 38; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Haste") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Heroism") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Pain") ) - { - v7 = 95; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Sparks") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Light") ) - { - v7 = 78; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Toxic") ) - { - v7 = 90; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "ShrapMetal") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Paralyze") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Fireball") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Incinerate") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Fire") ) - { - v7 = 2; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Rock") ) - { - v7 = 41; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Mass") ) - { - v7 = 44; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Ice") ) - { - v7 = 26; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Acid") ) - { - v7 = 29; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Bless") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Dragon") ) - { - v7 = 97; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Reanimate") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Summon") ) - { - v7 = 82; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Fate") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Harm") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Mind") ) - { - v7 = 57; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Blades") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Psychic") ) - { - v7 = 65; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Hammerhands") ) - { - sprintf(pTmpBuf, "Unknown monster spell %s", *(int *)(v2 + 4)); - MessageBoxA(nullptr, pTmpBuf, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0); - result = 0; - goto LABEL_76; - } - v7 = 73; - } - else - { - v7 = 39; - } - } - else - { - v7 = 70; - } - } - else - { - v7 = 47; - } - } - else - { - v7 = 89; - } - } - else - { - v7 = 46; - } - } - else - { - v7 = 11; - } - } - else - { - v7 = 6; - } - } - else - { - v7 = 81; - } - } - else - { - v7 = 93; - } - } - else - { - v7 = 15; - } - } - else - { - v7 = 51; - } - } - else - { - v7 = 5; - } - } - else - { - v7 = 20; - } - } - else - { - v7 = 17; - } - return v7; - } - v7 = 86; - } - else - { - v7 = 85; - } - *(int *)v3 += 2; - result = v7; + ++*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; } - return result; + 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) -------------------------------------------------------- @@ -348,8 +261,9 @@ } -int ParseSpecialAttack(const char *spec_att_str) +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") ) @@ -459,7 +373,7 @@ { *strchr(&Buf, 10) = 0; memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25)); - if ( v25.field_0 && *v25.pProperties[0] != 47 ) + if ( v25.uPropCount && *v25.pProperties[0] != 47 ) ++Argsa; } while ( fgets(&Buf, 490, File) ); @@ -478,7 +392,7 @@ *strchr(&Buf, 10) = 0; memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25)); v8 = 0; - if ( v25.field_0 && *v25.pProperties[0] != 47 ) + if ( v25.uPropCount && *v25.pProperties[0] != 47 ) { strcpy(v2->pMonsters[v2->uNumMonsters].pMonsterName, v25.pProperties[0]); v35 = 0; @@ -518,16 +432,16 @@ 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]); + 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.pProperties2[v19 + 4]); - v21 = v19++ + 76 * v2->uNumMonsters; - v2->pMonsters->pSoundSampleIDs[v21] = v20; + v20 = atoi(v25.pProperties[v19 + 16]); + v21 = v19++ ; + v2->pMonsters[v2->uNumMonsters].pSoundSampleIDs[v21] = v20; } while ( v19 < 4 ); ++v2->uNumMonsters; @@ -742,7 +656,7 @@ 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 @@ -765,6 +679,7 @@ int decode_step; int item_counter; int curr_rec_num; + char parse_str[64]; v1 = this; v102 = this; @@ -1079,7 +994,25 @@ 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: @@ -1116,6 +1049,30 @@ 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; @@ -1124,7 +1081,30 @@ 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:
--- a/Overlays.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/Overlays.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -219,8 +219,8 @@ do { *strchr(&Buf, 10) = 0; - memcpy(&v19, texture_frame_table_txt_parser(&Buf, &v18), sizeof(v19)); - if ( v19.field_0 && *v19.pProperties[0] != 47 ) + memcpy(&v19, txt_file_frametable_parser(&Buf, &v18), sizeof(v19)); + if ( v19.uPropCount && *v19.pProperties[0] != 47 ) ++Argsa; } while ( fgets(&Buf, 490, File) ); @@ -240,8 +240,8 @@ for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) { *strchr(&Buf, 10) = 0; - memcpy(&v19, texture_frame_table_txt_parser(&Buf, &v18), sizeof(v19)); - if ( v19.field_0 && *v19.pProperties[0] != 47 ) + memcpy(&v19, txt_file_frametable_parser(&Buf, &v18), sizeof(v19)); + if ( v19.uPropCount && *v19.pProperties[0] != 47 ) { v10 = atoi(v19.pProperties[0]); v11 = v19.pProperties[1];
--- a/Sprites.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/Sprites.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -466,7 +466,7 @@ { *strchr(Buf, '\n') = 0; memcpy(&v43, frame_table_txt_parser(Buf, &v42), sizeof(v43)); - if ( v43.field_0 && *v43.pProperties[0] != '/' ) + if ( v43.uPropCount && *v43.pProperties[0] != '/' ) ++Argsa; } while ( fgets(Buf, 490, File) ); @@ -485,7 +485,7 @@ { *strchr(Buf, 10) = 0; memcpy(&v43, frame_table_txt_parser(Buf, &v42), sizeof(v43)); - if ( v43.field_0 && *v43.pProperties[0] != '/' ) + if ( v43.uPropCount && *v43.pProperties[0] != '/' ) { v8 = v43.pProperties[0]; v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags = 0; @@ -542,7 +542,7 @@ v22 = (int)&v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags; *(int *)v22 |= 0x10u; } - for ( j = 13; j < v43.field_0; ++j ) + for ( j = 13; j < v43.uPropCount; ++j ) { v24 = v43.pProperties[j]; if ( _strcmpi(v43.pProperties[j], "Luminous") )
--- a/mm7_1.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/mm7_1.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -84,10 +84,14 @@ if ( dword_507CC0 ) { dword_507CC0 = 0; - for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) + for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = j ) { - if ( BYTE1(i->field_1C) & 0x80 ) + j=i->pNext; + if ( BYTE1(i->field_1C) & 0x80 ) + { i->Release(); + pAllocator->FreeChunk(i); + } } for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext ) { @@ -3838,6 +3842,9 @@ auto _w = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18 * *((short *)&pChests[0].igChestItems[139].uExpireTime + v1 + 2662 * (unsigned int)pChestWindow->ptr_1C + 3)); + + _w = (ItemGen *)(&pChests[(unsigned int)pChestWindow->ptr_1C] -32 + + 18 * *((short *)&pChests[(unsigned int)pChestWindow->ptr_1C].igChestItems[139].uExpireTime + v1 + 3)); v2 = _w->GetDisplayName(); sub_41C0B8_set_status_string(v2); }
--- a/mm7_2.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/mm7_2.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -2491,196 +2491,6 @@ } } -//----- (004BE3BF) -------------------------------------------------------- -FrameTableTxtLine *texture_frame_table_txt_parser(const char *_this, FrameTableTxtLine *a2) -{ - char *v2; // eax@3 - signed int v3; // edx@3 - unsigned int v4; // edi@3 - char v5; // cl@4 - FrameTableTxtLine *result; // eax@21 - signed int v7; // [sp+Ch] [bp-4h]@3 - - static struct FrameTableTxtLine static_stru_F8BA58; // weak - static_stru_F8BA58.field_0 = 0; - if ( _this && *_this ) - { - int i = 0; - v2 = (char *)&array_F8B668; - v3 = 1; - v7 = 0; - v4 = _this - (char *)&array_F8B668; - do - { - v5 = v2[v4]; - *v2 = v5; - if ( !v5 ) - break; - if ( v5 != 32 && v5 != 44 && v5 != 9 || v7 ) - { - if ( v5 == 34 ) - { - *v2 = 0; - v3 = 1; - if ( v7 ) - { - v7 = 0; - } - else - { - v7 = 1; - if ( v2[v4 + 1] == 34 ) - { - static_stru_F8BA58.pProperties[static_stru_F8BA58.field_0] = v2; - ++static_stru_F8BA58.field_0; - } - } - } - else - { - if ( v3 ) - { - static_stru_F8BA58.pProperties[static_stru_F8BA58.field_0] = v2; - ++static_stru_F8BA58.field_0; - } - v3 = 0; - } - } - else - { - *v2 = 0; - v3 = 1; - } - if ( static_stru_F8BA58.field_0 >= 30 ) - break; - ++v2; - ++i; - } - while (i < 1000); - *v2 = 0; - } - result = a2; - memcpy(a2, &static_stru_F8BA58, 0x7Cu); - return result; -} -// F8BA58: using guessed type FrameTableTxtLine static_stru_F8BA58; - -//----- (004BE485) -------------------------------------------------------- -FrameTableTxtLine *__thiscall frame_table_txt_parser(const char *pString, FrameTableTxtLine *a2) -{ - char *v2; // eax@3 - signed int v3; // edi@3 - signed int v4; // edx@3 - char v5; // cl@4 - FrameTableTxtLine *result; // eax@24 - unsigned int v7; // [sp+Ch] [bp-4h]@3 - - stru_F8B5E8.field_0 = 0; - if ( pString && *pString ) - { - v2 = (char *)&unk_F8B1F8; - v3 = 0; - v7 = pString - (const char *)&unk_F8B1F8; - v4 = 1; - while ( 1 ) - { - v5 = v2[v7]; - *v2 = v5; - if ( !v5 ) - { -//LABEL_23: - *v2 = 0; - break; - } - if ( v5 == ',' ) - { - if ( v3 ) - { - if ( v4 ) - { - stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; - ++stru_F8B5E8.field_0; - } - v4 = 0; - } - else - { - *v2 = 0; - v4 = 1; - } - } - else - { - if ( v5 != '\t' ) - { - if ( v5 == '"' ) - { - *v2 = 0; - v4 = 1; - if ( v3 ) - { - v3 = 0; - } - else - { - v3 = 1; - if ( v2[v7 + 1] == 34 ) - { - stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; - ++stru_F8B5E8.field_0; - } - } - } - else - { -//LABEL_18: - if ( v4 ) - { - stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; - ++stru_F8B5E8.field_0; - } - v4 = 0; - } - } - else - { - if ( v3 ) - { - if ( v4 ) - { - stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; - ++stru_F8B5E8.field_0; - } - v4 = 0; - } - else - { - *v2 = 0; - if ( v4 ) - { - stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; - ++stru_F8B5E8.field_0; - } - v4 = 1; - } - } - } -//LABEL_21: - if ( stru_F8B5E8.field_0 < 30 ) - { - ++v2; - if ( (unsigned int)v2 < (unsigned int)&unk_F8B5E0 ) - continue; - } - *v2 = 0; - break; - } - } - result = a2; - memcpy(a2, &stru_F8B5E8, 0x7Cu); - return result; -} -// F8B5E8: using guessed type FrameTableTxtLine stru_F8B5E8; @@ -4954,7 +4764,7 @@ do { *strchr(&Buf, 10) = 0; - memcpy(&v21, texture_frame_table_txt_parser(&Buf, &v20), 0x7Cu); + memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu); if ( v21 && *Str1 != 47 ) { if ( v21 < 2 ) @@ -4978,7 +4788,7 @@ for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) { *strchr(&Buf, 10) = 0; - memcpy(&v21, texture_frame_table_txt_parser(&Buf, &v20), 0x7Cu); + memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu); if ( v21 && *Str1 != 47 ) { strcpy(v2->pTextures[v2->uNumTextures].pTextureName, Str1); @@ -7263,7 +7073,7 @@ { *strchr(&Buf, 10) = 0; memcpy(&v42, frame_table_txt_parser(&Buf, &v41), sizeof(v42)); - if ( v42.field_0 && *v42.pProperties[0] != 47 && v42.field_0 >= 3 ) + if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 ) ++Argsa; } while ( fgets(&Buf, 490, File) ); @@ -7281,7 +7091,7 @@ { *strchr(&Buf, 10) = 0; memcpy(&v42, frame_table_txt_parser(&Buf, &v38), sizeof(v42)); - if ( v42.field_0 && *v42.pProperties[0] != 47 && v42.field_0 >= 3 ) + if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 ) { strcpy(v2->pDecorations[v2->uNumDecorations].pName, v42.pProperties[1]); v8 = pSpriteFrameTable->FastFindSprite(v2->pDecorations[v2->uNumDecorations].pName); @@ -7309,15 +7119,15 @@ v22 = v42.pProperties[9]; v2->pDecorations[v2->uNumDecorations].uColoredLightBlue = v21; v2->pDecorations[v2->uNumDecorations].uSoundID = atoi(v22); - v25 = __OFSUB__(v42.field_0, 10); - v23 = v42.field_0 == 10; - v24 = v42.field_0 - 10 < 0; + v25 = __OFSUB__(v42.uPropCount, 10); + v23 = v42.uPropCount == 10; + v24 = v42.uPropCount - 10 < 0; v2->pDecorations[v2->uNumDecorations].uFlags = 0; if ( !((unsigned __int8)(v24 ^ v25) | v23) ) { strcpy(&Dest, v42.pProperties[10]); memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41)); - for ( j = 0; j < v41.field_0; ++j ) + for ( j = 0; j < v41.uPropCount; ++j ) { v27 = v41.pProperties[j]; if ( _strcmpi(v41.pProperties[j], "NBM") ) @@ -7505,7 +7315,7 @@ { *strchr(&Buf, 10) = 0; memcpy(&v45, frame_table_txt_parser(&Buf, &v44), sizeof(v45)); - if ( v45.field_0 && *v45.pProperties[0] != '/' ) + if ( v45.uPropCount && *v45.pProperties[0] != '/' ) ++Argsa; } while ( fgets(&Buf, 490, File) ); @@ -7525,7 +7335,7 @@ { *strchr(&Buf, 10) = 0; memcpy(&v45, frame_table_txt_parser(&Buf, &v41), sizeof(v45)); - if ( v45.field_0 && *v45.pProperties[0] != 47 ) + if ( v45.uPropCount && *v45.pProperties[0] != 47 ) { strcpy(v2->pObjects[v2->uNumObjects].field_0, v45.pProperties[0]); v9 = pSpriteFrameTable->FastFindSprite((char *)v45.pProperties[1]); @@ -7548,9 +7358,9 @@ v2->pObjects[v2->uNumObjects].uSpeed = v19; strcpy(&Dest, v20); memcpy(&v44, frame_table_txt_parser(&Dest, &v40), sizeof(v44)); - if ( v45.field_0 > 7 ) - { - for ( Argsb = 0; Argsb < v44.field_0; ++Argsb ) + if ( v45.uPropCount > 7 ) + { + for ( Argsb = 0; Argsb < v44.uPropCount; ++Argsb ) { v21 = Argsb; v22 = v44.pProperties[Argsb];
--- a/mm7_4.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/mm7_4.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -1947,8 +1947,8 @@ for ( i = v3; fgets(&Buf, 490, i); i = File ) { *strchr(&Buf, 10) = 0; - memcpy(&v84, texture_frame_table_txt_parser(&Buf, &v85), sizeof(v84)); - if ( v84.field_0 && *v84.pProperties[0] != 47 ) + memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84)); + if ( v84.uPropCount && *v84.pProperties[0] != 47 ) ++v4; } v2->uNumTiles = v4; @@ -1964,8 +1964,8 @@ while ( 1 ) { *strchr(&Buf, 10) = 0; - memcpy(&v84, texture_frame_table_txt_parser(&Buf, &v85), sizeof(v84)); - if ( v84.field_0 ) + memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84)); + if ( v84.uPropCount ) { if ( *v84.pProperties[0] != 47 ) break; @@ -2196,7 +2196,7 @@ { LOBYTE(v2->pTiles[v2->uNumTiles].uSection) = -1; LABEL_152: - for ( j = 5; j < v84.field_0; ++j ) + for ( j = 5; j < v84.uPropCount; ++j ) { v72 = v84.pProperties[j]; if ( _strcmpi(v84.pProperties[j], "TTattr_Burn") ) @@ -4430,10 +4430,10 @@ do { *strchr(&Buf, 10) = 0; - memcpy(&v24, texture_frame_table_txt_parser(&Buf, &v23), sizeof(v24)); - if ( v24.field_0 && *v24.pProperties[0] != 47 ) - { - if ( v24.field_0 < 3 ) + memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); + if ( v24.uPropCount && *v24.pProperties[0] != 47 ) + { + if ( v24.uPropCount < 3 ) Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); ++v25; } @@ -4453,8 +4453,8 @@ for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) { *strchr(&Buf, 10) = 0; - memcpy(&v24, texture_frame_table_txt_parser(&Buf, &v23), sizeof(v24)); - if ( v24.field_0 && *v24.pProperties[0] != 47 ) + memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); + if ( v24.uPropCount && *v24.pProperties[0] != 47 ) { v8 = atoi(v24.pProperties[0]); v9 = v24.pProperties[1]; @@ -4465,7 +4465,7 @@ v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); v2->pFrames[v2->uNumFrames].uAnimLength = 0; v2->pFrames[v2->uNumFrames].uFlags = 0; - for ( j = 3; j < v24.field_0; ++j ) + for ( j = 3; j < v24.uPropCount; ++j ) { if ( !_strcmpi(v24.pProperties[j], "New") ) { @@ -4668,9 +4668,9 @@ { *strchr(&Buf, 10) = 0; memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); - if ( v20.field_0 && *v20.pProperties[0] != 47 ) - { - if ( v20.field_0 < 3 ) + if ( v20.uPropCount && *v20.pProperties[0] != 47 ) + { + if ( v20.uPropCount < 3 ) Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); ++v21; } @@ -4691,7 +4691,7 @@ { *strchr(&Buf, 10) = 0; memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); - if ( v20.field_0 && *v20.pProperties[0] != 47 ) + if ( v20.uPropCount && *v20.pProperties[0] != 47 ) { strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); @@ -11052,6 +11052,7 @@ unsigned __int8 v9; // zf@16 char v10; // sf@16 unsigned __int8 v11; // of@16 + bool test; auto a2 = _2da_idx; //v2 = p2DEvents_minus1___00[26 * a2]; @@ -11062,46 +11063,84 @@ if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771) && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen()) return 0; - v6 = v2 - 1; - if ( !v6 ) + switch( p2DEvents[a2 - 1].uType ) + { + case BildingType_WeaponShop: + { + test = v5 <= 2; + break; + } + case BildingType_ArmorShop: + { + test = v5 >= 3; + break; + } + case BildingType_MagicShop: + { + test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16; + break; + } + case BildingType_AlchemistShop: + { + __debugbreak(); // need to test + test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771); + break; + } + default: + { + test = 0; + break; + } + } + + return test; +/* + if ( p2DEvents[a2 - 1].uType == 1 ) { v11 = __OFSUB__(v5, 2); v9 = v5 == 2; v10 = v5 - 2 < 0; goto LABEL_23; } - v7 = v6 - 1; - if ( v7 ) - { - v8 = v7 - 1; - if ( !v8 ) + if ( p2DEvents[a2 - 1].uType > 2 ) + { + if ( p2DEvents[a2 - 1].uType == 3 ) { if ( pItemsTable->pItems[v4].uSkillType != 38 ) return v5 == 16; return 1; } - if ( v8 != 1 || v5 < 13 ) + if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) return 0; - if ( v5 <= 14 ) - return 1; - if ( v5 != 17 || (signed int)v3 < 740 ) - return 0; - v11 = __OFSUB__(v3, 771); - v9 = v3 == 771; - v10 = ((v3 - 771) & 0x80000000u) != 0; + if ( p2DEvents[a2 - 1].uType == 4) + { + if ( v5 < 13 ) + return 0; + if ( v5 <= 14 ) + return 1; + if ( v5 != 17 || (signed int)v3 < 740 ) + return 0; + v11 = __OFSUB__(v3, 771); + v9 = v3 == 771; + v10 = ((v3 - 771) & 0x80000000u) != 0; LABEL_23: - if ( !((unsigned __int8)(v10 ^ v11) | v9) ) - return 0; - return 1; - } - if ( v5 >= 3 ) - { - v11 = __OFSUB__(v5, 9); - v9 = v5 == 9; - v10 = v5 - 9 < 0; - goto LABEL_23; + if ( !((unsigned __int8)(v10 ^ v11) | v9) ) + return 0; + return 1; + } + } + if ( p2DEvents[a2 - 1].uType == 2 ) + { + if ( v5 >= 3 ) + { + v11 = __OFSUB__(v5, 9); + v9 = v5 == 9; + v10 = v5 - 9 < 0; + goto LABEL_23; + } } return 0; +*/ }
--- a/mm7_5.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/mm7_5.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -2284,8 +2284,8 @@ case UIMSG_DD: LABEL_524: sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer); - memcpy(&v216, texture_frame_table_txt_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); - if ( v216.field_0 == 1 ) + memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); + if ( v216.uPropCount == 1 ) { pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubIndices / 2); v70 = atoi(v216.pProperties[0]); @@ -2328,7 +2328,7 @@ } else { - if ( v216.field_0 != 3 ) + if ( v216.uPropCount != 3 ) //goto LABEL_90; { v1 = "";
--- a/mm7_data.cpp Tue Mar 19 23:41:14 2013 +0600 +++ b/mm7_data.cpp Tue Mar 19 23:41:29 2013 +0600 @@ -2180,9 +2180,9 @@ char byte_F8B1EF[777]; // weak char byte_F8B1F0[4]; int dword_F8B1F4; // weak -_UNKNOWN unk_F8B1F8; // weak -_UNKNOWN unk_F8B5E0; // weak -char array_F8B668[1000]; // weak + + + //_UNKNOWN unk_F8BA50; // weak char byte_F8BC0C; // weak int bGameoverLoop = 0; // weak
--- a/mm7_data.h Tue Mar 19 23:41:14 2013 +0600 +++ b/mm7_data.h Tue Mar 19 23:41:29 2013 +0600 @@ -1704,10 +1704,10 @@ extern char byte_F8B1EF[]; // weak extern char byte_F8B1F0[4]; extern int dword_F8B1F4; // weak -extern _UNKNOWN unk_F8B1F8; // weak -extern _UNKNOWN unk_F8B5E0; // weak -extern struct FrameTableTxtLine stru_F8B5E8; // weak -extern char array_F8B668[]; // weak + + + + //extern _UNKNOWN unk_F8BA50; // weak extern char byte_F8BC0C; // weak extern int bGameoverLoop; // weak @@ -2326,8 +2326,7 @@ signed int __cdecl sub_4BD8B5(); bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx); void __cdecl sub_4BDB56_buy_skill____(); -struct FrameTableTxtLine *__thiscall texture_frame_table_txt_parser(const char *_this, FrameTableTxtLine *a2); -struct FrameTableTxtLine *__thiscall frame_table_txt_parser(const char *pString, FrameTableTxtLine *a2); + void __cdecl ShowIntroVideo_and_LoadingScreen(); unsigned int __thiscall GameOverMenu(void *ecx0);