Mercurial > mm7
diff Game/MainMenu.cpp @ 2572:d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
author | a.parshin |
---|---|
date | Sat, 05 Mar 2016 01:51:54 +0200 |
parents | f9bdfe26d03d |
children | dd36326a9994 |
line wrap: on
line diff
--- a/Game/MainMenu.cpp Mon Oct 05 00:19:13 2015 +0200 +++ b/Game/MainMenu.cpp Sat Mar 05 01:51:54 2016 +0200 @@ -1,8 +1,10 @@ #include "Engine/Engine.h" +#include "Engine/AssetsManager.h" #include "Engine/Timer.h" #include "Engine/Party.h" #include "Engine/LOD.h" #include "Engine/SaveLoad.h" +#include "Engine/texts.h" #include "Engine/Graphics/IRender.h" #include "Engine/Graphics/Viewport.h" @@ -13,6 +15,7 @@ #include "GUI/UI/UIPartyCreation.h" #include "GUI/UI/UISaveLoad.h" #include "GUI/GUIButton.h" +#include "GUI/GUIFont.h" #include "Media/Audio/AudioPlayer.h" #include "Media/Audio/AIL.h" @@ -21,7 +24,8 @@ #include "Game/MainMenuLoad.h" -RGBTexture main_menu_background; +Image *main_menu_bg = nullptr; +Image *main_menu_background = nullptr; @@ -367,28 +371,20 @@ MSG msg; + pAudioPlayer->StopChannels(-1, -1); + if (!bNoSound && pAudioPlayer) + pAudioPlayer->PlayMusicTrack(MUSIC_MainMenu); if (first_initialization) { first_initialization = false; - RGBTexture tex; // [sp+Ch] [bp-30h]@1 - tex.Load("mm6title.pcx", 2); + if (!main_menu_bg) + main_menu_bg = assets->GetImage_PCXFromIconsLOD(L"mm6title.pcx"); pRenderer->ResetUIClipRect(); pRenderer->BeginScene(); { - pRenderer->DrawTextureNew(0, 0, &tex); - } - pRenderer->EndScene(); - pRenderer->Present(); - - tex.Release(); - - MainMenuUI_LoadFontsAndSomeStuff(); - - pRenderer->BeginScene(); - { DrawMM7CopyrightWindow(); } pRenderer->EndScene(); @@ -398,17 +394,6 @@ 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(); } @@ -417,38 +402,18 @@ current_screen_type = SCREEN_GAME; pGUIWindow2 = 0; - pAudioPlayer->StopChannels(-1, -1); - pMouse->RemoveHoldingItem(); - - pIcons_LOD->_inlined_sub2(); pWindow_MainMenu = new GUIWindow_MainMenu(); - main_menu_background.Release(); - main_menu_background.Load("title.pcx", 0); SetCurrentMenuID(MENU_MAIN); SetForegroundWindow(window->GetApiHandle()); SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0); - //while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD) while (GetCurrentMenuID() == MENU_MAIN) { POINT pt; pMouse->GetCursorPos(&pt); pWindow = pWindow_MainMenu; - /*if (GetCurrentMenuID() == MENU_SAVELOAD) - { - if (current_screen_type != SCREEN_LOADGAME) - { - main_menu_background.Release(); - main_menu_background.Load("lsave640.pcx", 0); - pGUIWindow2 = new GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); - - //LoadUI_Load(0); - pGUIWindow_CurrentMenu = new GUIWindow_Load(false); - } - pWindow = pGUIWindow_CurrentMenu; - }*/ while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) { @@ -464,9 +429,12 @@ continue; } + if (!main_menu_background) + main_menu_background = assets->GetImage_PCXFromIconsLOD(L"title.pcx"); + pRenderer->BeginScene(); { - pRenderer->DrawTextureNew(0, 0, &main_menu_background); + pRenderer->DrawTextureNew(0, 0, main_menu_background); MainMenu_EventLoop(); GUI_UpdateWindows(); @@ -483,14 +451,41 @@ pRenderer->EndScene(); pRenderer->Present(); - main_menu_background.Release(); - /*if (pGUIWindow2) - { - pGUIWindow2->Release(); - pGUIWindow2 = 0; - }*/ + main_menu_background->Release(); + main_menu_background = nullptr; + pWindow_MainMenu->Release(); pWindow_MainMenu = nullptr; +} - pIcons_LOD->RemoveTexturesPackFromTextureList(); -} \ No newline at end of file + + +//----- (00415485) -------------------------------------------------------- +void DrawMM7CopyrightWindow() +{ + pRenderer->DrawTextureNew(0, 0, main_menu_bg); + + GUIWindow Dst; // [sp+8h] [bp-54h]@1 + + memset(&Dst, 0, sizeof(Dst)); + Dst.uFrameWidth = 624; + Dst.uFrameHeight = 256; + Dst.uFrameX = 8; + Dst.uFrameY = 30; // c 1999 The 3DO Company. + Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(pGlobalTXT_LocalizationStrings[157], &Dst, 24, 0) + + 2 * LOBYTE(pFontSmallnum->uFontHeight) + + 24; + Dst.uFrameY = 470 - Dst.uFrameHeight; + Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; + Dst.uFrameW = 469; + //Dst.Hint = "abcagfdsgsg ljsrengvlkjesnfkjwnef"; + Dst.DrawMessageBox(0); + + Dst.uFrameWidth -= 24; + Dst.uFrameX += 12; + Dst.uFrameY += 12; + Dst.uFrameHeight -= 12; + Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; + Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; + Dst.DrawTitleText(pFontSmallnum, 0, 12, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3); +}