diff Game/Game.cpp @ 2547:fed97f15d1e1

* SaveLoad * QuickReference * Modal * Character
author a.parshin
date Tue, 12 May 2015 01:45:31 +0200
parents 4087cbc62706
children 87e5590d034b
line wrap: on
line diff
--- 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)
                 {