diff Game/MainMenu.cpp @ 2564:f9bdfe26d03d

.
author a.parshin
date Wed, 20 May 2015 00:56:07 +0200
parents 48708da03b7f
children d87bfbd3bb3b
line wrap: on
line diff
--- a/Game/MainMenu.cpp	Tue May 19 22:00:56 2015 +0200
+++ b/Game/MainMenu.cpp	Wed May 20 00:56:07 2015 +0200
@@ -15,6 +15,7 @@
 #include "GUI/GUIButton.h"
 
 #include "Media/Audio/AudioPlayer.h"
+#include "Media/Audio/AIL.h"
 
 #include "Game/MainMenu.h"
 #include "Game/MainMenuLoad.h"
@@ -354,6 +355,7 @@
 }
 
 
+static bool first_initialization = true;
 //----- (004627B7) --------------------------------------------------------
 void MainMenu_Loop()
 {
@@ -364,6 +366,54 @@
     GUIWindow *pWindow; // [sp+4h] [bp-38h]@11
     MSG msg;
 
+
+
+    if (first_initialization)
+    {
+        first_initialization = false;
+
+        RGBTexture tex; // [sp+Ch] [bp-30h]@1
+        tex.Load("mm6title.pcx", 2);
+
+        pRenderer->ResetUIClipRect();
+        pRenderer->BeginScene();
+        {
+            pRenderer->DrawTextureNew(0, 0, &tex);
+        }
+        pRenderer->EndScene();
+        pRenderer->Present();
+
+        tex.Release();
+
+        MainMenuUI_LoadFontsAndSomeStuff();
+
+        pRenderer->BeginScene();
+        {
+            DrawMM7CopyrightWindow();
+        }
+        pRenderer->EndScene();
+        pRenderer->Present();
+
+#ifdef NDEBUG
+        Sleep(1500);   // let the copyright window stay for a while
+#endif
+
+        if (!bNoSound && pAudioPlayer->hAILRedbook)
+        {
+            unsigned int uTrackStartMS; // [sp+34h] [bp-8h]@8
+            unsigned int uTrackEndMS; // [sp+38h] [bp-4h]@8
+
+            pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0));
+            AIL_redbook_stop(pAudioPlayer->hAILRedbook);
+            AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &uTrackStartMS, &uTrackEndMS);
+            AIL_redbook_play(pAudioPlayer->hAILRedbook, uTrackStartMS + 1, uTrackEndMS);
+        }
+
+        SecondaryInitialization();
+        FinalInitialization();
+    }
+
+
     current_screen_type = SCREEN_GAME;
 
     pGUIWindow2 = 0;
@@ -415,20 +465,24 @@
         }
 
         pRenderer->BeginScene();
-        pRenderer->DrawTextureNew(0, 0, &main_menu_background);
+        {
+            pRenderer->DrawTextureNew(0, 0, &main_menu_background);
 
-        MainMenu_EventLoop();
-        GUI_UpdateWindows();
-
+            MainMenu_EventLoop();
+            GUI_UpdateWindows();
+        }
         pRenderer->EndScene();
         pRenderer->Present();
     }
 
-    MainMenu_EventLoop();
     pRenderer->BeginScene();
-    GUI_UpdateWindows();
+    {
+        MainMenu_EventLoop();
+        GUI_UpdateWindows();
+    }
     pRenderer->EndScene();
     pRenderer->Present();
+
     main_menu_background.Release();
     /*if (pGUIWindow2)
     {
@@ -436,5 +490,7 @@
         pGUIWindow2 = 0;
     }*/
     pWindow_MainMenu->Release();
+    pWindow_MainMenu = nullptr;
+
     pIcons_LOD->RemoveTexturesPackFromTextureList();
 }
\ No newline at end of file