Mercurial > mm7
comparison GUIWindow.cpp @ 198:e6e348d66a75
Some work on spellbook
author | Nomad |
---|---|
date | Sat, 16 Feb 2013 21:46:07 +0200 |
parents | 038a4d09406f |
children | 1527f66fd81b |
comparison
equal
deleted
inserted
replaced
197:5979fc0de9ae | 198:e6e348d66a75 |
---|---|
960 } | 960 } |
961 } | 961 } |
962 | 962 |
963 | 963 |
964 //----- (00411621) -------------------------------------------------------- | 964 //----- (00411621) -------------------------------------------------------- |
965 GUIButton *GUIWindow::OpenSpellBook() | 965 void GUIWindow::OpenSpellBook() |
966 { | 966 { |
967 Player *pPlayer; // edi@1 | 967 Player *pPlayer; // edi@1 |
968 GUIWindow *pWindow; // esi@1 | 968 //GUIWindow *pWindow; // esi@1 |
969 unsigned int v3; // ebp@1 | 969 //unsigned int v3; // ebp@1 |
970 int v4; // eax@3 | 970 int v4; // eax@3 |
971 GUIButton *result; // eax@25 | 971 ///GUIButton *result; // eax@25 |
972 int a2; // [sp+10h] [bp-8h]@1 | 972 int a2; // [sp+10h] [bp-8h]@1 |
973 int v7; // [sp+14h] [bp-4h]@1 | 973 //int v7; // [sp+14h] [bp-4h]@1 |
974 | |
975 //__debugbreak(); | |
976 | 974 |
977 pPlayer = pPlayers[uActiveCharacter]; | 975 pPlayer = pPlayers[uActiveCharacter]; |
978 pWindow = this; | 976 //pWindow = this; |
979 LoadSpellbook(pPlayer->pNumSpellBookPage); | 977 LoadSpellbook(pPlayer->lastOpenedSpellbookPage); |
980 v3 = 0; | 978 //v3 = 0; |
981 a2 = 0; | 979 a2 = 0; |
982 v7 = (int)&pPlayer->spellbook.pChapters[pPlayer->pNumSpellBookPage]; | 980 |
983 do | 981 auto chapter = &pPlayer->spellbook.pChapters[pPlayer->lastOpenedSpellbookPage]; |
984 { | 982 for (uint i = 0; i < 11; ++i) |
985 if ( *(char *)(v7 + v3) ) | 983 { |
986 { | 984 if (!chapter->bIsSpellAvailable[i]) |
987 v4 = 2 * (12 * pPlayer->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2431[12 * pPlayer->pNumSpellBookPage] + v3)); | 985 continue; |
988 pWindow->CreateButton(pViewport->uViewportX + dword_4E20D0[v4], | 986 |
989 pViewport->uViewportY + dword_4E20D0[v4 + 1], | 987 v4 = 2 * (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); |
990 dword_506408[v3 + 1]->uTextureWidth, | 988 CreateButton(pViewport->uViewportX + dword_4E20D0[v4], |
991 dword_506408[v3 + 1]->uTextureHeight, | 989 pViewport->uViewportY + dword_4E20D0[v4 + 1], |
992 1, 79, 0x56u, v3, 0, "", 0); | 990 dword_506408[i + 1]->uTextureWidth, |
991 dword_506408[i + 1]->uTextureHeight, | |
992 1, 79, 0x56u, i, 0, "", 0); | |
993 ++a2; | 993 ++a2; |
994 } | 994 //++v3; |
995 ++v3; | 995 } |
996 } | 996 //while ( (signed int)v3 < 11 ); |
997 while ( (signed int)v3 < 11 ); | 997 |
998 pWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x33u, 0, 9u, "", 0); | 998 CreateButton(0, 0, 0, 0, 1, 0, 0x33u, 0, 9u, "", 0); |
999 if ( a2 ) | 999 if ( a2 ) |
1000 pWindow->_41D08F(a2, 0, 0, 0); | 1000 _41D08F(a2, 0, 0, 0); |
1001 if ( pPlayer->pActiveSkills[12] ) | 1001 if (pPlayer->pActiveSkills[PLAYER_SKILL_FIRE]) |
1002 pWindow->CreateButton(0x18Fu, 0xAu, 0x32u, 0x24u, 1, 0, 0x57u, 0, 0, aSpellSchoolNames[0], 0); | 1002 CreateButton(0x18Fu, 0xAu, 0x32u, 0x24u, 1, 0, 0x57u, 0, 0, aSpellSchoolNames[0], 0); |
1003 if ( pPlayer->pActiveSkills[13] ) | 1003 if (pPlayer->pActiveSkills[PLAYER_SKILL_AIR]) |
1004 pWindow->CreateButton(0x18Fu, 0x2Eu, 0x32u, 0x24u, 1, 0, 0x57u, 1u, 0, aSpellSchoolNames[1], 0); | 1004 CreateButton(0x18Fu, 0x2Eu, 0x32u, 0x24u, 1, 0, 0x57u, 1u, 0, aSpellSchoolNames[1], 0); |
1005 if ( pPlayer->pActiveSkills[14] ) | 1005 if (pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) |
1006 pWindow->CreateButton(0x18Fu, 0x53u, 0x32u, 0x24u, 1, 0, 0x57u, 2u, 0, aSpellSchoolNames[2], 0); | 1006 CreateButton(0x18Fu, 0x53u, 0x32u, 0x24u, 1, 0, 0x57u, 2u, 0, aSpellSchoolNames[2], 0); |
1007 if ( pPlayer->pActiveSkills[15] ) | 1007 if (pPlayer->pActiveSkills[PLAYER_SKILL_EARTH]) |
1008 pWindow->CreateButton(0x18Fu, 0x79u, 0x32u, 0x24u, 1, 0, 0x57u, 3u, 0, aSpellSchoolNames[3], 0); | 1008 CreateButton(0x18Fu, 0x79u, 0x32u, 0x24u, 1, 0, 0x57u, 3u, 0, aSpellSchoolNames[3], 0); |
1009 if ( pPlayer->pActiveSkills[16] ) | 1009 if (pPlayer->pActiveSkills[PLAYER_SKILL_SPIRIT]) |
1010 pWindow->CreateButton(0x18Fu, 0x9Eu, 0x32u, 0x24u, 1, 0, 0x57u, 4u, 0, aSpellSchoolNames[4], 0); | 1010 CreateButton(0x18Fu, 0x9Eu, 0x32u, 0x24u, 1, 0, 0x57u, 4u, 0, aSpellSchoolNames[4], 0); |
1011 if ( pPlayer->pActiveSkills[17] ) | 1011 if (pPlayer->pActiveSkills[PLAYER_SKILL_MIND]) |
1012 pWindow->CreateButton(0x190u, 0xC4u, 0x32u, 0x24u, 1, 0, 0x57u, 5u, 0, aSpellSchoolNames[5], 0); | 1012 CreateButton(0x190u, 0xC4u, 0x32u, 0x24u, 1, 0, 0x57u, 5u, 0, aSpellSchoolNames[5], 0); |
1013 if ( pPlayer->pActiveSkills[18] ) | 1013 if (pPlayer->pActiveSkills[PLAYER_SKILL_BODY]) |
1014 pWindow->CreateButton(0x190u, 0xEAu, 0x32u, 0x24u, 1, 0, 0x57u, 6u, 0, aSpellSchoolNames[6], 0); | 1014 CreateButton(0x190u, 0xEAu, 0x32u, 0x24u, 1, 0, 0x57u, 6u, 0, aSpellSchoolNames[6], 0); |
1015 if ( pPlayer->pActiveSkills[19] ) | 1015 if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT]) |
1016 pWindow->CreateButton(0x190u, 0x10Fu, 0x32u, 0x24u, 1, 0, 0x57u, 7u, 0, aSpellSchoolNames[7], 0); | 1016 CreateButton(0x190u, 0x10Fu, 0x32u, 0x24u, 1, 0, 0x57u, 7u, 0, aSpellSchoolNames[7], 0); |
1017 if ( pPlayer->pActiveSkills[20] ) | 1017 if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK]) |
1018 pWindow->CreateButton(0x190u, 0x133u, 0x32u, 0x24u, 1, 0, 0x57u, 8u, 0, aSpellSchoolNames[8], 0); | 1018 CreateButton(0x190u, 0x133u, 0x32u, 0x24u, 1, 0, 0x57u, 8u, 0, aSpellSchoolNames[8], 0); |
1019 pWindow->CreateButton(0x1DCu, 0x1C2u, pTexture_506444->uTextureWidth, pTexture_506444->uTextureHeight, 1, 78, 0x58u, 0, 0, "", 0); | 1019 CreateButton(0x1DCu, 0x1C2u, pTexture_506444->uTextureWidth, pTexture_506444->uTextureHeight, 1, 78, 0x58u, 0, 0, "", 0); |
1020 pBtn_InstallRemoveSpell = pWindow->CreateButton(0x1DCu, 0x1C2u, 0x30u, 0x20u, 1, 78, 0x58u, 0, 0, "", pTexture_506444, 0); | 1020 pBtn_InstallRemoveSpell = CreateButton(0x1DCu, 0x1C2u, 0x30u, 0x20u, 1, 78, 0x58u, 0, 0, "", pTexture_506444, 0); |
1021 pWindow->CreateButton(0x231u, 0x1C2u, ptr_506440->uTextureWidth, ptr_506440->uTextureHeight, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); | 1021 CreateButton(0x231u, 0x1C2u, ptr_506440->uTextureWidth, ptr_506440->uTextureHeight, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); |
1022 pBtn_CloseBook = pWindow->CreateButton(0x231u, 0x1C2u, 0x30u, 0x20u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], ptr_506440, 0); | 1022 pBtn_CloseBook = CreateButton(0x231u, 0x1C2u, 0x30u, 0x20u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], ptr_506440, 0); |
1023 result = pBtn_CloseBook; | |
1024 return result; | |
1025 } | 1023 } |
1026 // 50640C: using guessed type int dword_50640C[]; | 1024 // 50640C: using guessed type int dword_50640C[]; |
1027 | 1025 |
1028 | 1026 |
1029 //----- (004B3157) -------------------------------------------------------- | 1027 //----- (004B3157) -------------------------------------------------------- |