diff Game/MainMenu.cpp @ 2552:ac16f4a3a91e

Load from MainMenu logic separated from MainMenu window
author a.parshin
date Wed, 13 May 2015 01:33:20 +0200
parents 4008b2f34be0
children 48708da03b7f
line wrap: on
line diff
--- a/Game/MainMenu.cpp	Tue May 12 12:03:30 2015 +0200
+++ b/Game/MainMenu.cpp	Wed May 13 01:33:20 2015 +0200
@@ -17,6 +17,7 @@
 #include "Media/Audio/AudioPlayer.h"
 
 #include "Game/MainMenu.h"
+#include "Game/MainMenuLoad.h"
 
 
 RGBTexture main_menu_background;
@@ -61,7 +62,8 @@
                 break;
             case UIMSG_MainMenu_ShowLoadWindow:
                 new OnButtonClick2(495, 227, 0, 0, (int)pMainMenu_BtnLoad, 0);
-                SetCurrentMenuID(MENU_SAVELOAD);
+                //SetCurrentMenuID(MENU_SAVELOAD);
+                MainMenuLoad_Loop();
                 break;
             case UIMSG_ShowCredits:
                 new OnButtonClick2(495, 282, 0, 0, (int)pMainMenu_BtnCredits, 0);
@@ -190,10 +192,11 @@
             case UIMSG_ChangeCursor:
                 pMouse->SetCursorBitmap("MICON2");
                 break;
-            case UIMSG_3A:
+            case UIMSG_DebugBlv:
+                __debugbreak();//some debugging tool
                 SetCurrentMenuID(MENU_DebugBLVLevel);
                 break;
-            case UIMSG_LoadGame:
+            /*case UIMSG_LoadGame:
                 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
                     break;
                 SetCurrentMenuID(MENU_LoadingProcInMainMenu);
@@ -233,22 +236,24 @@
                     pSaveListPosition = 0;
                 pWindow = pGUIWindow_CurrentMenu;
                 new OnButtonClick2(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, (int)pBtnDownArrow, 0);
-                break;
+                break;*/
             case UIMSG_Cancel:
                 new OnCancel3(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (int)pBtnCancel, 0);
                 break;
-            case UIMSG_ArrowUp:
+            /*case UIMSG_ArrowUp:
                 --pSaveListPosition;
                 if (pSaveListPosition < 0)
                     pSaveListPosition = 0;
                 pWindow = pGUIWindow_CurrentMenu;
                 new OnButtonClick2(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, (int)pBtnArrowUp, 0);
-                break;
+                break;*/
             case UIMSG_AD:
+                __debugbreak();//some debugging tool
                 new OnButtonClick2(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, (int)pMainMenu_BtnNew, 0);
                 SetCurrentMenuID(MENU_LoadingProcInMainMenu);
                 break;
-            case UIMSG_AE:
+            case UIMSG_DebugBlv2:
+                __debugbreak();//some debugging tool
                 new OnButtonClick2(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, (int)pMainMenu_BtnExit, 0);
                 SetCurrentMenuID(MENU_DebugBLVLevel);
                 break;
@@ -283,7 +288,7 @@
                     pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0);
                     break;
                 }
-                if (GetCurrentMenuID() == MENU_CREDITSPROC && !current_screen_type)
+                if (GetCurrentMenuID() == MENU_CREDITSPROC && current_screen_type == SCREEN_GAME)
                 {
                     //if ( current_screen_type == SCREEN_VIDEO )
                     //pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag);
@@ -300,7 +305,7 @@
                     pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0);
                     break;
                 }
-                if (current_screen_type == SCREEN_LOADGAME)
+                /*if (current_screen_type == SCREEN_LOADGAME)
                 {
                     pIcons_LOD->RemoveTexturesPackFromTextureList();
                     //crt_deconstruct_ptr_6A0118();
@@ -315,7 +320,7 @@
                     current_screen_type = SCREEN_GAME;
                     viewparams->bRedrawGameUI = v15;
                     break;
-                }
+                }*/
                 if (current_screen_type == SCREEN_VIDEO)
                 {
                     //pVideoPlayer->Unload();
@@ -323,10 +328,17 @@
                 else
                 {
                     if (current_screen_type != SCREEN_1B)
-                    {
-                        pGUIWindow_CurrentMenu->Release();
-                        pGUIWindow2->Release();
-                        pGUIWindow2 = 0;
+                    { // MENU_CREDITSCLOSE  for example
+                        if (pGUIWindow_CurrentMenu)
+                        {
+                            pGUIWindow_CurrentMenu->Release();
+                            pGUIWindow_CurrentMenu = nullptr;
+                        }
+                        if (pGUIWindow2)
+                        {
+                            pGUIWindow2->Release();
+                            pGUIWindow2 = 0;
+                        }
                         pEventTimer->Resume();
                         current_screen_type = SCREEN_GAME;
                         viewparams->bRedrawGameUI = v15;
@@ -368,12 +380,14 @@
     SetCurrentMenuID(MENU_MAIN);
     SetForegroundWindow(window->GetApiHandle());
     SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0);
-    while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD)
+
+    //while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD)
+    while (GetCurrentMenuID() == MENU_MAIN)
     {
         POINT pt;
         pMouse->GetCursorPos(&pt);
         pWindow = pWindow_MainMenu;
-        if (GetCurrentMenuID() == MENU_SAVELOAD)
+        /*if (GetCurrentMenuID() == MENU_SAVELOAD)
         {
             if (current_screen_type != SCREEN_LOADGAME)
             {
@@ -385,7 +399,7 @@
                 pGUIWindow_CurrentMenu = new GUIWindow_Load(false);
             }
             pWindow = pGUIWindow_CurrentMenu;
-        }
+        }*/
 
         while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE))
         {
@@ -417,11 +431,11 @@
     pRenderer->EndScene();
     pRenderer->Present();
     main_menu_background.Release();
-    if (pGUIWindow2)
+    /*if (pGUIWindow2)
     {
         pGUIWindow2->Release();
         pGUIWindow2 = 0;
-    }
+    }*/
     pWindow_MainMenu->Release();
     pIcons_LOD->RemoveTexturesPackFromTextureList();
 }
\ No newline at end of file