annotate VideoPlayer.cpp @ 2263:3d644efae786

some more items.cpp init bugfixing
author Grumpy7
date Sat, 08 Mar 2014 17:53:38 +0100
parents aff7a7b072b7
children 0cd17b0d36c2
rev   line source
2253
aff7a7b072b7 adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents: 2223
diff changeset
1 #define _CRT_SECURE_NO_WARNINGS
0
Ritor1
parents:
diff changeset
2
Ritor1
parents:
diff changeset
3 #include "Bink_Smacker.h"
Ritor1
parents:
diff changeset
4
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
5 #include "mm7_data.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 898
diff changeset
6 #include "CShow.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 898
diff changeset
7 #include "Mouse.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 898
diff changeset
8
0
Ritor1
parents:
diff changeset
9 #include "VideoPlayer.h"
Ritor1
parents:
diff changeset
10 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
11 #include "Game.h"
Ritor1
parents:
diff changeset
12 #include "Render.h"
Ritor1
parents:
diff changeset
13 #include "Party.h"
Ritor1
parents:
diff changeset
14 #include "GUIWindow.h"
2044
28cb79ae2f6f Time.h rename
Ritor1
parents: 1980
diff changeset
15 #include "Timer.h"
0
Ritor1
parents:
diff changeset
16 #include "Log.h"
1253
fac7751b2dc9 included header cleanup
Grumpy7
parents: 1217
diff changeset
17 #include "texts.h"
1299
8c2f689b5f0b folder UI
Ritor1
parents: 1262
diff changeset
18 #include "UI\UIHouses.h"
0
Ritor1
parents:
diff changeset
19
Ritor1
parents:
diff changeset
20
Ritor1
parents:
diff changeset
21 VideoPlayer *pVideoPlayer = nullptr;
Ritor1
parents:
diff changeset
22
Ritor1
parents:
diff changeset
23
Ritor1
parents:
diff changeset
24
Ritor1
parents:
diff changeset
25
Ritor1
parents:
diff changeset
26
Ritor1
parents:
diff changeset
27
Ritor1
parents:
diff changeset
28
Ritor1
parents:
diff changeset
29 #pragma comment(lib, "Version.lib")
Ritor1
parents:
diff changeset
30 bool GetDllVersion(const wchar_t *pDllName, uint *pMajor, uint *pMinor)
Ritor1
parents:
diff changeset
31 {
Ritor1
parents:
diff changeset
32 uint uVersionSize = GetFileVersionInfoSizeW(pDllName, nullptr);
Ritor1
parents:
diff changeset
33 void *pVersionData = HeapAlloc(GetProcessHeap(), 0, uVersionSize);
Ritor1
parents:
diff changeset
34 {
Ritor1
parents:
diff changeset
35 GetFileVersionInfoW(pDllName, 0, uVersionSize, pVersionData);
Ritor1
parents:
diff changeset
36
Ritor1
parents:
diff changeset
37 VS_FIXEDFILEINFO *pInfo = nullptr;
Ritor1
parents:
diff changeset
38 UINT uInfoSize = 0;
Ritor1
parents:
diff changeset
39 VerQueryValueW(pVersionData, L"\\", (void **)&pInfo, &uInfoSize);
Ritor1
parents:
diff changeset
40
Ritor1
parents:
diff changeset
41 if (!pMajor || !pMinor)
Ritor1
parents:
diff changeset
42 {
Ritor1
parents:
diff changeset
43 HeapFree(GetProcessHeap(), 0, pVersionData);
Ritor1
parents:
diff changeset
44 return false;
Ritor1
parents:
diff changeset
45 }
Ritor1
parents:
diff changeset
46 *pMajor = pInfo->dwFileVersionMS;
Ritor1
parents:
diff changeset
47 *pMinor = pInfo->dwFileVersionLS;
Ritor1
parents:
diff changeset
48 }
Ritor1
parents:
diff changeset
49 HeapFree(GetProcessHeap(), 0, pVersionData);
Ritor1
parents:
diff changeset
50 return true;
Ritor1
parents:
diff changeset
51 }
Ritor1
parents:
diff changeset
52
Ritor1
parents:
diff changeset
53
Ritor1
parents:
diff changeset
54 // 3.15.1.0:
Ritor1
parents:
diff changeset
55 // 3 15 1 0
Ritor1
parents:
diff changeset
56 // 0x0003000F00010000
Ritor1
parents:
diff changeset
57 unsigned __int64 uBinkVersion;
Ritor1
parents:
diff changeset
58
Ritor1
parents:
diff changeset
59
Ritor1
parents:
diff changeset
60
Ritor1
parents:
diff changeset
61
Ritor1
parents:
diff changeset
62
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
63 bool BinkLockBuffer(struct _BINKBUF *_this);
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
64 void BinkUnlockBuffer(struct _BINKBUF *_this);
0
Ritor1
parents:
diff changeset
65
Ritor1
parents:
diff changeset
66 //----- (004BFE2D) --------------------------------------------------------
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
67 _BINKBUF *VideoPlayer::CreateBinkBuffer(unsigned int uWidth, unsigned int uHeight, char a4)
0
Ritor1
parents:
diff changeset
68 {
Ritor1
parents:
diff changeset
69 _BINKBUF *v5; // esi@3
Ritor1
parents:
diff changeset
70 HRESULT v6; // eax@5
Ritor1
parents:
diff changeset
71 IDirectDrawSurface *v7; // eax@6
Ritor1
parents:
diff changeset
72 HRESULT v8; // eax@9
Ritor1
parents:
diff changeset
73 DDSURFACEDESC2 v11; // [sp+Ch] [bp-108h]@7
Ritor1
parents:
diff changeset
74 DDSURFACEDESC Dst; // [sp+88h] [bp-8Ch]@3
Ritor1
parents:
diff changeset
75 IDirectDrawSurface4 *v15; // [sp+108h] [bp-Ch]@7
Ritor1
parents:
diff changeset
76 IDirectDrawSurface2 *a2; // [sp+10Ch] [bp-8h]@3
Ritor1
parents:
diff changeset
77
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2151
diff changeset
78 //if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2151
diff changeset
79 //pVersion->pVersionInfo.dwMajorVersion >= 5u )
0
Ritor1
parents:
diff changeset
80 {
Ritor1
parents:
diff changeset
81 v15 = 0;
Ritor1
parents:
diff changeset
82
Ritor1
parents:
diff changeset
83 if (uBinkVersion == 0x0001000500150000)
Ritor1
parents:
diff changeset
84 {
Ritor1
parents:
diff changeset
85 v5 = new _BINKBUF_1_5_21_0;
Ritor1
parents:
diff changeset
86 memset(v5, 0, sizeof(_BINKBUF_1_5_21_0));
Ritor1
parents:
diff changeset
87 }
Ritor1
parents:
diff changeset
88 else if (uBinkVersion == 0x0003000000000000)
Ritor1
parents:
diff changeset
89 {
Ritor1
parents:
diff changeset
90 v5 = new _BINKBUF_3_0_0_0;
Ritor1
parents:
diff changeset
91 memset(v5, 0, sizeof(_BINKBUF_3_0_0_0));
Ritor1
parents:
diff changeset
92 }
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
93 else __debugbreak();
0
Ritor1
parents:
diff changeset
94
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
95 memset(&v11, 0, 0x7C);
0
Ritor1
parents:
diff changeset
96 v11.dwSize = 124;
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
97 v11.dwWidth = uWidth;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
98 v11.dwFlags = 0x1007; // DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
99 v11.ddsCaps.dwCaps = 0x4040; // DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY
0
Ritor1
parents:
diff changeset
100 v11.dwHeight = uHeight;
Ritor1
parents:
diff changeset
101 *(_QWORD *)&v11.ddpfPixelFormat.dwSize = 0x400000020ui64;// DDPF_FOURCC
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
102 v11.ddpfPixelFormat.dwFourCC = 0x32595559;
2151
92511cd8fcdb Cleaned some variables.
Nomad
parents: 2142
diff changeset
103 if (FAILED(pRenderer->pDirectDraw4->CreateSurface(&v11, &v15, 0)))
0
Ritor1
parents:
diff changeset
104 {
Ritor1
parents:
diff changeset
105 memset(&v11.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT));
Ritor1
parents:
diff changeset
106
Ritor1
parents:
diff changeset
107 v11.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
Ritor1
parents:
diff changeset
108 v11.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
Ritor1
parents:
diff changeset
109
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1919
diff changeset
110 long hr = pRenderer->pDirectDraw4->CreateSurface(&v11, &v15, 0);
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
111 ErrD3D(hr);
0
Ritor1
parents:
diff changeset
112 }
Ritor1
parents:
diff changeset
113 v5->uWidth = v11.dwWidth;
Ritor1
parents:
diff changeset
114 v5->uHeight = v11.dwHeight;
Ritor1
parents:
diff changeset
115 v5->uBinkDDSurfaceType = BinkDDSurfaceType((IDirectDrawSurface *)v15);
Ritor1
parents:
diff changeset
116 v5->field_38 = 0;
Ritor1
parents:
diff changeset
117 v7 = (IDirectDrawSurface *)v15;
Ritor1
parents:
diff changeset
118 }
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2151
diff changeset
119 /*else
0
Ritor1
parents:
diff changeset
120 {
Ritor1
parents:
diff changeset
121 v4 = 0;
Ritor1
parents:
diff changeset
122 a2 = 0;
Ritor1
parents:
diff changeset
123
Ritor1
parents:
diff changeset
124
Ritor1
parents:
diff changeset
125 if (uBinkVersion == 0x0001000500150000)
Ritor1
parents:
diff changeset
126 {
Ritor1
parents:
diff changeset
127 v5 = new _BINKBUF_1_5_21_0;
Ritor1
parents:
diff changeset
128 memset(v5, 0, sizeof(_BINKBUF_1_5_21_0));
Ritor1
parents:
diff changeset
129 }
Ritor1
parents:
diff changeset
130 else if (uBinkVersion == 0x0003000000000000)
Ritor1
parents:
diff changeset
131 {
Ritor1
parents:
diff changeset
132 v5 = new _BINKBUF_3_0_0_0;
Ritor1
parents:
diff changeset
133 memset(v5, 0, sizeof(_BINKBUF_3_0_0_0));
Ritor1
parents:
diff changeset
134 }
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
135 else __debugbreak();
0
Ritor1
parents:
diff changeset
136
Ritor1
parents:
diff changeset
137 memset(&Dst, 0, 0x6Cu);
Ritor1
parents:
diff changeset
138 Dst.dwSize = 108;
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
139 Dst.dwWidth = uWidth;
0
Ritor1
parents:
diff changeset
140 Dst.dwFlags = 4103;
Ritor1
parents:
diff changeset
141 Dst.ddsCaps.dwCaps = 16448;
Ritor1
parents:
diff changeset
142 Dst.dwHeight = uHeight;
Ritor1
parents:
diff changeset
143 Dst.ddpfPixelFormat.dwSize = 32;
Ritor1
parents:
diff changeset
144 Dst.ddpfPixelFormat.dwFlags = 4;
Ritor1
parents:
diff changeset
145 Dst.ddpfPixelFormat.dwFourCC = 844715353;
2151
92511cd8fcdb Cleaned some variables.
Nomad
parents: 2142
diff changeset
146 if (FAILED(pRenderer->pDirectDraw2->CreateSurface(&Dst, (LPDIRECTDRAWSURFACE *)&a2, 0)))
0
Ritor1
parents:
diff changeset
147 {
Ritor1
parents:
diff changeset
148 memset(&Dst.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT));
Ritor1
parents:
diff changeset
149
Ritor1
parents:
diff changeset
150 Dst.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
Ritor1
parents:
diff changeset
151 Dst.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
Ritor1
parents:
diff changeset
152
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1919
diff changeset
153 long hr = pRenderer->pDirectDraw2->CreateSurface(&Dst, (LPDIRECTDRAWSURFACE *)&a2, 0);
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
154 ErrD3D(hr);
0
Ritor1
parents:
diff changeset
155 }
Ritor1
parents:
diff changeset
156 v5->uWidth = Dst.dwWidth;
Ritor1
parents:
diff changeset
157 v5->uHeight = Dst.dwHeight;
Ritor1
parents:
diff changeset
158 v5->uBinkDDSurfaceType = BinkDDSurfaceType((IDirectDrawSurface *)a2);
Ritor1
parents:
diff changeset
159 v5->field_38 = 0;
Ritor1
parents:
diff changeset
160 v7 = (IDirectDrawSurface *)a2;
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2151
diff changeset
161 }*/
0
Ritor1
parents:
diff changeset
162 v5->pTargetDDrawSurface = v7;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
163 v5->hWnd = window->GetApiHandle();
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
164 v5->field_4C = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
165 v5->field_68 = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
166 v5->field_5C = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
167 v5->field_74 = a4 & 0x1F;
0
Ritor1
parents:
diff changeset
168 v5->field_78 = 1;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
169 v5->target_width = GetSystemMetrics(SM_CXSCREEN);
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
170 v5->target_height = GetSystemMetrics(SM_CYSCREEN);
0
Ritor1
parents:
diff changeset
171 v5->field_2C = 16;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
172
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
173 RECT Rect;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
174 GetWindowRect(window->GetApiHandle(), &Rect);
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
175 v5->field_8 = window->GetWidth();
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
176 v5->field_C = window->GetHeight();
0
Ritor1
parents:
diff changeset
177 v5->field_1C = Rect.left;
Ritor1
parents:
diff changeset
178 v5->field_20 = Rect.top;
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
179 Rect.left = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
180 Rect.top = 0;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
181 ClientToScreen(window->GetApiHandle(), (POINT *)&Rect);
0
Ritor1
parents:
diff changeset
182 v5->field_1C = Rect.left - v5->field_1C;
Ritor1
parents:
diff changeset
183 v5->field_20 = Rect.top - v5->field_20;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
184 GetClientRect(window->GetApiHandle(), &Rect);
0
Ritor1
parents:
diff changeset
185 v5->field_30 = v5->field_8 - Rect.right;
Ritor1
parents:
diff changeset
186 v5->field_34 = v5->field_C - Rect.bottom;
Ritor1
parents:
diff changeset
187 v5->field_8 = v5->uWidth + v5->field_30;
Ritor1
parents:
diff changeset
188 v5->field_C = v5->uHeight + v5->field_34;
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
189 BinkBufferSetOffset(v5, 0, 0);
0
Ritor1
parents:
diff changeset
190 BinkBufferSetScale(v5, v5->uWidth, v5->uHeight);
Ritor1
parents:
diff changeset
191 return v5;
Ritor1
parents:
diff changeset
192 }
Ritor1
parents:
diff changeset
193
Ritor1
parents:
diff changeset
194
Ritor1
parents:
diff changeset
195 //----- (004C0133) --------------------------------------------------------
Ritor1
parents:
diff changeset
196 bool BinkLockBuffer(_BINKBUF *_this)
Ritor1
parents:
diff changeset
197 {
Ritor1
parents:
diff changeset
198 IDirectDrawSurface *v2; // edi@5
Ritor1
parents:
diff changeset
199 IDirectDrawSurface4 *v6; // edi@11
Ritor1
parents:
diff changeset
200
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2151
diff changeset
201 //if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5u )
0
Ritor1
parents:
diff changeset
202 {
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
203 DDSURFACEDESC2 v8; // [sp+Ch] [bp-7Ch]@4
0
Ritor1
parents:
diff changeset
204 if ( _this->pTargetDDrawSurface )
Ritor1
parents:
diff changeset
205 {
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
206 memset(&v8, 0, 0x7C);
0
Ritor1
parents:
diff changeset
207 v8.dwSize = 124;
Ritor1
parents:
diff changeset
208 while ( 1 )
Ritor1
parents:
diff changeset
209 {
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
210 v6 = (IDirectDrawSurface4 *)_this->pTargetDDrawSurface;
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
211 if ( !v6->Lock(0, &v8, 1, 0) )
0
Ritor1
parents:
diff changeset
212 break;
Ritor1
parents:
diff changeset
213
Ritor1
parents:
diff changeset
214 if (uBinkVersion < 0x0003000000000000)
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
215 _this->uBinkDDSurfaceType |= 0x80000000;
0
Ritor1
parents:
diff changeset
216 else
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
217 _this->uBinkDDSurfaceType |= 0x4000000;
0
Ritor1
parents:
diff changeset
218
Ritor1
parents:
diff changeset
219 if ( v6->Restore() )
Ritor1
parents:
diff changeset
220 return 0;
Ritor1
parents:
diff changeset
221 }
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
222 _this->pDDrawSurfaceData_ = v8.lpSurface;
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
223 _this->pDDrawSurfaceData = v8.lpSurface;
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
224 _this->uDDrawSurfacePitch = v8.lPitch;
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
225 return 1;
0
Ritor1
parents:
diff changeset
226 }
Ritor1
parents:
diff changeset
227 }
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2151
diff changeset
228 /*else
0
Ritor1
parents:
diff changeset
229 {
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
230 DDSURFACEDESC v8; // [sp+Ch] [bp-7Ch]@4
0
Ritor1
parents:
diff changeset
231 if ( _this->pTargetDDrawSurface )
Ritor1
parents:
diff changeset
232 {
Ritor1
parents:
diff changeset
233 memset(&v8.lPitch, 0, 0x6Cu);
Ritor1
parents:
diff changeset
234 v8.lPitch = 108;
Ritor1
parents:
diff changeset
235 while ( 1 )
Ritor1
parents:
diff changeset
236 {
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
237 v2 = _this->pTargetDDrawSurface;
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
238 if ( !v2->Lock(0, (LPDDSURFACEDESC)&v8.lPitch, 1, 0) )
0
Ritor1
parents:
diff changeset
239 break;
Ritor1
parents:
diff changeset
240
Ritor1
parents:
diff changeset
241 if (uBinkVersion < 0x0003000000000000)
Ritor1
parents:
diff changeset
242 __asm int 3;
Ritor1
parents:
diff changeset
243 else
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
244 BYTE3(_this->uBinkDDSurfaceType) |= 4u;
0
Ritor1
parents:
diff changeset
245
Ritor1
parents:
diff changeset
246 if ( v2->Restore() )
Ritor1
parents:
diff changeset
247 return 0;
Ritor1
parents:
diff changeset
248 }
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
249 _this->pDDrawSurfaceData_ = v8.lpSurface;
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
250 _this->pDDrawSurfaceData = v8.lpSurface;
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2125
diff changeset
251 _this->uDDrawSurfacePitch = v8.dwReserved;
0
Ritor1
parents:
diff changeset
252 return 1;
Ritor1
parents:
diff changeset
253 }
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2151
diff changeset
254 }*/
0
Ritor1
parents:
diff changeset
255 return 1;
Ritor1
parents:
diff changeset
256 }
Ritor1
parents:
diff changeset
257
Ritor1
parents:
diff changeset
258 //----- (004C01FB) --------------------------------------------------------
Ritor1
parents:
diff changeset
259 void BinkUnlockBuffer(_BINKBUF *_this)
Ritor1
parents:
diff changeset
260 {
Ritor1
parents:
diff changeset
261 IDirectDrawSurface *v2; // eax@1
Ritor1
parents:
diff changeset
262
Ritor1
parents:
diff changeset
263 v2 = _this->pTargetDDrawSurface;
Ritor1
parents:
diff changeset
264 if ( v2 )
Ritor1
parents:
diff changeset
265 {
Ritor1
parents:
diff changeset
266 v2->Unlock(0);
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
267 _this->uDDrawSurfacePitch = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
268 _this->pDDrawSurfaceData = 0;
0
Ritor1
parents:
diff changeset
269
Ritor1
parents:
diff changeset
270 if (uBinkVersion < 0x0003000000000000)
Ritor1
parents:
diff changeset
271 BYTE3(_this->uBinkDDSurfaceType) &= 0x7F;
Ritor1
parents:
diff changeset
272 else
Ritor1
parents:
diff changeset
273 BYTE3(_this->uBinkDDSurfaceType) &= 0xFB;
Ritor1
parents:
diff changeset
274 }
Ritor1
parents:
diff changeset
275 }
Ritor1
parents:
diff changeset
276 //----- (004BF794) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1429
diff changeset
277 void ShowIntroVideo_and_LoadingScreen()
0
Ritor1
parents:
diff changeset
278 {
Ritor1
parents:
diff changeset
279 RGBTexture tex; // [sp+Ch] [bp-30h]@1
Ritor1
parents:
diff changeset
280 unsigned int uTrackStartMS; // [sp+34h] [bp-8h]@8
Ritor1
parents:
diff changeset
281 unsigned int uTrackEndMS; // [sp+38h] [bp-4h]@8
Ritor1
parents:
diff changeset
282
Ritor1
parents:
diff changeset
283 pVideoPlayer->bStopBeforeSchedule = false;
165
Ritor1
parents: 151
diff changeset
284 pVideoPlayer->pResetflag = 0;
0
Ritor1
parents:
diff changeset
285 bGameoverLoop = 1;
256
c5e5c5146957 -novideo command arg
Nomad
parents: 227
diff changeset
286 if (!bNoVideo)
0
Ritor1
parents:
diff changeset
287 {
Ritor1
parents:
diff changeset
288 pRenderer->PresentBlackScreen();
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
289 PlayFullscreenMovie(MOVIE_3DOLogo, true);
1397
eb02a65e5c82 Quick Spell fixed.
Nomad
parents: 1299
diff changeset
290 //pGame->pCShow->PlayMovie(MOVIE_3DOLogo, 1);
0
Ritor1
parents:
diff changeset
291 if ( !pVideoPlayer->bStopBeforeSchedule )
Ritor1
parents:
diff changeset
292 {
1397
eb02a65e5c82 Quick Spell fixed.
Nomad
parents: 1299
diff changeset
293 PlayFullscreenMovie(MOVIE_NWCLogo, true);
eb02a65e5c82 Quick Spell fixed.
Nomad
parents: 1299
diff changeset
294 //pGame->pCShow->PlayMovie(MOVIE_NWCLogo, 1);
0
Ritor1
parents:
diff changeset
295 if ( !pVideoPlayer->bStopBeforeSchedule )
Ritor1
parents:
diff changeset
296 {
1397
eb02a65e5c82 Quick Spell fixed.
Nomad
parents: 1299
diff changeset
297 PlayFullscreenMovie(MOVIE_JVC, true);
eb02a65e5c82 Quick Spell fixed.
Nomad
parents: 1299
diff changeset
298 //pGame->pCShow->PlayMovie(MOVIE_JVC, 1);
0
Ritor1
parents:
diff changeset
299 if ( !pVideoPlayer->bStopBeforeSchedule )
1397
eb02a65e5c82 Quick Spell fixed.
Nomad
parents: 1299
diff changeset
300 PlayFullscreenMovie(MOVIE_Intro, true);
eb02a65e5c82 Quick Spell fixed.
Nomad
parents: 1299
diff changeset
301 //pGame->pCShow->PlayMovie(MOVIE_Intro, 1);
0
Ritor1
parents:
diff changeset
302 }
Ritor1
parents:
diff changeset
303 }
Ritor1
parents:
diff changeset
304 }
Ritor1
parents:
diff changeset
305 tex.Load("mm6title.pcx", 2);
Ritor1
parents:
diff changeset
306 pRenderer->BeginScene();
Ritor1
parents:
diff changeset
307 pRenderer->DrawTextureRGB(0, 0, &tex);
Ritor1
parents:
diff changeset
308 free(tex.pPixels);
Ritor1
parents:
diff changeset
309 tex.pPixels = 0;
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 731
diff changeset
310
cf2fbac6edc9 Misc cleaning
Nomad
parents: 731
diff changeset
311 LoadFonts_and_DrawCopyrightWindow();
cf2fbac6edc9 Misc cleaning
Nomad
parents: 731
diff changeset
312
0
Ritor1
parents:
diff changeset
313 pRenderer->EndScene();
Ritor1
parents:
diff changeset
314 pRenderer->Present();
1004
eac5af72b614 UI cleans
Nomad
parents: 898
diff changeset
315
eac5af72b614 UI cleans
Nomad
parents: 898
diff changeset
316 #ifndef _DEBUG
eac5af72b614 UI cleans
Nomad
parents: 898
diff changeset
317 Sleep(1500); // let the copyright window stay for a while
eac5af72b614 UI cleans
Nomad
parents: 898
diff changeset
318 #endif
eac5af72b614 UI cleans
Nomad
parents: 898
diff changeset
319
0
Ritor1
parents:
diff changeset
320 if (!bNoSound && pAudioPlayer->hAILRedbook )
Ritor1
parents:
diff changeset
321 {
Ritor1
parents:
diff changeset
322 pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0));
Ritor1
parents:
diff changeset
323 AIL_redbook_stop(pAudioPlayer->hAILRedbook);
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
324 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &uTrackStartMS, &uTrackEndMS);
0
Ritor1
parents:
diff changeset
325 AIL_redbook_play(pAudioPlayer->hAILRedbook, uTrackStartMS + 1, uTrackEndMS);
Ritor1
parents:
diff changeset
326 }
Ritor1
parents:
diff changeset
327 bGameoverLoop = 0;
Ritor1
parents:
diff changeset
328 }
Ritor1
parents:
diff changeset
329
Ritor1
parents:
diff changeset
330 //----- (004BE70E) --------------------------------------------------------
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
331 void VideoPlayer::MovieLoop(const char *pMovieName, int a2, int ScreenSizeFlag, int a4)
0
Ritor1
parents:
diff changeset
332 {
Ritor1
parents:
diff changeset
333 int v4; // ebp@1
Ritor1
parents:
diff changeset
334 const char *pName; // edi@1
Ritor1
parents:
diff changeset
335 MSG Msg; // [sp+Ch] [bp-1Ch]@12
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
336
0
Ritor1
parents:
diff changeset
337 v4 = a2;
Ritor1
parents:
diff changeset
338 pName = pMovieName;
2061
b2a434d65344 GAME_SETTINGS_* defines introduced
Nomad
parents: 2044
diff changeset
339 if ( !(dword_6BE364_game_settings_1 & (GAME_SETTINGS_NO_HOUSE_ANIM | GAME_SETTINGS_NO_INTRO)) )
0
Ritor1
parents:
diff changeset
340 {
Ritor1
parents:
diff changeset
341 if ( a2 == 2 )
Ritor1
parents:
diff changeset
342 v4 = 0;
Ritor1
parents:
diff changeset
343 ShowCursor(0);
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
344 OpenGlobalMovie(pName, 0, ScreenSizeFlag);
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
345 bPlayingMovie = 1;
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
346 field_44 = v4;
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
347 //if ( pRenderer->pRenderD3D )
0
Ritor1
parents:
diff changeset
348 {
Ritor1
parents:
diff changeset
349 pRenderer->ClearTarget(0);
Ritor1
parents:
diff changeset
350 }
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
351 /* else
0
Ritor1
parents:
diff changeset
352 {
Ritor1
parents:
diff changeset
353 pRenderer->BeginScene();
Ritor1
parents:
diff changeset
354 pRenderer->ClearTarget(0);
Ritor1
parents:
diff changeset
355 pRenderer->EndScene();
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
356 }*/
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 4
diff changeset
357 pCurrentScreen = SCREEN_VIDEO;
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
358
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
359 auto hwnd = pVideoPlayer->window->GetApiHandle();
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
360 RECT rc_client;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
361 GetClientRect(hwnd, &rc_client);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
362 int client_width = rc_client.right - rc_client.left,
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
363 client_height = rc_client.bottom - rc_client.top;
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
364
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
365 HDC dc = GetDC(hwnd);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
366 HDC back_dc = CreateCompatibleDC(dc);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
367 HBITMAP back_bmp;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
368 SelectObject(back_dc, back_bmp = CreateCompatibleBitmap(dc, client_width, client_height));
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
369
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
370 while (true)
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
371 {
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
372 if ( pVideoPlayer->bStopBeforeSchedule )
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
373 break;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
374 while (PeekMessageA(&Msg, hwnd, 0, 0, PM_REMOVE))
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
375 {
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
376 if (Msg.message == 18)
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
377 Game_DeinitializeAndTerminate(0);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
378 if (Msg.message == 15)
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
379 break;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
380 TranslateMessage(&Msg);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
381 DispatchMessageA(&Msg);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
382 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
383 GUI_MainMenuMessageProc();
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
384
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
385 if (pMovie->Stopped())
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
386 break;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
387 char *image = pPlayer->DoFrame();
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
388 if (image)
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
389 {
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
390 // draw to hwnd
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
391 BITMAPINFO bmi;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
392 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
393 bmi.bmiHeader.biWidth = client_width;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
394 bmi.bmiHeader.biHeight = -client_height;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
395 bmi.bmiHeader.biPlanes = 1;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
396 bmi.bmiHeader.biBitCount = 32;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
397 bmi.bmiHeader.biCompression = BI_RGB;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
398 bmi.bmiHeader.biSizeImage = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
399 bmi.bmiHeader.biXPelsPerMeter = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
400 bmi.bmiHeader.biYPelsPerMeter = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
401 bmi.bmiHeader.biClrUsed = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
402 bmi.bmiHeader.biClrImportant = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
403 GetDIBits(back_dc, back_bmp, 0, client_height, 0, &bmi, DIB_RGB_COLORS);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
404 SetDIBits(back_dc, back_bmp, 0, client_height, image, &bmi, DIB_RGB_COLORS);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
405 BitBlt(dc, 0, 0, client_width, client_height, back_dc, 0, 0, SRCCOPY);
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
406
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
407 delete[] image;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
408 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
409 if (pVideoPlayer->bStopBeforeSchedule == 1)
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
410 Sleep(1000);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
411 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
412 pVideoPlayer->Unload();
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
413 /*
0
Ritor1
parents:
diff changeset
414 if ( pVideoPlayer->uMovieFormat == 2 )
Ritor1
parents:
diff changeset
415 {
Ritor1
parents:
diff changeset
416 if ( pVideoPlayer->pBinkMovie )
Ritor1
parents:
diff changeset
417 {
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
418 //pVideoPlayer->BinkDrawFrame(v4, ScreenSizeFlag);
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
419
0
Ritor1
parents:
diff changeset
420 }
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
421 }
0
Ritor1
parents:
diff changeset
422 if ( pVideoPlayer->bStopBeforeSchedule == 1 )
Ritor1
parents:
diff changeset
423 Sleep(0x3E8u);
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
424 }*/
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
425 /*
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
426 if ( pVideoPlayer->uMovieFormat == 1 )
0
Ritor1
parents:
diff changeset
427 {
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
428 if ( pVideoPlayer->pSmackerMovie )
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
429 {
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
430 pVideoPlayer->SmackDrawFrame(v4, ScreenSizeFlag);
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
431 while ( pVideoPlayer->pSmackerMovie )
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
432 {
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
433 if ( pVideoPlayer->bStopBeforeSchedule )
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
434 break;
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
435 while ( PeekMessageW(&Msg, 0, 0, 0, 1) )
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
436 {
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
437 if (Msg.message == WM_QUIT)
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
438 Game_DeinitializeAndTerminate(0);
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
439 if (Msg.message == WM_PAINT)
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
440 break;
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
441 TranslateMessage(&Msg);
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
442 DispatchMessageW(&Msg);
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
443 }
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
444 GUI_MainMenuMessageProc();
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
445 if ( !pVideoPlayer->pSmackerMovie )
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
446 break;
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
447 if ( !SmackWait(pVideoPlayer->pSmackerMovie) && !pVideoPlayer->bStopBeforeSchedule )
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
448 pVideoPlayer->SmackDrawFrame(v4, ScreenSizeFlag);
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
449 }
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
450 }
0
Ritor1
parents:
diff changeset
451 }
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
452 */
227
bcd55744c2f4 Clicking background in MainMenu fix
Nomad
parents: 165
diff changeset
453 if (a4 == 1)
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 4
diff changeset
454 pCurrentScreen = SCREEN_GAME;
0
Ritor1
parents:
diff changeset
455 pVideoPlayer->bPlayingMovie = 0;
Ritor1
parents:
diff changeset
456 ShowCursor(1);
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 4
diff changeset
457 if ( pCurrentScreen == SCREEN_VIDEO )
9abdd40a107b pCurrentScreen
Ritor1
parents: 4
diff changeset
458 pCurrentScreen = SCREEN_GAME;
0
Ritor1
parents:
diff changeset
459 }
Ritor1
parents:
diff changeset
460 }
Ritor1
parents:
diff changeset
461
Ritor1
parents:
diff changeset
462 //----- (004BE95A) --------------------------------------------------------
Ritor1
parents:
diff changeset
463 unsigned int VideoPlayer::SmackCheckSurfaceFromat()
Ritor1
parents:
diff changeset
464 {
Ritor1
parents:
diff changeset
465 DDPIXELFORMAT a2; // [sp+0h] [bp-20h]@1
Ritor1
parents:
diff changeset
466
Ritor1
parents:
diff changeset
467 a2.dwSize = 32;
Ritor1
parents:
diff changeset
468 a2.dwFlags = 64;
Ritor1
parents:
diff changeset
469 pRenderer->GetTargetPixelFormat(&a2);
2070
4231fdf46dde Minimap's drawing
Nomad
parents: 2069
diff changeset
470 if (a2.dwRGBBitCount == 32)
4231fdf46dde Minimap's drawing
Nomad
parents: 2069
diff changeset
471 return SMACKBUFFER565;
0
Ritor1
parents:
diff changeset
472 if ( a2.dwRGBBitCount != 8 )
Ritor1
parents:
diff changeset
473 {
Ritor1
parents:
diff changeset
474 if ( a2.dwRBitMask == 0xF800 )
Ritor1
parents:
diff changeset
475 {
Ritor1
parents:
diff changeset
476 if ( a2.dwGBitMask == 0x7E0 && a2.dwBBitMask == 0x1F )
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1018
diff changeset
477 return SMACKBUFFER565;
0
Ritor1
parents:
diff changeset
478 }
Ritor1
parents:
diff changeset
479 else
Ritor1
parents:
diff changeset
480 {
Ritor1
parents:
diff changeset
481 if ( a2.dwRBitMask == 0x7C00
Ritor1
parents:
diff changeset
482 && a2.dwGBitMask == 0x3E0
Ritor1
parents:
diff changeset
483 && a2.dwBBitMask == 0x1F )
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1018
diff changeset
484 return SMACKBUFFER555;
0
Ritor1
parents:
diff changeset
485 }
Ritor1
parents:
diff changeset
486 MessageBoxA(0, "Unsupported pixel format.", "Smacker Error", 0);
Ritor1
parents:
diff changeset
487 }
Ritor1
parents:
diff changeset
488 return 0;
Ritor1
parents:
diff changeset
489 }
Ritor1
parents:
diff changeset
490
Ritor1
parents:
diff changeset
491 //----- (004BE9D8) --------------------------------------------------------
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
492 void VideoPlayer::Initialize(OSWindow *target_window)
0
Ritor1
parents:
diff changeset
493 {
Ritor1
parents:
diff changeset
494 DWORD NumberOfBytesRead; // [sp+10h] [bp-4h]@9
Ritor1
parents:
diff changeset
495
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
496 window = target_window;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
497
0
Ritor1
parents:
diff changeset
498 uint uBinkVersionMajor = -1,
Ritor1
parents:
diff changeset
499 uBinkVersionMinor = -1;
Ritor1
parents:
diff changeset
500 GetDllVersion(L"BINKW32.DLL", &uBinkVersionMajor, &uBinkVersionMinor);
Ritor1
parents:
diff changeset
501 uBinkVersion = (unsigned __int64)uBinkVersionMajor << 32 | uBinkVersionMinor;
Ritor1
parents:
diff changeset
502
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1165
diff changeset
503 strcpy(pTmpBuf.data(), "anims\\might7.vid");
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
504 hMightVid = CreateFileW(L"anims\\might7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080, 0);
0
Ritor1
parents:
diff changeset
505 if ( hMightVid == INVALID_HANDLE_VALUE )
Ritor1
parents:
diff changeset
506 {
1217
b237a61e61d3 sprintf didn't use .data member of new arrays
Grumpy7
parents: 1205
diff changeset
507 sprintf(pTmpBuf2.data(), "Can't open file - anims\\%s.smk", pTmpBuf.data());
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1165
diff changeset
508 MessageBoxA(0, pTmpBuf2.data(), "Video File Error", 0);
0
Ritor1
parents:
diff changeset
509 return;
Ritor1
parents:
diff changeset
510 }
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1165
diff changeset
511 strcpy(pTmpBuf.data(), "anims\\magic7.vid");
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
512 hMagicVid = CreateFileW(L"anims\\magic7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080, 0);
0
Ritor1
parents:
diff changeset
513 if ( hMagicVid == INVALID_HANDLE_VALUE )
Ritor1
parents:
diff changeset
514 {
Ritor1
parents:
diff changeset
515 if ( !bCanLoadFromCD )
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
516 {
1217
b237a61e61d3 sprintf didn't use .data member of new arrays
Grumpy7
parents: 1205
diff changeset
517 sprintf(pTmpBuf2.data(), "Can't open file - anims\\%s.smk", pTmpBuf.data());
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1165
diff changeset
518 MessageBoxA(0, pTmpBuf2.data(), "Video File Error", 0);
0
Ritor1
parents:
diff changeset
519 return;
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
520 }
1217
b237a61e61d3 sprintf didn't use .data member of new arrays
Grumpy7
parents: 1205
diff changeset
521 sprintf(pTmpBuf2.data(), "%c:\\%s", (unsigned __int8)cMM7GameCDDriveLetter, pTmpBuf.data());
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
522 hMagicVid = CreateFileA(pTmpBuf2.data(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080, 0);
0
Ritor1
parents:
diff changeset
523 if ( hMagicVid == (HANDLE)INVALID_HANDLE_VALUE )
Ritor1
parents:
diff changeset
524 {
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
525 sprintf(pTmpBuf2.data(), "Can't open file - %s", pTmpBuf.data());
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1165
diff changeset
526 MessageBoxA(0, pTmpBuf2.data(), "Video File Error", 0);
0
Ritor1
parents:
diff changeset
527 return;
Ritor1
parents:
diff changeset
528 }
Ritor1
parents:
diff changeset
529 }
Ritor1
parents:
diff changeset
530 ReadFile(hMightVid, &uNumMightVideoHeaders, 4, &NumberOfBytesRead, 0);
Ritor1
parents:
diff changeset
531 ReadFile(hMagicVid, &uNumMagicVideoHeaders, 4, &NumberOfBytesRead, 0);
Ritor1
parents:
diff changeset
532 pMagicVideoHeaders = 0;
Ritor1
parents:
diff changeset
533 pMightVideoHeaders = 0;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1459
diff changeset
534 pMightVideoHeaders = (MovieHeader *)malloc(sizeof(MovieHeader) * uNumMightVideoHeaders + 2);
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1459
diff changeset
535 pMagicVideoHeaders = (MovieHeader *)malloc(sizeof(MovieHeader) * uNumMagicVideoHeaders + 2);
0
Ritor1
parents:
diff changeset
536 ReadFile(hMightVid, pMightVideoHeaders, 44 * uNumMightVideoHeaders, &NumberOfBytesRead, 0);
Ritor1
parents:
diff changeset
537 ReadFile(hMagicVid, pMagicVideoHeaders, 44 * uNumMagicVideoHeaders, &NumberOfBytesRead, 0);
Ritor1
parents:
diff changeset
538 }
Ritor1
parents:
diff changeset
539
Ritor1
parents:
diff changeset
540 //----- (004BEB41) --------------------------------------------------------
Ritor1
parents:
diff changeset
541 void VideoPlayer::Prepare()
Ritor1
parents:
diff changeset
542 {
Ritor1
parents:
diff changeset
543 pEventTimer->Pause();
Ritor1
parents:
diff changeset
544 if ( pAudioPlayer->hAILRedbook )
Ritor1
parents:
diff changeset
545 AIL_redbook_pause(pAudioPlayer->hAILRedbook);
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
546
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
547 bStopBeforeSchedule = false;
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
548 bBufferLoaded = 1;
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
549 /*
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
550 pSmackerMovie = 0;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
551 pSmackerBuffer = 0;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
552 pBinkMovie = 0;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
553 pBinkBuffer = 0;
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
554 */
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
555 bPlayingMovie = false;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
556 bFirstFrame = false;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
557 bUsingSmackerMMX = SmackUseMMX(1);
0
Ritor1
parents:
diff changeset
558 BinkSetSoundSystem(BinkOpenMiles, pAudioPlayer->hDigDriver);
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2151
diff changeset
559 uBinkDirectDrawSurfaceType = BinkDDSurfaceType((IDirectDrawSurface *)pRenderer->pBackBuffer4);
0
Ritor1
parents:
diff changeset
560 }
Ritor1
parents:
diff changeset
561
Ritor1
parents:
diff changeset
562 //----- (004BEBD7) --------------------------------------------------------
Ritor1
parents:
diff changeset
563 void VideoPlayer::Unload()
Ritor1
parents:
diff changeset
564 {
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
565 //_BINK *pBinkMovie; // eax@1
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
566 //_BINKBUF *pBinkBuffer; // eax@3
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
567 //_SMACK *pSmackerMovie; // eax@5
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
568 /*
0
Ritor1
parents:
diff changeset
569 if ( pBinkMovie )
Ritor1
parents:
diff changeset
570 {
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
571 //BinkPause(pBinkMovie, 1);
0
Ritor1
parents:
diff changeset
572 Sleep(300);
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
573 //BinkClose(pBinkMovie);
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
574 pBinkMovie = 0;
0
Ritor1
parents:
diff changeset
575 }
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
576
0
Ritor1
parents:
diff changeset
577 if ( pBinkBuffer )
Ritor1
parents:
diff changeset
578 {
Ritor1
parents:
diff changeset
579 pBinkBuffer->pTargetDDrawSurface->Release();
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
580 pBinkBuffer->pTargetDDrawSurface = 0;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
581 free(pBinkBuffer);
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
582 pBinkBuffer = 0;
0
Ritor1
parents:
diff changeset
583 }
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
584
0
Ritor1
parents:
diff changeset
585 if ( pSmackerMovie )
Ritor1
parents:
diff changeset
586 {
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
587 //SmackSoundOnOff(pSmackerMovie, 0);
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
588 //SmackClose(pSmackerMovie);
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
589 pSmackerMovie = 0;
0
Ritor1
parents:
diff changeset
590 }
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
591 if ( pSmackerBuffer )
0
Ritor1
parents:
diff changeset
592 {
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
593 SmackBufferClose(pSmackerBuffer);
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
594 pSmackerBuffer = 0;
0
Ritor1
parents:
diff changeset
595 }
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
596 */
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
597 if ( pSmackMovieBlit )
0
Ritor1
parents:
diff changeset
598 {
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
599 SmackBlitClose(pSmackMovieBlit);
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
600 pSmackMovieBlit = 0;
0
Ritor1
parents:
diff changeset
601 }
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
602 bBufferLoaded = 0;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
603 uMovieFormat = 0;
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
604 uMovieFormatSwapped = 0;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
605 memset(pCurrentMovieName, 0, 0x40);
0
Ritor1
parents:
diff changeset
606 if ( pAudioPlayer->hAILRedbook && !bGameoverLoop )
Ritor1
parents:
diff changeset
607 AIL_redbook_resume(pAudioPlayer->hAILRedbook);
Ritor1
parents:
diff changeset
608 pEventTimer->Resume();
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
609
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
610 if (pMovie)
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
611 {
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
612 delete pMovie;
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
613 pMovie = nullptr;
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
614 }
0
Ritor1
parents:
diff changeset
615 }
Ritor1
parents:
diff changeset
616
Ritor1
parents:
diff changeset
617 //----- (004BECD5) --------------------------------------------------------
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
618 /*
0
Ritor1
parents:
diff changeset
619 void VideoPlayer::FastForwardToFrame(unsigned int uDstFrameNum)
Ritor1
parents:
diff changeset
620 {
Ritor1
parents:
diff changeset
621 VideoPlayer *v2; // esi@1
Ritor1
parents:
diff changeset
622 unsigned int v3; // eax@1
Ritor1
parents:
diff changeset
623
Ritor1
parents:
diff changeset
624 v2 = this;
Ritor1
parents:
diff changeset
625 v3 = this->uMovieFormat;
Ritor1
parents:
diff changeset
626 if ( v3 == 2 )
Ritor1
parents:
diff changeset
627 {
Ritor1
parents:
diff changeset
628 if (uDstFrameNum)
Ritor1
parents:
diff changeset
629 {
Ritor1
parents:
diff changeset
630 int *pCurrentFrame = uBinkVersion == 0x0001000500150000 ? &((_BINK_1_5_21_0 *)pBinkMovie)->uCurrentFrame :
Ritor1
parents:
diff changeset
631 uBinkVersion == 0x0003000000000000 ? &((_BINK_3_0_0_0 *)pBinkMovie)->uCurrentFrame :
Ritor1
parents:
diff changeset
632 nullptr;
Ritor1
parents:
diff changeset
633 while (*pCurrentFrame < uDstFrameNum)
Ritor1
parents:
diff changeset
634 {
Ritor1
parents:
diff changeset
635 BinkDoFrame(pBinkMovie);
Ritor1
parents:
diff changeset
636 BinkNextFrame(pBinkMovie);
Ritor1
parents:
diff changeset
637 }
Ritor1
parents:
diff changeset
638 }
Ritor1
parents:
diff changeset
639 }
Ritor1
parents:
diff changeset
640 else
Ritor1
parents:
diff changeset
641 {
Ritor1
parents:
diff changeset
642 if ( v3 != 1 )
Ritor1
parents:
diff changeset
643 return;
Ritor1
parents:
diff changeset
644 SmackSoundOnOff(this->pSmackerMovie, 0);
Ritor1
parents:
diff changeset
645 if (uDstFrameNum)
Ritor1
parents:
diff changeset
646 {
Ritor1
parents:
diff changeset
647 while ( v2->pSmackerMovie->FrameNum < uDstFrameNum)
Ritor1
parents:
diff changeset
648 {
Ritor1
parents:
diff changeset
649 SmackDoFrame(v2->pSmackerMovie);
Ritor1
parents:
diff changeset
650 SmackNextFrame(v2->pSmackerMovie);
Ritor1
parents:
diff changeset
651 }
Ritor1
parents:
diff changeset
652 }
Ritor1
parents:
diff changeset
653 }
Ritor1
parents:
diff changeset
654 Unload();
Ritor1
parents:
diff changeset
655 }
Ritor1
parents:
diff changeset
656
Ritor1
parents:
diff changeset
657
Ritor1
parents:
diff changeset
658 //----- (004BED4F) --------------------------------------------------------
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
659 void VideoPlayer::BinkDrawFrame(int a3, int a4)
0
Ritor1
parents:
diff changeset
660 {
Ritor1
parents:
diff changeset
661 //VideoPlayer *v4; // esi@1
Ritor1
parents:
diff changeset
662 _BINKBUF *v5; // eax@5
Ritor1
parents:
diff changeset
663 LONG v6; // edx@6
Ritor1
parents:
diff changeset
664 int v7; // ecx@6
Ritor1
parents:
diff changeset
665 LONG v8; // edx@6
Ritor1
parents:
diff changeset
666 struct tagRECT a3a; // [sp+8h] [bp-20h]@10
Ritor1
parents:
diff changeset
667 struct tagRECT a1; // [sp+18h] [bp-10h]@6
Ritor1
parents:
diff changeset
668
Ritor1
parents:
diff changeset
669 //v4 = this;
Ritor1
parents:
diff changeset
670 if ( this->pBinkMovie && this->pBinkBuffer )
Ritor1
parents:
diff changeset
671 {
Ritor1
parents:
diff changeset
672 BinkDoFrame(pBinkMovie);
Ritor1
parents:
diff changeset
673 BinkGetRects(pBinkMovie, pBinkBuffer->uBinkDDSurfaceType);
Ritor1
parents:
diff changeset
674 if ( BinkLockBuffer(pBinkBuffer) )
Ritor1
parents:
diff changeset
675 {
Ritor1
parents:
diff changeset
676 BinkCopyToBuffer(pBinkMovie, pBinkBuffer->pDDrawSurfaceData, pBinkBuffer->uDDrawSurfacePitch, pBinkBuffer->uHeight,
Ritor1
parents:
diff changeset
677 0, 0, pBinkBuffer->uBinkDDSurfaceType);
Ritor1
parents:
diff changeset
678 BinkUnlockBuffer(pBinkBuffer);
Ritor1
parents:
diff changeset
679 }
Ritor1
parents:
diff changeset
680 v5 = pBinkBuffer;
Ritor1
parents:
diff changeset
681 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
682 {
Ritor1
parents:
diff changeset
683 v6 = v5->uRectX;
Ritor1
parents:
diff changeset
684 a1.left = v6;
Ritor1
parents:
diff changeset
685 a1.top = v5->uRectY;
Ritor1
parents:
diff changeset
686 v7 = v6 + v5->uWidth;
Ritor1
parents:
diff changeset
687 a1.right = v6 + v5->uWidth;
Ritor1
parents:
diff changeset
688 v8 = a1.top + v5->uHeight;
Ritor1
parents:
diff changeset
689 }
Ritor1
parents:
diff changeset
690 else
Ritor1
parents:
diff changeset
691 {
Ritor1
parents:
diff changeset
692 a1.left = 0;
Ritor1
parents:
diff changeset
693 a1.top = 0;
Ritor1
parents:
diff changeset
694 v7 = v5->uWidth;
Ritor1
parents:
diff changeset
695 a1.right = v5->uWidth;
Ritor1
parents:
diff changeset
696 v8 = v5->uHeight;
Ritor1
parents:
diff changeset
697 }
Ritor1
parents:
diff changeset
698 a1.bottom = v8;
Ritor1
parents:
diff changeset
699 if ( a4 )
Ritor1
parents:
diff changeset
700 {
Ritor1
parents:
diff changeset
701 a1.right = v5->uWidth + v7;
Ritor1
parents:
diff changeset
702 a1.bottom = v5->uHeight + v8;
Ritor1
parents:
diff changeset
703 }
Ritor1
parents:
diff changeset
704 a3a.left = 0;
Ritor1
parents:
diff changeset
705 a3a.top = 0;
Ritor1
parents:
diff changeset
706 a3a.right = v5->uWidth;
Ritor1
parents:
diff changeset
707 a3a.bottom = v5->uHeight;
Ritor1
parents:
diff changeset
708 pRenderer->BltToFront(&a1, v5->pTargetDDrawSurface, &a3a, 0x1000000u);
Ritor1
parents:
diff changeset
709
Ritor1
parents:
diff changeset
710
Ritor1
parents:
diff changeset
711 int *pCurrentFrame = uBinkVersion == 0x0001000500150000 ? &((_BINK_1_5_21_0 *)pBinkMovie)->uCurrentFrame :
Ritor1
parents:
diff changeset
712 uBinkVersion == 0x0003000000000000 ? &((_BINK_3_0_0_0 *)pBinkMovie)->uCurrentFrame:
Ritor1
parents:
diff changeset
713 nullptr;
Ritor1
parents:
diff changeset
714 int *pNumFrames = uBinkVersion == 0x0001000500150000 ? &((_BINK_1_5_21_0 *)pBinkMovie)->uNumFrames :
Ritor1
parents:
diff changeset
715 uBinkVersion == 0x0003000000000000 ? &((_BINK_3_0_0_0 *)pBinkMovie)->uNumFrames :
Ritor1
parents:
diff changeset
716 nullptr;
Ritor1
parents:
diff changeset
717
Ritor1
parents:
diff changeset
718 if (*pCurrentFrame != *pNumFrames - 1 || bLoopPlaying)
Ritor1
parents:
diff changeset
719 BinkNextFrame(pBinkMovie);
Ritor1
parents:
diff changeset
720 else
Ritor1
parents:
diff changeset
721 Unload();
Ritor1
parents:
diff changeset
722 }
Ritor1
parents:
diff changeset
723 }
Ritor1
parents:
diff changeset
724
Ritor1
parents:
diff changeset
725
Ritor1
parents:
diff changeset
726
Ritor1
parents:
diff changeset
727 //----- (004BEE6B) --------------------------------------------------------
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
728 void VideoPlayer::SmackDrawFrame(int a3, int a4)
0
Ritor1
parents:
diff changeset
729 {
Ritor1
parents:
diff changeset
730 VideoPlayer *v4; // esi@1
Ritor1
parents:
diff changeset
731 _SMACK *v5; // eax@3
Ritor1
parents:
diff changeset
732 unsigned int v6; // eax@5
Ritor1
parents:
diff changeset
733 char v7; // zf@5
Ritor1
parents:
diff changeset
734 int v8; // eax@11
Ritor1
parents:
diff changeset
735 _SMACK *v9; // eax@13
Ritor1
parents:
diff changeset
736 _SMACK *v10; // eax@16
Ritor1
parents:
diff changeset
737 _SMACK *v11; // eax@20
Ritor1
parents:
diff changeset
738 unsigned int v12; // [sp-1Ch] [bp-34h]@7
Ritor1
parents:
diff changeset
739 LONG v13; // [sp-18h] [bp-30h]@7
Ritor1
parents:
diff changeset
740 LONG v14; // [sp-14h] [bp-2Ch]@7
Ritor1
parents:
diff changeset
741 signed int v15; // [sp-10h] [bp-28h]@7
Ritor1
parents:
diff changeset
742 signed int v16; // [sp-Ch] [bp-24h]@7
Ritor1
parents:
diff changeset
743 signed int v17; // [sp-8h] [bp-20h]@7
Ritor1
parents:
diff changeset
744 struct tagPOINT Point; // [sp+8h] [bp-10h]@7
Ritor1
parents:
diff changeset
745 unsigned short *pOutSurface; // [sp+10h] [bp-8h]@5
Ritor1
parents:
diff changeset
746 unsigned int uPixelsPerRow; // [sp+14h] [bp-4h]@5
Ritor1
parents:
diff changeset
747
Ritor1
parents:
diff changeset
748 v4 = this;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
749 if ( !pRenderer->bWindowMode || window->Focused())
0
Ritor1
parents:
diff changeset
750 {
Ritor1
parents:
diff changeset
751 v5 = v4->pSmackerMovie;
Ritor1
parents:
diff changeset
752 if ( v5->NewPalette )
Ritor1
parents:
diff changeset
753 SmackBlitSetPalette(v4->pSmackMovieBlit, v5->Palette, v5->PalType);
Ritor1
parents:
diff changeset
754 SmackDoFrame(v4->pSmackerMovie);
Ritor1
parents:
diff changeset
755 pRenderer->LockFrontBuffer((void **)&pOutSurface, &uPixelsPerRow);
Ritor1
parents:
diff changeset
756 v6 = 2 * uPixelsPerRow;
Ritor1
parents:
diff changeset
757 v7 = v4->bFirstFrame == 0;
Ritor1
parents:
diff changeset
758 uPixelsPerRow *= 2;
Ritor1
parents:
diff changeset
759 if ( !v7 )
Ritor1
parents:
diff changeset
760 {
Ritor1
parents:
diff changeset
761 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
762 {
Ritor1
parents:
diff changeset
763 Point.y = 0;
Ritor1
parents:
diff changeset
764 Point.x = 0;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
765 ClientToScreen(window->GetApiHandle(), &Point);
0
Ritor1
parents:
diff changeset
766 v17 = -1;
Ritor1
parents:
diff changeset
767 v16 = 480;
Ritor1
parents:
diff changeset
768 v15 = 640;
Ritor1
parents:
diff changeset
769 v14 = Point.y;
Ritor1
parents:
diff changeset
770 v13 = Point.x;
Ritor1
parents:
diff changeset
771 v12 = uPixelsPerRow;
Ritor1
parents:
diff changeset
772 }
Ritor1
parents:
diff changeset
773 else
Ritor1
parents:
diff changeset
774 {
Ritor1
parents:
diff changeset
775 v17 = -1;
Ritor1
parents:
diff changeset
776 v16 = 480;
Ritor1
parents:
diff changeset
777 v15 = 640;
Ritor1
parents:
diff changeset
778 v14 = 0;
Ritor1
parents:
diff changeset
779 v13 = 0;
Ritor1
parents:
diff changeset
780 v12 = v6;
Ritor1
parents:
diff changeset
781 }
Ritor1
parents:
diff changeset
782 SmackBlitClear(v4->pSmackMovieBlit, pOutSurface, v12, v13, v14, v15, v16, v17);
Ritor1
parents:
diff changeset
783 v4->bFirstFrame = 0;
Ritor1
parents:
diff changeset
784 }
Ritor1
parents:
diff changeset
785 pRenderer->RestoreFrontBuffer();
Ritor1
parents:
diff changeset
786 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
787 {
Ritor1
parents:
diff changeset
788 Point.y = 0;
Ritor1
parents:
diff changeset
789 Point.x = 0;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
790 ClientToScreen(window->GetApiHandle(), &Point);
0
Ritor1
parents:
diff changeset
791 v8 = SmackToBufferRect(v4->pSmackerMovie, 0);
Ritor1
parents:
diff changeset
792 if ( a4 )
Ritor1
parents:
diff changeset
793 {
Ritor1
parents:
diff changeset
794 while ( v8 )
Ritor1
parents:
diff changeset
795 {
Ritor1
parents:
diff changeset
796 v9 = v4->pSmackerMovie;
Ritor1
parents:
diff changeset
797 SmackBlit(
Ritor1
parents:
diff changeset
798 v4->pSmackMovieBlit,
Ritor1
parents:
diff changeset
799 pOutSurface,
Ritor1
parents:
diff changeset
800 uPixelsPerRow,
Ritor1
parents:
diff changeset
801 v9->LastRectx + Point.x / 2,
Ritor1
parents:
diff changeset
802 a3 + v9->LastRecty + Point.y / 2,
Ritor1
parents:
diff changeset
803 v4->pSomeSmackerBuffer,
Ritor1
parents:
diff changeset
804 v9->Width,
Ritor1
parents:
diff changeset
805 v9->LastRectx,
Ritor1
parents:
diff changeset
806 v9->LastRecty,
Ritor1
parents:
diff changeset
807 v9->LastRectw,
Ritor1
parents:
diff changeset
808 v9->LastRecth);
Ritor1
parents:
diff changeset
809 v8 = SmackToBufferRect(v4->pSmackerMovie, 0);
Ritor1
parents:
diff changeset
810 }
Ritor1
parents:
diff changeset
811 }
Ritor1
parents:
diff changeset
812 else
Ritor1
parents:
diff changeset
813 {
Ritor1
parents:
diff changeset
814 while ( v8 )
Ritor1
parents:
diff changeset
815 {
Ritor1
parents:
diff changeset
816 v10 = v4->pSmackerMovie;
Ritor1
parents:
diff changeset
817 SmackBlit(v4->pSmackMovieBlit, pOutSurface, uPixelsPerRow, Point.x + v10->LastRectx, a3 + Point.y + v10->LastRecty,
Ritor1
parents:
diff changeset
818 v4->pSomeSmackerBuffer, v10->Width, v10->LastRectx, v10->LastRecty, v10->LastRectw, v10->LastRecth);
Ritor1
parents:
diff changeset
819 v8 = SmackToBufferRect(v4->pSmackerMovie, 0);
Ritor1
parents:
diff changeset
820 }
Ritor1
parents:
diff changeset
821 }
Ritor1
parents:
diff changeset
822 }
Ritor1
parents:
diff changeset
823 else
Ritor1
parents:
diff changeset
824 {
Ritor1
parents:
diff changeset
825 while ( SmackToBufferRect(v4->pSmackerMovie, 0) )
Ritor1
parents:
diff changeset
826 {
Ritor1
parents:
diff changeset
827 v11 = v4->pSmackerMovie;
Ritor1
parents:
diff changeset
828 SmackBlit(v4->pSmackMovieBlit, pOutSurface, uPixelsPerRow, v11->LastRectx, a3 + v11->LastRecty, v4->pSomeSmackerBuffer,
Ritor1
parents:
diff changeset
829 v11->Width, v11->LastRectx, v11->LastRecty, v11->LastRectw, v11->LastRecth);
Ritor1
parents:
diff changeset
830 }
Ritor1
parents:
diff changeset
831 }
Ritor1
parents:
diff changeset
832 pRenderer->UnlockFrontBuffer();
Ritor1
parents:
diff changeset
833 if ( v4->pSmackerMovie->FrameNum != v4->pSmackerMovie->Frames - 1 || v4->bLoopPlaying )
Ritor1
parents:
diff changeset
834 SmackNextFrame(v4->pSmackerMovie);
Ritor1
parents:
diff changeset
835 else
Ritor1
parents:
diff changeset
836 Unload();
Ritor1
parents:
diff changeset
837 }
Ritor1
parents:
diff changeset
838 }
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
839 */
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
840 void VideoPlayer::_inlined_in_463149()
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
841 {
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
842 /*
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
843 if ( pSmackMovie && !SmackWait(pSmackerMovie) )
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
844 {
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
845 pRenderer->BeginScene();
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
846 pMouse->DrawCursorToTarget();
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
847 SmackUpdatePalette();
2216
3f375342de12 window->GetWidth() continue
Ritor1
parents: 2215
diff changeset
848 pMouse->ReadCursorWithItem();
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
849 pRenderer->EndScene();
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
850 }
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
851 else if ( pBinkMovie && !BinkWait(pBinkMovie) )
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
852 {
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
853 pRenderer->BeginScene();
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
854 pMouse->DrawCursorToTarget();
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
855 BinkUpdatePalette();
2216
3f375342de12 window->GetWidth() continue
Ritor1
parents: 2215
diff changeset
856 pMouse->ReadCursorWithItem();
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
857 pRenderer->EndScene();
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
858 }
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
859 */
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
860 if (pMovie)
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
861 {
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
862 pRenderer->BeginScene();
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
863 pMouse->DrawCursorToTarget();
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
864 UpdatePalette();
2216
3f375342de12 window->GetWidth() continue
Ritor1
parents: 2215
diff changeset
865 pMouse->ReadCursorWithItem();
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
866 pRenderer->EndScene();
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
867 }
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
868 }
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
869 //auto pixels = new unsigned short[640 * 480];
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
870
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
871 void VideoPlayer::UpdatePalette()
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
872 {
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
873 Log::Warning(L"smacker");
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
874
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
875 pRenderer->BeginScene();
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
876 if (pMovie->Stopped())//âèäåî çàâåðøåíî/ïåðåçàãðóçêà
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
877 {
2222
66bd74aa9f5e smk video draw
Ritor1
parents: 2221
diff changeset
878 int width = game_viewport_width;
66bd74aa9f5e smk video draw
Ritor1
parents: 2221
diff changeset
879 int height = game_viewport_height;
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
880 delete pMovie;
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
881
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
882 SetFilePointer(hVidFile, uOffset, nullptr, FILE_BEGIN);
0
Ritor1
parents:
diff changeset
883
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
884 pMovie = pPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, width, height);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
885 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
886 else
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
887 {
2221
c69013c186c7 for video
Ritor1
parents: 2218
diff changeset
888 char *image = pPlayer->DoFrame();
2222
66bd74aa9f5e smk video draw
Ritor1
parents: 2221
diff changeset
889 int image_array[460 * 344];//game_viewport_width * game_viewport_height
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
890 if (image)
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
891 {
2222
66bd74aa9f5e smk video draw
Ritor1
parents: 2221
diff changeset
892 memcpy(image_array, image, sizeof (image_array));
2223
17bc3a1eb037 LoadCursor fix
Ritor1
parents: 2222
diff changeset
893 for (unsigned int y = 8; y < 8 + game_viewport_height; ++y)//êîîðäèíàòû ìåñòîïîëîæåíèÿ âèäåîðîëèêà
2221
c69013c186c7 for video
Ritor1
parents: 2218
diff changeset
894 {
c69013c186c7 for video
Ritor1
parents: 2218
diff changeset
895 for (unsigned int x = 8; x < 8 + game_viewport_width; ++x)
c69013c186c7 for video
Ritor1
parents: 2218
diff changeset
896 {
2222
66bd74aa9f5e smk video draw
Ritor1
parents: 2221
diff changeset
897 auto p = (unsigned __int32 *)pRenderer->pTargetSurface + x + y * pRenderer->uTargetSurfacePitch;
66bd74aa9f5e smk video draw
Ritor1
parents: 2221
diff changeset
898 *p = image_array[((x - 8) + ((y - 8)*game_viewport_width))];
2221
c69013c186c7 for video
Ritor1
parents: 2218
diff changeset
899 }
c69013c186c7 for video
Ritor1
parents: 2218
diff changeset
900 }
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
901 delete[] image;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
902 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
903 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
904 pRenderer->EndScene();
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
905 }
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
906 /*
0
Ritor1
parents:
diff changeset
907 //----- (004BF08B) --------------------------------------------------------
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
908 void VideoPlayer::SmackUpdatePalette()
0
Ritor1
parents:
diff changeset
909 {
2069
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
910 //VideoPlayer *v2; // esi@1
0
Ritor1
parents:
diff changeset
911 unsigned __int16 *v3; // ebx@1
Ritor1
parents:
diff changeset
912 unsigned int v4; // edi@1
Ritor1
parents:
diff changeset
913 unsigned int v5; // eax@1
2069
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
914 //_SMACK *v6; // eax@1
0
Ritor1
parents:
diff changeset
915
2070
4231fdf46dde Minimap's drawing
Nomad
parents: 2069
diff changeset
916 Log::Warning(L"smacker");
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
917
0
Ritor1
parents:
diff changeset
918 pRenderer->BeginScene();
2069
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
919
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
920 v3 = pixels;//pRenderer->pTargetSurface;
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
921 v4 = 640;//pRenderer->uTargetSurfacePitch;
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
922 v5 = SmackCheckSurfaceFromat();
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
923
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
924 SmackToBuffer(pSmackerMovie, 8, 8, 2 * v4, pRenderer->field_14, v3, v5);
2069
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
925
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
926
2070
4231fdf46dde Minimap's drawing
Nomad
parents: 2069
diff changeset
927 for (unsigned int y = 8; y < 8 + pSmackerMovie->Height; ++y)
2069
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
928 for (unsigned int x = 8; x < 8 + pSmackerMovie->Width; ++x)
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
929 {
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
930 pRenderer->WritePixel16(x, y, pixels[x + y * 640]);
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
931 }
2125
ba3de1337989 house animations working
zipi
parents: 2082
diff changeset
932 //delete [] pixels;
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
933
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
934 //v6 = pSmackerMovie;
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
935 while (true)
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
936 {
2125
ba3de1337989 house animations working
zipi
parents: 2082
diff changeset
937 if ( pSmackerMovie->NewPalette )
0
Ritor1
parents:
diff changeset
938 {
2125
ba3de1337989 house animations working
zipi
parents: 2082
diff changeset
939 SmackBufferNewPalette(pSmackerBuffer, pSmackerMovie->Palette, (pSmackerMovie->PalType));
0
Ritor1
parents:
diff changeset
940 SmackColorRemapWithTrans(
2125
ba3de1337989 house animations working
zipi
parents: 2082
diff changeset
941 pSmackerMovie,
ba3de1337989 house animations working
zipi
parents: 2082
diff changeset
942 pSmackerBuffer->Palette,
ba3de1337989 house animations working
zipi
parents: 2082
diff changeset
943 pSmackerBuffer->MaxPalColors,
ba3de1337989 house animations working
zipi
parents: 2082
diff changeset
944 pSmackerBuffer->PalType,
0
Ritor1
parents:
diff changeset
945 1000);
Ritor1
parents:
diff changeset
946 }
2069
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
947 SmackDoFrame(pSmackerMovie);
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
948 if ( pSmackerMovie->FrameNum != pSmackerMovie->Frames - 1 || bLoopPlaying )
259df09dfb50 32bits almost there
Nomad
parents: 2061
diff changeset
949 SmackNextFrame(pSmackerMovie);
0
Ritor1
parents:
diff changeset
950 else
Ritor1
parents:
diff changeset
951 Unload();
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
952
0
Ritor1
parents:
diff changeset
953 pRenderer->EndScene();
Ritor1
parents:
diff changeset
954 }
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
955 */
0
Ritor1
parents:
diff changeset
956
Ritor1
parents:
diff changeset
957
Ritor1
parents:
diff changeset
958
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
959 /*
0
Ritor1
parents:
diff changeset
960 //----- (004BF141) --------------------------------------------------------
Ritor1
parents:
diff changeset
961 _BINK *VideoPlayer::OpenBink(const char *pName)
Ritor1
parents:
diff changeset
962 {
Ritor1
parents:
diff changeset
963 //VideoPlayer *v2; // esi@1
Ritor1
parents:
diff changeset
964 signed int v3; // edi@1
Ritor1
parents:
diff changeset
965 int v4; // ebx@2
Ritor1
parents:
diff changeset
966 signed int v5; // edi@5
Ritor1
parents:
diff changeset
967 int v6; // ebx@6
Ritor1
parents:
diff changeset
968 HANDLE v8; // [sp-8h] [bp-18h]@10
Ritor1
parents:
diff changeset
969 unsigned int v9; // [sp-4h] [bp-14h]@10
Ritor1
parents:
diff changeset
970
Ritor1
parents:
diff changeset
971 for (uint i = 0; i < uNumMightVideoHeaders; ++i)
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
972 if (!_stricmp(pName, pMightVideoHeaders[i].pVideoName))
0
Ritor1
parents:
diff changeset
973 {
Ritor1
parents:
diff changeset
974 SetFilePointer(hMightVid, pMightVideoHeaders[i].uFileOffset, 0, FILE_BEGIN);
Ritor1
parents:
diff changeset
975
Ritor1
parents:
diff changeset
976 if (uBinkVersion < 0x0003000000000000)
Ritor1
parents:
diff changeset
977 return BinkOpen(hMightVid, 0x8800000);
Ritor1
parents:
diff changeset
978 else
Ritor1
parents:
diff changeset
979 return BinkOpen(hMightVid, 0x82000000);
Ritor1
parents:
diff changeset
980 }
Ritor1
parents:
diff changeset
981
Ritor1
parents:
diff changeset
982 for (uint i = 0; i < uNumMagicVideoHeaders; ++i)
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
983 if (!_stricmp(pName, pMagicVideoHeaders[i].pVideoName))
0
Ritor1
parents:
diff changeset
984 {
Ritor1
parents:
diff changeset
985 SetFilePointer(hMagicVid, pMagicVideoHeaders[i].uFileOffset, 0, FILE_BEGIN);
Ritor1
parents:
diff changeset
986
2125
ba3de1337989 house animations working
zipi
parents: 2082
diff changeset
987 if (uBinkVersion < 0x0003000000000000)
ba3de1337989 house animations working
zipi
parents: 2082
diff changeset
988 return BinkOpen(hMagicVid, BINKNOTHREADEDIO | BINKFILEHANDLE);//0x8800000);
ba3de1337989 house animations working
zipi
parents: 2082
diff changeset
989 else
ba3de1337989 house animations working
zipi
parents: 2082
diff changeset
990 return BinkOpen(hMagicVid, BINKIOPROCESSOR | BINKCOPYALL);//0x82000000);
0
Ritor1
parents:
diff changeset
991 }
Ritor1
parents:
diff changeset
992
Ritor1
parents:
diff changeset
993 return nullptr;
Ritor1
parents:
diff changeset
994 }
Ritor1
parents:
diff changeset
995 //----- (004BF1E6) --------------------------------------------------------
Ritor1
parents:
diff changeset
996 _SMACK *VideoPlayer::OpenSmack(const char *pFilename)
Ritor1
parents:
diff changeset
997 {
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
998 if ( this->uNumMightVideoHeaders )
0
Ritor1
parents:
diff changeset
999 {
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1000 for ( uint i = 0; i < (signed int)this->uNumMightVideoHeaders; ++i)
0
Ritor1
parents:
diff changeset
1001 {
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1002 if ( !_stricmp(this->pMightVideoHeaders[i].pVideoName, pFilename) )
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1003 {
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1004 SetFilePointer(this->hMightVid, this->pMightVideoHeaders[i].uFileOffset, 0, 0);
2082
c15871e2d743 wakingsound and runingsound
Ritor1
parents: 2079
diff changeset
1005 return SmackOpen(this->hMightVid, SMACKTRACK2|SMACKTRACK1|SMACKFILEHANDLE|SMACKLOADEXTRA|SMACKNEEDVOLUME, -1);//0x7140,
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1006 }
0
Ritor1
parents:
diff changeset
1007 }
Ritor1
parents:
diff changeset
1008 }
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1009 if ( this->uNumMagicVideoHeaders )
0
Ritor1
parents:
diff changeset
1010 {
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1011 for ( uint i = 0; i < (signed int)this->uNumMagicVideoHeaders; ++i )
0
Ritor1
parents:
diff changeset
1012 {
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1013 if ( !_stricmp(this->pMagicVideoHeaders[i].pVideoName, pFilename) )
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1014 {
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1015 SetFilePointer(this->hMagicVid, this->pMagicVideoHeaders[i].uFileOffset, 0, 0);
2079
ba5cd8a8a0d3 smacker flags
Gloval
parents: 2070
diff changeset
1016 return SmackOpen(this->hMagicVid, SMACKTRACK2|SMACKTRACK1|SMACKFILEHANDLE|SMACKLOADEXTRA|SMACKNEEDVOLUME, -1);
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1017 }
0
Ritor1
parents:
diff changeset
1018 }
Ritor1
parents:
diff changeset
1019 }
Ritor1
parents:
diff changeset
1020 return 0;
Ritor1
parents:
diff changeset
1021 }
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1022 */
0
Ritor1
parents:
diff changeset
1023 //----- (004BF28F) --------------------------------------------------------
898
10fa7dad1391 DrawPaperdoll clean
Ritor1
parents: 832
diff changeset
1024 void VideoPlayer::OpenHouseMovie(const char *pMovieName, unsigned int a3_1)
0
Ritor1
parents:
diff changeset
1025 {
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1026 if (!this->bBufferLoaded)
0
Ritor1
parents:
diff changeset
1027 {
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1028 //Prepare();
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1029 pEventTimer->Pause();
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1030 if (pAudioPlayer->hAILRedbook)
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1031 AIL_redbook_pause(pAudioPlayer->hAILRedbook);
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1032
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1033 bStopBeforeSchedule = false;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1034 bBufferLoaded = 1;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1035 /*
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1036 pSmackerMovie = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1037 pSmackerBuffer = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1038 pBinkMovie = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1039 pBinkBuffer = 0;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1040 */
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1041 bPlayingMovie = false;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1042 bFirstFrame = false;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1043 bUsingSmackerMMX = SmackUseMMX(1);
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1044
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1045 this->bLoopPlaying = a3_1;
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1046 if ( LOBYTE(this->field_104) == 1 )
0
Ritor1
parents:
diff changeset
1047 {
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1048 MessageBoxA(nullptr, "Unsupported Bink playback!", "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:925", 0);
0
Ritor1
parents:
diff changeset
1049 return;
Ritor1
parents:
diff changeset
1050 }
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1051
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1052 LoadMovie(pMovieName);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1053 /*
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1054 this->pSmackerMovie = OpenSmack(Str2);
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1055 if ( !this->pSmackerMovie )
0
Ritor1
parents:
diff changeset
1056 {
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1057 this->Unload();
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1165
diff changeset
1058 sprintf(pTmpBuf.data(), "Can't load %s", &Str2);
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1059 MessageBoxA(nullptr, pTmpBuf.data(), "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:937", 0);
898
10fa7dad1391 DrawPaperdoll clean
Ritor1
parents: 832
diff changeset
1060 return;
0
Ritor1
parents:
diff changeset
1061 }
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1062 */
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1063
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1064 /*
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1065 this->pSmackerBuffer = (_SMACKBUF *)SmackBufferOpen(window->GetApiHandle(), 4, LOWORD(this->pSmackerMovie->Width), LOWORD(this->pSmackerMovie->Height), LOWORD(this->pSmackerMovie->Width), LOWORD(this->pSmackerMovie->Height));
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1066 if ( this->pSmackerBuffer )
0
Ritor1
parents:
diff changeset
1067 {
Ritor1
parents:
diff changeset
1068 pRenderer->BeginScene();
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1069 SmackToBuffer(this->pSmackerMovie, 8, 8, 2 * pRenderer->uTargetSurfacePitch, pRenderer->field_14, pRenderer->pTargetSurface, SmackCheckSurfaceFromat());
0
Ritor1
parents:
diff changeset
1070 pRenderer->EndScene();
Ritor1
parents:
diff changeset
1071 }
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1072 SmackVolumePan(this->pSmackerMovie, 1040384, (signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 32767.0), 32767);
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1073 */
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1074
0
Ritor1
parents:
diff changeset
1075 }
Ritor1
parents:
diff changeset
1076 }
Ritor1
parents:
diff changeset
1077
Ritor1
parents:
diff changeset
1078 //----- (004BF3F9) --------------------------------------------------------
Ritor1
parents:
diff changeset
1079 bool VideoPlayer::AnyMovieLoaded()
Ritor1
parents:
diff changeset
1080 {
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1081 return pMovie;// pSmackerMovie || pBinkMovie;
0
Ritor1
parents:
diff changeset
1082 }
Ritor1
parents:
diff changeset
1083
Ritor1
parents:
diff changeset
1084 //----- (004BF411) --------------------------------------------------------
898
10fa7dad1391 DrawPaperdoll clean
Ritor1
parents: 832
diff changeset
1085 void VideoPlayer::OpenGlobalMovie(const char *pFilename, unsigned int bLoop, int a4)
0
Ritor1
parents:
diff changeset
1086 {
Ritor1
parents:
diff changeset
1087 unsigned int v10; // eax@11
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1088
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1089 if (!this->bBufferLoaded)
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1090 {
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1091 //Prepare();
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1092 pEventTimer->Pause();
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1093 if (pAudioPlayer->hAILRedbook)
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1094 AIL_redbook_pause(pAudioPlayer->hAILRedbook);
0
Ritor1
parents:
diff changeset
1095
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1096 bStopBeforeSchedule = false;
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1097 bBufferLoaded = 1;
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1098 /*
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1099 pSmackerMovie = 0;
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1100 pSmackerBuffer = 0;
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1101 pBinkMovie = 0;
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1102 pBinkBuffer = 0;
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1103 */
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1104 bPlayingMovie = false;
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1105 bFirstFrame = false;
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1106 bUsingSmackerMMX = SmackUseMMX(1);
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1107 this->bLoopPlaying = bLoop;
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1108 LoadMovie(pFilename);
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1109 return;
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1110
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1111
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1112 /*
0
Ritor1
parents:
diff changeset
1113 sprintf(pVideoName, "%s.bik", pFilename);
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1114 this->pBinkMovie = OpenBink(pVideoName);
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1115 if ( this->pBinkMovie )
0
Ritor1
parents:
diff changeset
1116 {
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1117 this->uMovieFormat = 2;
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1118 strcpy(this->pCurrentMovieName, pFilename);
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1119 pBinkMovie = this->pBinkMovie;
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1120 this->uMovieFormatSwapped = 1;
0
Ritor1
parents:
diff changeset
1121 if ( pBinkMovie )
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1583
diff changeset
1122 this->pBinkBuffer = CreateBinkBuffer(pBinkMovie->uWidth, pBinkMovie->uHeight, 0);
0
Ritor1
parents:
diff changeset
1123 }
Ritor1
parents:
diff changeset
1124 else
Ritor1
parents:
diff changeset
1125 {
Ritor1
parents:
diff changeset
1126 Unload();
898
10fa7dad1391 DrawPaperdoll clean
Ritor1
parents: 832
diff changeset
1127 sprintfex(pVideoName, "%s.smk", pFilename);
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1128 this->pSmackerMovie = OpenSmack(pVideoName);
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1129 if ( !this->pSmackerMovie )
0
Ritor1
parents:
diff changeset
1130 {
Ritor1
parents:
diff changeset
1131 Unload();
Ritor1
parents:
diff changeset
1132 sprintf(pVideoName, "Can't load file - anims\\%s.smk", pFilename);
Ritor1
parents:
diff changeset
1133 MessageBoxA(0, pVideoName, "Smacker Error", 0);
Ritor1
parents:
diff changeset
1134 return;
Ritor1
parents:
diff changeset
1135 }
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1136 this->uMovieFormat = 1;
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1137 strcpy(this->pCurrentMovieName, pFilename);
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1138 this->uMovieFormatSwapped = 2;
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1139 this->pSomeSmackerBuffer = (char *)malloc(this->pSmackerMovie->Width * this->pSmackerMovie->Height);
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1140 if ( !this->pSomeSmackerBuffer )
0
Ritor1
parents:
diff changeset
1141 {
Ritor1
parents:
diff changeset
1142 Unload();
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1143 sprintf(pVideoName, "Can't allocate memory for buffer");
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1144 MessageBoxA(0, pVideoName, "Smacker Error", 0);
0
Ritor1
parents:
diff changeset
1145 return;
Ritor1
parents:
diff changeset
1146 }
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1147 SmackToBuffer(this->pSmackerMovie, 0, 0, this->pSmackerMovie->Width, this->pSmackerMovie->Height, this->pSomeSmackerBuffer, 0);
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1018
diff changeset
1148
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1018
diff changeset
1149 v10 = SmackCheckSurfaceFromat();
0
Ritor1
parents:
diff changeset
1150 if ( a4 )
Ritor1
parents:
diff changeset
1151 {
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1018
diff changeset
1152 v10 |= SMACKBLIT2X;
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1018
diff changeset
1153
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1018
diff changeset
1154 if (uCPUSpeed >= 165 )
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1018
diff changeset
1155 v10 |= SMACKBLIT2XSMOOTHING;
0
Ritor1
parents:
diff changeset
1156 else
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1018
diff changeset
1157 Log::Warning(L"Smacker seems to use lower resolution because it thinks CPU is slow");
0
Ritor1
parents:
diff changeset
1158 }
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1018
diff changeset
1159
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1160 this->pSmackMovieBlit = SmackBlitOpen(v10);
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1161 if ( !this->pSmackMovieBlit )
0
Ritor1
parents:
diff changeset
1162 {
Ritor1
parents:
diff changeset
1163 Unload();
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1164 sprintf(pVideoName, "Failed to open Blit API");
0
Ritor1
parents:
diff changeset
1165 MessageBoxA(0, pVideoName, "Smacker Error", 0);
Ritor1
parents:
diff changeset
1166 return;
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1167 }
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1168 }*/
0
Ritor1
parents:
diff changeset
1169 }
Ritor1
parents:
diff changeset
1170 }
Ritor1
parents:
diff changeset
1171
Ritor1
parents:
diff changeset
1172
Ritor1
parents:
diff changeset
1173 //----- (004BF5B2) --------------------------------------------------------
Ritor1
parents:
diff changeset
1174 void VideoPlayer::_4BF5B2()
Ritor1
parents:
diff changeset
1175 {
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1176 //__debugbreak();
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1177
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1178 /*if ( this->uMovieFormat == 2 )
0
Ritor1
parents:
diff changeset
1179 {
Ritor1
parents:
diff changeset
1180 BinkGoto(pBinkMovie, 1, 0);
Ritor1
parents:
diff changeset
1181 BinkDoFrame(pBinkMovie);
Ritor1
parents:
diff changeset
1182 BinkNextFrame(pBinkMovie);
Ritor1
parents:
diff changeset
1183 }
Ritor1
parents:
diff changeset
1184 else
Ritor1
parents:
diff changeset
1185 {
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1186 if ( this->uMovieFormat != 1 )
0
Ritor1
parents:
diff changeset
1187 return;
Ritor1
parents:
diff changeset
1188 SmackGoto(pSmackerMovie, 1);
Ritor1
parents:
diff changeset
1189 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
Ritor1
parents:
diff changeset
1190 {
Ritor1
parents:
diff changeset
1191 SmackDoFrame(pSmackerMovie);
Ritor1
parents:
diff changeset
1192 SmackNextFrame(pSmackerMovie);
Ritor1
parents:
diff changeset
1193 }
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1194 }*/
0
Ritor1
parents:
diff changeset
1195 pMouse->_469E24();
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1196 if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !this->pMovie)//!this->pSmackerMovie )
0
Ritor1
parents:
diff changeset
1197 {
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1198 bGameoverLoop = true;
1919
140ca8123384 Tavern rest fix
Ritor1
parents: 1802
diff changeset
1199 HouseDialogPressCloseBtn();
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 323
diff changeset
1200 window_SpeakInHouse->Release();
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1201 pParty->uFlags &= 0xFFFFFFFD;
481
5b6e2021c6fe HOUSE_ID
Ritor1
parents: 480
diff changeset
1202 if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) )
0
Ritor1
parents:
diff changeset
1203 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 347
diff changeset
1204 pAudioPlayer->PlaySound(SOUND_Invalid, 0, 0, -1, 0, 0, 0, 0);
2215
e9625ad08541 fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents: 2154
diff changeset
1205 window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_HouseInterior, 165, 0);
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1206 window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1, 0x31, "", 0);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1207 window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2, 0x32, "", 0);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1208 window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3, 0x33, "", 0);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1209 window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4, 0x34, "", 0);
0
Ritor1
parents:
diff changeset
1210 }
Ritor1
parents:
diff changeset
1211 bGameoverLoop = 0;
Ritor1
parents:
diff changeset
1212 }
Ritor1
parents:
diff changeset
1213 }
Ritor1
parents:
diff changeset
1214
Ritor1
parents:
diff changeset
1215 //----- (004BF73A) --------------------------------------------------------
898
10fa7dad1391 DrawPaperdoll clean
Ritor1
parents: 832
diff changeset
1216 void VideoPlayer::SelectMovieType()
0
Ritor1
parents:
diff changeset
1217 {
Ritor1
parents:
diff changeset
1218 char Source[32]; // [sp+Ch] [bp-40h]@1
Ritor1
parents:
diff changeset
1219
Ritor1
parents:
diff changeset
1220 strcpy(Source, this->pCurrentMovieName);
Ritor1
parents:
diff changeset
1221 Unload();
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1222 if ( this->uMovieFormatSwapped == 1 )
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1223 OpenHouseMovie(Source, LOBYTE(this->bLoopPlaying));
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1224 else if ( this->uMovieFormatSwapped == 2 )
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1225 OpenGlobalMovie(Source, LOBYTE(this->bLoopPlaying), 1);
0
Ritor1
parents:
diff changeset
1226 else
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1397
diff changeset
1227 __debugbreak();
0
Ritor1
parents:
diff changeset
1228 }
Ritor1
parents:
diff changeset
1229
Ritor1
parents:
diff changeset
1230 //----- (004BF8F6) --------------------------------------------------------
Ritor1
parents:
diff changeset
1231 void VideoPlayer::PlayDeathMovie()
Ritor1
parents:
diff changeset
1232 {
Ritor1
parents:
diff changeset
1233 bStopBeforeSchedule = 0;
165
Ritor1
parents: 151
diff changeset
1234 pResetflag = 0;
1397
eb02a65e5c82 Quick Spell fixed.
Nomad
parents: 1299
diff changeset
1235 PlayFullscreenMovie(MOVIE_Death, true);
eb02a65e5c82 Quick Spell fixed.
Nomad
parents: 1299
diff changeset
1236 //pGame->pCShow->PlayMovie(MOVIE_Death, 1);
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
1237 }
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
1238
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
1239 //----- (004BE6F5) --------------------------------------------------------
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
1240 VideoPlayer::VideoPlayer() :
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1241 bBufferLoaded(0),
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1242 //pBinkMovie(nullptr), pBinkBuffer(nullptr),
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1243 //pSmackerMovie(nullptr), pSmackerBuffer(nullptr),
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1244 pSmackMovieBlit(nullptr)
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
1245 {
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
1246 //RGBTexture::RGBTexture(&pVideoPlayer->pVideoFrame);
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
1247 bStopBeforeSchedule = false;
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
1248 pResetflag = 0;
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1249 pPlayer = new MultimediaPlayer();
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1250 pPlayer->Initialize();
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1251 pMovie = nullptr;
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
1252 //pBinkMovie = nullptr;
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
1253 }
2134
992d2e6f907d preparation for libavcodec
zipi
parents: 2132
diff changeset
1254
992d2e6f907d preparation for libavcodec
zipi
parents: 2132
diff changeset
1255 bool MultimediaPlayer::libavcodec_initialized = false;
992d2e6f907d preparation for libavcodec
zipi
parents: 2132
diff changeset
1256
992d2e6f907d preparation for libavcodec
zipi
parents: 2132
diff changeset
1257 void MultimediaPlayer::Logger(void *, int, const char *format, va_list args)
992d2e6f907d preparation for libavcodec
zipi
parents: 2132
diff changeset
1258 {
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1259 char msg[1024];
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1260 vsprintf(msg, format, args);
2134
992d2e6f907d preparation for libavcodec
zipi
parents: 2132
diff changeset
1261
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1262 DWORD w;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1263 WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), msg, lstrlenA(msg), &w, nullptr);
2134
992d2e6f907d preparation for libavcodec
zipi
parents: 2132
diff changeset
1264 }
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1265
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1266 int VideoPlayer::readFunction(void* opaque, uint8_t* buf, int buf_size)
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1267 {
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1268 HANDLE stream = (HANDLE)opaque;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1269 //int numBytes = stream->read((char*)buf, buf_size);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1270 int numBytes;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1271 ReadFile(stream, (char *)buf, buf_size, (LPDWORD)&numBytes, NULL);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1272 return numBytes;
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1273 }
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1274
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1275 int64_t VideoPlayer::seekFunction(void* opaque, int64_t offset, int whence)
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1276 {
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1277 if (whence == AVSEEK_SIZE)
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1278 return pVideoPlayer->uSize;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1279 HANDLE h = (HANDLE)opaque;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1280 LARGE_INTEGER li;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1281 li.QuadPart = offset;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1282
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1283 if (!SetFilePointerEx(h, li, (PLARGE_INTEGER)&li, FILE_BEGIN))
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1284 return -1;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1285 return li.QuadPart;
2137
d24ee391fd1f libavcodec playing movies and houses, loops not working yet
zipi
parents: 2134
diff changeset
1286 }
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1287
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1288 void VideoPlayer::LoadMovie(const char * pFilename)
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1289 {
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1290 char pVideoNameBik[120]; // [sp+Ch] [bp-28h]@2
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1291 char pVideoNameSmk[120]; // [sp+Ch] [bp-28h]@2
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1292
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1293 sprintf(pVideoNameBik, "%s.bik", pFilename);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1294 sprintf(pVideoNameSmk, "%s.smk", pFilename);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1295 for (uint i = 0; i < uNumMightVideoHeaders; ++i)
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1296 {
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1297 //no BIK in MightVid
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1298 /*
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1299 if (!_stricmp(pVideoNameBik, pMightVideoHeaders[i].pVideoName))
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1300 {
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1301 hVidFile = hMightVid;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1302 uOffset = pMightVideoHeaders[i].uFileOffset;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1303 uSize = pMightVideoHeaders[i + 1].uFileOffset - uOffset;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1304 this->uMovieFormat = 2;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1305 this->uMovieFormatSwapped = 1;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1306 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1307 */
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1308 if (!_stricmp(pVideoNameSmk, pMightVideoHeaders[i].pVideoName))
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1309 {
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1310 hVidFile = hMightVid;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1311 uOffset = pMightVideoHeaders[i].uFileOffset;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1312 uSize = pMightVideoHeaders[i + 1].uFileOffset - uOffset;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1313 this->uMovieFormat = 1;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1314 this->uMovieFormatSwapped = 2;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1315 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1316 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1317 for (uint i = 0; i < uNumMagicVideoHeaders; ++i)
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1318 {
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1319 if (!_stricmp(pVideoNameBik, pMagicVideoHeaders[i].pVideoName))
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1320 {
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1321 hVidFile = hMagicVid;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1322 uOffset = pMagicVideoHeaders[i].uFileOffset;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1323 uSize = pMagicVideoHeaders[i + 1].uFileOffset - uOffset;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1324 this->uMovieFormat = 2;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1325 this->uMovieFormatSwapped = 1;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1326 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1327 if (!_stricmp(pVideoNameSmk, pMagicVideoHeaders[i].pVideoName))
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1328 {
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1329 hVidFile = hMagicVid;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1330 uOffset = pMagicVideoHeaders[i].uFileOffset;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1331 uSize = pMagicVideoHeaders[i + 1].uFileOffset - uOffset;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1332 this->uMovieFormat = 1;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1333 this->uMovieFormatSwapped = 2;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1334 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1335 }
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1336 if (!hVidFile)
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1337 {
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1338 Unload();
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1339 MessageBoxA(0, "VideoPlayer error", "VideoPlayer Error", 0);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1340 return;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1341 }
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1342
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1343 SetFilePointer(hVidFile, uOffset, 0, FILE_BEGIN);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1344 strcpy(this->pCurrentMovieName, pFilename);
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1345
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1346 auto hwnd = pVideoPlayer->window->GetApiHandle();
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1347 RECT rc_client;
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1348 GetClientRect(hwnd, &rc_client);
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1349 int client_width = rc_client.right - rc_client.left,
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1350 client_height = rc_client.bottom - rc_client.top;
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1351
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1352
2218
e8f9a06c7bcb for video
Ritor1
parents: 2216
diff changeset
1353 pMovie = pPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, client_width, client_height);
2142
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1354
ca548138d6aa some code cleaning in video playing, loops play but there is a memory leak
zipi
parents: 2137
diff changeset
1355 }