Mercurial > might-and-magic-trilogy
annotate VideoPlayer.cpp @ 28:18f7a1b94448
Indoor::Load
author | Nomad |
---|---|
date | Tue, 16 Oct 2012 19:31:34 +0200 |
parents | 3fa5d0522f92 |
children | 916bec351934 |
rev | line source |
---|---|
0 | 1 #include "OSAPI.h" |
2 | |
3 #include "Bink_Smacker.h" | |
4 | |
5 #include "OSInfo.h" | |
6 #include "VideoPlayer.h" | |
7 #include "AudioPlayer.h" | |
8 #include "Game.h" | |
9 #include "Render.h" | |
10 #include "Party.h" | |
11 #include "GUIWindow.h" | |
12 #include "Allocator.h" | |
13 #include "Time.h" | |
14 #include "Log.h" | |
15 | |
16 #include "mm7_data.h" | |
17 | |
18 | |
19 VideoPlayer *pVideoPlayer = nullptr; | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
21 | 27 #pragma comment(lib, "Version.lib") |
28 bool GetDllVersion(const wchar_t *pDllName, uint *pMajor, uint *pMinor) | |
29 { | |
30 uint uVersionSize = GetFileVersionInfoSizeW(pDllName, nullptr); | |
31 void *pVersionData = HeapAlloc(GetProcessHeap(), 0, uVersionSize); | |
32 { | |
33 GetFileVersionInfoW(pDllName, 0, uVersionSize, pVersionData); | |
34 | |
35 VS_FIXEDFILEINFO *pInfo = nullptr; | |
36 UINT uInfoSize = 0; | |
37 VerQueryValueW(pVersionData, L"\\", (void **)&pInfo, &uInfoSize); | |
38 | |
39 if (!pMajor || !pMinor) | |
40 { | |
41 HeapFree(GetProcessHeap(), 0, pVersionData); | |
42 return false; | |
43 } | |
44 *pMajor = pInfo->dwFileVersionMS; | |
45 *pMinor = pInfo->dwFileVersionLS; | |
46 } | |
47 HeapFree(GetProcessHeap(), 0, pVersionData); | |
48 return true; | |
49 } | |
50 | |
51 | |
52 // 3.15.1.0: | |
53 // 3 15 1 0 | |
54 // 0x0003000F00010000 | |
55 unsigned __int64 uBinkVersion; | |
56 | |
57 | |
58 | |
59 | |
60 | |
0 | 61 |
62 //----- (004BFE2D) -------------------------------------------------------- | |
13
17150bdf321e
исправлено неполное воспроизведение роликов, бинков
Серик@ПончиК
parents:
3
diff
changeset
|
63 _BINKBUF *VideoPlayer::CreateBinkBuffer(HWND hWindow, unsigned int uWidth, unsigned int uHeight, char a4) |
0 | 64 { |
65 __int32 v4; // edi@3 | |
66 _BINKBUF *v5; // esi@3 | |
67 HRESULT v6; // eax@5 | |
68 IDirectDrawSurface *v7; // eax@6 | |
69 HRESULT v8; // eax@9 | |
70 char v9; // al@11 | |
71 DDSURFACEDESC2 v11; // [sp+Ch] [bp-108h]@7 | |
72 DDSURFACEDESC Dst; // [sp+88h] [bp-8Ch]@3 | |
73 unsigned int v13; // [sp+F4h] [bp-20h]@1 | |
74 struct tagRECT Rect; // [sp+F8h] [bp-1Ch]@11 | |
75 IDirectDrawSurface4 *v15; // [sp+108h] [bp-Ch]@7 | |
76 IDirectDrawSurface2 *a2; // [sp+10Ch] [bp-8h]@3 | |
77 HWND hWnd; // [sp+110h] [bp-4h]@1 | |
78 | |
79 v13 = uWidth; | |
13
17150bdf321e
исправлено неполное воспроизведение роликов, бинков
Серик@ПончиК
parents:
3
diff
changeset
|
80 hWnd = hWindow; |
17150bdf321e
исправлено неполное воспроизведение роликов, бинков
Серик@ПончиК
parents:
3
diff
changeset
|
81 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5u ) |
0 | 82 { |
83 v4 = 0; | |
84 v15 = 0; | |
21 | 85 |
86 if (uBinkVersion == 0x0001000500150000) | |
87 { | |
88 v5 = new _BINKBUF_1_5_21_0; | |
89 memset(v5, 0, sizeof(_BINKBUF_1_5_21_0)); | |
90 } | |
91 else if (uBinkVersion == 0x0003000000000000) | |
92 { | |
93 v5 = new _BINKBUF_3_0_0_0; | |
94 memset(v5, 0, sizeof(_BINKBUF_3_0_0_0)); | |
95 } | |
96 | |
0 | 97 memset(&v11, 0, 0x7Cu); |
98 v11.dwSize = 124; | |
99 v11.dwWidth = v13; | |
100 v11.dwFlags = 0x1007u; // DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | |
101 v11.ddsCaps.dwCaps = 0x4040u; // DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | |
102 v11.dwHeight = uHeight; | |
103 *(_QWORD *)&v11.ddpfPixelFormat.dwSize = 0x400000020ui64;// DDPF_FOURCC | |
104 v11.ddpfPixelFormat.dwFourCC = 0x32595559u; | |
105 if ( dword_6BE384_2dacceloff || pRenderer->pDirectDraw4->CreateSurface(&v11, &v15, 0) ) | |
106 { | |
107 memset(&v11.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT)); | |
108 | |
109 v11.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; | |
110 v11.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; | |
111 | |
112 auto hr = pRenderer->pDirectDraw4->CreateSurface(&v11, &v15, 0); | |
113 ErrD3D(hr, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:1476"); | |
114 } | |
115 v5->uWidth = v11.dwWidth; | |
116 v5->uHeight = v11.dwHeight; | |
117 v5->uBinkDDSurfaceType = BinkDDSurfaceType((IDirectDrawSurface *)v15); | |
118 v5->field_38 = 0; | |
119 v7 = (IDirectDrawSurface *)v15; | |
120 } | |
121 else | |
122 { | |
123 v4 = 0; | |
124 a2 = 0; | |
21 | 125 |
126 | |
127 if (uBinkVersion == 0x0001000500150000) | |
128 { | |
129 v5 = new _BINKBUF_1_5_21_0; | |
130 memset(v5, 0, sizeof(_BINKBUF_1_5_21_0)); | |
131 } | |
132 else if (uBinkVersion == 0x0003000000000000) | |
133 { | |
134 v5 = new _BINKBUF_3_0_0_0; | |
135 memset(v5, 0, sizeof(_BINKBUF_3_0_0_0)); | |
136 } | |
137 | |
0 | 138 memset(&Dst, 0, 0x6Cu); |
139 Dst.dwSize = 108; | |
140 Dst.dwWidth = v13; | |
141 Dst.dwFlags = 4103; | |
142 Dst.ddsCaps.dwCaps = 16448; | |
143 Dst.dwHeight = uHeight; | |
144 Dst.ddpfPixelFormat.dwSize = 32; | |
145 Dst.ddpfPixelFormat.dwFlags = 4; | |
146 Dst.ddpfPixelFormat.dwFourCC = 844715353; | |
147 if ( dword_6BE384_2dacceloff | |
148 || pRenderer->pDirectDraw2->CreateSurface(&Dst, (LPDIRECTDRAWSURFACE *)&a2, 0) ) | |
149 { | |
150 memset(&Dst.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT)); | |
151 | |
152 Dst.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; | |
153 Dst.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; | |
154 | |
155 auto hr = pRenderer->pDirectDraw2->CreateSurface(&Dst, (LPDIRECTDRAWSURFACE *)&a2, 0); | |
156 ErrD3D(hr, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:1426"); | |
157 } | |
158 v5->uWidth = Dst.dwWidth; | |
159 v5->uHeight = Dst.dwHeight; | |
160 v5->uBinkDDSurfaceType = BinkDDSurfaceType((IDirectDrawSurface *)a2); | |
161 v5->field_38 = 0; | |
162 v7 = (IDirectDrawSurface *)a2; | |
163 } | |
164 v5->pTargetDDrawSurface = v7; | |
165 v5->hWnd = hWnd; | |
166 v9 = a4; | |
167 v5->field_4C = v4; | |
168 v5->field_68 = v4; | |
169 v5->field_5C = v4; | |
170 v5->field_74 = v9 & 0x1F; | |
171 v5->field_78 = 1; | |
172 v5->field_24 = GetSystemMetrics(v4); | |
173 v5->field_28 = GetSystemMetrics(SM_CYSCREEN); | |
174 v5->field_2C = 16; | |
175 GetWindowRect(hWnd, &Rect); | |
176 v5->field_8 = Rect.right - Rect.left; | |
177 v5->field_C = Rect.bottom - Rect.top; | |
178 v5->field_1C = Rect.left; | |
179 v5->field_20 = Rect.top; | |
180 Rect.left = v4; | |
181 Rect.top = v4; | |
182 ClientToScreen(hWnd, (LPPOINT)&Rect); | |
183 v5->field_1C = Rect.left - v5->field_1C; | |
184 v5->field_20 = Rect.top - v5->field_20; | |
185 GetClientRect(hWnd, &Rect); | |
186 v5->field_30 = v5->field_8 - Rect.right; | |
187 v5->field_34 = v5->field_C - Rect.bottom; | |
188 v5->field_8 = v5->uWidth + v5->field_30; | |
189 v5->field_C = v5->uHeight + v5->field_34; | |
190 BinkBufferSetOffset(v5, v4, v4); | |
191 BinkBufferSetScale(v5, v5->uWidth, v5->uHeight); | |
192 return v5; | |
193 } | |
21 | 194 |
0 | 195 |
196 //----- (004C0133) -------------------------------------------------------- | |
197 bool BinkLockBuffer(_BINKBUF *_this) | |
198 { | |
199 _BINKBUF *v1; // esi@1 | |
200 IDirectDrawSurface *v2; // edi@5 | |
201 DWORD v4; // eax@8 | |
202 DWORD v5; // eax@8 | |
203 IDirectDrawSurface4 *v6; // edi@11 | |
204 LPVOID v7; // eax@14 | |
205 | |
206 v1 = _this; | |
13
17150bdf321e
исправлено неполное воспроизведение роликов, бинков
Серик@ПончиК
parents:
3
diff
changeset
|
207 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5u ) |
0 | 208 { |
209 DDSURFACEDESC2 v8; // [sp+Ch] [bp-7Ch]@4 | |
210 if ( _this->pTargetDDrawSurface ) | |
211 { | |
212 memset(&v8, 0, 0x7Cu); | |
213 v8.dwSize = 124; | |
214 while ( 1 ) | |
215 { | |
216 v6 = (IDirectDrawSurface4 *)v1->pTargetDDrawSurface; | |
217 if ( !v6->Lock(0, &v8, 1u, 0) ) | |
218 break; | |
21 | 219 |
220 if (uBinkVersion < 0x0003000000000000) | |
221 BYTE3(v1->uBinkDDSurfaceType) |= 0x80u; | |
222 else | |
223 BYTE3(v1->uBinkDDSurfaceType) |= 0x04; | |
224 | |
0 | 225 if ( v6->Restore() ) |
226 return 0; | |
227 } | |
228 v7 = v8.lpSurface; | |
229 v1->pDDrawSurfaceData_ = v8.lpSurface; | |
230 v1->pDDrawSurfaceData = v7; | |
231 v5 = v8.lPitch; | |
232 goto LABEL_15; | |
233 } | |
234 } | |
235 else | |
236 { | |
237 DDSURFACEDESC v8; // [sp+Ch] [bp-7Ch]@4 | |
238 if ( _this->pTargetDDrawSurface ) | |
239 { | |
240 memset(&v8.lPitch, 0, 0x6Cu); | |
241 v8.lPitch = 108; | |
242 while ( 1 ) | |
243 { | |
244 v2 = v1->pTargetDDrawSurface; | |
245 if ( !v2->Lock(0, (LPDDSURFACEDESC)&v8.lPitch, 1u, 0) ) | |
246 break; | |
21 | 247 |
248 if (uBinkVersion < 0x0003000000000000) | |
249 __asm int 3; | |
250 else | |
251 BYTE3(v1->uBinkDDSurfaceType) |= 4u; | |
252 | |
0 | 253 if ( v2->Restore() ) |
254 return 0; | |
255 } | |
256 v4 = (DWORD)v8.lpSurface; | |
257 v1->pDDrawSurfaceData_ = (void *)v8.lpSurface; | |
258 v1->pDDrawSurfaceData = (void *)v4; | |
259 v5 = v8.dwReserved; | |
260 LABEL_15: | |
261 v1->uDDrawSurfacePitch = v5; | |
262 return 1; | |
263 } | |
264 } | |
265 return 1; | |
266 } | |
267 | |
268 //----- (004C01FB) -------------------------------------------------------- | |
269 void BinkUnlockBuffer(_BINKBUF *_this) | |
270 { | |
271 _BINKBUF *v1; // esi@1 | |
272 IDirectDrawSurface *v2; // eax@1 | |
273 | |
274 v1 = _this; | |
275 v2 = _this->pTargetDDrawSurface; | |
276 if ( v2 ) | |
277 { | |
278 v2->Unlock(0); | |
279 v1->uDDrawSurfacePitch = 0; | |
280 v1->pDDrawSurfaceData = 0; | |
21 | 281 |
282 if (uBinkVersion < 0x0003000000000000) | |
283 BYTE3(_this->uBinkDDSurfaceType) &= 0x7F; | |
284 else | |
285 BYTE3(_this->uBinkDDSurfaceType) &= 0xFB; | |
0 | 286 } |
287 } | |
288 | |
289 | |
290 | |
291 | |
292 //----- (004BF794) -------------------------------------------------------- | |
293 void __cdecl ShowIntroVideo_and_LoadingScreen() | |
294 { | |
295 RGBTexture tex; // [sp+Ch] [bp-30h]@1 | |
296 unsigned int uTrackStartMS; // [sp+34h] [bp-8h]@8 | |
297 unsigned int uTrackEndMS; // [sp+38h] [bp-4h]@8 | |
298 | |
299 pVideoPlayer->bStopBeforeSchedule = false; | |
300 pVideoPlayer->field_40 = 0; | |
301 bGameoverLoop = 1; | |
302 if ( !bNoVideo ) | |
303 { | |
304 bNoVideo = 0; | |
305 pRenderer->PresentBlackScreen(); | |
306 pGame->pCShow->PlayMovie(MOVIE_3DOLogo, 1); | |
307 if ( !pVideoPlayer->bStopBeforeSchedule ) | |
308 { | |
309 pGame->pCShow->PlayMovie(MOVIE_NWCLogo, 1); | |
310 if ( !pVideoPlayer->bStopBeforeSchedule ) | |
311 { | |
312 pGame->pCShow->PlayMovie(MOVIE_JVC, 1); | |
313 if ( !pVideoPlayer->bStopBeforeSchedule ) | |
13
17150bdf321e
исправлено неполное воспроизведение роликов, бинков
Серик@ПончиК
parents:
3
diff
changeset
|
314 pGame->pCShow->PlayMovie(MOVIE_Intro, 1); |
0 | 315 } |
316 } | |
317 } | |
318 tex.Load("mm6title.pcx", 2); | |
319 pRenderer->BeginScene(); | |
320 pRenderer->DrawTextureRGB(0, 0, &tex); | |
321 free(tex.pPixels); | |
322 tex.pPixels = 0; | |
323 MainMenuUI_LoadFontsAndSomeStuff(); | |
324 DrawCopyrightWindow(); | |
325 pRenderer->EndScene(); | |
326 pRenderer->Present(); | |
3 | 327 if (!bNoSound && pAudioPlayer->hAILRedbook ) |
0 | 328 { |
329 pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0)); | |
330 AIL_redbook_stop(pAudioPlayer->hAILRedbook); | |
331 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xEu, &uTrackStartMS, &uTrackEndMS); | |
332 AIL_redbook_play(pAudioPlayer->hAILRedbook, uTrackStartMS + 1, uTrackEndMS); | |
333 } | |
334 bGameoverLoop = 0; | |
335 } | |
336 | |
337 | |
338 | |
339 | |
340 //----- (004BE70E) -------------------------------------------------------- | |
341 void __fastcall VideoPlayer::MovieLoop(const char *pMovieName, int a2, int a3, int a4) | |
342 { | |
343 int v4; // ebp@1 | |
344 const char *v5; // edi@1 | |
345 MSG Msg; // [sp+Ch] [bp-1Ch]@12 | |
346 | |
347 v4 = a2; | |
348 v5 = pMovieName; | |
349 if ( !(dword_6BE364_game_settings_1 & 0x44) ) | |
350 { | |
351 if ( a2 == 2 ) | |
352 v4 = 0; | |
353 ShowCursor(0); | |
354 pVideoPlayer->OpenMovie(v5, 0, a3); | |
355 pVideoPlayer->bPlayingMovie = 1; | |
356 pVideoPlayer->field_44 = v4; | |
357 if ( pRenderer->pRenderD3D ) | |
358 { | |
359 pRenderer->ClearTarget(0); | |
360 } | |
361 else | |
362 { | |
363 pRenderer->BeginScene(); | |
364 pRenderer->ClearTarget(0); | |
365 pRenderer->EndScene(); | |
366 } | |
367 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 16; | |
368 if ( pVideoPlayer->uMovieFormat == 2 ) | |
369 { | |
370 if ( pVideoPlayer->pBinkMovie ) | |
371 { | |
372 pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, a3); | |
373 while ( pVideoPlayer->pBinkMovie ) | |
374 { | |
375 if ( pVideoPlayer->bStopBeforeSchedule ) | |
376 break; | |
377 while ( PeekMessageA(&Msg, 0, 0, 0, 1u) ) | |
378 { | |
379 if ( Msg.message == 18 ) | |
380 Game_DeinitializeAndTerminate(0); | |
381 if ( Msg.message == 15 ) | |
382 break; | |
383 TranslateMessage(&Msg); | |
384 DispatchMessageA(&Msg); | |
385 } | |
386 GUI_MainMenuMessageProc(); | |
387 if ( !pVideoPlayer->pBinkMovie ) | |
388 break; | |
389 if ( !BinkWait(pVideoPlayer->pBinkMovie) && !pVideoPlayer->bStopBeforeSchedule ) | |
390 pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, a3); | |
391 } | |
392 } | |
393 if ( pVideoPlayer->bStopBeforeSchedule == 1 ) | |
394 Sleep(0x3E8u); | |
395 } | |
396 else | |
397 { | |
398 if ( pVideoPlayer->uMovieFormat == 1 ) | |
399 { | |
400 if ( pVideoPlayer->pSmackerMovie ) | |
401 { | |
402 pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, a3); | |
403 while ( pVideoPlayer->pSmackerMovie ) | |
404 { | |
405 if ( pVideoPlayer->bStopBeforeSchedule ) | |
406 break; | |
407 while ( PeekMessageW(&Msg, 0, 0, 0, 1u) ) | |
408 { | |
409 if (Msg.message == WM_QUIT) | |
410 Game_DeinitializeAndTerminate(0); | |
411 if (Msg.message == WM_PAINT) | |
412 break; | |
413 TranslateMessage(&Msg); | |
414 DispatchMessageW(&Msg); | |
415 } | |
416 GUI_MainMenuMessageProc(); | |
417 if ( !pVideoPlayer->pSmackerMovie ) | |
418 break; | |
419 if ( !SmackWait(pVideoPlayer->pSmackerMovie) && !pVideoPlayer->bStopBeforeSchedule ) | |
420 pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, a3); | |
421 } | |
422 } | |
423 } | |
424 } | |
425 if ( a4 == 1 ) | |
426 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; | |
427 pVideoPlayer->bPlayingMovie = 0; | |
428 ShowCursor(1); | |
429 if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 16 ) | |
430 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; | |
431 } | |
432 } | |
21 | 433 |
0 | 434 |
435 | |
436 | |
437 //----- (004BE95A) -------------------------------------------------------- | |
438 unsigned int VideoPlayer::SmackCheckSurfaceFromat() | |
439 { | |
440 DDPIXELFORMAT a2; // [sp+0h] [bp-20h]@1 | |
441 | |
442 a2.dwSize = 32; | |
443 a2.dwFlags = 64; | |
444 pRenderer->GetTargetPixelFormat(&a2); | |
445 if ( a2.dwRGBBitCount != 8 ) | |
446 { | |
447 if ( a2.dwRBitMask == 0xF800 ) | |
448 { | |
449 if ( a2.dwGBitMask == 0x7E0 && a2.dwBBitMask == 0x1F ) | |
450 return 0xC0000000u; | |
451 } | |
452 else | |
453 { | |
454 if ( a2.dwRBitMask == 0x7C00 | |
455 && a2.dwGBitMask == 0x3E0 | |
456 && a2.dwBBitMask == 0x1F ) | |
457 return 0x80000000u; | |
458 } | |
459 MessageBoxA(0, "Unsupported pixel format.", "Smacker Error", 0); | |
460 } | |
461 return 0; | |
462 } | |
463 | |
464 //----- (004BE9D8) -------------------------------------------------------- | |
465 void VideoPlayer::Initialize() | |
466 { | |
467 //VideoPlayer *v1; // esi@1 | |
468 HANDLE v2; // eax@1 | |
469 char *v3; // ebp@2 | |
470 HANDLE v4; // eax@5 | |
471 HANDLE v5; // eax@7 | |
472 unsigned int v6; // eax@9 | |
473 const char *v7; // [sp-8h] [bp-1Ch]@3 | |
474 char *v8; // [sp-4h] [bp-18h]@2 | |
475 DWORD NumberOfBytesRead; // [sp+10h] [bp-4h]@9 | |
476 | |
21 | 477 |
478 uint uBinkVersionMajor = -1, | |
479 uBinkVersionMinor = -1; | |
480 GetDllVersion(L"BINKW32.DLL", &uBinkVersionMajor, &uBinkVersionMinor); | |
481 uBinkVersion = (unsigned __int64)uBinkVersionMajor << 32 | uBinkVersionMinor; | |
482 | |
483 | |
0 | 484 //v1 = this; |
485 strcpy(pTmpBuf, "anims\\might7.vid"); | |
486 v2 = CreateFileW(L"anims\\might7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); | |
487 hMightVid = v2; | |
488 if ( v2 == INVALID_HANDLE_VALUE ) | |
489 { | |
490 v8 = pTmpBuf; | |
491 v3 = pTmpBuf2; | |
492 LABEL_3: | |
493 v7 = "Can't open file - anims\\%s.smk"; | |
494 LABEL_4: | |
495 sprintfex(v3, v7, v8); | |
496 MessageBoxA(0, v3, "Video File Error", 0); | |
497 return; | |
498 } | |
499 strcpy(pTmpBuf, "anims\\magic7.vid"); | |
500 v4 = CreateFileW(L"anims\\magic7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); | |
501 hMagicVid = v4; | |
502 if ( v4 == INVALID_HANDLE_VALUE ) | |
503 { | |
504 v3 = pTmpBuf2; | |
505 v8 = pTmpBuf; | |
506 if ( !bCanLoadFromCD ) | |
507 goto LABEL_3; | |
508 sprintfex(pTmpBuf2, "%c:\\%s", (unsigned __int8)cMM7GameCDDriveLetter, pTmpBuf); | |
509 v5 = CreateFileA(pTmpBuf2, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); | |
510 hMagicVid = v5; | |
511 if ( v5 == (HANDLE)INVALID_HANDLE_VALUE ) | |
512 { | |
513 v8 = pTmpBuf; | |
514 v7 = "Can't open file - %s"; | |
515 goto LABEL_4; | |
516 } | |
517 } | |
518 ReadFile(hMightVid, &uNumMightVideoHeaders, 4u, &NumberOfBytesRead, 0); | |
519 ReadFile(hMagicVid, &uNumMagicVideoHeaders, 4u, &NumberOfBytesRead, 0); | |
520 v6 = 44 * uNumMightVideoHeaders + 2; | |
521 pMagicVideoHeaders = 0; | |
522 pMightVideoHeaders = 0; | |
523 pMightVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk(0, v6, 0); | |
524 pMagicVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk( | |
525 pMagicVideoHeaders, | |
526 44 * uNumMagicVideoHeaders + 2, | |
527 0); | |
528 ReadFile(hMightVid, pMightVideoHeaders, 44 * uNumMightVideoHeaders, &NumberOfBytesRead, 0); | |
529 ReadFile(hMagicVid, pMagicVideoHeaders, 44 * uNumMagicVideoHeaders, &NumberOfBytesRead, 0); | |
530 } | |
531 | |
532 //----- (004BEB41) -------------------------------------------------------- | |
533 void VideoPlayer::Prepare() | |
534 { | |
535 VideoPlayer *v1; // esi@1 | |
536 IDirectDrawSurface *v2; // [sp-4h] [bp-Ch]@5 | |
537 | |
538 v1 = this; | |
539 pEventTimer->Pause(); | |
540 v1->bStopBeforeSchedule = 0; | |
541 if ( pAudioPlayer->hAILRedbook ) | |
542 AIL_redbook_pause(pAudioPlayer->hAILRedbook); | |
543 v1->field_54 = 1; | |
544 v1->hWindow = hWnd; | |
545 v1->pSmackerMovie = 0; | |
546 v1->pSmackerBuffer = 0; | |
547 v1->pBinkMovie = 0; | |
548 v1->pBinkBuffer = 0; | |
549 v1->bPlayingMovie = 0; | |
550 v1->bFirstFrame = 0; | |
551 v1->bUsingSmackerMMX = SmackUseMMX(1); | |
552 BinkSetSoundSystem(BinkOpenMiles, pAudioPlayer->hDigDriver); | |
13
17150bdf321e
исправлено неполное воспроизведение роликов, бинков
Серик@ПончиК
parents:
3
diff
changeset
|
553 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5u ) |
0 | 554 v2 = (IDirectDrawSurface*)pRenderer->pBackBuffer4; |
555 else | |
556 v2 = (IDirectDrawSurface*)pRenderer->pBackBuffer2; | |
557 v1->uBinkDirectDrawSurfaceType = BinkDDSurfaceType(v2); | |
558 _flushall(); | |
559 } | |
560 | |
561 | |
562 //----- (004BEBD7) -------------------------------------------------------- | |
563 void VideoPlayer::Unload() | |
564 { | |
565 VideoPlayer *v1; // esi@1 | |
566 _BINK *v2; // eax@1 | |
567 _BINKBUF *v3; // eax@3 | |
568 _SMACK *v4; // eax@5 | |
569 | |
570 v1 = this; | |
571 v2 = this->pBinkMovie; | |
572 if ( v2 ) | |
573 { | |
574 BinkPause(v2, 1); | |
575 Sleep(300u); | |
576 BinkClose(v1->pBinkMovie); | |
577 v1->pBinkMovie = 0; | |
578 } | |
579 v3 = v1->pBinkBuffer; | |
580 if ( v3 ) | |
581 { | |
582 v3->pTargetDDrawSurface->Release(); | |
583 v1->pBinkBuffer->pTargetDDrawSurface = 0; | |
584 free(v1->pBinkBuffer); | |
585 v1->pBinkBuffer = 0; | |
586 } | |
587 v4 = v1->pSmackerMovie; | |
588 if ( v4 ) | |
589 { | |
590 SmackSoundOnOff(v4, 0); | |
591 SmackClose(v1->pSmackerMovie); | |
592 v1->pSmackerMovie = 0; | |
593 } | |
594 if ( v1->pSmackerBuffer ) | |
595 { | |
596 SmackBufferClose(v1->pSmackerBuffer); | |
597 v1->pSmackerBuffer = 0; | |
598 } | |
599 if ( v1->pSmackMovieBlit ) | |
600 { | |
601 SmackBlitClose(v1->pSmackMovieBlit); | |
602 v1->pSmackMovieBlit = 0; | |
603 } | |
604 v1->field_54 = 0; | |
605 v1->uMovieFormat = 0; | |
606 v1->dword_0000A0 = 0; | |
607 memset(v1->pCurrentMovieName, 0, 0x40u); | |
608 if ( pAudioPlayer->hAILRedbook && !bGameoverLoop ) | |
609 AIL_redbook_resume(pAudioPlayer->hAILRedbook); | |
610 pEventTimer->Resume(); | |
611 } | |
612 | |
613 //----- (004BECD5) -------------------------------------------------------- | |
21 | 614 void VideoPlayer::FastForwardToFrame(unsigned int uDstFrameNum) |
0 | 615 { |
616 VideoPlayer *v2; // esi@1 | |
617 unsigned int v3; // eax@1 | |
618 | |
619 v2 = this; | |
620 v3 = this->uMovieFormat; | |
621 if ( v3 == 2 ) | |
622 { | |
21 | 623 if (uDstFrameNum) |
0 | 624 { |
21 | 625 int *pCurrentFrame = uBinkVersion == 0x0001000500150000 ? &((_BINK_1_5_21_0 *)pBinkMovie)->uCurrentFrame : |
626 uBinkVersion == 0x0003000000000000 ? &((_BINK_3_0_0_0 *)pBinkMovie)->uCurrentFrame : | |
627 nullptr; | |
628 while (*pCurrentFrame < uDstFrameNum) | |
0 | 629 { |
21 | 630 BinkDoFrame(pBinkMovie); |
631 BinkNextFrame(pBinkMovie); | |
0 | 632 } |
633 } | |
634 } | |
635 else | |
636 { | |
637 if ( v3 != 1 ) | |
638 return; | |
639 SmackSoundOnOff(this->pSmackerMovie, 0); | |
21 | 640 if (uDstFrameNum) |
0 | 641 { |
21 | 642 while ( v2->pSmackerMovie->FrameNum < uDstFrameNum) |
0 | 643 { |
644 SmackDoFrame(v2->pSmackerMovie); | |
645 SmackNextFrame(v2->pSmackerMovie); | |
646 } | |
647 } | |
648 } | |
649 Unload(); | |
650 } | |
21 | 651 |
0 | 652 |
653 //----- (004BED4F) -------------------------------------------------------- | |
654 void VideoPlayer::BinkDrawFrame(HWND hWnd, int a3, int a4) | |
655 { | |
21 | 656 //VideoPlayer *v4; // esi@1 |
0 | 657 _BINKBUF *v5; // eax@5 |
658 LONG v6; // edx@6 | |
659 int v7; // ecx@6 | |
660 LONG v8; // edx@6 | |
661 struct tagRECT a3a; // [sp+8h] [bp-20h]@10 | |
662 struct tagRECT a1; // [sp+18h] [bp-10h]@6 | |
663 | |
21 | 664 //v4 = this; |
0 | 665 if ( this->pBinkMovie && this->pBinkBuffer ) |
666 { | |
21 | 667 BinkDoFrame(pBinkMovie); |
668 BinkGetRects(pBinkMovie, pBinkBuffer->uBinkDDSurfaceType); | |
669 if ( BinkLockBuffer(pBinkBuffer) ) | |
0 | 670 { |
671 BinkCopyToBuffer( | |
21 | 672 pBinkMovie, |
673 pBinkBuffer->pDDrawSurfaceData, | |
674 pBinkBuffer->uDDrawSurfacePitch, | |
675 pBinkBuffer->uHeight, | |
0 | 676 0, |
677 0, | |
21 | 678 pBinkBuffer->uBinkDDSurfaceType); |
679 BinkUnlockBuffer(pBinkBuffer); | |
0 | 680 } |
21 | 681 v5 = pBinkBuffer; |
0 | 682 if ( pRenderer->bWindowMode ) |
683 { | |
684 v6 = v5->uRectX; | |
685 a1.left = v6; | |
686 a1.top = v5->uRectY; | |
687 v7 = v6 + v5->uWidth; | |
688 a1.right = v6 + v5->uWidth; | |
689 v8 = a1.top + v5->uHeight; | |
690 } | |
691 else | |
692 { | |
693 a1.left = 0; | |
694 a1.top = 0; | |
695 v7 = v5->uWidth; | |
696 a1.right = v5->uWidth; | |
697 v8 = v5->uHeight; | |
698 } | |
699 a1.bottom = v8; | |
700 if ( a4 ) | |
701 { | |
702 a1.right = v5->uWidth + v7; | |
703 a1.bottom = v5->uHeight + v8; | |
704 } | |
705 a3a.left = 0; | |
706 a3a.top = 0; | |
707 a3a.right = v5->uWidth; | |
708 a3a.bottom = v5->uHeight; | |
709 pRenderer->BltToFront(&a1, v5->pTargetDDrawSurface, &a3a, 0x1000000u); | |
21 | 710 |
711 | |
712 int *pCurrentFrame = uBinkVersion == 0x0001000500150000 ? &((_BINK_1_5_21_0 *)pBinkMovie)->uCurrentFrame : | |
713 uBinkVersion == 0x0003000000000000 ? &((_BINK_3_0_0_0 *)pBinkMovie)->uCurrentFrame: | |
714 nullptr; | |
715 int *pNumFrames = uBinkVersion == 0x0001000500150000 ? &((_BINK_1_5_21_0 *)pBinkMovie)->uNumFrames : | |
716 uBinkVersion == 0x0003000000000000 ? &((_BINK_3_0_0_0 *)pBinkMovie)->uNumFrames : | |
717 nullptr; | |
718 | |
719 if (*pCurrentFrame != *pNumFrames - 1 || bLoopPlaying) | |
720 BinkNextFrame(pBinkMovie); | |
0 | 721 else |
722 Unload(); | |
723 } | |
724 } | |
21 | 725 |
726 | |
0 | 727 |
728 //----- (004BEE6B) -------------------------------------------------------- | |
729 void VideoPlayer::SmackDrawFrame(HWND hWnd, int a3, int a4) | |
730 { | |
731 VideoPlayer *v4; // esi@1 | |
732 _SMACK *v5; // eax@3 | |
733 unsigned int v6; // eax@5 | |
734 char v7; // zf@5 | |
735 int v8; // eax@11 | |
736 _SMACK *v9; // eax@13 | |
737 _SMACK *v10; // eax@16 | |
738 _SMACK *v11; // eax@20 | |
739 unsigned int v12; // [sp-1Ch] [bp-34h]@7 | |
740 LONG v13; // [sp-18h] [bp-30h]@7 | |
741 LONG v14; // [sp-14h] [bp-2Ch]@7 | |
742 signed int v15; // [sp-10h] [bp-28h]@7 | |
743 signed int v16; // [sp-Ch] [bp-24h]@7 | |
744 signed int v17; // [sp-8h] [bp-20h]@7 | |
745 struct tagPOINT Point; // [sp+8h] [bp-10h]@7 | |
746 unsigned short *pOutSurface; // [sp+10h] [bp-8h]@5 | |
747 unsigned int uPixelsPerRow; // [sp+14h] [bp-4h]@5 | |
748 | |
749 v4 = this; | |
750 if ( !pRenderer->bWindowMode || GetFocus() == hWnd ) | |
751 { | |
752 v5 = v4->pSmackerMovie; | |
753 if ( v5->NewPalette ) | |
754 SmackBlitSetPalette(v4->pSmackMovieBlit, v5->Palette, v5->PalType); | |
755 SmackDoFrame(v4->pSmackerMovie); | |
756 pRenderer->LockFrontBuffer((void **)&pOutSurface, &uPixelsPerRow); | |
757 v6 = 2 * uPixelsPerRow; | |
758 v7 = v4->bFirstFrame == 0; | |
759 uPixelsPerRow *= 2; | |
760 if ( !v7 ) | |
761 { | |
762 if ( pRenderer->bWindowMode ) | |
763 { | |
764 Point.y = 0; | |
765 Point.x = 0; | |
766 ClientToScreen(hWnd, &Point); | |
767 v17 = -1; | |
768 v16 = 480; | |
769 v15 = 640; | |
770 v14 = Point.y; | |
771 v13 = Point.x; | |
772 v12 = uPixelsPerRow; | |
773 } | |
774 else | |
775 { | |
776 v17 = -1; | |
777 v16 = 480; | |
778 v15 = 640; | |
779 v14 = 0; | |
780 v13 = 0; | |
781 v12 = v6; | |
782 } | |
783 SmackBlitClear(v4->pSmackMovieBlit, pOutSurface, v12, v13, v14, v15, v16, v17); | |
784 v4->bFirstFrame = 0; | |
785 } | |
786 pRenderer->RestoreFrontBuffer(); | |
787 if ( pRenderer->bWindowMode ) | |
788 { | |
789 Point.y = 0; | |
790 Point.x = 0; | |
791 ClientToScreen(hWnd, &Point); | |
792 v8 = SmackToBufferRect(v4->pSmackerMovie, 0); | |
793 if ( a4 ) | |
794 { | |
795 while ( v8 ) | |
796 { | |
797 v9 = v4->pSmackerMovie; | |
798 SmackBlit( | |
799 v4->pSmackMovieBlit, | |
800 pOutSurface, | |
801 uPixelsPerRow, | |
802 v9->LastRectx + Point.x / 2, | |
803 a3 + v9->LastRecty + Point.y / 2, | |
804 v4->pSomeSmackerBuffer, | |
805 v9->Width, | |
806 v9->LastRectx, | |
807 v9->LastRecty, | |
808 v9->LastRectw, | |
809 v9->LastRecth); | |
810 v8 = SmackToBufferRect(v4->pSmackerMovie, 0); | |
811 } | |
812 } | |
813 else | |
814 { | |
815 while ( v8 ) | |
816 { | |
817 v10 = v4->pSmackerMovie; | |
818 SmackBlit( | |
819 v4->pSmackMovieBlit, | |
820 pOutSurface, | |
821 uPixelsPerRow, | |
822 Point.x + v10->LastRectx, | |
823 a3 + Point.y + v10->LastRecty, | |
824 v4->pSomeSmackerBuffer, | |
825 v10->Width, | |
826 v10->LastRectx, | |
827 v10->LastRecty, | |
828 v10->LastRectw, | |
829 v10->LastRecth); | |
830 v8 = SmackToBufferRect(v4->pSmackerMovie, 0); | |
831 } | |
832 } | |
833 } | |
834 else | |
835 { | |
836 while ( SmackToBufferRect(v4->pSmackerMovie, 0) ) | |
837 { | |
838 v11 = v4->pSmackerMovie; | |
839 SmackBlit( | |
840 v4->pSmackMovieBlit, | |
841 pOutSurface, | |
842 uPixelsPerRow, | |
843 v11->LastRectx, | |
844 a3 + v11->LastRecty, | |
845 v4->pSomeSmackerBuffer, | |
846 v11->Width, | |
847 v11->LastRectx, | |
848 v11->LastRecty, | |
849 v11->LastRectw, | |
850 v11->LastRecth); | |
851 } | |
852 } | |
853 pRenderer->UnlockFrontBuffer(); | |
854 if ( v4->pSmackerMovie->FrameNum != v4->pSmackerMovie->Frames - 1 || v4->bLoopPlaying ) | |
855 SmackNextFrame(v4->pSmackerMovie); | |
856 else | |
857 Unload(); | |
858 } | |
859 } | |
860 // 4D83D8: using guessed type int __stdcall SmackBlitSetPalette(int, int, int); | |
861 // 4D83DC: using guessed type int __stdcall SmackBlitClear(int, int, int, int, int, int, int, int); | |
862 // 4D83E0: using guessed type int __stdcall SmackToBufferRect(int, int); | |
863 // 4D83E4: using guessed type int __stdcall SmackDoFrame(int); | |
864 // 4D83E8: using guessed type int __stdcall SmackNextFrame(int); | |
865 // 4D8404: using guessed type int __stdcall SmackBlit(int, int, int, int, int, int, int, int, int, int, int); | |
866 | |
867 //----- (004BF08B) -------------------------------------------------------- | |
868 void VideoPlayer::SmackUpdatePalette(HWND hWnd) | |
869 { | |
870 VideoPlayer *v2; // esi@1 | |
871 unsigned __int16 *v3; // ebx@1 | |
872 unsigned int v4; // edi@1 | |
873 unsigned int v5; // eax@1 | |
874 _SMACK *v6; // eax@1 | |
875 | |
876 v2 = this; | |
877 pRenderer->BeginScene(); | |
878 v3 = pRenderer->pTargetSurface; | |
879 v4 = pRenderer->uTargetSurfacePitch; | |
880 v5 = SmackCheckSurfaceFromat(); | |
881 SmackToBuffer(v2->pSmackerMovie, 8, 8, 2 * v4, pRenderer->field_14, v3, v5); | |
882 v6 = v2->pSmackerMovie; | |
883 if ( v6->NewPalette ) | |
884 { | |
885 SmackBufferNewPalette((long)pSmackerBuffer, (long)v6->Palette, LOWORD(v6->PalType)); | |
886 SmackColorRemapWithTrans( | |
887 (long)pSmackerMovie, | |
888 (long)pSmackerBuffer->Palette, | |
889 (long)pSmackerBuffer->MaxPalColors, | |
890 (long)pSmackerBuffer->PalType, | |
891 1000); | |
892 } | |
893 SmackDoFrame(v2->pSmackerMovie); | |
894 if ( v2->pSmackerMovie->FrameNum != v2->pSmackerMovie->Frames - 1 || v2->bLoopPlaying ) | |
895 SmackNextFrame(v2->pSmackerMovie); | |
896 else | |
897 Unload(); | |
898 pRenderer->EndScene(); | |
899 } | |
3 | 900 |
0 | 901 |
21 | 902 |
903 | |
904 | |
0 | 905 //----- (004BF141) -------------------------------------------------------- |
906 _BINK *VideoPlayer::OpenBink(const char *pName) | |
907 { | |
21 | 908 //VideoPlayer *v2; // esi@1 |
0 | 909 signed int v3; // edi@1 |
910 int v4; // ebx@2 | |
911 signed int v5; // edi@5 | |
912 int v6; // ebx@6 | |
913 HANDLE v8; // [sp-8h] [bp-18h]@10 | |
914 unsigned int v9; // [sp-4h] [bp-14h]@10 | |
915 | |
21 | 916 for (uint i = 0; i < uNumMightVideoHeaders; ++i) |
917 if (!strcmpi(pName, pMightVideoHeaders[i].pVideoName)) | |
0 | 918 { |
21 | 919 SetFilePointer(hMightVid, pMightVideoHeaders[i].uFileOffset, 0, FILE_BEGIN); |
920 | |
921 if (uBinkVersion < 0x0003000000000000) | |
922 return BinkOpen(hMightVid, 0x08800000); | |
923 else | |
924 return BinkOpen(hMightVid, 0x82000000); | |
0 | 925 } |
21 | 926 |
927 for (uint i = 0; i < uNumMagicVideoHeaders; ++i) | |
928 if (!strcmpi(pName, pMagicVideoHeaders[i].pVideoName)) | |
0 | 929 { |
21 | 930 SetFilePointer(hMagicVid, pMagicVideoHeaders[i].uFileOffset, 0, FILE_BEGIN); |
931 | |
932 if (uBinkVersion < 0x0003000000000000) | |
933 return BinkOpen(hMagicVid, 0x08800000); | |
934 else | |
935 return BinkOpen(hMagicVid, 0x82000000); | |
0 | 936 } |
21 | 937 |
938 return nullptr; | |
0 | 939 } |
940 | |
941 //----- (004BF1E6) -------------------------------------------------------- | |
942 _SMACK *VideoPlayer::OpenSmack(const char *pFilename) | |
943 { | |
944 VideoPlayer *v2; // esi@1 | |
945 signed int v3; // edi@1 | |
946 int v4; // ebx@2 | |
947 signed int v5; // edi@5 | |
948 int v6; // ebx@6 | |
949 HANDLE v8; // [sp-Ch] [bp-1Ch]@10 | |
950 unsigned int v9; // [sp-8h] [bp-18h]@10 | |
951 signed int v10; // [sp-4h] [bp-14h]@10 | |
952 | |
953 v2 = this; | |
954 v3 = 0; | |
955 if ( (signed int)this->uNumMightVideoHeaders > 0 ) | |
956 { | |
957 v4 = 0; | |
958 while ( _strcmpi(v2->pMightVideoHeaders[v4].pVideoName, pFilename) ) | |
959 { | |
960 ++v3; | |
961 ++v4; | |
962 if ( v3 >= (signed int)v2->uNumMightVideoHeaders ) | |
963 goto LABEL_5; | |
964 } | |
965 SetFilePointer(v2->hMightVid, v2->pMightVideoHeaders[v3].uFileOffset, 0, 0); | |
966 v10 = -1; | |
967 v9 = 0x7140u; | |
968 v8 = v2->hMightVid; | |
969 return SmackOpen(v8, v9, v10); | |
970 } | |
971 LABEL_5: | |
972 v5 = 0; | |
973 if ( (signed int)v2->uNumMagicVideoHeaders > 0 ) | |
974 { | |
975 v6 = 0; | |
976 while ( _strcmpi(v2->pMagicVideoHeaders[v6].pVideoName, pFilename) ) | |
977 { | |
978 ++v5; | |
979 ++v6; | |
980 if ( v5 >= (signed int)v2->uNumMagicVideoHeaders ) | |
981 return 0; | |
982 } | |
983 SetFilePointer(v2->hMagicVid, v2->pMagicVideoHeaders[v5].uFileOffset, 0, 0); | |
984 v10 = -1; | |
985 v9 = 0x7140u; | |
986 v8 = v2->hMagicVid; | |
987 return SmackOpen(v8, v9, v10); | |
988 } | |
989 return 0; | |
990 } | |
991 | |
992 //----- (004BF28F) -------------------------------------------------------- | |
993 void VideoPlayer::_4BF28F(const char *pMovieName, unsigned int a3_1) | |
994 { | |
995 VideoPlayer *v3; // esi@1 | |
996 std::string *v4; // ecx@3 | |
997 _SMACK *v5; // eax@4 | |
998 _SMACK *v6; // eax@7 | |
999 int v7; // eax@7 | |
1000 int v8; // ecx@7 | |
1001 unsigned int v9; // ebx@8 | |
1002 unsigned int v10; // eax@8 | |
1003 signed __int64 v11; // qax@9 | |
1004 char *v12; // [sp-20h] [bp-54h]@3 | |
1005 int v13; // [sp-1Ch] [bp-50h]@3 | |
1006 std::string v14; // [sp-18h] [bp-4Ch]@3 | |
1007 const char *v15; // [sp-8h] [bp-3Ch]@3 | |
1008 int v16; // [sp-4h] [bp-38h]@3 | |
1009 char Str2[0x30]; // [sp+Ch] [bp-28h]@4 | |
1010 std::string *v18; // [sp+3Ch] [bp+8h]@3 | |
1011 std::string *v19; // [sp+3Ch] [bp+8h]@5 | |
1012 unsigned __int16 *v20; // [sp+3Ch] [bp+8h]@8 | |
1013 | |
1014 v3 = this; | |
1015 if ( !this->field_54 ) | |
1016 { | |
1017 Prepare(); | |
1018 v3->bLoopPlaying = a3_1; | |
1019 __debugbreak(); // VideoPlayer is larger than this | |
1020 if ( v3[1].pVideoFrame.pName[0] == 1 ) | |
1021 { | |
1022 v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:925"; | |
1023 v12 = "Unsupported Bink playback!"; | |
1024 LABEL_6: | |
1025 MessageBoxA(nullptr, v12, v15, 0); | |
1026 return; | |
1027 } | |
1028 sprintfex(Str2, "%s.smk", pMovieName); | |
1029 v5 = OpenSmack(Str2); | |
1030 v3->pSmackerMovie = v5; | |
1031 if ( !v5 ) | |
1032 { | |
1033 v3->Unload(); | |
1034 sprintfex(pTmpBuf, "Can't load %s", &Str2); | |
1035 v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:937"; | |
1036 v12 = pTmpBuf; | |
1037 goto LABEL_6; | |
1038 } | |
1039 v16 = (int)pMovieName; | |
1040 v3->uMovieFormat = 1; | |
1041 strcpy(v3->pCurrentMovieName, (const char *)v16); | |
1042 v6 = v3->pSmackerMovie; | |
1043 v3->dword_0000A0 = 1; | |
1044 v7 = SmackBufferOpen(v3->hWindow, 4, LOWORD(v6->Width), LOWORD(v6->Height), LOWORD(v6->Width), LOWORD(v6->Height)); | |
1045 v3->pSmackerBuffer = (_SMACKBUF *)v7; | |
1046 if ( v7 ) | |
1047 { | |
1048 pRenderer->BeginScene(); | |
1049 v9 = pRenderer->uTargetSurfacePitch; | |
1050 v20 = pRenderer->pTargetSurface; | |
1051 v10 = SmackCheckSurfaceFromat(); | |
1052 SmackToBuffer(v3->pSmackerMovie, 8, 8, 2 * v9, pRenderer->field_14, v20, v10); | |
1053 pRenderer->EndScene(); | |
1054 } | |
1055 v16 = 32767; | |
1056 v11 = (signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 32767.0); | |
1057 SmackVolumePan(v8, HIDWORD(v11), v3->pSmackerMovie, 1040384, v11, 32767); | |
1058 } | |
1059 } | |
1060 | |
1061 | |
1062 //----- (004BF3F9) -------------------------------------------------------- | |
1063 bool VideoPlayer::AnyMovieLoaded() | |
1064 { | |
1065 return pSmackerMovie || pBinkMovie; | |
1066 } | |
1067 | |
1068 //----- (004BF411) -------------------------------------------------------- | |
1069 void VideoPlayer::OpenMovie(const char *pFilename, unsigned int bLoop, int a4) | |
1070 { | |
1071 VideoPlayer *v4; // esi@1 | |
1072 _BINK *v5; // eax@2 | |
1073 _SMACK *v6; // eax@3 | |
13
17150bdf321e
исправлено неполное воспроизведение роликов, бинков
Серик@ПончиК
parents:
3
diff
changeset
|
1074 _BINK *pBinkMovie; // eax@5 |
0 | 1075 _SMACK *v8; // eax@7 |
1076 char *v9; // eax@7 | |
1077 unsigned int v10; // eax@11 | |
1078 _SMACKBLIT *v11; // eax@14 | |
1079 const char *v12; // [sp-4h] [bp-38h]@8 | |
1080 char pVideoName[120]; // [sp+Ch] [bp-28h]@2 | |
1081 | |
1082 v4 = this; | |
1083 if ( !this->field_54 ) | |
1084 { | |
1085 Prepare(); | |
1086 v4->bLoopPlaying = bLoop; | |
1087 sprintf(pVideoName, "%s.bik", pFilename); | |
1088 v5 = OpenBink(pVideoName); | |
1089 v4->pBinkMovie = v5; | |
1090 if ( v5 ) | |
1091 { | |
1092 v4->uMovieFormat = 2; | |
1093 strcpy(v4->pCurrentMovieName, pFilename); | |
13
17150bdf321e
исправлено неполное воспроизведение роликов, бинков
Серик@ПончиК
parents:
3
diff
changeset
|
1094 pBinkMovie = v4->pBinkMovie; |
0 | 1095 v4->dword_0000A0 = 1; |
13
17150bdf321e
исправлено неполное воспроизведение роликов, бинков
Серик@ПончиК
parents:
3
diff
changeset
|
1096 if ( pBinkMovie ) |
21 | 1097 v4->pBinkBuffer = CreateBinkBuffer(v4->hWindow, pBinkMovie->uWidth, pBinkMovie->uHeight, 0); |
0 | 1098 } |
1099 else | |
1100 { | |
1101 Unload(); | |
1102 sprintf(pVideoName, "%s.smk", pFilename); | |
1103 v6 = OpenSmack(pVideoName); | |
1104 v4->pSmackerMovie = v6; | |
1105 if ( !v6 ) | |
1106 { | |
1107 Unload(); | |
1108 sprintfex(pVideoName, "Can't load file - anims\\%s.smk", pFilename); | |
1109 LABEL_17: | |
1110 MessageBoxA(0, pVideoName, "Smacker Error", 0); | |
1111 return; | |
1112 } | |
1113 v4->uMovieFormat = 1; | |
1114 strcpy(v4->pCurrentMovieName, pFilename); | |
1115 v8 = v4->pSmackerMovie; | |
1116 v4->dword_0000A0 = 2; | |
1117 v9 = (char *)malloc(v8->Width * v8->Height); | |
1118 v4->pSomeSmackerBuffer = v9; | |
1119 if ( !v9 ) | |
1120 { | |
1121 Unload(); | |
1122 v12 = "Can't allocate memory for buffer"; | |
1123 LABEL_16: | |
1124 sprintfex(pVideoName, v12); | |
1125 goto LABEL_17; | |
1126 } | |
1127 SmackToBuffer(v4->pSmackerMovie, 0, 0, v4->pSmackerMovie->Width, v4->pSmackerMovie->Height, v9, 0); | |
1128 if ( a4 ) | |
1129 { | |
1130 if ( (unsigned int)uCPUSpeed < 165 ) | |
1131 { | |
1132 v10 = SmackCheckSurfaceFromat() | 2; | |
1133 } | |
1134 else | |
1135 { | |
1136 v10 = SmackCheckSurfaceFromat(); | |
1137 LOBYTE(v10) = v10 | 6; | |
1138 } | |
1139 } | |
1140 else | |
1141 { | |
1142 v10 = SmackCheckSurfaceFromat(); | |
1143 } | |
1144 v11 = SmackBlitOpen(v10); | |
1145 v4->pSmackMovieBlit = v11; | |
1146 if ( !v11 ) | |
1147 { | |
1148 Unload(); | |
1149 v12 = "Failed to open Blit API"; | |
1150 goto LABEL_16; | |
1151 } | |
1152 } | |
1153 } | |
1154 } | |
21 | 1155 |
0 | 1156 |
1157 //----- (004BF5B2) -------------------------------------------------------- | |
1158 void VideoPlayer::_4BF5B2() | |
1159 { | |
1160 VideoPlayer *v1; // esi@1 | |
1161 unsigned int v2; // eax@1 | |
1162 _BINK **v3; // edi@2 | |
1163 | |
1164 v1 = this; | |
1165 v2 = this->uMovieFormat; | |
1166 if ( v2 == 2 ) | |
1167 { | |
1168 v3 = &this->pBinkMovie; | |
1169 BinkGoto(pBinkMovie, 1, 0); | |
1170 BinkDoFrame(pBinkMovie); | |
1171 BinkNextFrame(pBinkMovie); | |
1172 } | |
1173 else | |
1174 { | |
1175 if ( v2 != 1 ) | |
1176 return; | |
1177 SmackGoto(pSmackerMovie, 1); | |
1178 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
1179 { | |
1180 SmackDoFrame(pSmackerMovie); | |
1181 SmackNextFrame(pSmackerMovie); | |
1182 } | |
1183 } | |
1184 pMouse->_469E24(); | |
1185 if ( ptr_507BC0 && ptr_507BC0->ptr_1C == (void *)165 && !v1->pSmackerMovie ) | |
1186 { | |
1187 bGameoverLoop = 1; | |
1188 sub_4BD8B5(); | |
1189 ptr_507BC0->Release(); | |
1190 pParty->uFlags &= 0xFFFFFFFDu; | |
1191 if ( EnterHouse((enum HOUSE_TYPE)165) ) | |
1192 { | |
1193 pAudioPlayer->PlaySound(SOUND_0, 0, 0, -1, 0, 0, 0, 0); | |
2 | 1194 ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); |
0 | 1195 ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, nullstring, 0); |
1196 ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, nullstring, 0); | |
1197 ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, nullstring, 0); | |
1198 ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, nullstring, 0); | |
1199 } | |
1200 bGameoverLoop = 0; | |
1201 } | |
1202 } | |
1203 | |
1204 //----- (004BF73A) -------------------------------------------------------- | |
1205 void VideoPlayer::_4BF73A() | |
1206 { | |
1207 VideoPlayer *v1; // esi@1 | |
1208 int v2; // edi@1 | |
1209 unsigned __int8 v3; // bl@1 | |
1210 int v4; // edi@1 | |
1211 char Source[32]; // [sp+Ch] [bp-40h]@1 | |
1212 | |
1213 v1 = this; | |
1214 v2 = this->dword_0000A0; | |
1215 v3 = LOBYTE(this->bLoopPlaying); | |
1216 strcpy(Source, this->pCurrentMovieName); | |
1217 Unload(); | |
1218 v4 = v2 - 1; | |
1219 if ( v4 ) | |
1220 { | |
1221 if ( v4 == 1 ) | |
1222 OpenMovie(Source, v3, 1); | |
1223 } | |
1224 else | |
1225 { | |
1226 _4BF28F(Source, v3); | |
1227 } | |
1228 } | |
1229 | |
1230 //----- (004BF8F6) -------------------------------------------------------- | |
1231 void VideoPlayer::PlayDeathMovie() | |
1232 { | |
1233 bStopBeforeSchedule = 0; | |
1234 field_40 = 0; | |
1235 pGame->pCShow->PlayMovie(MOVIE_Death, 1); | |
1236 } |