mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- removed the long broken and obsolete PlayMovie code.
This commit is contained in:
parent
becc00a8be
commit
1515ab8f4a
9 changed files with 3 additions and 608 deletions
|
@ -621,7 +621,6 @@ set( PLAT_WIN32_SOURCES
|
||||||
win32/i_rawps2.cpp
|
win32/i_rawps2.cpp
|
||||||
win32/i_xinput.cpp
|
win32/i_xinput.cpp
|
||||||
win32/i_main.cpp
|
win32/i_main.cpp
|
||||||
win32/i_movie.cpp
|
|
||||||
win32/i_system.cpp
|
win32/i_system.cpp
|
||||||
win32/i_specialpaths.cpp
|
win32/i_specialpaths.cpp
|
||||||
win32/st_start.cpp
|
win32/st_start.cpp
|
||||||
|
@ -629,7 +628,6 @@ set( PLAT_WIN32_SOURCES
|
||||||
win32/win32video.cpp )
|
win32/win32video.cpp )
|
||||||
set( PLAT_POSIX_SOURCES
|
set( PLAT_POSIX_SOURCES
|
||||||
posix/i_cd.cpp
|
posix/i_cd.cpp
|
||||||
posix/i_movie.cpp
|
|
||||||
posix/i_steam.cpp )
|
posix/i_steam.cpp )
|
||||||
set( PLAT_SDL_SOURCES
|
set( PLAT_SDL_SOURCES
|
||||||
posix/sdl/crashcatcher.c
|
posix/sdl/crashcatcher.c
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
/*
|
|
||||||
** i_movie.h
|
|
||||||
** Defines the movie-related stuff
|
|
||||||
**
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
** Copyright 1998-2006 Randy Heit
|
|
||||||
** All rights reserved.
|
|
||||||
**
|
|
||||||
** Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions
|
|
||||||
** are met:
|
|
||||||
**
|
|
||||||
** 1. Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in the
|
|
||||||
** documentation and/or other materials provided with the distribution.
|
|
||||||
** 3. The name of the author may not be used to endorse or promote products
|
|
||||||
** derived from this software without specific prior written permission.
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __I_MOVIE_H__
|
|
||||||
#define __I_MOVIE_H__
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int I_PlayMovie (const char *movieName);
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
MOVIE_Played = 0,
|
|
||||||
MOVIE_Played_NoVideo = 1,
|
|
||||||
MOVIE_Played_Aborted = 2,
|
|
||||||
MOVIE_Failed = -1,
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //__I_MOVIE_H__
|
|
|
@ -54,7 +54,6 @@
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "s_sndseq.h"
|
#include "s_sndseq.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "i_movie.h"
|
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
|
@ -8801,7 +8800,7 @@ scriptwait:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCD_PLAYMOVIE:
|
case PCD_PLAYMOVIE:
|
||||||
STACK(1) = I_PlayMovie (FBehavior::StaticLookupString (STACK(1)));
|
STACK(1) = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCD_SETACTORPOSITION:
|
case PCD_SETACTORPOSITION:
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#include "i_movie.h"
|
|
||||||
|
|
||||||
int I_PlayMovie (const char *movie)
|
|
||||||
{
|
|
||||||
return MOVIE_Failed;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1706,7 +1706,6 @@ void D3DFB::NewRefreshRate ()
|
||||||
|
|
||||||
void D3DFB::Blank ()
|
void D3DFB::Blank ()
|
||||||
{
|
{
|
||||||
// Only used by movie player, which isn't working with D3D9 yet.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3DFB::SetBlendingRect(int x1, int y1, int x2, int y2)
|
void D3DFB::SetBlendingRect(int x1, int y1, int x2, int y2)
|
||||||
|
|
|
@ -590,11 +590,9 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
case WTS_CONSOLE_DISCONNECT:
|
case WTS_CONSOLE_DISCONNECT:
|
||||||
SessionState |= 2;
|
SessionState |= 2;
|
||||||
//I_MovieDisableSound ();
|
|
||||||
break;
|
break;
|
||||||
case WTS_CONSOLE_CONNECT:
|
case WTS_CONSOLE_CONNECT:
|
||||||
SessionState &= ~2;
|
SessionState &= ~2;
|
||||||
//I_MovieResumeSound ();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,10 +617,6 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
GSnd->SuspendSound ();
|
GSnd->SuspendSound ();
|
||||||
}
|
}
|
||||||
else if (oldstate && !SessionState)
|
|
||||||
{
|
|
||||||
GSnd->MovieResumeSound ();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -948,18 +942,6 @@ FString I_GetFromClipboard (bool return_nothing)
|
||||||
return retstr;
|
return retstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "i_movie.h"
|
|
||||||
|
|
||||||
CCMD (playmovie)
|
|
||||||
{
|
|
||||||
if (argv.argc() != 2)
|
|
||||||
{
|
|
||||||
Printf ("Usage: playmovie <movie name>\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
I_PlayMovie (argv[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// FInputDevice - Destructor
|
// FInputDevice - Destructor
|
||||||
|
|
|
@ -1,523 +0,0 @@
|
||||||
/*
|
|
||||||
** i_movie.cpp
|
|
||||||
**
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
** Copyright 1998-2006 Randy Heit
|
|
||||||
** All rights reserved.
|
|
||||||
**
|
|
||||||
** Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions
|
|
||||||
** are met:
|
|
||||||
**
|
|
||||||
** 1. Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in the
|
|
||||||
** documentation and/or other materials provided with the distribution.
|
|
||||||
** 3. The name of the author may not be used to endorse or promote products
|
|
||||||
** derived from this software without specific prior written permission.
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
* If you do not have dshow.h, either download the latest DirectX SDK
|
|
||||||
* or #define I_DO_NOT_LIKE_BIG_DOWNLOADS
|
|
||||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef I_DO_NOT_LIKE_BIG_DOWNLOADS
|
|
||||||
#define I_DO_NOT_LIKE_BIG_DOWNLOADS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
#define USE_WINDOWS_DWORD
|
|
||||||
|
|
||||||
#include "c_cvars.h"
|
|
||||||
|
|
||||||
CUSTOM_CVAR (Float, snd_movievolume, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|
||||||
{
|
|
||||||
if (self < 0.f)
|
|
||||||
self = 0.f;
|
|
||||||
else if (self > 1.f)
|
|
||||||
self = 1.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef I_DO_NOT_LIKE_BIG_DOWNLOADS
|
|
||||||
|
|
||||||
#include "i_movie.h"
|
|
||||||
|
|
||||||
int I_PlayMovie (const char *movie)
|
|
||||||
{
|
|
||||||
return MOVIE_Failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include <dshow.h>
|
|
||||||
#include "i_movie.h"
|
|
||||||
#include "i_sound.h"
|
|
||||||
#include "v_video.h"
|
|
||||||
#include "c_console.h"
|
|
||||||
#include "win32iface.h"
|
|
||||||
#include "sbar.h"
|
|
||||||
|
|
||||||
EXTERN_CVAR (String, language)
|
|
||||||
|
|
||||||
#define WM_GRAPHNOTIFY (WM_APP+321)
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
#define INGAME_PRIORITY_CLASS NORMAL_PRIORITY_CLASS
|
|
||||||
#else
|
|
||||||
//#define INGAME_PRIORITY_CLASS HIGH_PRIORITY_CLASS
|
|
||||||
#define INGAME_PRIORITY_CLASS NORMAL_PRIORITY_CLASS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern HWND Window;
|
|
||||||
extern IVideo *Video;
|
|
||||||
extern LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
|
||||||
extern void I_CheckNativeMouse (bool preferNative);
|
|
||||||
|
|
||||||
static bool MovieNotDone;
|
|
||||||
static bool MovieInterrupted;
|
|
||||||
static bool MovieDestroyed;
|
|
||||||
static bool FullVideo;
|
|
||||||
static bool NoVideo;
|
|
||||||
static IVideoWindow *vidwin;
|
|
||||||
static IMediaEventEx *event;
|
|
||||||
static IGraphBuilder *graph;
|
|
||||||
static IMediaControl *control;
|
|
||||||
static IBasicAudio *audio;
|
|
||||||
static IBasicVideo *video;
|
|
||||||
|
|
||||||
static void CheckIfVideo ();
|
|
||||||
static void SetMovieSize ();
|
|
||||||
static void SetTheVolume ();
|
|
||||||
static void SizeWindowForVideo ();
|
|
||||||
|
|
||||||
LRESULT CALLBACK MovieWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
switch (message)
|
|
||||||
{
|
|
||||||
case WM_GRAPHNOTIFY:
|
|
||||||
{
|
|
||||||
long code;
|
|
||||||
LONG_PTR parm1, parm2;
|
|
||||||
|
|
||||||
while (event->GetEvent (&code, &parm1, &parm2, 0) == S_OK)
|
|
||||||
{
|
|
||||||
if (code == EC_COMPLETE)
|
|
||||||
{
|
|
||||||
MovieNotDone = false;
|
|
||||||
}
|
|
||||||
event->FreeEventParams (code, parm1, parm2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_SIZE:
|
|
||||||
if (vidwin == NULL)
|
|
||||||
{
|
|
||||||
InvalidateRect (Window, NULL, FALSE);
|
|
||||||
}
|
|
||||||
else if ((wParam == SIZE_MAXIMIZED || wParam == SIZE_RESTORED) && !FullVideo)
|
|
||||||
{
|
|
||||||
SetMovieSize ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_PAINT:
|
|
||||||
if (vidwin == NULL)
|
|
||||||
{
|
|
||||||
if (screen != NULL)
|
|
||||||
{
|
|
||||||
static_cast<BaseWinFB *> (screen)->PaintToWindow ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!FullVideo)
|
|
||||||
{
|
|
||||||
PAINTSTRUCT ps;
|
|
||||||
HBRUSH br;
|
|
||||||
HDC dc;
|
|
||||||
long left, top, width, height;
|
|
||||||
|
|
||||||
if (S_OK == vidwin->GetWindowPosition (&left, &top, &width, &height))
|
|
||||||
{
|
|
||||||
dc = BeginPaint (Window, &ps);
|
|
||||||
if (dc != NULL)
|
|
||||||
{
|
|
||||||
RECT rect = { left, top, left+width, top+height };
|
|
||||||
ScreenToClient (hWnd, (LPPOINT)&rect.left);
|
|
||||||
ScreenToClient (hWnd, (LPPOINT)&rect.right);
|
|
||||||
br = (HBRUSH)GetStockObject (BLACK_BRUSH);
|
|
||||||
switch (ExcludeClipRect (dc, rect.left, rect.top, rect.right, rect.bottom))
|
|
||||||
{
|
|
||||||
case SIMPLEREGION:
|
|
||||||
case COMPLEXREGION:
|
|
||||||
FillRect (dc, &ps.rcPaint, br);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
EndPaint (Window, &ps);
|
|
||||||
//return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_DESTROY:
|
|
||||||
case WM_KEYDOWN:
|
|
||||||
case WM_SYSKEYDOWN:
|
|
||||||
/*
|
|
||||||
case WM_LBUTTONDOWN:
|
|
||||||
case WM_RBUTTONDOWN:
|
|
||||||
case WM_MBUTTONDOWN:
|
|
||||||
*/
|
|
||||||
if (MovieNotDone)
|
|
||||||
{
|
|
||||||
if (wParam == VK_ESCAPE || message == WM_CANCELMODE || message == WM_DESTROY)
|
|
||||||
{
|
|
||||||
control->Stop ();
|
|
||||||
MovieNotDone = false;
|
|
||||||
MovieInterrupted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (message == WM_DESTROY)
|
|
||||||
{
|
|
||||||
MovieDestroyed = true;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case WM_GETMINMAXINFO:
|
|
||||||
if (screen && !FullVideo)
|
|
||||||
{
|
|
||||||
LPMINMAXINFO mmi = (LPMINMAXINFO)lParam;
|
|
||||||
RECT rect = { 0, 0, screen->GetWidth(), screen->GetHeight() };
|
|
||||||
AdjustWindowRectEx(&rect, WS_VISIBLE|WS_OVERLAPPEDWINDOW, FALSE, WS_EX_APPWINDOW);
|
|
||||||
mmi->ptMinTrackSize.x = rect.right - rect.left;
|
|
||||||
mmi->ptMinTrackSize.y = rect.bottom - rect.top;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_SETTINGCHANGE:
|
|
||||||
// In case regional settings were changed, reget preferred languages
|
|
||||||
language.Callback ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return DefWindowProc (hWnd, message, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
int I_PlayMovie (const char *name)
|
|
||||||
{
|
|
||||||
HRESULT hr;
|
|
||||||
int returnval = MOVIE_Failed;
|
|
||||||
size_t namelen = strlen (name) + 1;
|
|
||||||
wchar_t *uniname = new wchar_t[namelen];
|
|
||||||
bool returnSound = false;
|
|
||||||
bool runningFull = false;
|
|
||||||
bool hotkey = false;
|
|
||||||
size_t i;
|
|
||||||
MSG msg;
|
|
||||||
|
|
||||||
MovieNotDone = true;
|
|
||||||
|
|
||||||
if (MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, name, -1, uniname, (int)namelen) == 0)
|
|
||||||
{ // Could not convert name to Unicode
|
|
||||||
goto bomb1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert slashes to backslashes because IGraphBuilder cannot deal with them
|
|
||||||
for (i = 0; i < namelen; ++i)
|
|
||||||
{
|
|
||||||
if (uniname[i] == L'/')
|
|
||||||
uniname[i] = L'\\';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(hr = CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
|
|
||||||
IID_IGraphBuilder, (void **)&graph)))
|
|
||||||
{
|
|
||||||
goto bomb1;
|
|
||||||
}
|
|
||||||
|
|
||||||
control = NULL;
|
|
||||||
event = NULL;
|
|
||||||
vidwin = NULL;
|
|
||||||
audio = NULL;
|
|
||||||
video = NULL;
|
|
||||||
|
|
||||||
if (FAILED(hr = graph->RenderFile (uniname, NULL)))
|
|
||||||
{
|
|
||||||
goto bomb2;
|
|
||||||
}
|
|
||||||
|
|
||||||
graph->QueryInterface (IID_IMediaControl, (void **)&control);
|
|
||||||
graph->QueryInterface (IID_IMediaEventEx, (void **)&event);
|
|
||||||
graph->QueryInterface (IID_IVideoWindow, (void **)&vidwin);
|
|
||||||
graph->QueryInterface (IID_IBasicAudio, (void **)&audio);
|
|
||||||
graph->QueryInterface (IID_IBasicVideo, (void **)&video);
|
|
||||||
|
|
||||||
if (control == NULL || event == NULL)
|
|
||||||
{
|
|
||||||
goto bomb3;
|
|
||||||
}
|
|
||||||
|
|
||||||
GSnd->MovieDisableSound ();
|
|
||||||
returnSound = true;
|
|
||||||
|
|
||||||
CheckIfVideo ();
|
|
||||||
SetTheVolume ();
|
|
||||||
|
|
||||||
FullVideo = false;
|
|
||||||
|
|
||||||
if (vidwin != NULL)
|
|
||||||
{
|
|
||||||
FullVideo = runningFull = screen->IsFullscreen ();
|
|
||||||
|
|
||||||
// If the message drain cannot be set, then we simply won't be able
|
|
||||||
// to catch mouse button presses in the video window.
|
|
||||||
HRESULT drainhr = vidwin->put_MessageDrain ((OAHWND)Window);
|
|
||||||
|
|
||||||
if (FullVideo)
|
|
||||||
{
|
|
||||||
// Try to avoid nasty palette flashes by clearing the screen to black.
|
|
||||||
// Does not always work. :-(
|
|
||||||
static_cast<Win32Video *> (Video)->BlankForGDI ();
|
|
||||||
static_cast<Win32Video *> (Video)->GoFullscreen (false);
|
|
||||||
static_cast<BaseWinFB *> (screen)->ReleaseResources ();
|
|
||||||
if (FAILED (drainhr) || FAILED(hr = vidwin->put_FullScreenMode (OATRUE)))
|
|
||||||
{
|
|
||||||
SizeWindowForVideo ();
|
|
||||||
FullVideo = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!FullVideo)
|
|
||||||
{
|
|
||||||
vidwin->put_Owner ((OAHWND)Window);
|
|
||||||
vidwin->put_WindowStyle (WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
|
|
||||||
SetMovieSize ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RegisterHotKey (Window, 0, MOD_ALT, VK_TAB);
|
|
||||||
hotkey = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED (hr = event->SetNotifyWindow ((OAHWND)Window, WM_GRAPHNOTIFY, 0)))
|
|
||||||
{
|
|
||||||
goto bomb3;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetPriorityClass (GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
|
|
||||||
|
|
||||||
I_CheckNativeMouse (true);
|
|
||||||
SetWindowLongPtr (Window, GWLP_WNDPROC, (LONG_PTR)MovieWndProc);
|
|
||||||
|
|
||||||
if (FAILED (hr = control->Run ()))
|
|
||||||
{
|
|
||||||
goto bomb4;
|
|
||||||
}
|
|
||||||
|
|
||||||
MovieInterrupted = false;
|
|
||||||
MovieDestroyed = false;
|
|
||||||
|
|
||||||
while (MovieNotDone && GetMessage (&msg, NULL, 0, 0))
|
|
||||||
{
|
|
||||||
TranslateMessage (&msg);
|
|
||||||
DispatchMessage (&msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
returnval = MovieInterrupted ? MOVIE_Played_Aborted :
|
|
||||||
NoVideo ? MOVIE_Played_NoVideo :
|
|
||||||
MOVIE_Played;
|
|
||||||
|
|
||||||
bomb4:
|
|
||||||
SetWindowLongPtr (Window, GWLP_WNDPROC, (LONG_PTR)WndProc);
|
|
||||||
SetPriorityClass (GetCurrentProcess(), INGAME_PRIORITY_CLASS);
|
|
||||||
|
|
||||||
bomb3:
|
|
||||||
if (hotkey)
|
|
||||||
{
|
|
||||||
UnregisterHotKey (Window, 0);
|
|
||||||
}
|
|
||||||
if (vidwin != NULL)
|
|
||||||
{
|
|
||||||
if (!FullVideo)
|
|
||||||
{
|
|
||||||
vidwin->put_Visible (OAFALSE);
|
|
||||||
vidwin->put_Owner (NULL);
|
|
||||||
}
|
|
||||||
vidwin->Release ();
|
|
||||||
}
|
|
||||||
if (video != NULL)
|
|
||||||
{
|
|
||||||
video->Release ();
|
|
||||||
}
|
|
||||||
if (audio != NULL)
|
|
||||||
{
|
|
||||||
audio->Release ();
|
|
||||||
}
|
|
||||||
if (event != NULL)
|
|
||||||
{
|
|
||||||
event->Release ();
|
|
||||||
}
|
|
||||||
if (control != NULL)
|
|
||||||
{
|
|
||||||
control->Release ();
|
|
||||||
}
|
|
||||||
|
|
||||||
SetActiveWindow (Window);
|
|
||||||
|
|
||||||
bomb2:
|
|
||||||
graph->Release ();
|
|
||||||
|
|
||||||
if (returnSound)
|
|
||||||
{
|
|
||||||
GSnd->MovieResumeSound ();
|
|
||||||
C_FlushDisplay ();
|
|
||||||
}
|
|
||||||
if (runningFull)
|
|
||||||
{
|
|
||||||
static_cast<Win32Video *> (Video)->GoFullscreen (true);
|
|
||||||
static_cast<BaseWinFB *> (screen)->CreateResources ();
|
|
||||||
}
|
|
||||||
|
|
||||||
bomb1:
|
|
||||||
delete[] uniname;
|
|
||||||
|
|
||||||
if (MovieDestroyed)
|
|
||||||
{
|
|
||||||
exit (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnval;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CheckIfVideo ()
|
|
||||||
{
|
|
||||||
long visible;
|
|
||||||
|
|
||||||
if (vidwin == NULL || video == NULL)
|
|
||||||
{
|
|
||||||
NoVideo = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (vidwin->get_Visible (&visible) == E_NOINTERFACE)
|
|
||||||
{
|
|
||||||
NoVideo = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NoVideo = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NoVideo)
|
|
||||||
{
|
|
||||||
if (vidwin != NULL)
|
|
||||||
{
|
|
||||||
vidwin->Release ();
|
|
||||||
vidwin = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
DHUDMessage *message = new DHUDMessage (
|
|
||||||
"This movie either does not contain a video stream "
|
|
||||||
"or no suitable decompressor could be found.",
|
|
||||||
1.5f, 0.375f, 0, 0, CR_RED, 1.f);
|
|
||||||
StatusBar->AttachMessage (message);
|
|
||||||
screen->Lock (false);
|
|
||||||
StatusBar->Draw (HUD_None);
|
|
||||||
StatusBar->DrawTopStuff (HUD_None);
|
|
||||||
screen->Update ();
|
|
||||||
StatusBar->DetachMessage (message);
|
|
||||||
delete message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SetTheVolume ()
|
|
||||||
{
|
|
||||||
if (audio != NULL)
|
|
||||||
{
|
|
||||||
// Convert snd_movievolume from a linear range to 1/100th
|
|
||||||
// decibels and pass that to the IBasicAudio interface.
|
|
||||||
long volume;
|
|
||||||
|
|
||||||
if (snd_movievolume == 0.f)
|
|
||||||
{
|
|
||||||
volume = -10000;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
volume = (long)(log10 (snd_movievolume) * 10000.0);
|
|
||||||
}
|
|
||||||
audio->put_Volume (volume);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SizeWindowForVideo ()
|
|
||||||
{
|
|
||||||
LONG width, height;
|
|
||||||
|
|
||||||
if (video == NULL || FAILED (video->GetVideoSize (&width, &height)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
SetWindowPos (Window, NULL, 0, 0,
|
|
||||||
width + 2*GetSystemMetrics(SM_CXBORDER),
|
|
||||||
height + GetSystemMetrics(SM_CYCAPTION) + 2*GetSystemMetrics(SM_CYBORDER),
|
|
||||||
SWP_NOMOVE|SWP_NOOWNERZORDER);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SetMovieSize ()
|
|
||||||
{
|
|
||||||
LONG width, height, left, top;
|
|
||||||
RECT grc;
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
GetClientRect (Window, &grc);
|
|
||||||
|
|
||||||
hr = video->GetVideoSize (&width, &height);
|
|
||||||
if (FAILED (hr))
|
|
||||||
{
|
|
||||||
vidwin->SetWindowPosition (0, 0, grc.right, grc.bottom);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
double aspect = (double)height / (double)width;
|
|
||||||
|
|
||||||
// Calculate size of video window that fits in our window
|
|
||||||
if (grc.right > grc.bottom)
|
|
||||||
{
|
|
||||||
height = grc.bottom;
|
|
||||||
width = (LONG)((double)height / aspect);
|
|
||||||
}
|
|
||||||
if (grc.right <= grc.bottom || width > grc.right)
|
|
||||||
{
|
|
||||||
width = grc.right;
|
|
||||||
height = (LONG)((double)width * aspect);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then center it
|
|
||||||
left = (grc.right - width) / 2;
|
|
||||||
top = (grc.bottom - height) / 2;
|
|
||||||
|
|
||||||
// And use it
|
|
||||||
vidwin->SetWindowPosition (left, top, width, height);
|
|
||||||
|
|
||||||
InvalidateRect (Window, NULL, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // I_DO_NOT_LIKE_BIG_DOWNLOADS
|
|
|
@ -136,7 +136,6 @@ protected:
|
||||||
|
|
||||||
bool Windowed;
|
bool Windowed;
|
||||||
|
|
||||||
friend int I_PlayMovie (const char *name);
|
|
||||||
friend class Win32Video;
|
friend class Win32Video;
|
||||||
|
|
||||||
BaseWinFB() {}
|
BaseWinFB() {}
|
||||||
|
|
|
@ -336,7 +336,7 @@ bool Win32Video::GoFullscreen (bool yes)
|
||||||
HRESULT hr[2];
|
HRESULT hr[2];
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
// FIXME: Do this right for D3D. (This function is only called by the movie player when using D3D.)
|
// FIXME: Do this right for D3D.
|
||||||
if (D3D != NULL)
|
if (D3D != NULL)
|
||||||
{
|
{
|
||||||
return yes;
|
return yes;
|
||||||
|
@ -372,7 +372,7 @@ bool Win32Video::GoFullscreen (bool yes)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flips to the GDI surface and clears it; used by the movie player
|
// Flips to the GDI surface and clears it
|
||||||
void Win32Video::BlankForGDI ()
|
void Win32Video::BlankForGDI ()
|
||||||
{
|
{
|
||||||
static_cast<BaseWinFB *> (screen)->Blank ();
|
static_cast<BaseWinFB *> (screen)->Blank ();
|
||||||
|
|
Loading…
Reference in a new issue