Mercurial > mm7
changeset 394:172f1f9f55f4
Слияние
author | Ritor1 |
---|---|
date | Fri, 22 Feb 2013 18:32:47 +0600 |
parents | c1a45052d634 (current diff) 6e984a4a896f (diff) |
children | 6c3f8694005f |
files | |
diffstat | 17 files changed, 559 insertions(+), 757 deletions(-) [+] |
line wrap: on
line diff
--- a/Allocator.cpp Fri Feb 22 18:32:34 2013 +0600 +++ b/Allocator.cpp Fri Feb 22 18:32:47 2013 +0600 @@ -24,7 +24,7 @@ //Allocator *v4; // esi@1 unsigned int v5; // eax@7 void *result; // eax@8 - unsigned int *pNumBuffersUsed; // ebx@12 + // unsigned int *pNumBuffersUsed; // ebx@12 unsigned int v8; // edi@15 char v9; // zf@15 int v10; // eax@16 @@ -32,6 +32,59 @@ void *v12; // eax@22 unsigned int Size; // [sp+14h] [bp+Ch]@16 + int aligned_size; + + + if ( pPrevPtrValue && !aborting_app ) + AbortWithError(); + if ( !bBigBufferAllocated && !aborting_app ) + AbortWithError(); + + if (!uSize) + return 0; + + if (((uSize & 0x80000000u) != 0) && !aborting_app) + AbortWithError(); + + if (uNumBuffersUsed == 6000 && !aborting_app) + AbortWithError(); + + ++uNumBuffersUsed; + + if (!bUseBigBuffer) + { + pMemoryBuffers[uNumBuffersUsed] = malloc(uSize); + if (pMemoryBuffers[uNumBuffersUsed]) + uMemoryBuffersSizes[uNumBuffersUsed] = uSize; + else + { + if ( !aborting_app ) + AbortWithError(); + } + } + else + { + + aligned_size =(uSize&0xFFFFFFFC) + 4; + + if ((uNextFreeOffsetInBigBuffer +aligned_size) > uBigBufferSizeAligned) + { + printf("Id: %s Size: %i", pName, aligned_size); + CreateFileDump( "Memory"); + if ( !aborting_app ) + AbortWithError(); + } + + pMemoryBuffers[uNumBuffersUsed] = (char *)(pBigBufferAligned) + uNextFreeOffsetInBigBuffer; + uMemoryBuffersSizes[uNumBuffersUsed] =aligned_size; + + if (pName) + strncpy(pMemoryBuffersNames[uNumBuffersUsed], pName, 11); + uNextFreeOffsetInBigBuffer += aligned_size; + } + return pMemoryBuffers[uNumBuffersUsed]; + + /* //v4 = this; if ( pPrevPtrValue && !aborting_app ) AbortWithError(); @@ -94,7 +147,7 @@ { result = 0; } - return result; + return result;*/ } // 720018: using guessed type int aborting_app; @@ -113,7 +166,8 @@ if (!pBigMemoryBuffer) return false; - pBigBufferAligned = (char *)pBigMemoryBuffer + -((unsigned __int16)pBigMemoryBuffer & 0xFFF) + 4096; + pBigBufferAligned = (void *)((unsigned int)(pBigMemoryBuffer) & 0xFFFF0000 + 4096); + //(char *)pBigMemoryBuffer + -((unsigned __int16)pBigMemoryBuffer & 0xFFF) + 4096; uBigBufferSizeAligned = (uNumKBytes * 1024) - 4096; uNumBuffersUsed = 0; @@ -135,6 +189,49 @@ signed int j; // edx@16 char v8; // zf@20 + + + unsigned int uBuffindx; + unsigned int indx; + + if (ptr) + { + if ((!bBigBufferAllocated)&& (!aborting_app )) + AbortWithError(); + for (indx = 0; indx <=uNumBuffersUsed; ++indx) + if (pMemoryBuffers[indx] == ptr) + break; + // if ((indx>uNumBuffersUsed)&& !aborting_app ) +// AbortWithError(); to detect memory problems - uncomment + if (!bUseBigBuffer) + free(pMemoryBuffers[indx]); + pMemoryBuffers[indx] = NULL; + uMemoryBuffersSizes[indx] = 0; + pMemoryBuffersNames[indx][0] = 0; + if (indx == (uNumBuffersUsed-1)) + { + if (indx>0) + { + uBuffindx = 0; + for (j = 0; j < uNumBuffersUsed-1; ++j) + { + if (pMemoryBuffers[j]) + uBuffindx = j; + } + uNumBuffersUsed = uBuffindx + 1; + if (bUseBigBuffer) + uNextFreeOffsetInBigBuffer = + ((long)((char*)pMemoryBuffers[uBuffindx] -(char*)pBigBufferAligned)+ uMemoryBuffersSizes[uBuffindx]); + } + else + { + uNumBuffersUsed = 0; + uNextFreeOffsetInBigBuffer = 0; + } + } + } + +/* v2 = this; if ( ptr ) { @@ -177,7 +274,7 @@ v2->uNumBuffersUsed = 0; } } - } + }*/ } // 720018: using guessed type int aborting_app;
--- a/GUIWindow.cpp Fri Feb 22 18:32:34 2013 +0600 +++ b/GUIWindow.cpp Fri Feb 22 18:32:47 2013 +0600 @@ -985,10 +985,10 @@ { if (!chapter->bIsSpellAvailable[i]) continue; - - v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); - CreateButton(pViewport->uViewportX + pIconPos[v4].Xpos, - pViewport->uViewportY + pIconPos[v4].Ypos, //dword_4E20D0 + v4= pPlayer->lastOpenedSpellbookPage; + //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); + CreateButton(pViewport->uViewportX + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Xpos, + pViewport->uViewportY + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos, //dword_4E20D0 dword_506408[i + 1]->uTextureWidth, dword_506408[i + 1]->uTextureHeight, 1, 79, 0x56u, i, 0, "", 0); @@ -1171,7 +1171,7 @@ sub_4B6478(); break; case 1: - sub_4B910F(); + _4B910F_shop_interaction(); break; case 2: sub_4BA928(); @@ -1233,14 +1233,14 @@ LABEL_58: if ( array_5913D8[6] == (NPCData *)uNumDialogueNPCPortraits && uHouse_ExitPic ) { - pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); + pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, (Texture *)(uTextureID_x_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); v16 = (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0); v14 = 451; v12 = 476; } else { - v16 = (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0); + v16 = (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0); v14 = 445; v12 = 471; }
--- a/GUIWindow.h Fri Feb 22 18:32:34 2013 +0600 +++ b/GUIWindow.h Fri Feb 22 18:32:47 2013 +0600 @@ -226,7 +226,7 @@ UIMSG_InventoryLeftClick = 0x78, UIMSG_SkillUp = 0x79, UIMSG_7A = 0x7A, - UIMSG_7B = 0x7B, + UIMSG_GameMenu_ReturnToGame = 0x7B, UIMSG_StartNewGame = 0x7C, UIMSG_Game_OpenLoadGameDialog = 0x7D, UIMSG_Game_OpenSaveGameDialog = 0x7E,
--- a/Items.cpp Fri Feb 22 18:32:34 2013 +0600 +++ b/Items.cpp Fri Feb 22 18:32:47 2013 +0600 @@ -493,82 +493,82 @@ { if ( !_strcmpi(test_string, "weapon") ) { - pItems[item_counter].uEquipType = 0; + pItems[item_counter].uEquipType = EQUIP_ONE_OR_TWO_HANDS; break; } if ( !_strcmpi(test_string, "weapon2") ) { - pItems[item_counter].uEquipType = 1; + pItems[item_counter].uEquipType = EQUIP_TWO_HANDED; break; } if ( !_strcmpi(test_string, "weapon1or2") ) { - pItems[item_counter].uEquipType = 0; + pItems[item_counter].uEquipType = EQUIP_ONE_OR_TWO_HANDS; break; } if ( !(_strcmpi(test_string, "missile")&&_strcmpi(test_string, "bow"))) { - pItems[item_counter].uEquipType = 2; + pItems[item_counter].uEquipType = EQUIP_BOW; break; } if ( !_strcmpi(test_string, "armor") ) { - pItems[item_counter].uEquipType = 3; + pItems[item_counter].uEquipType = EQUIP_ARMOUR; break; } if ( !_strcmpi(test_string, "shield") ) { - pItems[item_counter].uEquipType = 4; + pItems[item_counter].uEquipType = EQUIP_SHIELD; break; } if ( !_strcmpi(test_string, "helm") ) { - pItems[item_counter].uEquipType = 5; + pItems[item_counter].uEquipType = EQUIP_HELMET; break; } if ( !_strcmpi(test_string, "belt") ) { - pItems[item_counter].uEquipType = 6; + pItems[item_counter].uEquipType = EQUIP_BELT; break; } if ( !_strcmpi(test_string, "cloak") ) { - pItems[item_counter].uEquipType = 7; + pItems[item_counter].uEquipType = EQUIP_CLOAK; break; } if ( !_strcmpi(test_string, "gauntlets") ) { - pItems[item_counter].uEquipType = 8; + pItems[item_counter].uEquipType = EQUIP_GAUNTLETS; break; } if ( !_strcmpi(test_string, "boots") ) { - pItems[item_counter].uEquipType = 9; + pItems[item_counter].uEquipType = EQUIP_BOOTS; break; } if ( !_strcmpi(test_string, "ring") ) { - pItems[item_counter].uEquipType = 10; + pItems[item_counter].uEquipType = EQUIP_RING; break; } if ( !_strcmpi(test_string, "amulet") ) { - pItems[item_counter].uEquipType = 11; + pItems[item_counter].uEquipType = EQUIP_AMULET; break; } if ( !_strcmpi(test_string, "weaponw") ) { - pItems[item_counter].uEquipType = 12; + pItems[item_counter].uEquipType = EQUIP_WAND; break; } if ( !(_strcmpi(test_string, "herb")&&_strcmpi(test_string, "reagent"))) { - pItems[item_counter].uEquipType = 13; + pItems[item_counter].uEquipType = EQUIP_REAGENT; break; } if ( !_strcmpi(test_string, "bottle") ) { - pItems[item_counter].uEquipType = 14; + pItems[item_counter].uEquipType = EQUIP_POTION; break; } if ( !_strcmpi(test_string, "sscroll") ) @@ -578,7 +578,7 @@ } if ( !_strcmpi(test_string, "book") ) { - pItems[item_counter].uEquipType = 16; + pItems[item_counter].uEquipType = EQUIP_BOOK; break; } if ( !_strcmpi(test_string, "mscroll") ) @@ -588,15 +588,15 @@ } if ( !_strcmpi(test_string, "gold") ) { - pItems[item_counter].uEquipType = 18; + pItems[item_counter].uEquipType = EQUIP_GOLD; break; } if ( !_strcmpi(test_string, "gem") ) { - pItems[item_counter].uEquipType = 19; + pItems[item_counter].uEquipType = EQUIP_GEM; break; } - pItems[item_counter].uEquipType = 20; + pItems[item_counter].uEquipType = EQUIP_NONE; break; } case 5: //Skill Group @@ -1417,13 +1417,10 @@ //----- (00456499) -------------------------------------------------------- const char *ItemGen::GetDisplayName() { - const char *result; // eax@2 - - if ( this->uAttributes & ITEM_IDENTIFIED ) - result = GetIdentifiedName(); + if (Identified()) + return GetIdentifiedName(); else - result = pItemsTable->pItems[uItemID].pUnidentifiedName; - return result; + return pItemsTable->pItems[uItemID].pUnidentifiedName; } //----- (004564B3) --------------------------------------------------------
--- a/Items.h Fri Feb 22 18:32:34 2013 +0600 +++ b/Items.h Fri Feb 22 18:32:47 2013 +0600 @@ -63,26 +63,27 @@ /* 331 */ enum ITEM_EQUIP_TYPE { - EQUIP_ONE_OR_TWO_HANDS = 0x0, - EQUIP_TWO_HANDED = 0x1, - EQUIP_BOW = 0x2, - EQUIP_ARMOUR = 0x3, - EQUIP_SHIELD = 0x4, - EQUIP_HELMET = 0x5, - EQUIP_BELT = 0x6, - EQUIP_CLOAK = 0x7, + EQUIP_ONE_OR_TWO_HANDS = 0, + EQUIP_TWO_HANDED = 1, + EQUIP_BOW = 2, + EQUIP_ARMOUR = 3, + EQUIP_SHIELD = 4, + EQUIP_HELMET = 5, + EQUIP_BELT = 6, + EQUIP_CLOAK = 7, EQUIP_GAUNTLETS = 0x8, EQUIP_BOOTS = 0x9, - EQUIP_RING = 0xA, - EQUIP_AMULET = 0xB, + EQUIP_RING = 10, + EQUIP_AMULET = 11, EQUIP_WAND = 12, - EQUIP_REAGENT = 0xD, - EQUIP_POTION = 0xE, + EQUIP_REAGENT = 13, + EQUIP_POTION = 14, EQUIP_F = 0xF, - EQUIP_BOOK = 0x10, - EQUIP_11 = 0x11, + EQUIP_BOOK = 16, + EQUIP_11 = 17, EQUIP_GOLD = 18, - EQUIP_GEM = 0x13, + EQUIP_GEM = 19, + EQUIP_NONE = 20 }; @@ -140,8 +141,8 @@ unsigned int uValue; //10 14 unsigned __int16 uSpriteID; //14 18 __int16 field_1A; //16 - unsigned __int16 uEquipX; //18 1c - unsigned __int16 uEquipY; //1a 1e + signed __int16 uEquipX; //18 1c + signed __int16 uEquipY; //1a 1e unsigned __int8 uEquipType; //1c 20 unsigned __int8 uSkillType; //1d 21 unsigned __int8 uDamageDice; //1e 22
--- a/Player.cpp Fri Feb 22 18:32:34 2013 +0600 +++ b/Player.cpp Fri Feb 22 18:32:47 2013 +0600 @@ -1909,7 +1909,6 @@ return result; } - //----- (0049107D) -------------------------------------------------------- int Player::GetBodybuilding() {
--- a/Spells.cpp Fri Feb 22 18:32:34 2013 +0600 +++ b/Spells.cpp Fri Feb 22 18:32:47 2013 +0600 @@ -17,10 +17,11 @@ stru324_spell stru_4E3ACC[102]; - + //9 spellbook pages 11 spells per page 9*11 =99 +1 zero struct at 0. It counted from 1! SpellData pSpellDatas[100]={ - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 1, 1, 60, 60, 60, 40, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + + {1, 1, 1, 1, 60, 60, 60, 40, 0, 0},//0 {2, 2, 2, 2, 110, 110, 100, 90, 768, 0}, {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, {4, 4, 4, 4, 120, 120, 120, 120, 0, 0}, @@ -31,7 +32,8 @@ {20, 20, 20, 20, 100, 100, 100, 90, 264, 0}, {25, 25, 25, 25, 100, 100, 100, 90, 268, 0}, {30, 30, 30, 30, 90, 90, 90, 90, 3855, 0}, - {1, 1, 1, 0, 60, 60, 60, 60, 0, 0}, + + {1, 1, 1, 0, 60, 60, 60, 60, 0, 0}, //1 {2, 2, 2, 2, 120, 120, 120, 100, 0, 0}, {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, {4, 4, 4, 4, 110, 100, 90, 80, 258, 0}, @@ -42,7 +44,8 @@ {20, 20, 20, 20, 100, 100, 100, 90, 2570, 0}, {25, 25, 25, 25, 250, 250, 250, 250, 0, 0}, {30, 30, 30, 30, 90, 90, 90, 90, 276, 0}, - {1, 1, 1, 1, 60, 60, 60, 20, 0, 0}, + + {1, 1, 1, 1, 60, 60, 60, 20, 0, 0}, //2 {2, 2, 2, 2, 110, 100, 90, 70, 514, 0}, {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, {4, 4, 4, 4, 110, 100, 90, 80, 1024, 0}, @@ -53,7 +56,8 @@ {20, 20, 20, 20, 200, 200, 200, 200, 0, 0}, {25, 25, 25, 25, 80, 80, 80, 80, 780, 0}, {30, 30, 30, 30, 250, 250, 250, 250, 0, 0}, - {1, 1, 1, 1, 80, 80, 80, 80, 0, 0}, + + {1, 1, 1, 1, 80, 80, 80, 80, 0, 0}, //3 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0}, {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, {4, 4, 4, 4, 110, 100, 90, 80, 773, 0}, @@ -64,7 +68,8 @@ {20, 20, 20, 20, 150, 150, 150, 150, 0, 0}, {25, 25, 25, 25, 100, 100, 100, 90, 276, 0}, {30, 30, 30, 30, 90, 90, 90, 90, 25, 0}, - {1, 1, 1, 1, 100, 100, 100, 100, 0, 0}, + + {1, 1, 1, 1, 100, 100, 100, 100, 0, 0}, //4 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0}, {3, 3, 3, 3, 90, 90, 90, 90, 0, 0}, {4, 4, 4, 4, 120, 120, 120, 120, 0, 0}, @@ -75,7 +80,8 @@ {20, 20, 20, 20, 240, 240, 240, 240, 0, 0}, {25, 25, 25, 25, 150, 150, 150, 150, 0, 0}, {30, 30, 30, 30, 1000, 1000, 1000, 1000, 0, 0}, - {1, 1, 1, 1, 120, 120, 120, 120, 0, 0}, + + {1, 1, 1, 1, 120, 120, 120, 120, 0, 0}, //5 {2, 2, 2, 2, 110, 110, 110, 110, 771, 0}, {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, {4, 4, 4, 4, 110, 100, 90, 80, 0, 0}, @@ -86,7 +92,8 @@ {20, 20, 20, 20, 120, 120, 120, 120, 0, 0}, {25, 25, 25, 25, 110, 110, 110, 100, 268, 0}, {30, 30, 30, 30, 120, 120, 120, 120, 0, 0}, - {1, 1, 1, 1, 120, 120, 120, 120, 0, 0}, + + {1, 1, 1, 1, 120, 120, 120, 120, 0, 0}, //6 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0}, {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, {4, 4, 4, 4, 110, 100, 90, 80, 520, 0}, @@ -97,7 +104,8 @@ {20, 20, 20, 20, 120, 120, 120, 120, 0, 0}, {25, 25, 25, 25, 110, 110, 110, 100, 1310, 0}, {30, 30, 30, 30, 100, 100, 100, 100, 0, 0}, - {5, 5, 5, 5, 110, 100, 90, 80, 1024, 0}, + + {5, 5, 5, 5, 110, 100, 90, 80, 1024, 0}, //7 {10, 10, 10, 10, 120, 110, 100, 90, 4112, 0}, {15, 15, 15, 15, 120, 110, 100, 90, 0, 0}, {20, 20, 20, 20, 160, 140, 120, 100, 0, 0}, @@ -108,7 +116,8 @@ {45, 45, 45, 45, 250, 250, 250, 250, 0, 0}, {50, 50, 50, 50, 150, 150, 150, 135, 5140, 0}, {55, 55, 55, 55, 300, 300, 300, 300, 0, 0}, - {10, 10, 10, 10, 140, 140, 140, 140, 0, 0}, + + {10, 10, 10, 10, 140, 140, 140, 140, 0, 0}, //8 {15, 15, 15, 15, 120, 110, 100, 90, 2585, 0}, {20, 20, 20, 20, 120, 100, 90, 120, 0, 0}, {25, 25, 25, 25, 120, 120, 120, 120, 0, 0}, @@ -122,7 +131,7 @@ }; unsigned char pSpellbookSpellIndices[9][12] = // 4E2430 - { + { //0 1 2 3 4 5 6 7 8 9 10 11 {0, 3, 1, 8, 11, 7, 4, 10, 6, 2, 5, 9}, {0, 11, 2, 9, 6, 8, 5, 10, 3, 7, 1, 4}, {0, 4, 8, 9, 1, 10, 3, 11, 7, 6, 2, 5}, @@ -134,123 +143,43 @@ {0, 9, 3, 7, 1, 5, 2, 10, 11, 8, 6, 4} }; - struct SpellBookIconPos pIconPos[108]={ - {0, 0}, - {17, 13}, - {115, 2}, - {217, 15}, - {299, 6}, - {28, 125}, - {130, 133}, - {294, 114}, - {11, 232}, - {134, 233}, - {237, 171}, - {296, 231}, + struct SpellBookIconPos pIconPos[9][12]={ + + {{ 0, 0}, { 17, 13}, {115, 2}, {217, 15}, + {299, 6}, { 28, 125}, {130, 133}, {294, 114}, + { 11, 232}, {134, 233}, {237, 171}, {296, 231}}, - {0, 0}, - {19, 9}, - {117, 3}, - {206, 13}, - {285, 7}, - {16, 123}, - {113, 101}, - {201, 118}, - {317, 110}, - {11, 230}, - {149, 236}, - {296, 234}, + {{ 0, 0}, {19, 9}, {117, 3}, {206, 13}, + {285, 7}, {16, 123}, {113, 101}, {201, 118}, + {317, 110}, {11, 230}, {149, 236}, {296, 234}}, - {0, 0}, - {17, 9}, - {140, 0}, - {210, 34}, - {293, 5}, - {15, 98}, - {78, 121}, - {175, 136}, - {301, 115}, - {15, 226}, - {154, 225}, - {272, 220}, + {{ 0, 0}, {17, 9}, {140, 0}, {210, 34}, + {293, 5}, {15, 98}, { 78, 121}, {175, 136}, + {301, 115}, {15, 226}, {154, 225}, {272, 220}}, - {0, 0}, - {7, 9}, - {156, 2}, - {277, 9}, - {11, 117}, - {111, 82}, - {180, 102}, - {303, 108}, - {10, 229}, - {120, 221}, - {201, 217}, - {296, 225}, + {{ 0, 0}, { 7, 9}, {156, 2}, {277, 9}, + { 11, 117}, {111, 82}, {180, 102}, {303, 108}, + { 10, 229}, {120, 221}, {201, 217}, {296, 225}}, - {0, 0}, - {18, 8}, - {89, 15}, - {192, 14}, - {292, 7}, - {22, 129}, - {125, 146}, - {217, 136}, - {305, 115}, - {22, 226}, - {174, 237}, - {290, 231}, + {{ 0, 0}, {18, 8}, { 89, 15}, {192, 14}, + {292, 7}, {22, 129}, {125, 146}, {217, 136}, + {305, 115}, {22, 226}, {174, 237}, {290, 231}}, - {0, 0}, - {18, 12}, - {148, 9}, - {292, 7}, - {17, 122}, - {121, 99}, - {220, 87}, - {293, 112}, - {13, 236}, - {128, 213}, - {220, 223}, - {315, 223}, + {{ 0, 0}, { 18, 12}, {148, 9}, {292, 7}, + { 17, 122}, {121, 99}, {220, 87}, {293, 112}, + { 13, 236}, {128, 213}, {220, 223}, {315, 223}}, - {0, 0}, - {23, 14}, - {127, 8}, - {204, 0}, - {306, 8}, - {14, 115}, - {122, 132}, - {200, 116}, - {293, 122}, - {20, 228}, - {154, 228}, - {294, 239}, + {{ 0, 0}, {23, 14}, {127, 8}, {204, 0}, + {306, 8}, {14, 115}, {122, 132}, {200, 116}, + {293, 122}, {20, 228}, {154, 228}, {294, 239}}, - {0, 0}, - {19, 14}, - {124, 10}, - {283, 12}, - {8, 105}, - {113, 89}, - {190, 82}, - {298, 108}, - {18, 181}, - {101, 204}, - {204, 203}, - {285, 218}, + {{ 0, 0}, { 19, 14}, {124, 10}, {283, 12}, + { 8, 105}, {113, 89}, {190, 82}, {298, 108}, + { 18, 181}, {101, 204}, {204, 203}, {285, 218}}, - {0, 0}, - {18, 17}, - {110, 16}, - {201, 15}, - {307, 15}, - {18, 148}, - {125, 166}, - {201, 123}, - {275, 120}, - {28, 235}, - {217, 222}, - {324, 216} }; + {{ 0, 0}, {18, 17}, {110, 16}, {201, 15}, + {307, 15}, {18, 148}, {125, 166}, {201, 123}, + {275, 120}, {28, 235}, {217, 222}, {324, 216}}}; //----- (0042EB31) --------------------------------------------------------
--- a/Spells.h Fri Feb 22 18:32:34 2013 +0600 +++ b/Spells.h Fri Feb 22 18:32:47 2013 +0600 @@ -126,10 +126,17 @@ #pragma pack(push, 1) struct SpellData { +union + { + unsigned __int16 mana_per_skill[4]; + struct + { unsigned __int16 uNormalLevelMana; unsigned __int16 uExpertLevelMana; unsigned __int16 uMasterLevelMana; unsigned __int16 uMagisterLevelMana; + }; + }; unsigned __int16 field_8; __int16 field_A; __int16 field_C; @@ -154,7 +161,7 @@ extern struct SpellStats *pSpellStats; -extern struct SpellBookIconPos pIconPos[108]; +extern struct SpellBookIconPos pIconPos[9][12]; extern stru324_spell stru_4E3ACC[]; extern SpellData pSpellDatas[100]; \ No newline at end of file
--- a/Texture.cpp Fri Feb 22 18:32:34 2013 +0600 +++ b/Texture.cpp Fri Feb 22 18:32:47 2013 +0600 @@ -169,12 +169,7 @@ Texture *pTexture_RestUI_CurrentHourglassFrame; // idb -unsigned int uTextureID_Optkb; // weak -unsigned int uTextureID_Optkb_h; // weak -unsigned int uTextureID_KeyResume1; // weak -unsigned int uTextureID_Optkb_1; // weak -unsigned int uTextureID_Optkb_2; // weak - +unsigned int uTextureID_Optkb[5]; unsigned int uTextureID_507C10; // weak unsigned int uTextureID_507C14; // weak @@ -186,15 +181,15 @@ unsigned int uTextureID_507C50; // weak unsigned int uTextureID_507C54; // weak unsigned int uTextureID_507C58; // weak -unsigned int uTextureID_ControlBG; // weak -unsigned int uTextureID_Con_Smoo[3]; // weak -unsigned int uTextureID_Con_ArrL; // weak -unsigned int uTextureID_Con_ArrR; // weak -unsigned int uTextureID_Option04; // weak -unsigned int pTextureIDs_SoundLevels[10]; -unsigned int uTextureID_Option03; // weak -unsigned int uTextureID_Option01; -unsigned int uTextureID_Option02; // weak +unsigned int uTextureID_ControlBG[23]; +//unsigned int uTextureID_Con_Smoo[3]; // weak +//unsigned int uTextureID_Con_ArrL; // weak +//unsigned int uTextureID_Con_ArrR; // weak +//unsigned int uTextureID_Option04; // weak +//unsigned int pTextureIDs_SoundLevels[10]; +//unsigned int uTextureID_Option03; // weak +//unsigned int uTextureID_Option01; +//unsigned int uTextureID_Option02; // weak unsigned int uTextureID_5118C8; // weak
--- a/Texture.h Fri Feb 22 18:32:34 2013 +0600 +++ b/Texture.h Fri Feb 22 18:32:47 2013 +0600 @@ -271,12 +271,7 @@ extern Texture *pTexture_RestUI_CurrentHourglassFrame; // idb -extern unsigned int uTextureID_Optkb; // weak -extern unsigned int uTextureID_Optkb_h; // weak -extern unsigned int uTextureID_KeyResume1; // weak -extern unsigned int uTextureID_Optkb_1; // weak -extern unsigned int uTextureID_Optkb_2; // weak - +extern unsigned int uTextureID_Optkb[5]; extern unsigned int uTextureID_507C10; // weak extern unsigned int uTextureID_507C14; // weak @@ -288,15 +283,15 @@ extern unsigned int uTextureID_507C50; // weak extern unsigned int uTextureID_507C54; // weak extern unsigned int uTextureID_507C58; // weak -extern unsigned int uTextureID_ControlBG; // weak -extern unsigned int uTextureID_Con_Smoo[3]; // weak -extern unsigned int uTextureID_Con_ArrL; // weak -extern unsigned int uTextureID_Con_ArrR; // weak -extern unsigned int uTextureID_Option04; // weak -extern unsigned int pTextureIDs_SoundLevels[10]; -extern unsigned int uTextureID_Option03; // weak -extern unsigned int uTextureID_Option01; -extern unsigned int uTextureID_Option02; // weak +extern unsigned int uTextureID_ControlBG[23]; // weak +//extern unsigned int uTextureID_Con_Smoo[3]; // weak +//extern unsigned int uTextureID_Con_ArrL; // weak +//extern unsigned int uTextureID_Con_ArrR; // weak +//extern unsigned int uTextureID_Option04; // weak +//extern unsigned int pTextureIDs_SoundLevels[10]; +//extern unsigned int uTextureID_Option03; // weak +//extern unsigned int uTextureID_Option01; +//extern unsigned int uTextureID_Option02; // weak extern unsigned int uTextureID_5118C8; // weak
--- a/mm7_1.cpp Fri Feb 22 18:32:34 2013 +0600 +++ b/mm7_1.cpp Fri Feb 22 18:32:47 2013 +0600 @@ -2878,12 +2878,7 @@ v106.uFlags = 0; pRenderer->Clip_v2(0, 0, 0x27Fu, 0x1DFu); pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, a5); - pRenderer->Line2D( - v106.uViewportX + 129, - v106.uViewportY - 1, - v106.uViewportX + 129, - v106.uViewportW + 1, - a5); + pRenderer->Line2D( v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, a5); pRenderer->Line2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, a5); pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, a5); if ( pRenderer->pRenderD3D )
--- a/mm7_2.cpp Fri Feb 22 18:32:34 2013 +0600 +++ b/mm7_2.cpp Fri Feb 22 18:32:47 2013 +0600 @@ -1005,7 +1005,7 @@ //----- (004B910F) -------------------------------------------------------- -char *__cdecl sub_4B910F() +char *__cdecl _4B910F_shop_interaction() { Player *v0; // ebx@1 char *result; // eax@6 @@ -11705,6 +11705,7 @@ { case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam); }; + v4 = lParam; if ( Msg > WM_SYSCOMMAND ) @@ -12200,6 +12201,7 @@ { if ( !(dword_6BE364_game_settings_1 & 0x100) ) { + while(initing); //ADDED spinlock to allow int players ets! Gloval dword_4E98BC_bApplicationActive = 0; if ( (pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) && pVideoPlayer->bPlayingMovie ) pVideoPlayer->bStopBeforeSchedule = 1; @@ -12852,6 +12854,7 @@ //----- (004651F4) -------------------------------------------------------- bool MM7_Initialize() { +initing=true; //ADDED Gloval wchar_t pCurrentDir[1024]; _wgetcwd(pCurrentDir, 1024); @@ -13235,6 +13238,7 @@ { uTurnSpeed = (unsigned int)uCPUSpeed < 0xC7 ? 128 : 64; // adjust turn speed to estimated fps } + initing=false; //ADDED Gloval return true; }
--- a/mm7_3.cpp Fri Feb 22 18:32:34 2013 +0600 +++ b/mm7_3.cpp Fri Feb 22 18:32:47 2013 +0600 @@ -14211,168 +14211,168 @@ //----- (00443FDC) -------------------------------------------------------- void OnMapLoad() -{ - stru176 *v3; // esi@7 - __int16 v4; // cx@9 - __int16 v5; // di@9 - int v6; // eax@9 - signed __int64 v8; // qax@26 - unsigned int v9; // ecx@26 - signed __int64 v10; // qax@26 - signed __int64 v11; // qax@26 - int v12; // ST50_4@26 - signed __int64 v13; // qax@26 - signed __int64 v14; // qax@26 - int v15; // ST58_4@26 - signed __int64 v16; // qax@26 - int hours; // ebx@26 - unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 - signed __int64 seconds; // [sp+14h] [bp-3Ch]@26 - unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7 - int minutes; // [sp+2Ch] [bp-24h]@26 - int month; // [sp+34h] [bp-1Ch]@26 - int weeks; // [sp+38h] [bp-18h]@26 - int v26; // [sp+3Ch] [bp-14h]@15 - int days; // [sp+3Ch] [bp-14h]@26 - int v28; // [sp+40h] [bp-10h]@26 - __int16 v29; // [sp+46h] [bp-Ah]@9 - __int16 v30; // [sp+48h] [bp-8h]@9 - __int16 v31; // [sp+4Ah] [bp-6h]@9 - __int16 v32; // [sp+4Ch] [bp-4h]@9 - __int16 v33; // [sp+4Eh] [bp-2h]@9 - - for (uint i = 0; i < uLevelEVT_NumEvents; ++i) - { - auto pEvent = pLevelEVT_Index[i]; - - auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT); - - if (_evt->_e_type == EVENT_PlaySound) - { - pSoundList->LoadSound( - _evt->v5 + - ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8), - 0); - } - else if (_evt->_e_type == EVENT_OnMapReload) - { - start_event_seq_number = pEvent.event_sequence_num; - EventProcessor(pEvent.uEventID, 0, 0); - start_event_seq_number = 0; - } - else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) - { - v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; - v20 = pOutdoor->uLastVisitDay; - if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - v20 = pIndoor->stru1.uLastVisitDay; - - v3->timer_evt_type = _evt->_e_type; - v3->timer_evt_ID = pEvent.uEventID; - v3->timer_evt_seq_num = pEvent.event_sequence_num; - - v3->field_10 = _evt->v5; - v3->field_12 = _evt->v6; - v3->field_14 = _evt->v7; - v3->field_16 = _evt->v8; - v3->field_18 = _evt->v9; - v3->field_1A = _evt->v10; - - - v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; - - v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11; - v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11; - if (v3->timer_evt_type == EVENT_OnLongTimer && !(short)v6 ) - { - if ( v20 ) - v18 = pParty->uTimePlayed - v20; - else - v18 = 0i64; - v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; - - if ( v26 / 7 / 4 / 12 ) - { - if ( v5 ) - { - ++dword_5B65C8_timers_count; - v3->field_0_time = 0; - continue; - } - } - if (v26 / 7 / 4 != 0 && v33 != 0 || - v26 / 7 != 0 && v32 != 0 || - v26 != 0 || !v20) - { - ++dword_5B65C8_timers_count; - v3->field_0_time = 0; - continue; - } - } - else - { - v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); - v9 = v8; - v10 = (signed int)v8 / 60; - minutes = v10 % 60; - v11 = (signed int)(v10 / 60); - v12 = v11 % 24; - v13 = (signed int)(v11 / 24); - days = v13 % 7; - v14 = (signed int)(v13 / 7); - v15 = v14 % 4; - v16 = (signed int)(v14 / 4); - month = v16 / 12; - - auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32; - auto _2 = ((__int64)v9 << 32) | _1; - - seconds = _2 % 60; - //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32, - // v9) - // % 60; - - hours = v12; - weeks = v15; - v28 = v16 % 12; - if ( v5 ) - { - ++month; - } - else - { - if ( v33 ) - { - ++v28; - } - else - { - if ( v32 ) - { - ++weeks; - } - else - { - ++days; - minutes = v30; - hours = v31; - seconds = v29; - } - } - } - v3->field_0_time = (signed __int64)((double)((seconds - + 60 * minutes - + 3600 * hours - + 0x93A80 * weeks - + 0x15180 * days - + 0x24EA00 * (v28 + 12i64 * month)) << 7) - * 0.033333335); - - ++dword_5B65C8_timers_count; - } - } - } -} + { + stru176 *v3; // esi@7 + __int16 v4; // cx@9 + __int16 v5; // di@9 + int v6; // eax@9 + signed __int64 v8; // qax@26 + unsigned int v9; // ecx@26 + signed __int64 v10; // qax@26 + signed __int64 v11; // qax@26 + int v12; // ST50_4@26 + signed __int64 v13; // qax@26 + signed __int64 v14; // qax@26 + int v15; // ST58_4@26 + signed __int64 v16; // qax@26 + int hours; // ebx@26 + unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 + signed __int64 seconds; // [sp+14h] [bp-3Ch]@26 + unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7 + int minutes; // [sp+2Ch] [bp-24h]@26 + int years; // [sp+34h] [bp-1Ch]@26 + int weeks; // [sp+38h] [bp-18h]@26 + int v26; // [sp+3Ch] [bp-14h]@15 + int days; // [sp+3Ch] [bp-14h]@26 + int months; // [sp+40h] [bp-10h]@26 + __int16 v29; // [sp+46h] [bp-Ah]@9 + __int16 v30; // [sp+48h] [bp-8h]@9 + __int16 v31; // [sp+4Ah] [bp-6h]@9 + __int16 v32; // [sp+4Ch] [bp-4h]@9 + __int16 v33; // [sp+4Eh] [bp-2h]@9 + + for (uint i = 0; i < uLevelEVT_NumEvents; ++i) + { + auto pEvent = pLevelEVT_Index[i]; + + auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT); + + if (_evt->_e_type == EVENT_PlaySound) + { + pSoundList->LoadSound( + _evt->v5 + + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8), + 0); + } + else if (_evt->_e_type == EVENT_OnMapReload) + { + start_event_seq_number = pEvent.event_sequence_num; + EventProcessor(pEvent.uEventID, 0, 0); + start_event_seq_number = 0; + } + else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) + { + v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; + v20 = pOutdoor->uLastVisitDay; + if (uCurrentlyLoadedLevelType == LEVEL_Indoor) + v20 = pIndoor->stru1.uLastVisitDay; + + v3->timer_evt_type = _evt->_e_type; + v3->timer_evt_ID = pEvent.uEventID; + v3->timer_evt_seq_num = pEvent.event_sequence_num; + + v3->field_10 = _evt->v5; + v3->field_12 = _evt->v6; + v3->field_14 = _evt->v7; + v3->field_16 = _evt->v8; + v3->field_18 = _evt->v9; + v3->field_1A = _evt->v10; + + + v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; + + v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11; + v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11; + if (v3->timer_evt_type == EVENT_OnLongTimer && !(short)v6 ) + { + if ( v20 ) + v18 = pParty->uTimePlayed - v20; + else + v18 = 0i64; + v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; + + if ( v26 / 7 / 4 / 12 ) + { + if ( v3->field_10 ) + { + ++dword_5B65C8_timers_count; + v3->field_0_time = 0; + continue; + } + } + if (v26 / 7 / 4 != 0 && v3->field_12 != 0 || + v26 / 7 != 0 && v3->field_14 != 0 || + v26 != 0 || !v20) + { + ++dword_5B65C8_timers_count; + v3->field_0_time = 0; + continue; + } + } + else + { + v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); + v9 = v8; + v10 = (signed int)v8 / 60; + minutes = v10 % 60; + v11 = (signed int)(v10 / 60); + v12 = v11 % 24; + v13 = (signed int)(v11 / 24); + days = v13 % 7; + v14 = (signed int)(v13 / 7); + v15 = v14 % 4; + v16 = (signed int)(v14 / 4); + years = v16 / 12; + + auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32; + auto _2 = ((__int64)v9 << 32) | _1; + + seconds = _2 % 60; + //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32, + // v9) + // % 60; + + hours = v12; + weeks = v15; + months = v16 % 12; + if ( v3->field_10 ) + { + ++years; + } + else + { + if ( v3->field_12 ) + { + ++months; + } + else + { + if ( v3->field_14 ) + { + ++weeks; + } + else + { + ++days; + minutes = v3->field_18; + hours = v3->field_16; + seconds = v3->field_1A; + } + } + } + v3->field_0_time = (signed __int64)((double)((seconds + + 60 * minutes + + 3600 * hours + + 0x93A80 * weeks + + 0x15180 * days + + 0x24EA00 * (months + 12i64 * years)) << 7) + * 0.033333335); + + ++dword_5B65C8_timers_count; + } + } + } + } //----- (00444360) -------------------------------------------------------- void __thiscall Level_LoadEvtAndStr(const char *pLevelName) @@ -15116,7 +15116,7 @@ strcpy(v14->pButtonName, GetProfessionActionText(pNPC->uProfession)); else if (v16 == 19) { - __debugbreak(); // learn conditions of this event + // __debugbreak(); // learn conditions of this event Scavenger Hunt auto topic = pNPCTopics[pNPC->evt_A - 1].pTopic;//(&dword_721660)[8 * v23]; if (!topic) {
--- a/mm7_5.cpp Fri Feb 22 18:32:34 2013 +0600 +++ b/mm7_5.cpp Fri Feb 22 18:32:47 2013 +0600 @@ -386,7 +386,6 @@ memset(&actor, 0, 0x344u); actor.uNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx; pActor = &actor; -//_actor_init_dlg: pActor->InitializeDialogue(v0); } } @@ -415,7 +414,6 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); uGameState = 4; -LABEL_188: pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; } @@ -425,7 +423,6 @@ pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); dword_6BE138 = 124; } -//_release_tex_and_continue: stru_506E40.Release(); continue; case UIMSG_Game_OpenLoadGameDialog: @@ -453,11 +450,10 @@ } else { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2u);// "Are you sure? Click again to quit" + ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit" pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); dword_6BE138 = 132; } - //goto _release_tex_and_continue; stru_506E40.Release(); continue; case UIMSG_80: @@ -465,63 +461,25 @@ pIcons_LOD->_4114F2(); pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_OPTIONS; - v162 = 0; - v148 = 0; - pWindowType = (WindowType)8; - //goto LABEL_439; - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, pWindowType, v148, v162); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (WindowType)8, 0, 0); continue; case UIMSG_ArrowUp: --pSaveListPosition; if ( pSaveListPosition < 0 ) pSaveListPosition = 0; - v163 = 0; - v8 = 199; - pButton2 = pBtnArrowUp; - //goto LABEL_60; - pWindowType1 = (WindowType)90; - v137 = 17; - v133 = 17; - v9 = 215; - //goto LABEL_733; - GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163); + GUIWindow::Create(215, 199, 17, 17, (WindowType)90, (int)pBtnArrowUp, 0); continue; case UIMSG_DownArrow: ++pSaveListPosition; if ( pSaveListPosition >= uMessageParam ) pSaveListPosition = uMessageParam - 1; - v163 = 0; - v8 = 323; - pButton2 = pBtnDownArrow; -//LABEL_60: - pWindowType1 = (WindowType)90; - v137 = 17; - v133 = 17; - v9 = 215; - //goto LABEL_733; - GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163); + GUIWindow::Create(215, 323, 17, 17, (WindowType)90, (int)pBtnDownArrow, 0); continue; case UIMSG_Cancel: - v163 = 0; - v8 = 302; - pButton2 = pBtnCancel; - v9 = 350; - pWindowType1 = (WindowType)96; - v137 = 42; - v133 = 106; - //goto LABEL_733; - GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163); + GUIWindow::Create(350, 302, 106, 42, (WindowType)96, (int)pBtnCancel, 0); continue; case UIMSG_LoadSlot: - v163 = 0; - v8 = 302; - pButton2 = pBtnLoadSlot; - v9 = 241; - pWindowType1 = (WindowType)94; - v137 = 42; - v133 = 106; - //goto LABEL_733; - GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163); + GUIWindow::Create(241, 302, 106, 42, (WindowType)94, (int)pBtnLoadSlot, 0); continue; case UIMSG_SelectLoadSlot: if ( pGUIWindow_CurrentMenu->field_40 == v0 ) @@ -566,19 +524,15 @@ LoadGame(uLoadGameUI_SelectedSlot); uGameState = 3; } - //goto _release_tex_and_continue; stru_506E40.Release(); continue; case UIMSG_SaveGame: if ( pGUIWindow_CurrentMenu->field_40 == v0 ) { pKeyActionMap->_459ED1(0); - strcpy( - (char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, - (const char *)pKeyActionMap->pPressedKeysBuffer); + strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer); } DoSavegame(uLoadGameUI_SelectedSlot); - //goto _release_tex_and_continue; stru_506E40.Release(); continue; case UIMSG_Game_OpenSaveGameDialog: @@ -586,75 +540,75 @@ pCurrentScreen = SCREEN_SAVEGAME; GameUI_DrawSaveMenu(); continue; - case UIMSG_Game_OpenOptionsDialog: + case UIMSG_Game_OpenOptionsDialog://Open if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); viewparams->field_48 = v0; pCurrentScreen = SCREEN_OPTIONS; - uTextureID_ControlBG = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE); - uTextureID_Con_Smoo[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE); - uTextureID_Con_Smoo[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE); - uTextureID_Con_ArrL = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE); - uTextureID_Con_ArrR = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE); - uTextureID_Con_Smoo[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE); - pTextureIDs_SoundLevels[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); - pTextureIDs_SoundLevels[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE); - pTextureIDs_SoundLevels[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE); - pTextureIDs_SoundLevels[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE); - pTextureIDs_SoundLevels[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE); - pTextureIDs_SoundLevels[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE); - pTextureIDs_SoundLevels[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE); - pTextureIDs_SoundLevels[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE); - pTextureIDs_SoundLevels[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE); - pTextureIDs_SoundLevels[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE); - uTextureID_Option04 = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE); - uTextureID_Option03 = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE); - uTextureID_Option02 = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE); - uTextureID_Option01 = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[0] = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[3] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[2] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[4] = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[5] = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[1] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[19] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[10] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[11] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[12] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[13] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[14] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[15] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[16] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[17] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[18] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[9] = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[20] = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[22] = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE); + uTextureID_ControlBG[21] = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0); pGUIWindow_CurrentMenu->CreateButton(0x16u, 0x10Eu, - (uTextureID_Con_Smoo[2] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[2]].uTextureWidth : 24), - (uTextureID_Con_Smoo[2] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[2]].uTextureHeight : 26), + (uTextureID_ControlBG[3] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[3]].uTextureWidth : 24), + (uTextureID_ControlBG[3] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[3]].uTextureHeight : 26), v0, 0, 0xB8u, 0x80u, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(0x5Du, 0x10Eu, - (uTextureID_Con_Smoo[1] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[1]].uTextureWidth : 24), - (uTextureID_Con_Smoo[1] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[1]].uTextureHeight : 26), + (uTextureID_ControlBG[2] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[2]].uTextureWidth : 24), + (uTextureID_ControlBG[2] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[2]].uTextureHeight : 26), v0, 0, 0xB8u, 0x40u, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(0xA4u, 0x10Eu, - (uTextureID_Con_Smoo[0] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[0]].uTextureWidth : 24), - (uTextureID_Con_Smoo[0] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[0]].uTextureHeight : 26), + (uTextureID_ControlBG[1] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[1]].uTextureWidth : 24), + (uTextureID_ControlBG[1] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[1]].uTextureHeight : 26), v0, 0, 0xB8u, 0, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x12Fu, - (uTextureID_Option01 != -1 ? pIcons_LOD->pTextures[uTextureID_Option01].uTextureWidth : 24), - (uTextureID_Option01 != -1 ? pIcons_LOD->pTextures[uTextureID_Option01].uTextureHeight : 26), + (uTextureID_ControlBG[21] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[21]].uTextureWidth : 24), + (uTextureID_ControlBG[21] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[21]].uTextureHeight : 26), v0, 0, 0xB9u, 0, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x12Fu, - (uTextureID_Option02 != -1 ? pIcons_LOD->pTextures[uTextureID_Option02].uTextureWidth : 24), - (uTextureID_Option02 != -1 ? pIcons_LOD->pTextures[uTextureID_Option02].uTextureHeight : 26), + (uTextureID_ControlBG[22] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[22]].uTextureWidth : 24), + (uTextureID_ControlBG[22] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[22]].uTextureHeight : 26), v0, 0, 0xBBu, 0, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x145u, - (uTextureID_Option03 != -1 ? pIcons_LOD->pTextures[uTextureID_Option03].uTextureWidth : 24), - (uTextureID_Option03 != -1 ? pIcons_LOD->pTextures[uTextureID_Option03].uTextureHeight : 26), + (uTextureID_ControlBG[20] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[20]].uTextureWidth : 24), + (uTextureID_ControlBG[20] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[20]].uTextureHeight : 26), v0, 0, 0xE1u, 0, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x145u, - (uTextureID_Option04 != -1 ? pIcons_LOD->pTextures[uTextureID_Option04].uTextureWidth : 24), - (uTextureID_Option04 != -1 ? pIcons_LOD->pTextures[uTextureID_Option04].uTextureHeight : 26), + (uTextureID_ControlBG[9] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[9]].uTextureWidth : 24), + (uTextureID_ControlBG[9] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[9]].uTextureHeight : 26), v0, 0, 0xE2u, 0, 0, v1, 0); pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, v0, 0, 111, 4, 0, v1, - &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0); + &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0); pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xA2u, 0x10u, 0x10u, v0, 0, 0x6Fu, 5, 0, v1, - &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 0); + &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0); pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xA2u, 0xACu, 0x11u, v0, 0, 0x6Fu, 0, 0, v1, 0); pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0xD8u, 0x10u, 0x10u, v0, 0, 0x70u, 4, 0, v1, - &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0); + &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0); pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xD8u, 0x10u, 0x10u, v0, 0, 0x70u, 5, 0, v1, - &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 0); + &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0); pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xD8u, 0xACu, 0x11u, v0, 0, 0x70u, 0, 0, v1, 0); pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0x10Eu, 0x10u, 0x10u, v0, 0, 0xBAu, 4, 0, v1, - &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0); + &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0); pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0x10Eu, 0x10u, 0x10u, v0, 0, 0xBAu, 5u, 0, v1, - &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 0); + &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0); pGUIWindow_CurrentMenu->CreateButton(0x107u, 0x10Eu, 0xACu, 0x11u, v0, 0, 0xBAu, 0, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[619],// "Return to Game" @@ -662,17 +616,17 @@ pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x8Cu, 0xD6u, 0x28u, v0, 0, 0x19Fu, 0, 0x4Bu, v1, 0); pGUIWindow_CurrentMenu->CreateButton(19, 194, 214, 40, v0, 0, 421, 0, 86, v1, 0); continue; - case UIMSG_OpenKeyMappingOptions: + case UIMSG_OpenKeyMappingOptions://Open if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); viewparams->field_48 = 1; pCurrentScreen = SCREEN_KEYBOARD_OPTIONS; - uTextureID_Optkb = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE); - uTextureID_Optkb_h = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE); - uTextureID_KeyResume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); - uTextureID_Optkb_1 = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE); - uTextureID_Optkb_2 = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE); + uTextureID_Optkb[0] = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE); + uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE); + uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); + uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE); + uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_KeyMappingOptions, 0, 0); pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, 0x71u, 0, 0, "", 0); pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A0u, 0, 0, "", 0); @@ -695,15 +649,12 @@ pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, 0x1A3u, 0xDu, 0, "", 0); dword_506E68 = -1; KeyboardPageNum = 1; - memset(word_506E6C, 0, 0x1Cu); - word_506E6C[14] = 0; + memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray)); + //*(_WORD *)KeyButtonArray[28] = 0; memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); - //goto LABEL_90; v1 = ""; v0 = 1; continue; - //default: - //continue; case UIMSG_ChangeKeyButton: if ( dword_506E68 != -1 ) { @@ -741,18 +692,11 @@ v18 = uAction++; v13 = uAction > 28; v12 = uAction - 28 < 0; - *((char *)word_506E6C + v18) = 0; + KeyButtonFlagChangesArray[v18] = 0; } while ( v12 ^ v13 ); - v165 = 0; - v151 = 0; - v144 = 0; - v139 = 0; - v135 = -1; - v132 = 0; - v130 = 0; - v127 = 219; - goto _play_sound_and_continue; + pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); + continue; case UIMSG_SelectKeyPage1: KeyboardPageNum = v0; continue; @@ -801,19 +745,7 @@ &pIcons_LOD->pTextures[uTextureID_507C20], 0); pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, 0x1A9u, 5u, 0, v1, &pIcons_LOD->pTextures[uTextureID_507C24], 0); - pTexture = 0; - v150 = v1; - v143 = 0; - v138 = 0; - v134 = 425; - v131 = 0; - v129 = 1; - v126 = 18; - v124 = 170; - v122 = 162; - v120 = 42; -//LABEL_117: - pGUIWindow_CurrentMenu->CreateButton(v120, v122, v124, v126, v129, v131, v134, v138, v143, v150, pTexture); + pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, 425, 0, 0, v1, 0); } } continue; @@ -824,37 +756,14 @@ if ( (uGammaPos -- -1) < 0 ) { uGammaPos = 0; - //goto LABEL_128; - v165 = 0; - v151 = 0; - v144 = 0; - v139 = 0; - v135 = -1; - v132 = 0; - v130 = 0; - v127 = 21; - goto _play_sound_and_continue; + pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); + continue; } v19 = (double)(signed int)uGammaPos * 0.1 + 0.6; pGame->pGammaController->Initialize(v19); - v166 = v0; - v152 = (int)pBtn_SliderLeft; - pWindowType2 = (WindowType)90; - v140 = 0; - v136 = 0; - v20 = 21; - //goto LABEL_122; - GUIWindow::Create(v20, 0xA1u, v136, v140, pWindowType2, v152, v166); - //goto LABEL_128; - v165 = 0; - v151 = 0; - v144 = 0; - v139 = 0; - v135 = -1; - v132 = 0; - v130 = 0; - v127 = 21; - goto _play_sound_and_continue; + GUIWindow::Create(21, 161, 0, 0, (WindowType)90, (int)pBtn_SliderLeft, v0); + pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); + continue; } if ( uMessageParam == 5 ) { @@ -863,24 +772,9 @@ { v21 = (double)(signed int)uGammaPos * 0.1 + 0.6; pGame->pGammaController->Initialize(v21); - v20 = 213; - v166 = v0; - v152 = (int)pBtn_SliderRight; - pWindowType2 = (WindowType)90; - v140 = 0; - v136 = 0; -//LABEL_122: - GUIWindow::Create(v20, 0xA1u, v136, v140, pWindowType2, v152, v166); - //goto LABEL_128; - v165 = 0; - v151 = 0; - v144 = 0; - v139 = 0; - v135 = -1; - v132 = 0; - v130 = 0; - v127 = 21; - goto _play_sound_and_continue; + GUIWindow::Create(213, 161, 0, 0, (WindowType)90, (int)pBtn_SliderRight, v0); + pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); + continue; } uGammaPos = 9; } @@ -890,16 +784,8 @@ v22 = (double)(signed int)uGammaPos * 0.1 + 0.6; pGame->pGammaController->Initialize(v22); } -//LABEL_128: - v165 = 0; - v151 = 0; - v144 = 0; - v139 = 0; - v135 = -1; - v132 = 0; - v130 = 0; - v127 = 21; - goto _play_sound_and_continue; + pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); + continue; case UIMSG_ToggleBloodsplats: pGame->ToggleFlags2(0x20u); continue; @@ -915,12 +801,7 @@ --uMusicVolimeMultiplier; if ( (char)uMusicVolimeMultiplier < 1 ) uMusicVolimeMultiplier = 0; - v167 = v0; - v23 = 243; - v153 = (int)pBtn_SliderLeft; -//LABEL_136: - GUIWindow::Create(v23, 0xD8u, 0, 0, (enum WindowType)90, v153, v167); - //goto LABEL_143; + GUIWindow::Create(243, 0xD8u, 0, 0, (enum WindowType)90, (int)pBtn_SliderLeft, v0); if ( uMusicVolimeMultiplier ) pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); @@ -931,12 +812,7 @@ ++uMusicVolimeMultiplier; if ( (char)uMusicVolimeMultiplier > 9 ) uMusicVolimeMultiplier = 9; - v167 = v0; - v23 = 435; - v153 = (int)pBtn_SliderRight; - //goto LABEL_136; - GUIWindow::Create(v23, 0xD8u, 0, 0, (enum WindowType)90, v153, v167); - //goto LABEL_143; + GUIWindow::Create(435, 0xD8u, 0, 0, (enum WindowType)90, (int)pBtn_SliderRight, v0); if ( uMusicVolimeMultiplier ) pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); @@ -945,13 +821,12 @@ uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17; if ( (char)uMusicVolimeMultiplier > 9 ) uMusicVolimeMultiplier = 9; -//LABEL_143: if ( uMusicVolimeMultiplier ) pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); continue; case UIMSG_ChangeSoundVolume: - if ( uMessageParam == 4 )//reduce sound level + if ( uMessageParam == 4 )//reduce sound level button left { --uSoundVolumeMultiplier; if ( (char)uSoundVolumeMultiplier < 1 ) @@ -961,7 +836,7 @@ pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); continue; } - if ( uMessageParam == 5 )//Increase sound level + if ( uMessageParam == 5 )//Increase sound level button right { ++uSoundVolumeMultiplier; if ( (char)uSoundVolumeMultiplier > 8 ) @@ -969,34 +844,17 @@ v168 = v0; v24 = 435; v154 = (int)pBtn_SliderRight; - //goto LABEL_150; GUIWindow::Create(v24, 0xA2u, 0, 0, (enum WindowType)90, v154, v168); - //goto LABEL_157; pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); - v165 = 0; - v151 = 0; - v144 = 0; - v139 = 0; - v135 = -1; - v132 = 0; - v130 = -1; - v127 = 218; - goto _play_sound_and_continue; + pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); + continue; } uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17; if ( (char)uSoundVolumeMultiplier > 8 ) uSoundVolumeMultiplier = 9; -//LABEL_157: pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); - v165 = 0; - v151 = 0; - v144 = 0; - v139 = 0; - v135 = -1; - v132 = 0; - v130 = -1; - v127 = 218; - goto _play_sound_and_continue; + pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); + continue; case UIMSG_ToggleFlipOnExit: bFlipOnExit = bFlipOnExit == 0; continue; @@ -1015,62 +873,30 @@ --uVoicesVolumeMultiplier; if ( (char)uVoicesVolumeMultiplier < 1 ) uVoicesVolumeMultiplier = 0; - v169 = v0; - v25 = 243; - v155 = (int)pBtn_SliderLeft; -//LABEL_166: - GUIWindow::Create(v25, 0x10Eu, 0, 0, (enum WindowType)90, v155, v169); - //goto LABEL_173; + GUIWindow::Create(243, 270, 0, 0, (enum WindowType)90, (int)pBtn_SliderLeft, v0); if ( !uVoicesVolumeMultiplier ) continue; - v165 = 0; - v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f; - v144 = 0; - v139 = 0; - v135 = -1; - v132 = 0; - v130 = -1; - v127 = 5788; - goto _play_sound_and_continue; + pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); + continue; } if ( uMessageParam == 5 ) { ++uVoicesVolumeMultiplier; if ( (char)uVoicesVolumeMultiplier > 8 ) uVoicesVolumeMultiplier = 9; - v169 = v0; - v25 = 435; - v155 = (int)pBtn_SliderRight; - //goto LABEL_166; - GUIWindow::Create(v25, 0x10Eu, 0, 0, (enum WindowType)90, v155, v169); - //goto LABEL_173; + GUIWindow::Create(435, 270, 0, 0, (enum WindowType)90, (int)pBtn_SliderRight, v0); if ( !uVoicesVolumeMultiplier ) continue; - v165 = 0; - v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f; - v144 = 0; - v139 = 0; - v135 = -1; - v132 = 0; - v130 = -1; - v127 = 5788; - goto _play_sound_and_continue; + pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); + continue; } uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17; if ( (char)uVoicesVolumeMultiplier > 8 ) uVoicesVolumeMultiplier = 9; -//LABEL_173: if ( !uVoicesVolumeMultiplier ) continue; - v165 = 0; - v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f; - v144 = 0; - v139 = 0; - v135 = -1; - v132 = 0; - v130 = -1; - v127 = 5788; - goto _play_sound_and_continue; + pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); + continue; case UIMSG_SetTurnSpeed: if ( uMessageParam ) pParty->sRotationY = uMessageParam * pParty->sRotationY / uMessageParam; @@ -1080,7 +906,6 @@ if ( !bUseLoResSprites ) { byte_6BE388_graphicsmode = uMessageParam; -//LABEL_184: MM7Initialization(); continue; } @@ -1096,16 +921,18 @@ continue; byte_6BE388_graphicsmode = 1; } - //goto LABEL_184; MM7Initialization(); continue; } ModalWindow(pNPCTopics[453].pText, 0); continue; - case UIMSG_7B: + case UIMSG_GameMenu_ReturnToGame: pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); - goto LABEL_188; + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = v0; + stru_506E40.Release(); + continue; case UIMSG_OpenQuestBook: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; @@ -1137,14 +964,8 @@ viewparams->sPartyPosX = pParty->vPosition.x; viewparams->sPartyPosZ = pParty->vPosition.y; pAudioPlayer->StopChannels(-1, -1); - pWindow = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); - v27 = 353; - v28 = 546; - v170 = 0; - v156 = (int)pBtn_Maps; - //goto LABEL_210; - pGUIWindow_CurrentMenu = pWindow; - pBooksWindow = GUIWindow::Create(v28, v27, 0, 0, (enum WindowType)99, v156, v170); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); + pBooksWindow = GUIWindow::Create(546, 353, 0, 0, (enum WindowType)99, (int)pBtn_Maps, 0); continue; case UIMSG_OpenCalendar: if ( pMessageQueue_50CBD0->uNumMessages ) @@ -1153,14 +974,8 @@ pGUIWindow_CurrentMenu->Release(); pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); - pWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); - v27 = 354; - v28 = 570; - v170 = 0; - v156 = (int)pBtn_Calendar; -//LABEL_210: - pGUIWindow_CurrentMenu = pWindow; - pBooksWindow = GUIWindow::Create(v28, v27, 0, 0, (enum WindowType)99, v156, v170); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); + pBooksWindow = GUIWindow::Create(570, 354, 0, 0, (enum WindowType)99, (int)pBtn_Calendar, 0); continue; case UIMSG_OpenHistoryBook: if ( pMessageQueue_50CBD0->uNumMessages ) @@ -1173,7 +988,7 @@ pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, (enum WindowType)99, (int)pBtn_History, 0); bFlashHistoryBook = 0; continue; - case UIMSG_Escape:// Escape + case UIMSG_Escape:// Escape and return to game back_to_game(); if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; @@ -1181,11 +996,9 @@ { if ( pCurrentScreen >= SCREEN_CHANGE_LOCATION && (pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_QUICK_REFERENCE) ) { -//LABEL_229: if ( dword_50CDC8 ) goto LABEL_232; CloseWindowBackground(); - //goto LABEL_231; uMessageParam = v0; goto LABEL_232; } @@ -1193,22 +1006,18 @@ else { if ( pCurrentScreen >= SCREEN_E || pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHEST ) - { - //goto LABEL_229; + { if ( dword_50CDC8 ) goto LABEL_232; CloseWindowBackground(); - //goto LABEL_231; uMessageParam = v0; goto LABEL_232; - } + } if ( pCurrentScreen == SCREEN_HOUSE && !dword_50CDC8 && !dword_5C35C8 ) { CloseWindowBackground(); dword_5C35C8 = 0; -//LABEL_231: uMessageParam = v0; - goto LABEL_232; } } LABEL_232: @@ -1249,7 +1058,6 @@ dword_50C9A8 = 0; ptr_50C9A4 = 0; } - //goto LABEL_322; if ( pGUIWindow_Settings ) { if ( pCurrentScreen == SCREEN_CHARACTERS ) @@ -1282,7 +1090,6 @@ //crt_deconstruct_ptr_6A0118(); pBooksWindow = 0; pEventTimer->Resume(); - //goto LABEL_322; if ( pGUIWindow_Settings ) { if ( pCurrentScreen == SCREEN_CHARACTERS ) @@ -1314,7 +1121,6 @@ case SCREEN_LOADGAME: pIcons_LOD->_4114F2(); //crt_deconstruct_ptr_6A0118(); - //goto LABEL_291; stru_506E40.Release(); break; case SCREEN_F: @@ -1322,7 +1128,6 @@ continue; case SCREEN_CHEST: pWindow2 = pChestWindow; - //goto LABEL_249; pWindow2->Release(); pIcons_LOD->_4114F2(); pCurrentScreen = SCREEN_GAME; @@ -1331,14 +1136,13 @@ continue; case SCREEN_19: pWindow2 = ptr_507BC8; -//LABEL_249: pWindow2->Release(); pIcons_LOD->_4114F2(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; pEventTimer->Resume(); continue; - case SCREEN_OPTIONS: + case SCREEN_OPTIONS://Close thisa = (signed int)&uTextureID_ControlBG; do { @@ -1360,9 +1164,7 @@ if ( !uTurnSpeed ) { v171 = 3; - //goto LABEL_261; v30 = v171; - //goto LABEL_262; v31 = "TurnDelta"; WriteWindowsRegistryInt(v31, v30); stru_506E40.Release(); @@ -1371,26 +1173,20 @@ if ( uTurnSpeed == 64 ) { v171 = 2; -//LABEL_261: v30 = v171; - //goto LABEL_262; v31 = "TurnDelta"; WriteWindowsRegistryInt(v31, v30); stru_506E40.Release(); break; } if ( uTurnSpeed != 128 ) - //goto LABEL_291; { stru_506E40.Release(); break; } v30 = v0; -//LABEL_262: v31 = "TurnDelta"; -//LABEL_263: WriteWindowsRegistryInt(v31, v30); -//LABEL_291: stru_506E40.Release(); break; case SCREEN_MENU: @@ -1398,7 +1194,6 @@ pIcons_LOD->_4114F2(); pIcons_LOD->_40F9C5(); pIcons_LOD->_4114F2(); - //goto LABEL_291; stru_506E40.Release(); break; case SCREEN_VIDEO_OPTIONS: @@ -1409,21 +1204,19 @@ WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pGame->uFlags2) >> 5) & 1); } if ( pRenderer->bWindowMode ) - //goto LABEL_291; { stru_506E40.Release(); break; } v30 = uGammaPos; v31 = "GammaPos"; - //goto LABEL_263; WriteWindowsRegistryInt(v31, v30); stru_506E40.Release(); break; - case SCREEN_KEYBOARD_OPTIONS: + case SCREEN_KEYBOARD_OPTIONS://Return to game v197 = 1; v32 = 0; - while ( *((char *)word_506E6C + v32) != 1 ) + while ( KeyButtonFlagChangesArray[v32] != 1 ) { ++v32; if ( v32 >= 28 ) @@ -1465,13 +1258,11 @@ } while ( uAction < 28 ); pKeyActionMap->StoreMappings(); - //goto LABEL_291; stru_506E40.Release(); break; } } - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); - continue; + break; case SCREEN_REST: if ( dword_506F14 ) { @@ -1490,7 +1281,6 @@ _506F18_num_hours_to_sleep = 0; dword_506F14 = 0; dword_507B94 = v0; - //goto LABEL_322; if ( pGUIWindow_Settings ) { if ( pCurrentScreen == SCREEN_CHARACTERS ) @@ -1540,7 +1330,6 @@ pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 814, 0, -1, 0, 0, 0, 0); pVideoPlayer->Unload(); pGUIWindow_CurrentMenu = window_SpeakInHouse; - //goto LABEL_322; if ( pGUIWindow_Settings ) { if ( pCurrentScreen == SCREEN_CHARACTERS ) @@ -1572,7 +1361,6 @@ if ( uCurrentHouse_Animation == 153 ) HousePlaySomeSound(0x99u, 3); pVideoPlayer->Unload(); - //goto LABEL_306; if ( dword_5B65CC ) { pParty->field_709 = 0; @@ -1583,7 +1371,6 @@ } goto LABEL_317; case SCREEN_NPC_DIALOGUE: -//LABEL_306: if ( dword_5B65CC ) { pParty->field_709 = 0; @@ -1613,7 +1400,6 @@ case SCREEN_CHARACTERS: goto LABEL_319; default: - //goto LABEL_322; if ( pGUIWindow_Settings ) { if ( pCurrentScreen == SCREEN_CHARACTERS ) @@ -1642,7 +1428,6 @@ pIcons_LOD->_4355F7(); continue; } - //goto LABEL_322; if ( pGUIWindow_Settings ) { if ( pCurrentScreen == SCREEN_CHARACTERS ) @@ -1677,7 +1462,6 @@ LABEL_321: pIcons_LOD->_4114F2(); } -//LABEL_322: if ( pGUIWindow_Settings ) { if ( pCurrentScreen == SCREEN_CHARACTERS ) @@ -1752,7 +1536,6 @@ stru_506E40._40E55E("gamma.pcx", 0); continue; } - //goto LABEL_333; pWindow3->Release(); pGUIWindow_Settings = 0; pMouse->SetCursorBitmap("MICON1"); @@ -8781,13 +8564,13 @@ { v229 = pPlayer->pEquipment.uMainHand; v9 = (int)&pPlayer->pInventoryItems[v8-1]; - v10 = pBodyComplection << 7; + // v10 = pBodyComplection << 7; v218 = v9; v11 = *(int *)v9; v12 = *(int *)v9; v13 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[v12].uEquipX; a2a = v13; - a3a = pPaperdoll_BodyY + *(int *)((char *)&paperdoll_Weapon[0][1][1] + v10) - pItemsTable->pItems[v12].uEquipY; + a3a = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[v12].uEquipY; if ( v11 == 64 ) v166 = "item64v1"; else @@ -13050,7 +12833,7 @@ } //----- (00410B28) -------------------------------------------------------- -void __thiscall DrawSpellDescriptionPopup(void *_this) +void __thiscall DrawSpellDescriptionPopup(int spell_index) { Player *v1; // edi@1 SpellInfo *v2; // esi@1 @@ -13061,14 +12844,14 @@ char *v7; // ST44_4@12 unsigned __int16 v8; // ax@12 GUIWindow a1; // [sp+Ch] [bp-68h]@4 - void *v10; // [sp+60h] [bp-14h]@1 + int v10; // [sp+60h] [bp-14h]@1 POINT a2; // [sp+64h] [bp-10h]@1 int v12; // [sp+6Ch] [bp-8h]@4 int v13; // [sp+70h] [bp-4h]@4 v1 = pPlayers[uActiveCharacter]; - v10 = _this; - v2 = &pSpellStats->pInfos[(signed int)((char *)_this + 11 * v1->lastOpenedSpellbookPage) + 1]; + v10 = spell_index; + v2 = &pSpellStats->pInfos[spell_index + 11 * v1->lastOpenedSpellbookPage + 1]; if ( pMouse->GetCursorPos(&a2)->y <= 250 ) v3 = pMouse->GetCursorPos(&a2)->y + 30; else @@ -13080,10 +12863,10 @@ a1.uFrameZ = 417; a1.uFrameW = v3 + 67; a1.Hint = 0; - a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); - v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); - v12 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); - v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); + a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]); + v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]); + v12 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]); + v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]); v5 = a2.y; if ( v13 > a2.y ) v5 = v13; @@ -13091,25 +12874,20 @@ v5 = v12; if ( v4 > v5 ) v5 = v4; - sprintf( - pTmpBuf2, + sprintf( pTmpBuf2, "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", v2->pDescription, - pGlobalTXT_LocalizationStrings[431], - v5 + 3, - v5 + 10, + pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL], + v5 + 3, v5 + 10, v2->pBasicSkillDesc, - pGlobalTXT_LocalizationStrings[433], - v5 + 3, - v5 + 10, + pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT], + v5 + 3, v5 + 10, v2->pExpertSkillDesc, - pGlobalTXT_LocalizationStrings[432], - v5 + 3, - v5 + 10, + pGlobalTXT_LocalizationStrings[LOCSTR_MASTER], + v5 + 3, v5 + 10, v2->pMasterSkillDesc, - pGlobalTXT_LocalizationStrings[96], - v5 + 3, - v5 + 10, + pGlobalTXT_LocalizationStrings[LOCSTR_GRAND], + v5 + 3, v5 + 10, v2->pGrandmasterSkillDesc); v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); a1.uFrameHeight += v6; @@ -13128,13 +12906,11 @@ a1.uFrameWidth = 108; a1.uFrameZ = a1.uFrameX + 107; a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->lastOpenedSpellbookPage + 12], 3u); - sprintf( - pTmpBuf, - "%s\n%d", - pGlobalTXT_LocalizationStrings[522], - *(&pSpellDatas[0].field_12 //temp_fix field_14 - + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6) - + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage))); + sprintf( pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST], + pSpellDatas[spell_index + 11 * v1->lastOpenedSpellbookPage + 1].mana_per_skill[v1->pActiveSkills[v1->lastOpenedSpellbookPage + PLAYER_SKILL_FIRE]]); + // *(&[0].field_12 //temp_fix field_14 + // + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6) + // + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage))); a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3u); dword_507B00_spell_info_to_draw_in_popup = 0; } @@ -13663,15 +13439,16 @@ } if ( v6->pLevelOfDetail0 ) { - v7 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); - v19 = pViewport->uViewportY + pIconPos[v7].Ypos; - v17 = pViewport->uViewportX + pIconPos[v7].Xpos; + v7 = v0->lastOpenedSpellbookPage; + // v7 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); + v19 = pViewport->uViewportY + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos; + v17 = pViewport->uViewportX + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos; if ( BYTE1(v6->pBits) & 2 ) pRenderer->DrawTextureTransparent(v17, v19, v6); else pRenderer->DrawTextureIndexed(v17, v19, v6); - v8 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); - pRenderer->_4A612A(pIconPos[v8].Xpos,pIconPos[v8].Ypos, v23, v4); + pRenderer->_4A612A(pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos, + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos, v23, v4); } } } @@ -13687,9 +13464,10 @@ if ( v11->pLevelOfDetail0 ) { v21 = dword_5063D8[v10]; - v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]); - v20 = pViewport->uViewportY + pIconPos[v12].Ypos; - v18 = pViewport->uViewportX + pIconPos[v12].Xpos; + v12 = v0->lastOpenedSpellbookPage; + // v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]); + v20 = pViewport->uViewportY + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos; + v18 = pViewport->uViewportX + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos; if ( BYTE1(v11->pBits) & 2 ) pRenderer->DrawTextureTransparent(v18, v20, v21); else @@ -14805,7 +14583,7 @@ if ( pGUIWindow_CurrentMenu->field_40 == 2 ) { pPrevVirtualCidesMapping[dword_506E68] = pKeyActionMap->pPressedKeysBuffer[0]; - memset(word_506E6C, 0, 0x1Cu); + memset(&KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray)); v4 = 0; do { @@ -14814,8 +14592,8 @@ { if ( v4 != v5 && pPrevVirtualCidesMapping[v4] == pPrevVirtualCidesMapping[v5] ) { - *((char *)word_506E6C + v4) = 1; - *((char *)word_506E6C + v5) = 1; + KeyButtonFlagChangesArray[v4] = 1; + KeyButtonFlagChangesArray[v5] = 1; } ++v5; } @@ -14826,10 +14604,10 @@ dword_506E68 = -1; v3->field_40 = 0; } - pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_Optkb != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb] : 0)); + pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_Optkb[0] != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb[0]] : 0)); if ( KeyboardPageNum == 1 ) { - pRenderer->DrawTextureIndexed(0x13, 0x12E, (Texture *)(uTextureID_Optkb_1 != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb_1] : 0)); + pRenderer->DrawTextureIndexed(0x13, 0x12E, (Texture *)(uTextureID_Optkb[3] != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb[3]] : 0)); pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, ascii_4E2D5C, 0, 0, 0); v6 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[0]); v7 = sub_414D24(0); @@ -14892,7 +14670,7 @@ } else { - pRenderer->DrawTextureIndexed(0x7F, 0x12E, (Texture *)(uTextureID_Optkb_2 != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb_2] : 0)); + pRenderer->DrawTextureIndexed(0x7F, 0x12E, (Texture *)(uTextureID_Optkb[4] != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb[4]] : 0)); pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, ascii_4E2CDC, 0, 0, 0); v33 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[14]); v34 = sub_414D24(14); @@ -14979,7 +14757,7 @@ } else { - if ( *((char *)word_506E6C + v1) ) + if ( KeyButtonFlagChangesArray[v1] ) result = dword_507C08; } return result; @@ -15056,7 +14834,7 @@ signed int v0; // eax@1 pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0)); - pRenderer->DrawTextureIndexed(8, 132, (Texture *)(uTextureID_ControlBG != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG] : 0)); + pRenderer->DrawTextureIndexed(8, 132, (Texture *)(uTextureID_ControlBG[0] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[0]] : 0)); v0 = 0; if ( uTurnSpeed == 128 ) { @@ -15067,21 +14845,21 @@ if ( uTurnSpeed == 64 ) v0 = 1; } - pRenderer->DrawTextureIndexed(BtnTurnCoord[v0], 270, (Texture *)(uTextureID_Con_Smoo[v0] != -1 ? &pIcons_LOD->pTextures[uTextureID_Con_Smoo[v0]] : 0)); + pRenderer->DrawTextureIndexed(BtnTurnCoord[v0], 270, (Texture *)(uTextureID_ControlBG[v0 + 1] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[v0 + 1]] : 0)); if ( bWalkSound ) - pRenderer->DrawTextureIndexed(20, 303, (Texture *)(uTextureID_Option01 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option01] : 0)); + pRenderer->DrawTextureIndexed(20, 303, (Texture *)(uTextureID_ControlBG[21] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[21]] : 0)); if ( bShowDamage ) - pRenderer->DrawTextureIndexed(128, 303, (Texture *)(uTextureID_Option02 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option02] : 0)); + pRenderer->DrawTextureIndexed(128, 303, (Texture *)(uTextureID_ControlBG[22] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[22]] : 0)); if ( bFlipOnExit ) - pRenderer->DrawTextureIndexed(128, 325, (Texture *)(uTextureID_Option04 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option04] : 0)); + pRenderer->DrawTextureIndexed(128, 325, (Texture *)(uTextureID_ControlBG[9] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[9]] : 0)); if ( bAlwaysRun ) - pRenderer->DrawTextureIndexed(20, 325, (Texture *)(uTextureID_Option03 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option03] : 0)); + pRenderer->DrawTextureIndexed(20, 325, (Texture *)(uTextureID_ControlBG[20] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[20]] : 0)); pRenderer->DrawTextureIndexed(17 * (char)uSoundVolumeMultiplier + 265, 162, - (Texture *)(pTextureIDs_SoundLevels[(char)uSoundVolumeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uSoundVolumeMultiplier]] : 0)); + (Texture *)(uTextureID_ControlBG[(char)uSoundVolumeMultiplier + 10] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[(char)uSoundVolumeMultiplier + 10]] : 0)); pRenderer->DrawTextureIndexed(17 * (char)uMusicVolimeMultiplier + 265, 216, - (Texture *)(pTextureIDs_SoundLevels[(char)uMusicVolimeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uMusicVolimeMultiplier]] : 0)); + (Texture *)(uTextureID_ControlBG[(char)uMusicVolimeMultiplier + 10] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[(char)uMusicVolimeMultiplier + 10]] : 0)); pRenderer->DrawTextureIndexed(17 * (char)uVoicesVolumeMultiplier + 265, 270, - (Texture *)(pTextureIDs_SoundLevels[(char)uVoicesVolumeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uVoicesVolumeMultiplier]] : 0)); + (Texture *)(uTextureID_ControlBG[(char)uVoicesVolumeMultiplier + 10] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[(char)uVoicesVolumeMultiplier + 10]] : 0)); } @@ -16520,7 +16298,7 @@ if ( pCurrentScreen == SCREEN_SPELL_BOOK ) { if ( dword_507B00_spell_info_to_draw_in_popup ) - DrawSpellDescriptionPopup((void *)(dword_507B00_spell_info_to_draw_in_popup - 1)); + DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); } goto LABEL_132; }
--- a/mm7_data.cpp Fri Feb 22 18:32:34 2013 +0600 +++ b/mm7_data.cpp Fri Feb 22 18:32:47 2013 +0600 @@ -1779,7 +1779,7 @@ int dword_506988; // weak int dword_50698C; // weak int dword_506E68; // weak -__int16 word_506E6C[18]; // weak +char KeyButtonFlagChangesArray[28]; // weak unsigned int pPrevVirtualCidesMapping[27]; int KeyboardPageNum; // weak int dword_506F0C[777]; // idb @@ -2304,6 +2304,8 @@ int dword_F93F20; // weak int dword_F93F70; // weak +volatile bool initing; + //int crt_F94004; // weak //int crtdword_F9400C; // weak FARPROC lpfn; // idb \ No newline at end of file
--- a/mm7_data.h Fri Feb 22 18:32:34 2013 +0600 +++ b/mm7_data.h Fri Feb 22 18:32:47 2013 +0600 @@ -1182,7 +1182,7 @@ extern int dword_506988; // weak extern int dword_50698C; // weak extern int dword_506E68; // weak -extern __int16 word_506E6C[18]; // weak +extern char KeyButtonFlagChangesArray[28]; // weak extern unsigned int pPrevVirtualCidesMapping[27]; extern int KeyboardPageNum; // weak extern int dword_506F0C[]; // idb @@ -1720,6 +1720,8 @@ extern int dword_F93F20; // weak extern int dword_F93F70; // weak +extern volatile bool initing; //ADDED + //extern int crt_F94004; // weak //extern int crtdword_F9400C; // weak extern FARPROC lpfn; // idb @@ -1821,7 +1823,7 @@ void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue); void __fastcall sub_40F92A(int *pZBuffer, struct Texture *a2, int a3); // idb void __cdecl SetMoonPhaseNames(); -void __thiscall DrawSpellDescriptionPopup(void *_this); +void DrawSpellDescriptionPopup(int spell_index); signed int __fastcall sub_410D99_get_map_index(int a1); unsigned int __cdecl DrawLloydBeaconsScreen(); char *__cdecl DrawTownPortalScreen(); @@ -2331,7 +2333,7 @@ void __cdecl sub_4B8285_prolly_draw_arcomage_result(); void *__cdecl GenerateShopItems(); void *__cdecl sub_4B8F94(); -char *__cdecl sub_4B910F(); +char *__cdecl _4B910F_shop_interaction(); POINT *__cdecl sub_4B9CC6(); void __cdecl sub_4BA928(); signed int __fastcall sub_4BB756(signed int a1);