Mercurial > mm7
changeset 1402:a519a6a412d0
CloseSpellBook and close SpellBookPage
author | Ritor1 |
---|---|
date | Fri, 19 Jul 2013 17:21:40 +0600 |
parents | 3161094869e0 |
children | d3c5f28a0ca5 |
files | GUIWindow.cpp GUIWindow.h LOD.cpp Texture.cpp Texture.h UI/Books/UISpellBook.cpp UI/UIBooks.cpp mm7_5.cpp |
diffstat | 8 files changed, 119 insertions(+), 191 deletions(-) [+] |
line wrap: on
line diff
--- a/GUIWindow.cpp Fri Jul 19 12:50:44 2013 +0600 +++ b/GUIWindow.cpp Fri Jul 19 17:21:40 2013 +0600 @@ -326,17 +326,17 @@ } case WINDOW_SpellBook: { - sub_41140B(); - sub_411473(); + OnCloseSpellBookPage(); + OnCloseSpellBook(); break; } case WINDOW_Book: { - OnCloseSpellBook(); + OnCloseBook(); break; } - case WINDOW_ChangeLocation: - { + case WINDOW_ChangeLocation: + { pTexture_outside->Release(); pTexture_Dialogue_Background->Release(); pIcons_LOD->SyncLoadedFilesCount(); @@ -874,8 +874,8 @@ //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); CreateButton(pViewport->uViewportTL_X + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Xpos, pViewport->uViewportTL_Y + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos, //dword_4E20D0 - dword_506408[i + 1]->uTextureWidth, - dword_506408[i + 1]->uTextureHeight, + SBPageSSpellsTextureList[i + 1]->uTextureWidth, + SBPageSSpellsTextureList[i + 1]->uTextureHeight, 1, 79, UIMSG_SelectSpell, i, 0, "", 0); ++a2; //++v3; @@ -896,10 +896,10 @@ if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT]) CreateButton(400, 271, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 7, 0, aSpellSchoolNames[7], 0); if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK]) CreateButton(400, 307, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 8, 0, aSpellSchoolNames[8], 0); - CreateButton(476, 450, pTexture_506444->uTextureWidth, pTexture_506444->uTextureHeight, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", 0); - pBtn_InstallRemoveSpell = CreateButton(476, 450, 48, 32, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", pTexture_506444, 0); - CreateButton(561, 450, ptr_506440->uTextureWidth, ptr_506440->uTextureHeight, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); - pBtn_CloseBook = CreateButton(561, 450, 48, 32, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], ptr_506440, 0); + CreateButton(476, 450, pSBClickQuickSpellBtnTextr->uTextureWidth, pSBClickQuickSpellBtnTextr->uTextureHeight, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", 0); + pBtn_InstallRemoveSpell = CreateButton(476, 450, 48, 32, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", pSBClickQuickSpellBtnTextr, 0); + CreateButton(561, 450, pSpellBookClickCloseBtnTextr->uTextureWidth, pSpellBookClickCloseBtnTextr->uTextureHeight, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); + pBtn_CloseBook = CreateButton(561, 450, 48, 32, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], pSpellBookClickCloseBtnTextr, 0); } // 50640C: using guessed type int dword_50640C[];
--- a/GUIWindow.h Fri Jul 19 12:50:44 2013 +0600 +++ b/GUIWindow.h Fri Jul 19 17:21:40 2013 +0600 @@ -545,7 +545,7 @@ void BookUI_Calendar_Draw(); void BookUI_Journal_Draw(); -void OnCloseSpellBook(); +void OnCloseBook(); void InitializeBookTextures(); void InitializeBookFonts(); void DrawSpellBookContent(Player *player); @@ -553,8 +553,8 @@ void BookUI_DrawTownPortalMap(); void LoadSpellbook(unsigned int uID); // idb void DrawSpellDescriptionPopup(int spell_index); -void sub_41140B(); -void sub_411473(); +void OnCloseSpellBookPage(); +void OnCloseSpellBook();
--- a/LOD.cpp Fri Jul 19 12:50:44 2013 +0600 +++ b/LOD.cpp Fri Jul 19 17:21:40 2013 +0600 @@ -133,7 +133,7 @@ //----- (004114F2) -------------------------------------------------------- void LODFile_IconsBitmaps::_4114F2() { - LODFile_IconsBitmaps *v1; // esi@1 + //LODFile_IconsBitmaps *v1; // esi@1 int *pTexturePacksCount; // eax@1 int v3; // ecx@1 int v4; // ecx@2 @@ -145,7 +145,7 @@ struct IDirectDrawSurface *v10; // eax@9 int v11; // eax@12 - v1 = this; + //v1 = this; pTexturePacksCount = &this->uTexturePacksCount; v3 = this->uTexturePacksCount; if ( v3 ) @@ -154,41 +154,41 @@ *pTexturePacksCount = v4; if ( !v4 ) { - v5 = v1->uNumLoadedFiles - 1; - if ( v5 >= v1->uNumPrevLoadedFiles ) + v5 = this->uNumLoadedFiles - 1; + if ( v5 >= this->uNumPrevLoadedFiles ) { - v6 = &v1->pTextures[v5]; + v6 = &this->pTextures[v5]; do { v6->Release(); - v7 = v1->pHardwareTextures; + v7 = this->pHardwareTextures; if ( v7 ) { v8 = v7[v5]; if ( v8 ) { v8->Release(); - v1->pHardwareTextures[v5] = 0; + this->pHardwareTextures[v5] = 0; } } - v9 = v1->pHardwareSurfaces; + v9 = this->pHardwareSurfaces; if ( v9 ) { v10 = v9[v5]; if ( v10 ) { v10->Release(); - v1->pHardwareSurfaces[v5] = 0; + this->pHardwareSurfaces[v5] = 0; } } --v5; --v6; } - while ( v5 >= v1->uNumPrevLoadedFiles ); + while ( v5 >= this->uNumPrevLoadedFiles ); } - v11 = v1->uNumPrevLoadedFiles; - v1->uNumPrevLoadedFiles = 0; - v1->uNumLoadedFiles = v11; + v11 = this->uNumPrevLoadedFiles; + this->uNumPrevLoadedFiles = 0; + this->uNumLoadedFiles = v11; } } }
--- a/Texture.cpp Fri Jul 19 12:50:44 2013 +0600 +++ b/Texture.cpp Fri Jul 19 17:21:40 2013 +0600 @@ -47,12 +47,12 @@ Texture *pTex_tab_an_7b__zoot_on; Texture *pTex_tab_an_6b__zoom_on; std::array<Texture *, 6> pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit -std::array<Texture *, 12> dword_5063D8; -std::array<Texture *, 12> dword_506408; -Texture *pTexture_50643C; // idb -Texture *ptr_506440; -Texture *pTexture_506444; -Texture *pTexture_506448; // idb +std::array<Texture *, 12> SBPageCSpellsTextureList; +std::array<Texture *, 12> SBPageSSpellsTextureList; +Texture *pSBQuickSpellBtnTextr; +Texture *pSpellBookClickCloseBtnTextr; +Texture *pSBClickQuickSpellBtnTextr; +Texture *pSpellBookCloseBtnTextr; std::array<std::array<Texture *, 2>, 9> pTextures_tabs; Texture *pTexture_mapbordr; // idb Texture *pTexture_pagemask; // idb
--- a/Texture.h Fri Jul 19 12:50:44 2013 +0600 +++ b/Texture.h Fri Jul 19 17:21:40 2013 +0600 @@ -146,12 +146,12 @@ extern struct Texture *pTex_tab_an_6b__zoom_on; extern std::array<struct Texture *, 6> pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit -extern std::array<struct Texture *, 12> dword_5063D8; -extern std::array<struct Texture *, 12> dword_506408; -extern struct Texture *pTexture_50643C; // idb -extern struct Texture *ptr_506440; -extern struct Texture *pTexture_506444; -extern struct Texture *pTexture_506448; // idb +extern std::array<struct Texture *, 12> SBPageCSpellsTextureList; +extern std::array<struct Texture *, 12> SBPageSSpellsTextureList; +extern struct Texture *pSBQuickSpellBtnTextr; +extern struct Texture *pSpellBookClickCloseBtnTextr; +extern struct Texture *pSBClickQuickSpellBtnTextr; +extern struct Texture *pSpellBookCloseBtnTextr; extern std::array<std::array<struct Texture *, 2>, 9> pTextures_tabs; extern struct Texture *pTexture_mapbordr; // idb extern struct Texture *pTexture_pagemask; // idb
--- a/UI/Books/UISpellBook.cpp Fri Jul 19 12:50:44 2013 +0600 +++ b/UI/Books/UISpellBook.cpp Fri Jul 19 17:21:40 2013 +0600 @@ -24,46 +24,32 @@ //----- (00411300) -------------------------------------------------------- void LoadSpellbook(unsigned int spell_school) - { - //unsigned int v1; // esi@1 - Player *pPlayer; // ecx@1 - char v3; // al@1 - //int v4; // edi@5 - //Texture *result; // eax@6 - //unsigned char *v6; // edi@7 - //unsigned int v7; // eax@7 - //unsigned __int8 v8; // sf@8 - //unsigned __int8 v9; // of@8 - char pContainer[20]; // [sp+Ch] [bp-1Ch]@7 - //Texture *v11; // [sp+20h] [bp-8h]@5 - //int v12; // [sp+24h] [bp-4h]@5 +{ + char pContainer[20]; // [sp+Ch] [bp-1Ch]@7 + + byte_506550 = 0; + if ( pPlayers[uActiveCharacter]->uQuickSpell && (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 == spell_school ) + quick_spell_at_page = (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell - 11 * spell_school; + else + quick_spell_at_page = 0; - byte_506550 = 0; - //v1 = uID; - pPlayer = pPlayers[uActiveCharacter]; - v3 = pPlayer->uQuickSpell; - if ( v3 && (unsigned __int8)v3 / 11 == spell_school ) - quick_spell_at_page = (unsigned __int8)v3 - 11 * spell_school; - else - quick_spell_at_page = 0; + for (uint i = 1; i <= 11; ++i) + { + if (pPlayers[uActiveCharacter]->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1]) + { + sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); + SBPageSSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); - for (uint i = 1; i < 12; ++i) - { - if (pPlayer->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1]) - { - sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); - dword_506408[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); - - sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); - dword_5063D8[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); - } - } + sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); + SBPageCSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); } + } +} //----- (00411597) -------------------------------------------------------- -void OnCloseSpellBook() +void OnCloseBook() { pAllocator->FreeChunk(pSpellFont); pSpellFont = nullptr; @@ -90,44 +76,21 @@ if ( uActiveCharacter ) v0 = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage;//*((char *)&pParty->pPartyBuffs[5].uExpireTime + 6972 * uActiveCharacter + 2); pRenderer->DrawTextureIndexed(8, 8, pSpellBookPagesTextr[v0]); - pRenderer->DrawTextureIndexed(0x1DCu, 0x1C2u, pTexture_50643C); - pRenderer->DrawTextureIndexed(0x231u, 0x1C2u, pTexture_506448); + pRenderer->DrawTextureIndexed(476, 450, pSBQuickSpellBtnTextr); + pRenderer->DrawTextureIndexed(561, 450, pSpellBookCloseBtnTextr); } - - - - //----- (00412B58) -------------------------------------------------------- void DrawSpellBookContent(Player *player) { - //Player *v0; // ebx@1 - int v1; // ebp@1 - //unsigned int v2; // eax@1 - Texture *v3; // edi@1 - int v4; // esi@1 - Texture *v5; // eax@3 - Texture *v6; // edx@5 - int v7; // eax@8 - int v8; // eax@11 - //POINT *v9; // esi@13 + Texture *PendingTexture; // edi@1 + Texture *pTexture; // edx@5 int v10; // eax@13 - Texture *v11; // edx@14 - int v12; // eax@15 - signed int v13; // ecx@18 - unsigned int v14; // esi@18 - unsigned int v15; // edi@18 + unsigned int pX_coord; // esi@18 + unsigned int pY_coord; // edi@18 Texture *pPageTexture; // eax@21 - unsigned int v17; // [sp-Ch] [bp-2Ch]@8 - unsigned int v18; // [sp-Ch] [bp-2Ch]@15 - unsigned int v19; // [sp-8h] [bp-28h]@8 - unsigned int v20; // [sp-8h] [bp-28h]@15 - Texture *v21; // [sp-4h] [bp-24h]@15 signed int v22; // [sp-4h] [bp-24h]@22 - Texture *v23; // [sp+10h] [bp-10h]@5 POINT a2; // [sp+18h] [bp-8h]@13 - //POINT v24; - int v25; static unsigned int texture_tab_coord1[9][2]= {{406, 9}, {406, 46}, {406, 84}, {406,121}, {407,158}, {405, 196}, {405, 234}, {405, 272}, {405,309} }; @@ -137,96 +100,69 @@ BookUI_Spellbook_DrawCurrentSchoolBackground(); - //v0 = pPlayers[uActiveCharacter]; - v1 = 11 * player->lastOpenedSpellbookPage; - //v2 = pIcons_LOD->FindTextureByName("Pending"); - v3 = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending")); + PendingTexture = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending")); pRenderer->ClearZBuffer(0, 479); - v4 = 1; - //if ( __OFSUB__(v1, v1 + 11) ^ 1 ) + if ( (11 * player->lastOpenedSpellbookPage) || ((11 * player->lastOpenedSpellbookPage) + 11) )//??? maybe structure need fix { - do + for ( uint i = 1; i <= 11; ++i ) { - if (player->_guilds_member_bits[v1 + v4 + 63] ) + if (player->_guilds_member_bits[(11 * player->lastOpenedSpellbookPage) + i + 63] ) { - v5 = (Texture *)dword_506408[v4]; - if ( v5 != v3 ) + if ( SBPageSSpellsTextureList[i] != PendingTexture ) { - if ( quick_spell_at_page == v4 ) + if ( quick_spell_at_page == i ) + pTexture = SBPageCSpellsTextureList[i]; + else + pTexture = SBPageSSpellsTextureList[i]; + if ( pTexture->pLevelOfDetail0_prolly_alpha_mask ) { - v6 = dword_5063D8[v4]; - v23 = dword_5063D8[v4]; - } - else - { - v23 = dword_506408[v4]; - v6 = v5; - } - if ( v6->pLevelOfDetail0_prolly_alpha_mask ) - { - v7 = player->lastOpenedSpellbookPage; - // v7 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); - v19 = pViewport->uViewportTL_Y + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos; - v17 = pViewport->uViewportTL_X + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos; - if ( BYTE1(v6->pBits) & 2 ) - pRenderer->DrawTextureTransparent(v17, v19, v6); + pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos; + pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos; + if ( BYTE1(pTexture->pBits) & 2 ) + pRenderer->DrawTextureTransparent(pX_coord, pY_coord, pTexture); else - pRenderer->DrawTextureIndexed(v17, v19, v6); - pRenderer->DrawMaskToZBuffer(pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos, - pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos, v23, v4); + pRenderer->DrawTextureIndexed(pX_coord, pY_coord, pTexture); + pRenderer->DrawMaskToZBuffer(pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos, + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos, pTexture, i); } } } - ++v4; } - while ( v4 - 1 < 11 ); } - /*v9 = */pMouse->GetCursorPos(&a2); + pMouse->GetCursorPos(&a2); v10 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; if ( v10 ) { - v11 = dword_5063D8[v10]; - if ( v11->pLevelOfDetail0_prolly_alpha_mask ) + if ( SBPageCSpellsTextureList[v10]->pLevelOfDetail0_prolly_alpha_mask ) { - v21 = dword_5063D8[v10]; - v12 = player->lastOpenedSpellbookPage; - // v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]); - v20 = pViewport->uViewportTL_Y + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos; - v18 = pViewport->uViewportTL_X + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos; - if ( BYTE1(v11->pBits) & 2 ) - pRenderer->DrawTextureTransparent(v18, v20, v21); + pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Xpos; + pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Ypos; + if ( BYTE1(SBPageCSpellsTextureList[v10]->pBits) & 2 ) + pRenderer->DrawTextureTransparent(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); else - pRenderer->DrawTextureIndexed(v18, v20, v21); + pRenderer->DrawTextureIndexed(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); } } - v13 = 0; - a2.x = (LONG)&player->pActiveSkills[12]; - v14 = (unsigned int)&player->pActiveSkills[12]; - v15 = (unsigned int)&player->pActiveSkills[12]; - v25 = 0; - do + pX_coord = (unsigned int)&player->pActiveSkills[12]; + pY_coord = (unsigned int)&player->pActiveSkills[12]; + for ( uint i = 0; i < 9; i++ ) { - if ( *(short *)a2.x ) + if ( player->pActiveSkills[12 + i] ) { - if ( player->lastOpenedSpellbookPage == v13 ) + if ( player->lastOpenedSpellbookPage == i ) { - pPageTexture = pTextures_tabs[v13][1]; - v14=texture_tab_coord1[v13][0]; - v15=texture_tab_coord1[v13][1]; + pPageTexture = pTextures_tabs[i][1]; + pX_coord = texture_tab_coord1[i][0]; + pY_coord = texture_tab_coord1[i][1]; } else { - pPageTexture = pTextures_tabs[v13][0]; - v14=texture_tab_coord0[v13][0]; - v15=texture_tab_coord0[v13][1]; + pPageTexture = pTextures_tabs[i][0]; + pX_coord = texture_tab_coord0[i][0]; + pY_coord = texture_tab_coord0[i][1]; } - pRenderer->DrawTextureTransparent(v14, v15, pPageTexture); - v13 = v25; + pRenderer->DrawTextureTransparent(pX_coord, pY_coord, pPageTexture); } - a2.x += 2; - ++v13; - v25 = v13; } - while ( v13 < 9 ); } \ No newline at end of file
--- a/UI/UIBooks.cpp Fri Jul 19 12:50:44 2013 +0600 +++ b/UI/UIBooks.cpp Fri Jul 19 17:21:40 2013 +0600 @@ -48,8 +48,6 @@ //----- (0041192C) -------------------------------------------------------- void InitializeBookTextures() { - //signed int v0; // ebp@3 - //Texture **v1; // ebx@3 pAudioPlayer->StopChannels(-1, -1); @@ -60,9 +58,9 @@ pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE); pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE); - pTexture_506448 = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); - ptr_506440 = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); - pTexture_50643C = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); + pSpellBookCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); + pSpellBookClickCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); + pSBQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); //v0 = 1; static const char *texNames[9] = // 004E24EC @@ -71,7 +69,7 @@ "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00" }; - pTexture_506444 = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE); + pSBClickQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE); for (uint i = 0; i < 9; ++i) { pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE); @@ -106,31 +104,25 @@ //----- (0041140B) -------------------------------------------------------- -void sub_41140B() +void OnCloseSpellBookPage() { - signed int v0; // esi@1 - GUIButton *v1; // eax@3 - GUIButton *v2; // esi@4 + GUIButton *pNextButton; // esi@4 - v0 = 0; - do + for ( uint i = 1; i <= 11; i++ ) { - dword_5063D8[11+v0]->Release(); - dword_506408[11+v0]->Release(); - --v0; + SBPageCSpellsTextureList[i]->Release(); + SBPageSSpellsTextureList[i]->Release(); } - while ( v0 >= -11 ); pIcons_LOD->SyncLoadedFilesCount(); - v1 = pGUIWindow_CurrentMenu->pControlsHead; - if ( v1 ) + if ( pGUIWindow_CurrentMenu->pControlsHead ) { do { - v2 = v1->pNext; - pAllocator->FreeChunk(v1); - v1 = v2; + pNextButton = pGUIWindow_CurrentMenu->pControlsHead->pNext; + pAllocator->FreeChunk(pGUIWindow_CurrentMenu->pControlsHead); + pGUIWindow_CurrentMenu->pControlsHead = pNextButton; } - while ( v2 ); + while ( pNextButton ); } pGUIWindow_CurrentMenu->pControlsHead = 0; pGUIWindow_CurrentMenu->pControlsTail = 0; @@ -138,11 +130,11 @@ } //----- (00411473) -------------------------------------------------------- -void sub_411473() +void OnCloseSpellBook() { pTexture_pagemask->Release(); - pTexture_506448->Release(); - pTexture_50643C->Release(); + pSpellBookCloseBtnTextr->Release(); + pSBQuickSpellBtnTextr->Release(); for (uint i = 0; i < 9; ++i) { pSpellBookPagesTextr[i]->Release();
--- a/mm7_5.cpp Fri Jul 19 12:50:44 2013 +0600 +++ b/mm7_5.cpp Fri Jul 19 17:21:40 2013 +0600 @@ -2712,7 +2712,7 @@ if ( uAction >= (signed int)pNPCData4 ) uAction = 0; } - sub_41140B(); + OnCloseSpellBookPage(); pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); pGUIWindow_CurrentMenu->OpenSpellBook(); v127 = rand() % 2 + 204; @@ -2721,7 +2721,7 @@ case UIMSG_OpenSpellbookPage: if ( pTurnEngine->turn_stage == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage ) continue; - sub_41140B(); + OnCloseSpellBookPage(); pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; pGUIWindow_CurrentMenu->OpenSpellBook(); v127 = rand() % 2 + 204;