diff Engine/Engine.cpp @ 2544:c674d547cc7c

GUIWindow switch logic refactored into behaviour classes
author a.parshin
date Mon, 11 May 2015 09:51:04 +0200
parents b6140dfeac27
children 4008b2f34be0
line wrap: on
line diff
--- a/Engine/Engine.cpp	Sun May 10 03:21:14 2015 +0200
+++ b/Engine/Engine.cpp	Mon May 11 09:51:04 2015 +0200
@@ -1059,7 +1059,7 @@
     static_assert(sizeof(PartyTimeStruct) == 0x678, "Wrong type size");
     static_assert(sizeof(Party) == 0x16238, "Wrong type size");
     static_assert(sizeof(GUIButton) == 0xBC, "Wrong type size");
-    static_assert(sizeof(GUIWindow) == 0x54, "Wrong type size");
+    //static_assert(sizeof(GUIWindow) == 0x54, "Wrong type size");
     //static_assert(sizeof(GUIProgressBar) == 0x1B8, "Wrong type size");
     static_assert(sizeof(GUIFont) == 0x1020, "Wrong type size");
     // static_assert(sizeof(stru262_TurnBased) == 0x40, "Wrong type size");
@@ -1811,8 +1811,8 @@
     Log::Warning(L"MM: entering main loop");
     while (1)
     {
-        //MainMenuWindow* main_menu_window = MainMenuWindow::Create();
-        //window->AddControl(main_menu_window);
+        MainMenuWindow *main_menu_window = MainMenuWindow::Create();
+        window->AddControl(main_menu_window);
         MainMenu_Loop();
         uGameState = GAME_STATE_PLAYING;
         while (1)
@@ -2127,7 +2127,11 @@
     v0 = uNumVisibleWindows;
     pParty->armageddon_timer = 0;
     while (v0 > 0)
-        pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release();
+    {
+        pWindowList[pVisibleWindowsIdxs[v0--] - 1]->Release();
+        delete pWindowList[pVisibleWindowsIdxs[v0--] - 1];
+        pWindowList[pVisibleWindowsIdxs[v0--] - 1] = nullptr;
+    }
 }
 
 //----- (00461103) --------------------------------------------------------
@@ -3405,7 +3409,7 @@
         dword_5C3418 = a1;
         dword_5C341C = a2;
         _591094_decoration = activeLevelDecoration;
-        pGUIWindow2 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_GreetingNPC, a4, 0);
+        pGUIWindow2 = new GUIWindow_GenericDialogue(0, 0, window->GetWidth(), window->GetHeight(), a4, 0);
         pGUIWindow2->CreateButton(61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
         pGUIWindow2->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
         pGUIWindow2->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);