diff MMT.cpp @ 2294:815d9ecf9881

Merge
author Grumpy7
date Sun, 16 Mar 2014 19:43:28 +0100
parents d65414f65bd4
children 6fd03869f65c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMT.cpp	Sun Mar 16 19:43:28 2014 +0100
@@ -0,0 +1,243 @@
+#define _CRT_SECURE_NO_WARNINGS
+
+#include "MMT.h"
+#include "GUIWindow.h"
+#include "mm7_unsorted_subs.h"
+#include "mm7_data.h"
+#include "AudioPlayer.h"
+#include "Mouse.h"
+#include "LOD.h"
+#include "Render.h"
+#include "VideoPlayer.h"
+#include "CShow.h"
+#include "GUIFont.h"
+
+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
+
+  pVideoPlayer->bStopBeforeSchedule = false;
+  pVideoPlayer->pResetflag = 0;
+  bGameoverLoop = 1;
+  if (!bNoVideo)
+  {
+    pRenderer->PresentBlackScreen();
+    PlayFullscreenMovie(MOVIE_3DOLogo, true);
+    if ( !pVideoPlayer->bStopBeforeSchedule )
+    {
+      PlayFullscreenMovie(MOVIE_NWCLogo, true);
+      if ( !pVideoPlayer->bStopBeforeSchedule )
+        PlayFullscreenMovie(MOVIE_JVC, true);
+    }
+  }
+  char pContainerName[64];
+
+  sprintf(pContainerName, "data\\New_Icons/%s", "MMTTITLE.pcx");
+  tex.LoadPCXFile(pContainerName, 0);
+
+  pRenderer->BeginScene();
+  pRenderer->DrawTextureRGB(0, 0, &tex);
+  free(tex.pPixels);
+  tex.pPixels = 0;
+  MainMenuUI_LoadFontsAndSomeStuff();
+  DrawMMTCopyrightWindow();
+
+  pRenderer->EndScene();
+  pRenderer->Present();
+
+  #ifndef _DEBUG
+    Sleep(1500);   // let the copyright window stay for a while
+  #endif
+
+  /*if (!bNoSound && pAudioPlayer->hAILRedbook )
+  {
+    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;
+}
+
+void MMT_MainMenu_Loop()
+{
+  GUIButton *pButton; // eax@27
+  unsigned int pControlParam; // ecx@35
+  int v10; // ecx@36
+  int v11; // ecx@37
+  unsigned int pX;
+  unsigned int pY; // [sp-18h] [bp-54h]@39
+  Texture *pTexture; // [sp-14h] [bp-50h]@39
+  GUIButton *pButton2; // [sp+0h] [bp-3Ch]@27
+
+  pCurrentScreen = SCREEN_GAME;
+
+  pGUIWindow2 = 0;
+  pAudioPlayer->StopChannels(-1, -1);//остановить/подготовить канал
+  pMouse->RemoveHoldingItem();//избавить курсор от вещи
+
+  pIcons_LOD->_inlined_sub2();
+
+  pWindow_MMT_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0);
+  Texture* MMT_MM6      = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE);
+  Texture* MMT_MM7      = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE);
+  Texture* MMT_MM8      = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE);
+  Texture* MMT_Continue = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE);
+  Texture* MMT_Exit     = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE);
+
+  pMMT_MainMenu_BtnMM6      = pWindow_MMT_MainMenu->CreateButton((window->GetWidth() / 4) - 100,                 window->GetHeight() / 4,                                MMT_MM6->uTextureWidth,      MMT_MM6->uTextureHeight,      1, 0, UIMSG_MMT_MainMenu_MM6,      0, 0, "", MMT_MM6, 0);
+  pMMT_MainMenu_BtnMM7      = pWindow_MMT_MainMenu->CreateButton(window->GetWidth() - (window->GetWidth()  / 4), window->GetHeight() / 4,                                MMT_MM7->uTextureWidth,      MMT_MM7->uTextureHeight,      1, 0, UIMSG_MMT_MainMenu_MM7,      1, 0, "", MMT_MM7, 0);
+  pMMT_MainMenu_BtnMM8      = pWindow_MMT_MainMenu->CreateButton(window->GetWidth() - (window->GetWidth()  / 4), window->GetHeight() - ((window->GetHeight() / 4) + 50), MMT_MM8->uTextureWidth,      MMT_MM8->uTextureHeight,      1, 0, UIMSG_MMT_MainMenu_MM8,      2, 0, "", MMT_MM8, 0);
+  pMMT_MainMenu_BtnContinue = pWindow_MMT_MainMenu->CreateButton((window->GetWidth() / 4) - 100,                 window->GetHeight() - ((window->GetHeight() / 4) + 50), MMT_Continue->uTextureWidth, MMT_Continue->uTextureHeight, 1, 0, UIMSG_MMT_MainMenu_Continue, 3, 0, "", MMT_Continue, 0);
+  pMMT_MainMenu_BtnExit     = pWindow_MMT_MainMenu->CreateButton(window->GetWidth() - 130,                       window->GetHeight() - 35,                               MMT_Exit->uTextureWidth,     MMT_Exit->uTextureHeight,     1, 0, UIMSG_ExitToWindows,         4, 0, "", MMT_Exit, 0);
+
+  pTexture_PCX.Release();
+
+  char pContainerName[64];
+
+  sprintf(pContainerName, "data\\New_Icons/%s", "MMTTITLE.pcx");
+  pTexture_PCX.LoadPCXFile(pContainerName, 0);
+  SetCurrentMenuID(MENU_MMT_MAIN_MENU);
+  SetForegroundWindow(window->GetApiHandle());
+  SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0);
+  while (GetCurrentMenuID() == MENU_MMT_MAIN_MENU )
+  {
+    POINT cursor;
+    pMouse->GetCursorPos(&cursor);
+
+    for (MSG msg; PeekMessageW(&msg, 0, 0, 0, PM_REMOVE);)
+    {
+      if (msg.message == WM_QUIT)
+        Game_DeinitializeAndTerminate(0);
+      TranslateMessage(&msg);
+      DispatchMessageW(&msg);
+    }
+
+    if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
+    {
+      WaitMessage();
+      continue;
+    }
+
+      pRenderer->BeginScene();
+      pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
+
+      MMT_MenuMessageProc();
+      GUI_UpdateWindows();
+
+      if ( !pModalWindow )// ???
+      {
+          pButton = pWindow_MMT_MainMenu->pControlsHead;
+          for ( pButton = pWindow_MMT_MainMenu->pControlsHead; pButton; pButton = pButton->pNext )
+          {
+           if ( cursor.x >= (signed int)pButton->uX && cursor.x <= (signed int)pButton->uZ
+             && cursor.y >= (signed int)pButton->uY && cursor.y <= (signed int)pButton->uW )
+           {
+            pControlParam = pButton->msg_param;
+            switch (pControlParam) // подсветка кнопок
+            {
+              case 0:
+                pTexture = MMT_MM6;
+                pX = (window->GetWidth() / 4) - 100;
+                pY = window->GetHeight() / 4;
+                break;
+              case 1:
+                pTexture = MMT_MM7;
+                pX = window->GetWidth() - (window->GetWidth() / 4);
+                pY = window->GetHeight() / 4;
+                break;
+              case 2:
+                pTexture = MMT_MM8;
+                pX = window->GetWidth() - (window->GetWidth() / 4);
+                pY = window->GetHeight() - ((window->GetHeight() / 4) + 50);
+                break;
+              case 3:
+                pTexture = MMT_Continue;
+                pX = (window->GetWidth() / 4) - 100;
+                pY = window->GetHeight() - ((window->GetHeight() / 4) + 50);
+                break;
+              case 4:
+                pTexture = MMT_Exit;
+                pX = window->GetWidth() - 130;
+                pY = window->GetHeight() - 35;
+                break;
+            }
+            pRenderer->DrawTextureIndexed(pX, pY, pTexture); //подсветка кнопок
+           }
+          }
+        }
+      //}
+      pRenderer->EndScene();
+      pRenderer->Present();
+  }
+  MMT_MenuMessageProc();
+  pRenderer->BeginScene();
+  GUI_UpdateWindows();
+  pRenderer->EndScene();
+  pRenderer->Present();
+  pTexture_PCX.Release();
+  if ( pGUIWindow2 )
+  {
+    pGUIWindow2->Release();
+    pGUIWindow2 = 0;
+  }
+  pWindow_MMT_MainMenu->Release();
+  pIcons_LOD->RemoveTexturesPackFromTextureList();
+}
+
+void MMT_MenuMessageProc()
+{
+  int pParam;
+  int pParam2;
+  UIMessageType pUIMessageType;
+
+  if ( pMessageQueue_50CBD0->uNumMessages )
+  {
+    do
+    {
+
+      pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, &pParam2);
+
+      switch (pUIMessageType)
+      {
+        case UIMSG_MMT_MainMenu_MM7: //кнопка игры ММ7
+          //GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0);
+          ShowMM7IntroVideo_and_LoadingScreen();
+          SetCurrentMenuID(MENU_MAIN);
+          break;
+
+        default:
+          break;
+      }
+    }
+    while ( pMessageQueue_50CBD0->uNumMessages );
+  }
+}
+void DrawMMTCopyrightWindow()
+{
+  GUIWindow Dst; // [sp+8h] [bp-54h]@1
+
+  memset(&Dst, 0, 0x54u);
+  Dst.uFrameWidth = 624;
+  Dst.uFrameHeight = 256;
+  Dst.uFrameX = 8;
+  Dst.uFrameY = 30;
+  Dst.uFrameHeight = pFontSmallnum->CalcTextHeight("Text Verification: Here we can write an explanation of the project", &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, 0xCu, ui_mainmenu_copyright_color, "Text Verification: Here we can write an explanation of the project", 3);
+}
\ No newline at end of file