comparison MMT.cpp @ 2450:90349b8048a5

remove VideoPlayer.cpp/.h
author Ritor1
date Fri, 25 Jul 2014 14:17:57 +0600
parents c99c99439f6c
children 16f0278279a5
comparison
equal deleted inserted replaced
2447:45dcf81c5b1c 2450:90349b8048a5
10 #include "mm7_data.h" 10 #include "mm7_data.h"
11 #include "AudioPlayer.h" 11 #include "AudioPlayer.h"
12 #include "Mouse.h" 12 #include "Mouse.h"
13 #include "LOD.h" 13 #include "LOD.h"
14 #include "Render.h" 14 #include "Render.h"
15 #include "VideoPlayer.h"
16 #include "CShow.h" 15 #include "CShow.h"
17 #include "GUIFont.h" 16 #include "GUIFont.h"
18 #include "lib/libpng/png.h" 17 #include "lib/libpng/png.h"
19 #include "MediaPlayer.h" 18 #include "MediaPlayer.h"
20 19
22 { 21 {
23 RGBTexture tex; // [sp+Ch] [bp-30h]@1 22 RGBTexture tex; // [sp+Ch] [bp-30h]@1
24 //unsigned int uTrackStartMS; // [sp+34h] [bp-8h]@8 23 //unsigned int uTrackStartMS; // [sp+34h] [bp-8h]@8
25 //unsigned int uTrackEndMS; // [sp+38h] [bp-4h]@8 24 //unsigned int uTrackEndMS; // [sp+38h] [bp-4h]@8
26 25
27 pVideoPlayer->bStopBeforeSchedule = false; 26 pMediaPlayer->bStopBeforeSchedule = false;
28 pVideoPlayer->pResetflag = 0; 27 // pMediaPlayer->pResetflag = 0;
29 bGameoverLoop = 1; 28 bGameoverLoop = 1;
30 if (!bNoVideo) 29 if (!bNoVideo)
31 { 30 {
32 pRenderer->PresentBlackScreen(); 31 pRenderer->PresentBlackScreen();
33 PlayFullscreenMovie(MOVIE_3DOLogo, true); 32 PlayFullscreenMovie(MOVIE_3DOLogo, true);
34 if ( !pVideoPlayer->bStopBeforeSchedule ) 33 if ( !pMediaPlayer->bStopBeforeSchedule )
35 { 34 {
36 PlayFullscreenMovie(MOVIE_NWCLogo, true); 35 PlayFullscreenMovie(MOVIE_NWCLogo, true);
37 if ( !pVideoPlayer->bStopBeforeSchedule ) 36 if ( !pMediaPlayer->bStopBeforeSchedule )
38 PlayFullscreenMovie(MOVIE_JVC, true); 37 PlayFullscreenMovie(MOVIE_JVC, true);
39 } 38 }
40 } 39 }
41 char pContainerName[64]; 40 char pContainerName[64];
42 41
46 pRenderer->BeginScene(); 45 pRenderer->BeginScene();
47 pRenderer->DrawTextureRGB(0, 0, &tex); 46 pRenderer->DrawTextureRGB(0, 0, &tex);
48 free(tex.pPixels); 47 free(tex.pPixels);
49 tex.pPixels = 0; 48 tex.pPixels = 0;
50 MainMenuUI_LoadFontsAndSomeStuff(); 49 MainMenuUI_LoadFontsAndSomeStuff();
51 DrawMMTCopyrightWindow();//Текстовое сообщение ММТ меню 50 DrawMMTCopyrightWindow();//Text message in ММТ menu
52 51
53 pRenderer->EndScene(); 52 pRenderer->EndScene();
54 pRenderer->Present(); 53 pRenderer->Present();
55 54
56 #ifndef _DEBUG 55 #ifndef _DEBUG
159 tex->pPalette16[i] = Color16(ptr[0], ptr[1], ptr[2]); 158 tex->pPalette16[i] = Color16(ptr[0], ptr[1], ptr[2]);
160 tex->pLevelOfDetail0_prolly_alpha_mask[i] = ptr[3]; 159 tex->pLevelOfDetail0_prolly_alpha_mask[i] = ptr[3];
161 i++; 160 i++;
162 } 161 }
163 } 162 }
164 //Ritor1: temporarily stopped, needed change RGBTexture structure/Пока приостановлено в связи с необходимостью внести изменения в структуру(создать)RGBTexture 163 //Ritor1: temporarily stopped, needed change RGBTexture structure
165 /*for (int i = 0; i < width * height; ++i) 164 /*for (int i = 0; i < width * height; ++i)
166 tex->pPalette16[i] = 0x7FF; 165 tex->pPalette16[i] = 0x7FF;
167 memset(tex->pLevelOfDetail0_prolly_alpha_mask, 1, sizeof(unsigned __int8) * width * height);*/ 166 memset(tex->pLevelOfDetail0_prolly_alpha_mask, 1, sizeof(unsigned __int8) * width * height);*/
168 return tex; 167 return tex;
169 } 168 }
178 char pContainerName[64]; 177 char pContainerName[64];
179 178
180 pCurrentScreen = SCREEN_GAME; 179 pCurrentScreen = SCREEN_GAME;
181 180
182 pGUIWindow2 = 0; 181 pGUIWindow2 = 0;
183 pAudioPlayer->StopChannels(-1, -1);//остановить/подготовить канал 182 pAudioPlayer->StopChannels(-1, -1);
184 183
185 //if (!bNoSound ) 184 //if (!bNoSound )
186 //PlayAudio(L"Sounds\\New_Sounds/Stronghold_Theme.mp3");//воспроизводим мп3 185 //PlayAudio(L"Sounds\\New_Sounds/Stronghold_Theme.mp3");
187 //if (!bNoVideo ) 186 //if (!bNoVideo )
188 //pVideoPlayer->PlayMovie(L"Anims\\New_Video/3DOLOGO.smk"); 187 //pVideoPlayer->PlayMovie(L"Anims\\New_Video/3DOLOGO.smk");
189 188
190 pMouse->RemoveHoldingItem();//избавить курсор от вещи 189 pMouse->RemoveHoldingItem();
191 190
192 pIcons_LOD->_inlined_sub2(); 191 pIcons_LOD->_inlined_sub2();
193 192
194 //Создание нового окна 193 //Create new window
195 //WINDOW_MainMenu добавлено в GUIWindow.h 194 //WINDOW_MainMenu included in GUIWindow.h
196 pWindow_MMT_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0); 195 pWindow_MMT_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0);
197 196
198 //Загрузка кнопок 197 //load buttons
199 //Texture* MMT_MM6 = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); 198 //Texture* MMT_MM6 = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE);
200 199
201 sprintf(pContainerName, "data\\New_Icons/%s", "mm6_button_oval.png");//загружаем png из папки 200 sprintf(pContainerName, "data\\New_Icons/%s", "mm6_button_oval.png");
202 Texture* MMT_MM6 = LoadPNG(pContainerName); 201 Texture* MMT_MM6 = LoadPNG(pContainerName);
203 202
204 Texture* MMT_MM7 = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); 203 Texture* MMT_MM7 = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE);
205 Texture* MMT_MM8 = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE); 204 Texture* MMT_MM8 = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE);
206 Texture* MMT_Continue = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE); 205 Texture* MMT_Continue = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE);
212 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); 211 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);
213 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); 212 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);
214 213
215 pTexture_PCX.Release(); 214 pTexture_PCX.Release();
216 215
217 sprintf(pContainerName, "data\\New_Icons/%s", "MMTTITLE.pcx");//загружаем pcx из папки 216 sprintf(pContainerName, "data\\New_Icons/%s", "MMTTITLE.pcx");
218 if (pTexture_PCX.LoadPCXFile(pContainerName, 0) == 1) 217 if (pTexture_PCX.LoadPCXFile(pContainerName, 0) == 1)
219 Error("File not found: %s", pContainerName); 218 Error("File not found: %s", pContainerName);
220 219
221 SetCurrentMenuID(MENU_MMT_MAIN_MENU);//Добавлено в enum MENU_STATE в GUIWindows.h 220 SetCurrentMenuID(MENU_MMT_MAIN_MENU);//included in enum MENU_STATE in GUIWindows.h
222 SetForegroundWindow(window->GetApiHandle()); 221 SetForegroundWindow(window->GetApiHandle());
223 SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0); 222 SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0);
224 while (GetCurrentMenuID() == MENU_MMT_MAIN_MENU ) 223 while (GetCurrentMenuID() == MENU_MMT_MAIN_MENU )
225 { 224 {
226 POINT cursor; 225 POINT cursor;
241 } 240 }
242 241
243 pRenderer->BeginScene(); 242 pRenderer->BeginScene();
244 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); 243 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
245 244
246 MMT_MenuMessageProc();//отдельный для ММТ меню обработчик сообщений 245 MMT_MenuMessageProc();//for ММТ menu
247 GUI_UpdateWindows(); 246 GUI_UpdateWindows();
248 247
249 if ( !pModalWindow )// ??? 248 if ( !pModalWindow )// ???
250 { 249 {
251 pButton = pWindow_MMT_MainMenu->pControlsHead; 250 pButton = pWindow_MMT_MainMenu->pControlsHead;
253 { 252 {
254 if ( cursor.x >= (signed int)pButton->uX && cursor.x <= (signed int)pButton->uZ 253 if ( cursor.x >= (signed int)pButton->uX && cursor.x <= (signed int)pButton->uZ
255 && cursor.y >= (signed int)pButton->uY && cursor.y <= (signed int)pButton->uW ) 254 && cursor.y >= (signed int)pButton->uY && cursor.y <= (signed int)pButton->uW )
256 { 255 {
257 pControlParam = pButton->msg_param; 256 pControlParam = pButton->msg_param;
258 switch (pControlParam) // подсветка кнопок 257 switch (pControlParam) // backlight for buttons
259 { 258 {
260 case 0: 259 case 0:
261 pTexture = MMT_MM6; 260 pTexture = MMT_MM6;
262 pX = 0; 261 pX = 0;
263 pY = 0; 262 pY = 0;
281 pTexture = MMT_Exit; 280 pTexture = MMT_Exit;
282 pX = window->GetWidth() - 130; 281 pX = window->GetWidth() - 130;
283 pY = window->GetHeight() - 35; 282 pY = window->GetHeight() - 35;
284 break; 283 break;
285 } 284 }
286 pRenderer->DrawTextureIndexed(pX, pY, pTexture); //подсветка кнопок 285 pRenderer->DrawTextureIndexed(pX, pY, pTexture);
287 } 286 }
288 } 287 }
289 } 288 }
290 //} 289 //}
291 pRenderer->EndScene(); 290 pRenderer->EndScene();
295 pRenderer->BeginScene(); 294 pRenderer->BeginScene();
296 GUI_UpdateWindows(); 295 GUI_UpdateWindows();
297 pRenderer->EndScene(); 296 pRenderer->EndScene();
298 pRenderer->Present(); 297 pRenderer->Present();
299 298
300 //освобождаем ресурсы 299 //remove resurs
301 pTexture_PCX.Release(); 300 pTexture_PCX.Release();
302 if ( pGUIWindow2 ) 301 if ( pGUIWindow2 )
303 { 302 {
304 pGUIWindow2->Release(); 303 pGUIWindow2->Release();
305 pGUIWindow2 = 0; 304 pGUIWindow2 = 0;
321 320
322 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, &pParam2); 321 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, &pParam2);
323 322
324 switch (pUIMessageType) 323 switch (pUIMessageType)
325 { 324 {
326 case UIMSG_MMT_MainMenu_MM7: //кнопка игры ММ7 325 case UIMSG_MMT_MainMenu_MM6:
326 //video
327 //SetCurrentMenuID(MENU_MAIN_MM6);
328 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);//temporarily
329 break;
330 case UIMSG_MMT_MainMenu_MM7: //new button for ММ7
327 //GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); 331 //GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0);
328 alSourceStop(mSourceID); 332 alSourceStop(mSourceID);
329 ShowMM7IntroVideo_and_LoadingScreen(); 333 pMediaPlayer->ShowMM7IntroVideo_and_LoadingScreen();
330 SetCurrentMenuID(MENU_MAIN); 334 SetCurrentMenuID(MENU_MAIN);
331 break; 335 break;
336 case UIMSG_MMT_MainMenu_MM8:
337 //video
338 //SetCurrentMenuID(MENU_MAIN_MM8);
339 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);//temporarily
340 break;
341 case UIMSG_MMT_MainMenu_Continue:
342 //video
343 //SetCurrentMenuID(MENU_MAIN_Continue);
344 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);//temporarily
345 break;
346 case UIMSG_ExitToWindows:
347 GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0);
348 SetCurrentMenuID(MENU_EXIT_GAME);
332 349
333 default: 350 default:
334 break; 351 break;
335 } 352 }
336 } 353 }