comparison MMT.cpp @ 2294:815d9ecf9881

Merge
author Grumpy7
date Sun, 16 Mar 2014 19:43:28 +0100
parents d65414f65bd4
children 6fd03869f65c
comparison
equal deleted inserted replaced
2293:b0f10ef66e00 2294:815d9ecf9881
1 #define _CRT_SECURE_NO_WARNINGS
2
3 #include "MMT.h"
4 #include "GUIWindow.h"
5 #include "mm7_unsorted_subs.h"
6 #include "mm7_data.h"
7 #include "AudioPlayer.h"
8 #include "Mouse.h"
9 #include "LOD.h"
10 #include "Render.h"
11 #include "VideoPlayer.h"
12 #include "CShow.h"
13 #include "GUIFont.h"
14
15 void ShowLogoVideo()
16 {
17 RGBTexture tex; // [sp+Ch] [bp-30h]@1
18 //unsigned int uTrackStartMS; // [sp+34h] [bp-8h]@8
19 //unsigned int uTrackEndMS; // [sp+38h] [bp-4h]@8
20
21 pVideoPlayer->bStopBeforeSchedule = false;
22 pVideoPlayer->pResetflag = 0;
23 bGameoverLoop = 1;
24 if (!bNoVideo)
25 {
26 pRenderer->PresentBlackScreen();
27 PlayFullscreenMovie(MOVIE_3DOLogo, true);
28 if ( !pVideoPlayer->bStopBeforeSchedule )
29 {
30 PlayFullscreenMovie(MOVIE_NWCLogo, true);
31 if ( !pVideoPlayer->bStopBeforeSchedule )
32 PlayFullscreenMovie(MOVIE_JVC, true);
33 }
34 }
35 char pContainerName[64];
36
37 sprintf(pContainerName, "data\\New_Icons/%s", "MMTTITLE.pcx");
38 tex.LoadPCXFile(pContainerName, 0);
39
40 pRenderer->BeginScene();
41 pRenderer->DrawTextureRGB(0, 0, &tex);
42 free(tex.pPixels);
43 tex.pPixels = 0;
44 MainMenuUI_LoadFontsAndSomeStuff();
45 DrawMMTCopyrightWindow();
46
47 pRenderer->EndScene();
48 pRenderer->Present();
49
50 #ifndef _DEBUG
51 Sleep(1500); // let the copyright window stay for a while
52 #endif
53
54 /*if (!bNoSound && pAudioPlayer->hAILRedbook )
55 {
56 pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0));
57 AIL_redbook_stop(pAudioPlayer->hAILRedbook);
58 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &uTrackStartMS, &uTrackEndMS);
59 AIL_redbook_play(pAudioPlayer->hAILRedbook, uTrackStartMS + 1, uTrackEndMS);
60 } */
61 bGameoverLoop = 0;
62 }
63
64 void MMT_MainMenu_Loop()
65 {
66 GUIButton *pButton; // eax@27
67 unsigned int pControlParam; // ecx@35
68 int v10; // ecx@36
69 int v11; // ecx@37
70 unsigned int pX;
71 unsigned int pY; // [sp-18h] [bp-54h]@39
72 Texture *pTexture; // [sp-14h] [bp-50h]@39
73 GUIButton *pButton2; // [sp+0h] [bp-3Ch]@27
74
75 pCurrentScreen = SCREEN_GAME;
76
77 pGUIWindow2 = 0;
78 pAudioPlayer->StopChannels(-1, -1);//остановить/подготовить канал
79 pMouse->RemoveHoldingItem();//избавить курсор от вещи
80
81 pIcons_LOD->_inlined_sub2();
82
83 pWindow_MMT_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0);
84 Texture* MMT_MM6 = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE);
85 Texture* MMT_MM7 = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE);
86 Texture* MMT_MM8 = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE);
87 Texture* MMT_Continue = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE);
88 Texture* MMT_Exit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE);
89
90 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);
91 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);
92 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);
93 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);
94 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);
95
96 pTexture_PCX.Release();
97
98 char pContainerName[64];
99
100 sprintf(pContainerName, "data\\New_Icons/%s", "MMTTITLE.pcx");
101 pTexture_PCX.LoadPCXFile(pContainerName, 0);
102 SetCurrentMenuID(MENU_MMT_MAIN_MENU);
103 SetForegroundWindow(window->GetApiHandle());
104 SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0);
105 while (GetCurrentMenuID() == MENU_MMT_MAIN_MENU )
106 {
107 POINT cursor;
108 pMouse->GetCursorPos(&cursor);
109
110 for (MSG msg; PeekMessageW(&msg, 0, 0, 0, PM_REMOVE);)
111 {
112 if (msg.message == WM_QUIT)
113 Game_DeinitializeAndTerminate(0);
114 TranslateMessage(&msg);
115 DispatchMessageW(&msg);
116 }
117
118 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
119 {
120 WaitMessage();
121 continue;
122 }
123
124 pRenderer->BeginScene();
125 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
126
127 MMT_MenuMessageProc();
128 GUI_UpdateWindows();
129
130 if ( !pModalWindow )// ???
131 {
132 pButton = pWindow_MMT_MainMenu->pControlsHead;
133 for ( pButton = pWindow_MMT_MainMenu->pControlsHead; pButton; pButton = pButton->pNext )
134 {
135 if ( cursor.x >= (signed int)pButton->uX && cursor.x <= (signed int)pButton->uZ
136 && cursor.y >= (signed int)pButton->uY && cursor.y <= (signed int)pButton->uW )
137 {
138 pControlParam = pButton->msg_param;
139 switch (pControlParam) // подсветка кнопок
140 {
141 case 0:
142 pTexture = MMT_MM6;
143 pX = (window->GetWidth() / 4) - 100;
144 pY = window->GetHeight() / 4;
145 break;
146 case 1:
147 pTexture = MMT_MM7;
148 pX = window->GetWidth() - (window->GetWidth() / 4);
149 pY = window->GetHeight() / 4;
150 break;
151 case 2:
152 pTexture = MMT_MM8;
153 pX = window->GetWidth() - (window->GetWidth() / 4);
154 pY = window->GetHeight() - ((window->GetHeight() / 4) + 50);
155 break;
156 case 3:
157 pTexture = MMT_Continue;
158 pX = (window->GetWidth() / 4) - 100;
159 pY = window->GetHeight() - ((window->GetHeight() / 4) + 50);
160 break;
161 case 4:
162 pTexture = MMT_Exit;
163 pX = window->GetWidth() - 130;
164 pY = window->GetHeight() - 35;
165 break;
166 }
167 pRenderer->DrawTextureIndexed(pX, pY, pTexture); //подсветка кнопок
168 }
169 }
170 }
171 //}
172 pRenderer->EndScene();
173 pRenderer->Present();
174 }
175 MMT_MenuMessageProc();
176 pRenderer->BeginScene();
177 GUI_UpdateWindows();
178 pRenderer->EndScene();
179 pRenderer->Present();
180 pTexture_PCX.Release();
181 if ( pGUIWindow2 )
182 {
183 pGUIWindow2->Release();
184 pGUIWindow2 = 0;
185 }
186 pWindow_MMT_MainMenu->Release();
187 pIcons_LOD->RemoveTexturesPackFromTextureList();
188 }
189
190 void MMT_MenuMessageProc()
191 {
192 int pParam;
193 int pParam2;
194 UIMessageType pUIMessageType;
195
196 if ( pMessageQueue_50CBD0->uNumMessages )
197 {
198 do
199 {
200
201 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, &pParam2);
202
203 switch (pUIMessageType)
204 {
205 case UIMSG_MMT_MainMenu_MM7: //кнопка игры ММ7
206 //GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0);
207 ShowMM7IntroVideo_and_LoadingScreen();
208 SetCurrentMenuID(MENU_MAIN);
209 break;
210
211 default:
212 break;
213 }
214 }
215 while ( pMessageQueue_50CBD0->uNumMessages );
216 }
217 }
218 void DrawMMTCopyrightWindow()
219 {
220 GUIWindow Dst; // [sp+8h] [bp-54h]@1
221
222 memset(&Dst, 0, 0x54u);
223 Dst.uFrameWidth = 624;
224 Dst.uFrameHeight = 256;
225 Dst.uFrameX = 8;
226 Dst.uFrameY = 30;
227 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight("Text Verification: Here we can write an explanation of the project", &Dst, 24, 0)
228 + 2 * LOBYTE(pFontSmallnum->uFontHeight)
229 + 24;
230 Dst.uFrameY = 470 - Dst.uFrameHeight;
231 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
232 Dst.uFrameW = 469;
233 //Dst.Hint = "abcagfdsgsg ljsrengvlkjesnfkjwnef";
234 Dst.DrawMessageBox(0);
235
236 Dst.uFrameWidth -= 24;
237 Dst.uFrameX += 12;
238 Dst.uFrameY += 12;
239 Dst.uFrameHeight -= 12;
240 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
241 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
242 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, "Text Verification: Here we can write an explanation of the project", 3);
243 }