changeset 2564:f9bdfe26d03d

.
author a.parshin
date Wed, 20 May 2015 00:56:07 +0200
parents 65c97624c047
children 117c219bf913
files Engine/Engine.cpp Engine/MMT.cpp GUI/UI/UIMainMenu.cpp Game/MainMenu.cpp
diffstat 4 files changed, 68 insertions(+), 74 deletions(-) [+]
line wrap: on
line diff
--- a/Engine/Engine.cpp	Tue May 19 22:00:56 2015 +0200
+++ b/Engine/Engine.cpp	Wed May 20 00:56:07 2015 +0200
@@ -1796,13 +1796,15 @@
 
     SetUserInterface(PartyAlignment_Neutral, false);
 
+    for (uint i = 0; i < 20; ++i)
+        pWindowList[i] = nullptr;
+    uNumVisibleWindows = -1;
+    memset(pVisibleWindowsIdxs.data(), 0, sizeof(pVisibleWindowsIdxs));
+
     ShowLogoVideo();
     //ShowIntroVideo_and_LoadingScreen();
     WriteWindowsRegistryInt("Ran once", 1);
     dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
-    SecondaryInitialization();
-    //pRenderer->SetRasterClipRect(0, 0, window->GetWidth() - 1, window->GetHeight() - 1);
-    FinalInitialization();
 
     //Ritor1: include
     if (use_MMT)
--- a/Engine/MMT.cpp	Tue May 19 22:00:56 2015 +0200
+++ b/Engine/MMT.cpp	Wed May 20 00:56:07 2015 +0200
@@ -24,12 +24,8 @@
     return access(fname, 0) != -1;
 }
 
-void  ShowLogoVideo()
+void ShowLogoVideo()
 {
-  RGBTexture tex; // [sp+Ch] [bp-30h]@1
-  unsigned int uTrackStartMS; // [sp+34h] [bp-8h]@8
-  unsigned int uTrackEndMS; // [sp+38h] [bp-4h]@8
-
   pMediaPlayer->bStopBeforeSchedule = false;
 
 //  pMediaPlayer->pResetflag = 0;
@@ -56,60 +52,6 @@
     }
   }
 
-  if (use_MMT)
-    tex.LoadPCXFile("data/New_Icons/MMTTITLE.pcx", 0);
-  else
-    tex.Load("mm6title.pcx", 2);
-  
-  pRenderer->ResetUIClipRect();
-  pRenderer->BeginScene();
-  {
-    pRenderer->DrawTextureNew(0, 0, &tex);
-  }
-  pRenderer->EndScene();
-  pRenderer->Present();
-  
-  tex.Release();
-
-  MainMenuUI_LoadFontsAndSomeStuff();
-  
-  pRenderer->BeginScene();
-  if (use_MMT)
-    DrawMMTCopyrightWindow();
-  else
-    DrawMM7CopyrightWindow();
-
-  pRenderer->EndScene();
-  pRenderer->Present();
-
-  #ifdef NDEBUG
-    Sleep(1500);   // let the copyright window stay for a while
-  #endif
-
-  if (!use_MMT)
-  {
-    if (!bNoSound && pAudioPlayer->hAILRedbook )
-    {
-	  if ( use_music_folder )
-	  {
-        if (!FileExists("Music\\14.mp3"))
-		{
-          Log::Warning(L"File 14.mp3 in Music\\ folder not found");
-		  //Error("File 14.mp3 in Music\\ folder not found");
-		  return;
-		}
-	    PlayAudio(L"Music\\14.mp3");
-	    alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
-	  }
-	  else 
-	  {
-        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);
-	  }
-    }	 
-  }
   bGameoverLoop = 0;
 }
 
--- a/GUI/UI/UIMainMenu.cpp	Tue May 19 22:00:56 2015 +0200
+++ b/GUI/UI/UIMainMenu.cpp	Wed May 20 00:56:07 2015 +0200
@@ -126,12 +126,6 @@
 
   pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", nullptr);
   pFontComic = LoadFont("comic.fnt", "FONTPAL", nullptr);
-
-  for (uint i = 0; i < 20; ++i)
-      pWindowList[i] = nullptr;
-
-  uNumVisibleWindows = -1;
-  memset(pVisibleWindowsIdxs.data(), 0, sizeof(pVisibleWindowsIdxs));
 }
 
 //----- (004415C5) --------------------------------------------------------
--- 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