annotate VideoPlayer.cpp @ 2125:ba3de1337989

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