Mercurial > mm7
diff GUIWindow.cpp @ 198:e6e348d66a75
Some work on spellbook
author | Nomad |
---|---|
date | Sat, 16 Feb 2013 21:46:07 +0200 |
parents | 038a4d09406f |
children | 1527f66fd81b |
line wrap: on
line diff
--- a/GUIWindow.cpp Sat Feb 16 20:24:31 2013 +0200 +++ b/GUIWindow.cpp Sat Feb 16 21:46:07 2013 +0200 @@ -962,66 +962,64 @@ //----- (00411621) -------------------------------------------------------- -GUIButton *GUIWindow::OpenSpellBook() +void GUIWindow::OpenSpellBook() { Player *pPlayer; // edi@1 - GUIWindow *pWindow; // esi@1 - unsigned int v3; // ebp@1 + //GUIWindow *pWindow; // esi@1 + //unsigned int v3; // ebp@1 int v4; // eax@3 - GUIButton *result; // eax@25 + ///GUIButton *result; // eax@25 int a2; // [sp+10h] [bp-8h]@1 - int v7; // [sp+14h] [bp-4h]@1 - - //__debugbreak(); + //int v7; // [sp+14h] [bp-4h]@1 pPlayer = pPlayers[uActiveCharacter]; - pWindow = this; - LoadSpellbook(pPlayer->pNumSpellBookPage); - v3 = 0; + //pWindow = this; + LoadSpellbook(pPlayer->lastOpenedSpellbookPage); + //v3 = 0; a2 = 0; - v7 = (int)&pPlayer->spellbook.pChapters[pPlayer->pNumSpellBookPage]; - do + + auto chapter = &pPlayer->spellbook.pChapters[pPlayer->lastOpenedSpellbookPage]; + for (uint i = 0; i < 11; ++i) { - if ( *(char *)(v7 + v3) ) - { - v4 = 2 * (12 * pPlayer->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2431[12 * pPlayer->pNumSpellBookPage] + v3)); - pWindow->CreateButton(pViewport->uViewportX + dword_4E20D0[v4], - pViewport->uViewportY + dword_4E20D0[v4 + 1], - dword_506408[v3 + 1]->uTextureWidth, - dword_506408[v3 + 1]->uTextureHeight, - 1, 79, 0x56u, v3, 0, "", 0); + if (!chapter->bIsSpellAvailable[i]) + continue; + + v4 = 2 * (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); + CreateButton(pViewport->uViewportX + dword_4E20D0[v4], + pViewport->uViewportY + dword_4E20D0[v4 + 1], + dword_506408[i + 1]->uTextureWidth, + dword_506408[i + 1]->uTextureHeight, + 1, 79, 0x56u, i, 0, "", 0); ++a2; - } - ++v3; + //++v3; } - while ( (signed int)v3 < 11 ); - pWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x33u, 0, 9u, "", 0); + //while ( (signed int)v3 < 11 ); + + CreateButton(0, 0, 0, 0, 1, 0, 0x33u, 0, 9u, "", 0); if ( a2 ) - pWindow->_41D08F(a2, 0, 0, 0); - if ( pPlayer->pActiveSkills[12] ) - pWindow->CreateButton(0x18Fu, 0xAu, 0x32u, 0x24u, 1, 0, 0x57u, 0, 0, aSpellSchoolNames[0], 0); - if ( pPlayer->pActiveSkills[13] ) - pWindow->CreateButton(0x18Fu, 0x2Eu, 0x32u, 0x24u, 1, 0, 0x57u, 1u, 0, aSpellSchoolNames[1], 0); - if ( pPlayer->pActiveSkills[14] ) - pWindow->CreateButton(0x18Fu, 0x53u, 0x32u, 0x24u, 1, 0, 0x57u, 2u, 0, aSpellSchoolNames[2], 0); - if ( pPlayer->pActiveSkills[15] ) - pWindow->CreateButton(0x18Fu, 0x79u, 0x32u, 0x24u, 1, 0, 0x57u, 3u, 0, aSpellSchoolNames[3], 0); - if ( pPlayer->pActiveSkills[16] ) - pWindow->CreateButton(0x18Fu, 0x9Eu, 0x32u, 0x24u, 1, 0, 0x57u, 4u, 0, aSpellSchoolNames[4], 0); - if ( pPlayer->pActiveSkills[17] ) - pWindow->CreateButton(0x190u, 0xC4u, 0x32u, 0x24u, 1, 0, 0x57u, 5u, 0, aSpellSchoolNames[5], 0); - if ( pPlayer->pActiveSkills[18] ) - pWindow->CreateButton(0x190u, 0xEAu, 0x32u, 0x24u, 1, 0, 0x57u, 6u, 0, aSpellSchoolNames[6], 0); - if ( pPlayer->pActiveSkills[19] ) - pWindow->CreateButton(0x190u, 0x10Fu, 0x32u, 0x24u, 1, 0, 0x57u, 7u, 0, aSpellSchoolNames[7], 0); - if ( pPlayer->pActiveSkills[20] ) - pWindow->CreateButton(0x190u, 0x133u, 0x32u, 0x24u, 1, 0, 0x57u, 8u, 0, aSpellSchoolNames[8], 0); - pWindow->CreateButton(0x1DCu, 0x1C2u, pTexture_506444->uTextureWidth, pTexture_506444->uTextureHeight, 1, 78, 0x58u, 0, 0, "", 0); - pBtn_InstallRemoveSpell = pWindow->CreateButton(0x1DCu, 0x1C2u, 0x30u, 0x20u, 1, 78, 0x58u, 0, 0, "", pTexture_506444, 0); - pWindow->CreateButton(0x231u, 0x1C2u, ptr_506440->uTextureWidth, ptr_506440->uTextureHeight, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); - pBtn_CloseBook = pWindow->CreateButton(0x231u, 0x1C2u, 0x30u, 0x20u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], ptr_506440, 0); - result = pBtn_CloseBook; - return result; + _41D08F(a2, 0, 0, 0); + if (pPlayer->pActiveSkills[PLAYER_SKILL_FIRE]) + CreateButton(0x18Fu, 0xAu, 0x32u, 0x24u, 1, 0, 0x57u, 0, 0, aSpellSchoolNames[0], 0); + if (pPlayer->pActiveSkills[PLAYER_SKILL_AIR]) + CreateButton(0x18Fu, 0x2Eu, 0x32u, 0x24u, 1, 0, 0x57u, 1u, 0, aSpellSchoolNames[1], 0); + if (pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) + CreateButton(0x18Fu, 0x53u, 0x32u, 0x24u, 1, 0, 0x57u, 2u, 0, aSpellSchoolNames[2], 0); + if (pPlayer->pActiveSkills[PLAYER_SKILL_EARTH]) + CreateButton(0x18Fu, 0x79u, 0x32u, 0x24u, 1, 0, 0x57u, 3u, 0, aSpellSchoolNames[3], 0); + if (pPlayer->pActiveSkills[PLAYER_SKILL_SPIRIT]) + CreateButton(0x18Fu, 0x9Eu, 0x32u, 0x24u, 1, 0, 0x57u, 4u, 0, aSpellSchoolNames[4], 0); + if (pPlayer->pActiveSkills[PLAYER_SKILL_MIND]) + CreateButton(0x190u, 0xC4u, 0x32u, 0x24u, 1, 0, 0x57u, 5u, 0, aSpellSchoolNames[5], 0); + if (pPlayer->pActiveSkills[PLAYER_SKILL_BODY]) + CreateButton(0x190u, 0xEAu, 0x32u, 0x24u, 1, 0, 0x57u, 6u, 0, aSpellSchoolNames[6], 0); + if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT]) + CreateButton(0x190u, 0x10Fu, 0x32u, 0x24u, 1, 0, 0x57u, 7u, 0, aSpellSchoolNames[7], 0); + if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK]) + CreateButton(0x190u, 0x133u, 0x32u, 0x24u, 1, 0, 0x57u, 8u, 0, aSpellSchoolNames[8], 0); + CreateButton(0x1DCu, 0x1C2u, pTexture_506444->uTextureWidth, pTexture_506444->uTextureHeight, 1, 78, 0x58u, 0, 0, "", 0); + pBtn_InstallRemoveSpell = CreateButton(0x1DCu, 0x1C2u, 0x30u, 0x20u, 1, 78, 0x58u, 0, 0, "", pTexture_506444, 0); + CreateButton(0x231u, 0x1C2u, ptr_506440->uTextureWidth, ptr_506440->uTextureHeight, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); + pBtn_CloseBook = CreateButton(0x231u, 0x1C2u, 0x30u, 0x20u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], ptr_506440, 0); } // 50640C: using guessed type int dword_50640C[];