Mercurial > mm7
changeset 2547:fed97f15d1e1
* SaveLoad
* QuickReference
* Modal
* Character
author | a.parshin |
---|---|
date | Tue, 12 May 2015 01:45:31 +0200 |
parents | 4087cbc62706 |
children | 87e5590d034b |
files | Build/Visual Studio 2013/World of Might and Magic.vcxproj Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters Engine/mm7_data.h GUI/GUIWindow.cpp GUI/GUIWindow.h GUI/UI/UICharacter.cpp GUI/UI/UICharacter.h GUI/UI/UIModal.cpp GUI/UI/UIModal.h GUI/UI/UIMsgProc.cpp GUI/UI/UIMsgProc.h GUI/UI/UIQuickReference.cpp GUI/UI/UIQuickReference.h GUI/UI/UISaveLoad.cpp GUI/UI/UISaveLoad.h GUI/UI/UiGame.cpp Game/Game.cpp Game/MainMenu.cpp |
diffstat | 17 files changed, 757 insertions(+), 611 deletions(-) [+] |
line wrap: on
line diff
--- a/Build/Visual Studio 2013/World of Might and Magic.vcxproj Mon May 11 17:45:02 2015 +0200 +++ b/Build/Visual Studio 2013/World of Might and Magic.vcxproj Tue May 12 01:45:31 2015 +0200 @@ -170,9 +170,10 @@ <ClCompile Include="..\..\GUI\UI\UIGuilds.cpp" /> <ClCompile Include="..\..\GUI\UI\UIHouses.cpp" /> <ClCompile Include="..\..\GUI\UI\UIMainMenu.cpp" /> - <ClCompile Include="..\..\GUI\UI\UIMsgProc.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIModal.cpp" /> <ClCompile Include="..\..\GUI\UI\UIPartyCreation.cpp" /> <ClCompile Include="..\..\GUI\UI\UIPopup.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIQuickReference.cpp" /> <ClCompile Include="..\..\GUI\UI\UIRest.cpp" /> <ClCompile Include="..\..\GUI\UI\UISaveLoad.cpp" /> <ClCompile Include="..\..\GUI\UI\UIShops.cpp" /> @@ -342,9 +343,10 @@ <ClInclude Include="..\..\GUI\UI\UIGuilds.h" /> <ClInclude Include="..\..\GUI\UI\UIHouses.h" /> <ClInclude Include="..\..\GUI\UI\UIMainMenu.h" /> - <ClInclude Include="..\..\GUI\UI\UIMsgProc.h" /> + <ClInclude Include="..\..\GUI\UI\UIModal.h" /> <ClInclude Include="..\..\GUI\UI\UIPartyCreation.h" /> <ClInclude Include="..\..\GUI\UI\UIPopup.h" /> + <ClInclude Include="..\..\GUI\UI\UIQuickReference.h" /> <ClInclude Include="..\..\GUI\UI\UIRest.h" /> <ClInclude Include="..\..\GUI\UI\UISaveLoad.h" /> <ClInclude Include="..\..\GUI\UI\UIShops.h" />
--- a/Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters Mon May 11 17:45:02 2015 +0200 +++ b/Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters Tue May 12 01:45:31 2015 +0200 @@ -505,9 +505,6 @@ <ClCompile Include="..\..\GUI\UI\UIMainMenu.cpp"> <Filter>GUI\UI</Filter> </ClCompile> - <ClCompile Include="..\..\GUI\UI\UIMsgProc.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> <ClCompile Include="..\..\GUI\UI\UIPartyCreation.cpp"> <Filter>GUI\UI</Filter> </ClCompile> @@ -580,6 +577,12 @@ <ClCompile Include="..\..\Game\GameOver.cpp"> <Filter>Game</Filter> </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIQuickReference.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIModal.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\lib\libavcodec\avcodec.h"> @@ -1252,9 +1255,6 @@ <ClInclude Include="..\..\GUI\UI\UIMainMenu.h"> <Filter>GUI\UI</Filter> </ClInclude> - <ClInclude Include="..\..\GUI\UI\UIMsgProc.h"> - <Filter>GUI\UI</Filter> - </ClInclude> <ClInclude Include="..\..\GUI\UI\UIPartyCreation.h"> <Filter>GUI\UI</Filter> </ClInclude> @@ -1327,6 +1327,12 @@ <ClInclude Include="..\..\Game\GameOver.h"> <Filter>Game</Filter> </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIQuickReference.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIModal.h"> + <Filter>GUI\UI</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="..\..\lib\OpenAL\lib\x86\avcodec-55.def">
--- a/Engine/mm7_data.h Mon May 11 17:45:02 2015 +0200 +++ b/Engine/mm7_data.h Tue May 12 01:45:31 2015 +0200 @@ -499,8 +499,6 @@ extern std::array<char, 17> byte_5111F6_OwnedArtifacts; extern std::array<unsigned int, 16> papredoll_dbrds; -extern int bRingsShownInCharScreen; // weak - extern unsigned int uNumBlueFacesInBLVMinimap; extern std::array<unsigned __int16, 50> pBlueFacesInBLVMinimapIDs; extern std::array<int, 14> pTextureIDs_PartyBuffIcons;
--- a/GUI/GUIWindow.cpp Mon May 11 17:45:02 2015 +0200 +++ b/GUI/GUIWindow.cpp Tue May 12 01:45:31 2015 +0200 @@ -1615,13 +1615,6 @@ -void GUIWindow_CharacterRecord::Update() -{ -// ----------------------------------- -// 004156F0 GUI_UpdateWindows --- part - CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]); -} - void GUIWindow_Book::Update() { // ----------------------------------- @@ -1638,13 +1631,6 @@ viewparams->bRedrawGameUI = true; } -void GUIWindow_QuickReference::Update() -{ -// ----------------------------------- -// 004156F0 GUI_UpdateWindows --- part - GameUI_QuickRef_Draw(); -} - void GUIWindow_Dialogue::Update() { // ----------------------------------- @@ -1683,20 +1669,6 @@ } } -void GUIWindow_Save::Update() -{ -// ----------------------------------- -// 004156F0 GUI_UpdateWindows --- part - SaveUI_Draw(); -} - -void GUIWindow_Load::Update() -{ -// ----------------------------------- -// 004156F0 GUI_UpdateWindows --- part - LoadUI_Draw(); -} - void GUIWindow_House::Update() { // ----------------------------------- @@ -1754,13 +1726,6 @@ pRenderer->DrawTextureIndexedAlpha(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u)); } -void GUIWindow_Modal::Update() -{ -// ----------------------------------- -// 004156F0 GUI_UpdateWindows --- part - ModalWindow_ShowHint(); -} - void OnButtonClick::Update() { // ----------------------------------- @@ -2040,44 +2005,6 @@ Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3); } -enum CURRENT_SCREEN modal_window_prev_screen_type; - -//----- (004141CA) -------------------------------------------------------- -void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message) -{ - pEventTimer->Pause(); - modal_window_prev_screen_type = current_screen_type; - pModalWindow = new GUIWindow_Modal(0, 0, window->GetWidth(), window->GetHeight(), OnRelease_message, pStrHint); - current_screen_type = SCREEN_MODAL_WINDOW; -} - -//----- (0041420D) -------------------------------------------------------- -void ModalWindow_ShowHint() -{ - GUIWindow pWindow; // [sp+4h] [bp-54h]@1 - - sprintf(pTmpBuf2.data(), "%s\n \n%s", pModalWindow->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape - pWindow.Hint = pTmpBuf2.data(); - pWindow.uFrameWidth = 400; - pWindow.uFrameHeight = 100; - pWindow.uFrameX = 120; - pWindow.uFrameY = 140; - pWindow.uFrameZ = 519; - pWindow.uFrameW = 239; - pWindow.DrawMessageBox(0); -} - -//----- (0041426F) -------------------------------------------------------- -void ModalWindow_Release() -{ - pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)pModalWindow->par1C, 0, 0); - - pModalWindow->Release(); - pModalWindow = nullptr; - - current_screen_type = modal_window_prev_screen_type; - pEventTimer->Resume(); -} //----- (00467FB6) -------------------------------------------------------- void CreateScrollWindow()
--- a/GUI/GUIWindow.h Mon May 11 17:45:02 2015 +0200 +++ b/GUI/GUIWindow.h Tue May 12 01:45:31 2015 +0200 @@ -379,15 +379,7 @@ }; #pragma pack(pop) -struct GUIWindow_CharacterRecord : public GUIWindow -{ - GUIWindow_CharacterRecord(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : - GUIWindow(x, y, width, height, button, hint) - {} - virtual ~GUIWindow_CharacterRecord() {} - virtual void Update(); -}; struct GUIWindow_Book : public GUIWindow { GUIWindow_Book(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : @@ -409,15 +401,6 @@ virtual void Update(); }; -struct GUIWindow_QuickReference : public GUIWindow -{ - GUIWindow_QuickReference(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : - GUIWindow(x, y, width, height, button, hint) - {} - virtual ~GUIWindow_QuickReference() {} - - virtual void Update(); -}; struct GUIWindow_Dialogue : public GUIWindow { GUIWindow_Dialogue(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint); @@ -457,24 +440,6 @@ virtual void Update(); }; -struct GUIWindow_Save : public GUIWindow -{ - GUIWindow_Save(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : - GUIWindow(x, y, width, height, button, hint) - {} - virtual ~GUIWindow_Save() {} - - virtual void Update(); -}; -struct GUIWindow_Load : public GUIWindow -{ - GUIWindow_Load(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : - GUIWindow(x, y, width, height, button, hint) - {} - virtual ~GUIWindow_Load() {} - - virtual void Update(); -}; struct GUIWindow_House : public GUIWindow { GUIWindow_House(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint); @@ -515,15 +480,6 @@ virtual void Update(); }; -struct GUIWindow_Modal : public GUIWindow -{ - GUIWindow_Modal(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : - GUIWindow(x, y, width, height, button, hint) - {} - virtual ~GUIWindow_Modal() {} - - virtual void Update(); -}; struct OnButtonClick : public GUIWindow { OnButtonClick(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : @@ -700,9 +656,6 @@ -void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message); -void ModalWindow_ShowHint(); -void ModalWindow_Release(); @@ -714,18 +667,10 @@ void MainMenuUI_Create(); MENU_STATE MainMenuUI_Credits_Loop(); -// save & load ui -GUIWindow *SaveUI_Load(enum CURRENT_SCREEN screen); -void SaveUI_Draw(); - -void LoadUI_Draw(); -void LoadUI_Load(unsigned int uDialogueType); // idb - // game ui void GameUI_DrawRightPanel(); void GameUI_DrawRightPanelFrames(); void GameUI_DrawRightPanelItems(); -void GameUI_QuickRef_Draw(); void GameUI_DrawFoodAndGold(); void GameUI_DrawLifeManaBars(); void GameUI_DrawHiredNPCs(); @@ -749,16 +694,10 @@ // character ui -struct GUIWindow *CharacterUI_Initialize(enum CURRENT_SCREEN); const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType); void CharacterUI_SkillsTab_ShowHint(); void CharacterUI_StatsTab_ShowHint(); -void CharacterUI_StatsTab_Draw(Player *player); -void CharacterUI_SkillsTab_CreateButtons(); -void CharacterUI_SkillsTab_Draw(Player *player); -void CharacterUI_AwardsTab_Draw(Player *player); void CharacterUI_InventoryTab_Draw(Player *player, bool a2); -void CharacterUI_CharacterScreen_Draw(Player *player); void CharacterUI_DrawPaperdoll(Player *player); void CharacterUI_DrawPaperdollWithRingOverlay(Player *player); void CharacterUI_ReleaseButtons();
--- a/GUI/UI/UICharacter.cpp Mon May 11 17:45:02 2015 +0200 +++ b/GUI/UI/UICharacter.cpp Tue May 12 01:45:31 2015 +0200 @@ -24,6 +24,9 @@ #include "..\../IO/Mouse.h" +void CharacterUI_LoadPaperdollTextures(); +void WetsuitOn(unsigned int uPlayerID); +void WetsuitOff(unsigned int uPlayerID); int bRingsShownInCharScreen; // 5118E0 @@ -403,9 +406,14 @@ const int pMagicSkills[9] = {PLAYER_SKILL_FIRE, PLAYER_SKILL_AIR, PLAYER_SKILL_WATER, PLAYER_SKILL_EARTH, PLAYER_SKILL_SPIRIT, PLAYER_SKILL_MIND, PLAYER_SKILL_BODY, PLAYER_SKILL_LIGHT, PLAYER_SKILL_DARK}; + +GUIWindow_CharacterRecord::GUIWindow_CharacterRecord(unsigned int uActiveCharacter, enum CURRENT_SCREEN screen) : + GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), uActiveCharacter, nullptr) +{ //----- (00421626) -------------------------------------------------------- -GUIWindow *CharacterUI_Initialize(enum CURRENT_SCREEN screen) -{ +// 00421626 CharacterUI_Initialize --- part +//GUIWindow *CharacterUI_Initialize(enum CURRENT_SCREEN screen) + ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; @@ -416,52 +424,203 @@ CharacterUI_LoadPaperdollTextures(); current_screen_type = screen; - auto wnd = new GUIWindow_CharacterRecord(0, 0, window->GetWidth(), window->GetHeight(), uActiveCharacter, 0); - pCharacterScreen_StatsBtn = wnd->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308, + //auto wnd = new GUIWindow_CharacterRecord(0, 0, window->GetWidth(), window->GetHeight(), uActiveCharacter, 0); + pCharacterScreen_StatsBtn = CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308, pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureWidth, pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureHeight, 1, 0, UIMSG_ClickStatsBtn, 0, 'S', pGlobalTXT_LocalizationStrings[216],// Stats pIcons_LOD->GetTexture(papredoll_dbrds[10]), pIcons_LOD->GetTexture(papredoll_dbrds[9]), 0); - pCharacterScreen_SkillsBtn = wnd->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308, + pCharacterScreen_SkillsBtn = CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308, pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureWidth, pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureHeight, 1, 0, UIMSG_ClickSkillsBtn, 0, 'K', pGlobalTXT_LocalizationStrings[205],//Skills pIcons_LOD->GetTexture(papredoll_dbrds[8]), pIcons_LOD->GetTexture(papredoll_dbrds[7]), 0); - pCharacterScreen_InventoryBtn = wnd->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308, + pCharacterScreen_InventoryBtn = CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308, pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureWidth, pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureHeight, 1, 0, UIMSG_ClickInventoryBtn, 0, 'I', pGlobalTXT_LocalizationStrings[120], //Inventory pIcons_LOD->GetTexture(papredoll_dbrds[6]), pIcons_LOD->GetTexture(papredoll_dbrds[5]), 0); - pCharacterScreen_AwardsBtn = wnd->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308, + pCharacterScreen_AwardsBtn = CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308, pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureWidth, pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureHeight, 1, 0, UIMSG_ClickAwardsBtn, 0, 'A', pGlobalTXT_LocalizationStrings[22], //Awards pIcons_LOD->GetTexture(papredoll_dbrds[4]), pIcons_LOD->GetTexture(papredoll_dbrds[3]), 0); - pCharacterScreen_ExitBtn = wnd->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308, + pCharacterScreen_ExitBtn = CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308, pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureWidth, pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureHeight, 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit pIcons_LOD->GetTexture(papredoll_dbrds[2]), pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0); - wnd->CreateButton(0, 0, 476, 345, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); - pCharacterScreen_DetalizBtn = wnd->CreateButton(600, 300, 30, 30, 1, 0, UIMSG_ChangeDetaliz, 0, 0, pGlobalTXT_LocalizationStrings[64], 0); - pCharacterScreen_DollBtn = wnd->CreateButton(476, 0, 164, 345, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); + CreateButton(0, 0, 476, 345, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); + pCharacterScreen_DetalizBtn = CreateButton(600, 300, 30, 30, 1, 0, UIMSG_ChangeDetaliz, 0, 0, pGlobalTXT_LocalizationStrings[64], 0); + pCharacterScreen_DollBtn = CreateButton(476, 0, 164, 345, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); + + CreateButton(61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); + CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); + CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); + CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + + CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); + FillAwardsData(); +} + +//----- (0041ABFD) -------------------------------------------------------- +void GUIWindow_CharacterRecord::Update() +{ + // ----------------------------------- + // 004156F0 GUI_UpdateWindows --- part + // { + // 0041ABFD CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]); + // } + + auto player = pPlayers[uActiveCharacter]; + + pRenderer->ClearZBuffer(0, 479); + switch (current_character_screen_window) + { + case WINDOW_CharacterWindow_Stats: + { + CharacterUI_ReleaseButtons(); + ReleaseAwardsScrollBar(); + CharacterUI_StatsTab_Draw(player); + pRenderer->DrawTextureIndexed( + pCharacterScreen_StatsBtn->uX, + pCharacterScreen_StatsBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd1-d", TEXTURE_16BIT_PALETTE) + ); + } + break; + + case WINDOW_CharacterWindow_Skills: + { + if (dword_507CC0_activ_ch != uActiveCharacter) + { + CharacterUI_ReleaseButtons(); + CharacterUI_SkillsTab_CreateButtons(); + } + ReleaseAwardsScrollBar(); + CharacterUI_SkillsTab_Draw(player); + pRenderer->DrawTextureIndexed( + pCharacterScreen_SkillsBtn->uX, + pCharacterScreen_SkillsBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd2-d", TEXTURE_16BIT_PALETTE) + ); + } + break; + + case WINDOW_CharacterWindow_Awards: + { + CharacterUI_ReleaseButtons(); + ReleaseAwardsScrollBar(); + CreateAwardsScrollBar(); + CharacterUI_AwardsTab_Draw(player); + pRenderer->DrawTextureIndexed( + pCharacterScreen_AwardsBtn->uX, + pCharacterScreen_AwardsBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd4-d", TEXTURE_16BIT_PALETTE) + ); + } + break; - wnd->CreateButton(61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); - wnd->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); - wnd->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); - wnd->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + case WINDOW_CharacterWindow_Inventory: + { + CharacterUI_ReleaseButtons(); + ReleaseAwardsScrollBar(); + CharacterUI_InventoryTab_Draw(player, false); + pRenderer->DrawTextureIndexed( + pCharacterScreen_InventoryBtn->uX, + pCharacterScreen_InventoryBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd3-d", TEXTURE_16BIT_PALETTE) + ); + } + break; + + default: __debugbreak(); break; + } + + if (bRingsShownInCharScreen) + CharacterUI_DrawPaperdollWithRingOverlay(player); + else + CharacterUI_DrawPaperdoll(player); +} + + + +void GUIWindow_CharacterRecord::ShowStatsTab() +{ +// 004304E7 Game_EventLoop --- part + current_character_screen_window = WINDOW_CharacterWindow_Stats; + CharacterUI_ReleaseButtons(); + ReleaseAwardsScrollBar(); + new OnButtonClick3(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, (int)pCharacterScreen_StatsBtn, 0); +} + +void GUIWindow_CharacterRecord::ShowSkillsTab() +{ +// 004304E7 Game_EventLoop --- part + current_character_screen_window = WINDOW_CharacterWindow_Skills; + CharacterUI_ReleaseButtons(); + ReleaseAwardsScrollBar(); + CharacterUI_SkillsTab_CreateButtons(); + new OnButtonClick3(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, (int)pCharacterScreen_SkillsBtn, 0); +} - wnd->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); - FillAwardsData(); +void GUIWindow_CharacterRecord::ShowInventoryTab() +{ +// 004304E7 Game_EventLoop --- part + current_character_screen_window = WINDOW_CharacterWindow_Inventory; + ReleaseAwardsScrollBar(); + CharacterUI_ReleaseButtons(); + new OnButtonClick3(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, (int)pCharacterScreen_InventoryBtn, 0); +} + +void GUIWindow_CharacterRecord::ShowAwardsTab() +{ +// 004304E7 Game_EventLoop --- part + ReleaseAwardsScrollBar(); + CharacterUI_ReleaseButtons(); + CreateAwardsScrollBar(); + current_character_screen_window = WINDOW_CharacterWindow_Awards; + new OnButtonClick3(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, (int)pCharacterScreen_AwardsBtn, 0); + FillAwardsData(); +} + +void GUIWindow_CharacterRecord::ToggleRingsOverlay() +{ + int v128, v125, v123, v121; - return wnd; + bRingsShownInCharScreen ^= 1; + pCharacterScreen_DetalizBtn->Release(); + pCharacterScreen_DollBtn->Release(); + if (bRingsShownInCharScreen) + { + v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight; + v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth; + v123 = 445; + v121 = 470; + } + else + { + v128 = 30; + v125 = 30; + v123 = 300; + v121 = 600; + } + pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton( + v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0, + pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" + 0 + ); + pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); + viewparams->bRedrawGameUI = true; } + + //----- (004219BE) -------------------------------------------------------- GUIWindow *CastSpellInfo::GetCastSpellInInventoryWindow() { @@ -566,7 +725,7 @@ } //----- (00419719) -------------------------------------------------------- -void CharacterUI_SkillsTab_Draw(Player *player) +void GUIWindow_CharacterRecord::CharacterUI_SkillsTab_Draw(Player *player) { pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_skill", TEXTURE_16BIT_PALETTE)); @@ -593,7 +752,7 @@ } //----- (0041A000) -------------------------------------------------------- -void CharacterUI_AwardsTab_Draw(Player *player) +void GUIWindow_CharacterRecord::CharacterUI_AwardsTab_Draw(Player *player) { int items_per_page; // eax@1 char *v6; // ebx@15 @@ -691,61 +850,6 @@ pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather)); } -//----- (0041ABFD) -------------------------------------------------------- -void CharacterUI_CharacterScreen_Draw(Player *player) -{ - pRenderer->ClearZBuffer(0, 479); - switch (current_character_screen_window) - { - case WINDOW_CharacterWindow_Stats: // stats - CharacterUI_ReleaseButtons(); - ReleaseAwardsScrollBar(); - CharacterUI_StatsTab_Draw(player); - pRenderer->DrawTextureIndexed(pCharacterScreen_StatsBtn->uX, - pCharacterScreen_StatsBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd1-d", TEXTURE_16BIT_PALETTE)); - break; - - case WINDOW_CharacterWindow_Skills: // skills - if (dword_507CC0_activ_ch != uActiveCharacter) - { - CharacterUI_ReleaseButtons(); - CharacterUI_SkillsTab_CreateButtons(); - } - ReleaseAwardsScrollBar(); - CharacterUI_SkillsTab_Draw(player); - pRenderer->DrawTextureIndexed(pCharacterScreen_SkillsBtn->uX, - pCharacterScreen_SkillsBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd2-d", TEXTURE_16BIT_PALETTE)); - break; - - case WINDOW_CharacterWindow_Awards: // awards - CharacterUI_ReleaseButtons(); - ReleaseAwardsScrollBar(); - CreateAwardsScrollBar(); - CharacterUI_AwardsTab_Draw(player); - pRenderer->DrawTextureIndexed(pCharacterScreen_AwardsBtn->uX, - pCharacterScreen_AwardsBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd4-d", TEXTURE_16BIT_PALETTE)); - break; - - case WINDOW_CharacterWindow_Inventory: // inventory and other - CharacterUI_ReleaseButtons(); - ReleaseAwardsScrollBar(); - CharacterUI_InventoryTab_Draw(player, false); - pRenderer->DrawTextureIndexed(pCharacterScreen_InventoryBtn->uX, - pCharacterScreen_InventoryBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd3-d", TEXTURE_16BIT_PALETTE)); - break; - - default: break; - } - - if (bRingsShownInCharScreen) - CharacterUI_DrawPaperdollWithRingOverlay(player); - else - CharacterUI_DrawPaperdoll(player); -} //----- (0043CC7C) -------------------------------------------------------- void CharacterUI_DrawPaperdoll(Player *player) @@ -1858,7 +1962,7 @@ } //----- (00419401) -------------------------------------------------------- -void CharacterUI_SkillsTab_CreateButtons() +void GUIWindow_CharacterRecord::CharacterUI_SkillsTab_CreateButtons() { GUIButton *pButton; // eax@3 unsigned int current_Y; // esi@8 @@ -1949,7 +2053,7 @@ } //----- (00418511) -------------------------------------------------------- -void CharacterUI_StatsTab_Draw( Player *player ) +void GUIWindow_CharacterRecord::CharacterUI_StatsTab_Draw(Player *player) { int pY; // ST34_4@4 const char *pText; // eax@9
--- a/GUI/UI/UICharacter.h Mon May 11 17:45:02 2015 +0200 +++ b/GUI/UI/UICharacter.h Tue May 12 01:45:31 2015 +0200 @@ -1,4 +1,23 @@ #pragma once -void CharacterUI_LoadPaperdollTextures(); -void WetsuitOn(unsigned int uPlayerID); // idb -void WetsuitOff(unsigned int uPlayerID); \ No newline at end of file +#include "GUI/GUIWindow.h" + +struct GUIWindow_CharacterRecord : public GUIWindow +{ + GUIWindow_CharacterRecord(unsigned int uActiveCharacter, enum CURRENT_SCREEN screen); + virtual ~GUIWindow_CharacterRecord() {} + + virtual void Update(); + + void ShowStatsTab(); + void ShowSkillsTab(); + void ShowInventoryTab(); + void ShowAwardsTab(); + void ToggleRingsOverlay(); + + protected: + void CharacterUI_StatsTab_Draw(struct Player *); + void CharacterUI_SkillsTab_Draw(struct Player *); + void CharacterUI_AwardsTab_Draw(struct Player *); + + void CharacterUI_SkillsTab_CreateButtons(); +}; \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIModal.cpp Tue May 12 01:45:31 2015 +0200 @@ -0,0 +1,64 @@ + +#include "OSWindow.h" + +#include "Engine/Engine.h" +#include "Engine/Timer.h" +#include "Engine/texts.h" + +#include "GUI/UI/UIModal.h" + + +enum CURRENT_SCREEN modal_window_prev_screen_type; + +GUIWindow_Modal::GUIWindow_Modal(const char *message, enum UIMessageType on_release_event) : + GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), (int)on_release_event, message) +{ +// ----- (004141CA) -------------------------------------------------------- +// void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message) +// { + pEventTimer->Pause(); + prev_screen_type = current_screen_type; + //modal_window_prev_screen_type = current_screen_type; + //pModalWindow = new GUIWindow_Modal(0, 0, window->GetWidth(), window->GetHeight(), OnRelease_message, pStrHint); + current_screen_type = SCREEN_MODAL_WINDOW; +} + +void GUIWindow_Modal::Update() +{ +// ----------------------------------- +// 004156F0 GUI_UpdateWindows --- part +// { +// ModalWindow_ShowHint(); +// } + +// ----- (0041420D) -------------------------------------------------------- +// void ModalWindow_ShowHint() +// { + GUIWindow pWindow; // [sp+4h] [bp-54h]@1 + + sprintf(pTmpBuf2.data(), "%s\n \n%s", pModalWindow->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape + pWindow.Hint = pTmpBuf2.data(); + pWindow.uFrameWidth = 400; + pWindow.uFrameHeight = 100; + pWindow.uFrameX = 120; + pWindow.uFrameY = 140; + pWindow.uFrameZ = 519; + pWindow.uFrameW = 239; + pWindow.DrawMessageBox(0); +} + + + +//----- (0041426F) -------------------------------------------------------- +void GUIWindow_Modal::Release() +{ + pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)par1C, 0, 0); + + //pModalWindow->Release(); + //pModalWindow = nullptr; + + current_screen_type = prev_screen_type; + pEventTimer->Resume(); + + GUIWindow::Release(); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIModal.h Tue May 12 01:45:31 2015 +0200 @@ -0,0 +1,14 @@ +#pragma once +#include "GUI/GUIWindow.h" + +struct GUIWindow_Modal : public GUIWindow +{ + GUIWindow_Modal(const char *message, enum UIMessageType on_release_event); + virtual ~GUIWindow_Modal() {} + + virtual void Update(); + virtual void Release(); + + protected: + enum CURRENT_SCREEN prev_screen_type; +}; \ No newline at end of file
--- a/GUI/UI/UIMsgProc.h Mon May 11 17:45:02 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -#pragma once \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIQuickReference.cpp Tue May 12 01:45:31 2015 +0200 @@ -0,0 +1,148 @@ +#include "Engine/Engine.h" +#include "Engine/Timer.h" +#include "Engine/LOD.h" +#include "Engine/texts.h" +#include "Engine/Party.h" +#include "Engine/Graphics/IRender.h" + +#include "GUI/GUIFont.h" +#include "GUI/UI/UIQuickReference.h" + +#include "Media/Audio/AudioPlayer.h" + +GUIWindow_QuickReference::GUIWindow_QuickReference() : + GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 5, 0) +{ +// 004304E7 Game_EventLoop --- part + pEventTimer->Pause(); + pAudioPlayer->StopChannels(-1, -1); + current_screen_type = SCREEN_QUICK_REFERENCE; + papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); + pBtn_ExitCancel = CreateButton( + 0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, + pGlobalTXT_LocalizationStrings[79],// "Exit" + pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), + 0 + ); //, v179); +} + +void GUIWindow_QuickReference::Update() +{ +// ----------------------------------- +// 004156F0 GUI_UpdateWindows --- part +// { +// GameUI_QuickRef_Draw(); +// } + +//----- (0041A57E) -------------------------------------------------------- +//void GameUI_QuickRef_Draw() + + unsigned int pTextColor; // eax@7 + unsigned int pX; // [sp+14h] [bp-18h]@2 + unsigned int pY; // edi@9 + int pSkillsCount; // ecx@27 + const char *pText; // eax@38 + int pFontHeight; // [sp+18h] [bp-14h]@1 + + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); + pFontHeight = LOBYTE(pFontArrus->uFontHeight) + 1; + for (uint i = 0; i < 4; ++i) + { + Player* player = &pParty->pPlayers[i]; + pX = 94 * i + 89; + if (i == 0) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 18, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * i + 89, 18, ui_character_header_text_color, player->pName, 84, 0); + if (i == 0) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 47, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //Уров. + sprintf(pTmpBuf.data(), "%lu", player->GetActualLevel()); + if (player->GetActualLevel() <= player->GetBaseLevel()) + pTextColor = player->GetExperienceDisplayColor(); + else + pTextColor = ui_character_bonus_text_color; + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, 47, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + 47; + if (i == 0) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pFontHeight + 47, 0, pGlobalTXT_LocalizationStrings[41], 60, 0);//Класс + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pClassNames[player->classType], 84, 0); + pY = pFontHeight + pY; + if (i == 0) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[107], 60, 0);//Здор. + sprintf(pTmpBuf.data(), "%d", player->sHealth); + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sHealth, player->GetMaxHealth()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if (i == 0) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[209], 60, 0);//Мана + sprintf(pTmpBuf.data(), "%d", player->sMana); + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sMana, player->GetMaxMana()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if (i == 0) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[0], 60, 0);//Класс брони + sprintf(pTmpBuf.data(), "%d", player->GetActualAC()); + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAC(), player->GetBaseAC()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if (!i) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//Атака + sprintf(pTmpBuf.data(), "%+d", player->GetActualAttack(false)); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if (!i) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр. + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetMeleeDamageString(), 84, 0); + pY = pFontHeight + pY; + if (!i) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// Стрелять + sprintf(pTmpBuf.data(), "%+d", player->GetRangedAttack()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if (!i) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр. + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetRangedDamageString(), 84, 0); + pY = pFontHeight + pY; + if (!i) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//Навыки + pSkillsCount = 0; + for (uint j = 0; j <= 36; ++j) + { + if (player->pActiveSkills[j]) + ++pSkillsCount; + } + sprintf(pTmpBuf.data(), "%lu", pSkillsCount); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if (!i) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Очки + sprintf(pTmpBuf.data(), "%lu", player->uSkillPoints); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if (!i) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//Сост. + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, aCharacterConditionNames[player->GetMajorConditionIdx()], 84, 0); + pY = pFontHeight + pY; + if (!i) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//Б.Прим. + if (player->uQuickSpell) + pText = pSpellStats->pInfos[player->uQuickSpell].pShortName; + else + pText = pGlobalTXT_LocalizationStrings[153];//Нет + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pText, 84, 0); + } + + if (pParty->GetPartyReputation() >= 0) + { + if (pParty->GetPartyReputation() <= 5) + pTextColor = ui_character_default_text_color; + else + pTextColor = ui_character_bonus_text_color_neg; + } + else + pTextColor = ui_character_bonus_text_color; + + sprintf(pTmpBuf.data(), "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], pTextColor, GetReputationString(pParty->GetPartyReputation()));//Reputation + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf.data(), 0, 0, 0); + sprintf(pTmpBuf.data(), "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame Слава + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf.data(), 0, 0, 0); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIQuickReference.h Tue May 12 01:45:31 2015 +0200 @@ -0,0 +1,9 @@ +#include "GUI/GUIWindow.h" + +struct GUIWindow_QuickReference : public GUIWindow +{ + GUIWindow_QuickReference(); + virtual ~GUIWindow_QuickReference() {} + + virtual void Update(); +}; \ No newline at end of file
--- a/GUI/UI/UISaveLoad.cpp Mon May 11 17:45:02 2015 +0200 +++ b/GUI/UI/UISaveLoad.cpp Tue May 12 01:45:31 2015 +0200 @@ -1,24 +1,262 @@ #define _CRTDBG_MAP_ALLOC +#define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS #include <io.h> #include "Engine/Engine.h" - -#include "..\../IO/Keyboard.h" +#include "Engine/MapInfo.h" +#include "Engine/Graphics/Render.h" +#include "Engine/LOD.h" +#include "Engine/SaveLoad.h" +#include "Engine/texts.h" -#include "..\../Engine/MapInfo.h" -#include "..\../GUI/GUIWindow.h" -#include "..\../GUI/GUIFont.h" -#include "..\../Engine/Graphics/Render.h" -#include "..\../Engine/LOD.h" -#include "..\../Engine/SaveLoad.h" -#include "..\../Engine/texts.h" +#include "IO/Keyboard.h" + +#include "GUI/GUIFont.h" +#include "GUI/UI/UISaveLoad.h" #include "Game/MainMenu.h" +void UI_DrawSaveLoad(bool save); + + +GUIWindow_Save::GUIWindow_Save() : + GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) +{ + // ------------------------------------------------ + // 0045E93E SaveUI_Load(enum CURRENT_SCREEN screen) + char *v3; // eax@7 + LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 + + ++pIcons_LOD->uTexturePacksCount; + if (!pIcons_LOD->uNumPrevLoadedFiles) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots)); + memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails)); + uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); + uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); + uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); + uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); + uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); + uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); + + //if (screen == SCREEN_SAVEGAME) + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); + } + /*else + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); + }*/ + + //pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...) + pRenderer->Present(); + pSavegameList->Initialize(1); + pLODFile.AllocSubIndicesAndIO(300, 0); + for (uint i = 0; i < 40; ++i) + { + v3 = pSavegameList->pFileList[i].pSaveFileName; + if (!*pSavegameList->pFileList[i].pSaveFileName) + v3 = "1.mm7"; + sprintf(pTmpBuf.data(), "saves\\%s", v3); + if (_access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6)) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]); + } + else + { + pLODFile.LoadFile(pTmpBuf.data(), 1); + fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", 1)); + if (pLODFile.FindContainer("image.pcx", 1)) + { + pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", 1), 0, 1); + pLODFile.CloseWriteFile(); + pSavegameUsedSlots[i] = 1; + } + else + pSavegameUsedSlots[i] = 0; + } + } + pLODFile.FreeSubIndexAndIO(); + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); + uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); + uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); + +// ----------------------------- +// GUIWindow_Save c-tor --- part + CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); + CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); + CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); + CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); + CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); + CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); + CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); + pBtnLoadSlot = CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); + pBtnCancel = CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); + pBtnArrowUp = CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); + pBtnDownArrow = CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); +} + + +void GUIWindow_Save::Update() +{ +// ----------------------------------- +// 004156F0 GUI_UpdateWindows --- part +// { +// SaveUI_Draw(); +// } + +// ----- (004606FE) -------------------------------------------------------- +// void SaveUI_Draw() +// { + UI_DrawSaveLoad(true); +} + + + + +GUIWindow_Load::GUIWindow_Load(bool ingame) : + GUIWindow(0, 0, 0, 0, 0, nullptr) +{ +// ----- (0045E361) -------------------------------------------------------- +// void LoadUI_Load(unsigned int uDialogueType) +// { + current_screen_type = SCREEN_LOADGAME; + + LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 + + dword_6BE138 = -1; + pIcons_LOD->_inlined_sub2(); + + memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots)); + memset(pSavegameThumbnails.data(), 0, 45 * sizeof(RGBTexture)); + uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); + uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); + uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); + uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); + uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); + uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); + if (ingame) + { + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); + if (current_screen_type == SCREEN_SAVEGAME) + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); + } + else + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); + } + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + } + else + pRenderer->DrawTextureNew(0, 0, &main_menu_background); + + + /*pGUIWindow_CurrentMenu = new GUIWindow_Load( + saveload_dlg_xs[uDialogueType], + saveload_dlg_ys[uDialogueType], + saveload_dlg_zs[uDialogueType], + saveload_dlg_ws[uDialogueType], 0, 0);*/ + + // GUIWindow::GUIWindow + this->uFrameX = saveload_dlg_xs[ingame ? 1 : 0]; + this->uFrameY = saveload_dlg_ys[ingame ? 1 : 0]; + this->uFrameWidth = saveload_dlg_zs[ingame ? 1 : 0]; + this->uFrameHeight = saveload_dlg_ws[ingame ? 1 : 0]; + this->uFrameZ = uFrameX + uFrameWidth - 1; + this->uFrameW = uFrameY + uFrameHeight - 1; + + + + DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..." + pRenderer->Present(); + pSavegameList->Initialize(0); + if (pSaveListPosition > (signed int)uNumSavegameFiles) + { + pSaveListPosition = 0; + uLoadGameUI_SelectedSlot = 0; + } + pLODFile.AllocSubIndicesAndIO(300, 0); + Assert(sizeof(SavegameHeader) == 100); + for (uint i = 0; i < uNumSavegameFiles; ++i) + { + sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); + if (_access(pTmpBuf.data(), 6)) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" + continue; + } + pLODFile.LoadFile(pTmpBuf.data(), 1); + if (pLODFile.FindContainer("header.bin", true)) + fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", true)); + if (!_stricmp(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]))// "AutoSave.MM7" + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" + if (!pLODFile.FindContainer("image.pcx", true)) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameList->pFileList[i].pSaveFileName, ""); + } + else + { + pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", true), 0, true); + pLODFile.CloseWriteFile(); + pSavegameUsedSlots[i] = 1; + } + } + + pLODFile.FreeSubIndexAndIO(); + if (current_screen_type == SCREEN_SAVEGAME) + { + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); + } + else + { + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD", TEXTURE_16BIT_PALETTE); + } + uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); + uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); + CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); + CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); + CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); + CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); + CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); + CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); + CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); + pBtnLoadSlot = CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); + pBtnCancel = CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); + pBtnArrowUp = CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); + pBtnDownArrow = CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); +} + + +void GUIWindow_Load::Update() +{ +// ----------------------------------- +// 004156F0 GUI_UpdateWindows --- part +// { +// LoadUI_Draw(); +// } + +// ----- (004606F7) -------------------------------------------------------- +// void LoadUI_Draw() +// { + UI_DrawSaveLoad(false); +} + //----- (004601B7) -------------------------------------------------------- static void UI_DrawSaveLoad(bool save) @@ -136,196 +374,3 @@ } pRenderer->EndScene(); } -// 6A0C9C: using guessed type int dword_6A0C9C; - -//----- (004606F7) -------------------------------------------------------- -void LoadUI_Draw() -{ - UI_DrawSaveLoad(false); -} - -//----- (004606FE) -------------------------------------------------------- -void SaveUI_Draw() -{ - UI_DrawSaveLoad(true); -} - -//----- (0045E361) -------------------------------------------------------- -void LoadUI_Load(unsigned int uDialogueType) -{ - LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 - - dword_6BE138 = -1; - pIcons_LOD->_inlined_sub2(); - - memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots)); - memset(pSavegameThumbnails.data(), 0, 45 * sizeof(RGBTexture)); - uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); - uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); - uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); - uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); - uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); - uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); - if ( uDialogueType ) - { - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); - if ( current_screen_type == SCREEN_SAVEGAME ) - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); - pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); - } - else - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); - pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); - } - pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - } - else - pRenderer->DrawTextureNew(0, 0, &main_menu_background); - pGUIWindow_CurrentMenu = new GUIWindow_Load(saveload_dlg_xs[uDialogueType], saveload_dlg_ys[uDialogueType], saveload_dlg_zs[uDialogueType], - saveload_dlg_ws[uDialogueType], 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..." - pRenderer->Present(); - pSavegameList->Initialize(0); - if ( pSaveListPosition > (signed int)uNumSavegameFiles ) - { - pSaveListPosition = 0; - uLoadGameUI_SelectedSlot = 0; - } - pLODFile.AllocSubIndicesAndIO(300, 0); - Assert(sizeof(SavegameHeader) == 100); - for (uint i = 0; i < uNumSavegameFiles; ++i) - { - sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); - if (_access(pTmpBuf.data(), 6)) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" - continue; - } - pLODFile.LoadFile(pTmpBuf.data(), 1); - if ( pLODFile.FindContainer("header.bin", true) ) - fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", true)); - if ( !_stricmp(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" - if ( !pLODFile.FindContainer("image.pcx", true) ) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameList->pFileList[i].pSaveFileName, ""); - } - else - { - pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", true), 0, true); - pLODFile.CloseWriteFile(); - pSavegameUsedSlots[i] = 1; - } - } - - pLODFile.FreeSubIndexAndIO(); - if ( current_screen_type == SCREEN_SAVEGAME ) - { - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD",TEXTURE_16BIT_PALETTE); - } - else - { - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD",TEXTURE_16BIT_PALETTE); - } - uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); - uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); - pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); - pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); - pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); - pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); - pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); -} - -//----- (0045E93E) -------------------------------------------------------- -GUIWindow *SaveUI_Load(enum CURRENT_SCREEN screen) -{ - char *v3; // eax@7 - LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 - - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots)); - memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails)); - uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); - uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); - uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); - uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); - uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); - uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); - if (screen == SCREEN_SAVEGAME) - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); - pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); - } - else - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); - pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); - } - - //pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...) - pRenderer->Present(); - pSavegameList->Initialize(1); - pLODFile.AllocSubIndicesAndIO(300, 0); - for (uint i = 0; i < 40; ++i) - { - v3 = pSavegameList->pFileList[i].pSaveFileName; - if ( !*pSavegameList->pFileList[i].pSaveFileName ) - v3 = "1.mm7"; - sprintf(pTmpBuf.data(), "saves\\%s", v3); - if ( _access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6) ) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]); - } - else - { - pLODFile.LoadFile(pTmpBuf.data(), 1); - fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", 1)); - if ( pLODFile.FindContainer("image.pcx", 1) ) - { - pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", 1), 0, 1); - pLODFile.CloseWriteFile(); - pSavegameUsedSlots[i] = 1; - } - else - pSavegameUsedSlots[i] = 0; - } - } - pLODFile.FreeSubIndexAndIO(); - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); - uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); - uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); - - auto wnd = new GUIWindow_Save(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); - wnd->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); - wnd->CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); - wnd->CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); - wnd->CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); - wnd->CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); - wnd->CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); - wnd->CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); - pBtnLoadSlot = wnd->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); - pBtnCancel = wnd->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); - pBtnArrowUp = wnd->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); - pBtnDownArrow = wnd->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); - - return wnd; -} \ No newline at end of file
--- a/GUI/UI/UISaveLoad.h Mon May 11 17:45:02 2015 +0200 +++ b/GUI/UI/UISaveLoad.h Tue May 12 01:45:31 2015 +0200 @@ -1,1 +1,18 @@ -#pragma once \ No newline at end of file +#pragma once +#include "GUI/GUIWindow.h" + +struct GUIWindow_Save : public GUIWindow +{ + GUIWindow_Save(); + virtual ~GUIWindow_Save() {} + + virtual void Update(); +}; + +struct GUIWindow_Load : public GUIWindow +{ + GUIWindow_Load(bool ingame); + virtual ~GUIWindow_Load() {} + + virtual void Update(); +}; \ No newline at end of file
--- a/GUI/UI/UiGame.cpp Mon May 11 17:45:02 2015 +0200 +++ b/GUI/UI/UiGame.cpp Tue May 12 01:45:31 2015 +0200 @@ -37,6 +37,7 @@ #include "GUI/GUIFont.h" #include "GUI/UI/UIHouses.h" #include "GUI/UI/UIGame.h" +#include "GUI/UI/UICharacter.h" #include "Media/Audio/AudioPlayer.h" @@ -563,7 +564,7 @@ uActiveCharacter = uPlayerID; return; } - pGUIWindow_CurrentMenu = CharacterUI_Initialize(SCREEN_CHARACTERS); + pGUIWindow_CurrentMenu = new GUIWindow_CharacterRecord(uActiveCharacter, SCREEN_CHARACTERS);//CharacterUI_Initialize(SCREEN_CHARACTERS); return; } if ( current_screen_type == SCREEN_SPELL_BOOK ) @@ -623,7 +624,7 @@ { __debugbreak(); // fix indexing current_character_screen_window = WINDOW_CharacterWindow_Inventory; - pGUIWindow_CurrentMenu = CharacterUI_Initialize(SCREEN_E); + pGUIWindow_CurrentMenu = new GUIWindow_CharacterRecord(uActiveCharacter, SCREEN_E);//CharacterUI_Initialize(SCREEN_E); return; } } @@ -1331,119 +1332,6 @@ window->DrawText(pFontArrus, 14, 114, 0, pTmpBuf.data(), 0, 0, 0); } -//----- (0041A57E) -------------------------------------------------------- -void GameUI_QuickRef_Draw() -{ - unsigned int pTextColor; // eax@7 - unsigned int pX; // [sp+14h] [bp-18h]@2 - unsigned int pY; // edi@9 - int pSkillsCount; // ecx@27 - const char *pText; // eax@38 - int pFontHeight; // [sp+18h] [bp-14h]@1 - - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); - pFontHeight = LOBYTE(pFontArrus->uFontHeight) + 1; - for ( uint i = 0; i < 4; ++i ) - { - Player* player = &pParty->pPlayers[i]; - pX = 94 * i + 89; - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 18, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * i + 89, 18, ui_character_header_text_color, player->pName, 84, 0); - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 47, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //Уров. - sprintf(pTmpBuf.data(), "%lu", player->GetActualLevel()); - if ( player->GetActualLevel() <= player->GetBaseLevel()) - pTextColor = player->GetExperienceDisplayColor(); - else - pTextColor = ui_character_bonus_text_color; - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, 47, pTextColor, pTmpBuf.data(), 84, 0); - pY = pFontHeight + 47; - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pFontHeight + 47, 0, pGlobalTXT_LocalizationStrings[41], 60, 0);//Класс - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pClassNames[player->classType], 84, 0); - pY = pFontHeight + pY; - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[107], 60, 0);//Здор. - sprintf(pTmpBuf.data(), "%d", player->sHealth); - pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sHealth, player->GetMaxHealth()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[209], 60, 0);//Мана - sprintf(pTmpBuf.data(), "%d", player->sMana); - pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sMana, player->GetMaxMana()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[0], 60, 0);//Класс брони - sprintf(pTmpBuf.data(), "%d", player->GetActualAC()); - pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAC(), player->GetBaseAC()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//Атака - sprintf(pTmpBuf.data(), "%+d", player->GetActualAttack(false)); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр. - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetMeleeDamageString(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// Стрелять - sprintf(pTmpBuf.data(), "%+d", player->GetRangedAttack()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр. - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetRangedDamageString(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//Навыки - pSkillsCount = 0; - for ( uint j = 0; j <= 36; ++j ) - { - if ( player->pActiveSkills[j] ) - ++pSkillsCount; - } - sprintf(pTmpBuf.data(), "%lu", pSkillsCount); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Очки - sprintf(pTmpBuf.data(), "%lu", player->uSkillPoints); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//Сост. - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, aCharacterConditionNames[player->GetMajorConditionIdx()], 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//Б.Прим. - if (player->uQuickSpell) - pText = pSpellStats->pInfos[player->uQuickSpell].pShortName; - else - pText = pGlobalTXT_LocalizationStrings[153];//Нет - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pText, 84, 0); - } - - if ( pParty->GetPartyReputation() >= 0 ) - { - if ( pParty->GetPartyReputation() <= 5 ) - pTextColor = ui_character_default_text_color; - else - pTextColor = ui_character_bonus_text_color_neg; - } - else - pTextColor = ui_character_bonus_text_color; - - sprintf(pTmpBuf.data(), "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], pTextColor, GetReputationString(pParty->GetPartyReputation()));//Reputation - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf.data(), 0, 0, 0); - sprintf(pTmpBuf.data(), "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame Слава - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf.data(), 0, 0, 0); -} - //----- (0041AD6E) -------------------------------------------------------- void GameUI_DrawRightPanelItems() {
--- a/Game/Game.cpp Mon May 11 17:45:02 2015 +0200 +++ b/Game/Game.cpp Tue May 12 01:45:31 2015 +0200 @@ -37,6 +37,10 @@ #include "GUI/UI/UIShops.h" #include "GUI/UI/UIPartyCreation.h" #include "GUI/UI/UIGame.h" +#include "GUI/UI/UICharacter.h" +#include "GUI/UI/UIQuickReference.h" +#include "GUI/UI/UISaveLoad.h" +#include "GUI/UI/UIModal.h" #include "Game/Game.h" @@ -146,8 +150,9 @@ pIcons_LOD->RemoveTexturesPackFromTextureList(); DoThatMessageThing(); pGUIWindow_CurrentMenu->Release(); - current_screen_type = SCREEN_LOADGAME; - LoadUI_Load(1); + + //LoadUI_Load(1); + pGUIWindow_CurrentMenu = new GUIWindow_Load(true); } @@ -390,7 +395,7 @@ case UIMSG_Game_OpenSaveGameDialog: { pGUIWindow_CurrentMenu->Release(); - pGUIWindow_CurrentMenu = SaveUI_Load(current_screen_type = SCREEN_SAVEGAME); + pGUIWindow_CurrentMenu = new GUIWindow_Save(); //SaveUI_Load(current_screen_type = SCREEN_SAVEGAME); continue; } case UIMSG_Game_OpenOptionsDialog://Open @@ -670,7 +675,7 @@ MM7Initialization(); continue; }*/ - ModalWindow(pNPCTopics[453].pText, UIMSG_0); + pModalWindow = new GUIWindow_Modal(pNPCTopics[453].pText, UIMSG_0); __debugbreak(); // Nomad: graphicsmode as it was now removed continue; @@ -1283,7 +1288,8 @@ back_to_game(); continue; } - ModalWindow_Release(); + pModalWindow->Release(); + pModalWindow = nullptr; continue; case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel @@ -1957,7 +1963,7 @@ sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." pGlobalTXT_LocalizationStrings[118],// "We hope that you've enjoyed playing Might and Magic VII as much as we did making it. We have saved this screen as MM7_WIN.PCX in your MM7 directory. You can print it out as proof of your accomplishment." pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team." - ModalWindow(pFinalMessage.data(), UIMSG_OnFinalWindowClose); + pModalWindow = new GUIWindow_Modal(pFinalMessage.data(), UIMSG_OnFinalWindowClose); uGameState = GAME_STATE_FINAL_WINDOW; continue; case UIMSG_OnFinalWindowClose: @@ -2492,21 +2498,15 @@ continue; case UIMSG_QuickReference: DoThatMessageThing(); - if (current_screen_type) + if (current_screen_type != SCREEN_GAME) pGUIWindow_CurrentMenu->Release(); ++pIcons_LOD->uTexturePacksCount; if (!pIcons_LOD->uNumPrevLoadedFiles) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; new OnButtonClick2(0x230u, 0x1C2u, 0, 0, (int)pBtn_QuickReference, 0); - viewparams->bRedrawGameUI = 1; - pEventTimer->Pause(); - pAudioPlayer->StopChannels(-1, -1); - current_screen_type = SCREEN_QUICK_REFERENCE; - pGUIWindow_CurrentMenu = new GUIWindow_QuickReference(0, 0, window->GetWidth(), window->GetHeight(), 5, 0); - papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); - pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, - pGlobalTXT_LocalizationStrings[79],// "Exit" - pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179); + viewparams->bRedrawGameUI = true; + + pGUIWindow_CurrentMenu = new GUIWindow_QuickReference(); continue; case UIMSG_GameMenuButton: if (current_screen_type != SCREEN_GAME) @@ -2546,45 +2546,11 @@ BtnDown_flag = 1; continue; case UIMSG_ChangeDetaliz: - bRingsShownInCharScreen ^= 1; - pCharacterScreen_DetalizBtn->Release(); - pCharacterScreen_DollBtn->Release(); - if (bRingsShownInCharScreen) - { - v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight; - v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth; - v123 = 445; - v121 = 470; - } - else - { - v128 = 30; - v125 = 30; - v123 = 300; - v121 = 600; - } - pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0, - pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" - 0); - pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); - viewparams->bRedrawGameUI = 1; + ((GUIWindow_CharacterRecord *)pGUIWindow_CurrentMenu)->ToggleRingsOverlay(); continue; case UIMSG_ClickPaperdoll: OnPaperdollLeftClick(); continue; - case UIMSG_ClickStatsBtn: - current_character_screen_window = WINDOW_CharacterWindow_Stats; - CharacterUI_ReleaseButtons(); - ReleaseAwardsScrollBar(); - new OnButtonClick3(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, (int)pCharacterScreen_StatsBtn, 0); - continue; - case UIMSG_ClickSkillsBtn: - current_character_screen_window = WINDOW_CharacterWindow_Skills; - CharacterUI_ReleaseButtons(); - ReleaseAwardsScrollBar(); - CharacterUI_SkillsTab_CreateButtons(); - new OnButtonClick3(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, (int)pCharacterScreen_SkillsBtn, 0); - continue; case UIMSG_SkillUp: pPlayer4 = pPlayers[uActiveCharacter]; v105 = (int)&pPlayer4->pActiveSkills[uMessageParam]; @@ -2608,23 +2574,21 @@ } ShowStatusBarString(v87, 2); continue; + case UIMSG_ClickStatsBtn: + ((GUIWindow_CharacterRecord *)pGUIWindow_CurrentMenu)->ShowStatsTab(); + continue; + case UIMSG_ClickSkillsBtn: + ((GUIWindow_CharacterRecord *)pGUIWindow_CurrentMenu)->ShowSkillsTab(); + continue; case UIMSG_ClickInventoryBtn: - current_character_screen_window = WINDOW_CharacterWindow_Inventory; - ReleaseAwardsScrollBar(); - CharacterUI_ReleaseButtons(); - new OnButtonClick3(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, (int)pCharacterScreen_InventoryBtn, 0); + ((GUIWindow_CharacterRecord *)pGUIWindow_CurrentMenu)->ShowInventoryTab(); + continue; + case UIMSG_ClickAwardsBtn: + ((GUIWindow_CharacterRecord *)pGUIWindow_CurrentMenu)->ShowAwardsTab(); continue; case UIMSG_ClickExitCharacterWindowBtn: new OnCancel2(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, (int)pCharacterScreen_ExitBtn, 0); continue; - case UIMSG_ClickAwardsBtn: - ReleaseAwardsScrollBar(); - CharacterUI_ReleaseButtons(); - CreateAwardsScrollBar(); - current_character_screen_window = WINDOW_CharacterWindow_Awards; - new OnButtonClick3(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, (int)pCharacterScreen_AwardsBtn, 0); - FillAwardsData(); - continue; case UIMSG_ClickBooksBtn: switch (uMessageParam) {
--- a/Game/MainMenu.cpp Mon May 11 17:45:02 2015 +0200 +++ b/Game/MainMenu.cpp Tue May 12 01:45:31 2015 +0200 @@ -12,6 +12,7 @@ #include "GUI/GUIWindow.h" #include "GUI/GUIButton.h" #include "GUI/UI/UIPartyCreation.h" +#include "GUI/UI/UISaveLoad.h" #include "Media/Audio/AudioPlayer.h" @@ -259,7 +260,8 @@ case UIMSG_Escape: if (pModalWindow) { - ModalWindow_Release(); + pModalWindow->Release(); + pModalWindow = nullptr; break; } if (!(dword_6BE364_game_settings_1 & GAME_SETTINGS_4000)) @@ -392,8 +394,9 @@ main_menu_background.Release(); main_menu_background.Load("lsave640.pcx", 0); pGUIWindow2 = new GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); - current_screen_type = SCREEN_LOADGAME; - LoadUI_Load(0); + + //LoadUI_Load(0); + pGUIWindow_CurrentMenu = new GUIWindow_Load(false); } pWindow = pGUIWindow_CurrentMenu; }