aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/Base
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-06-02 18:38:20 +0200
committerEinar Johan Trøan Sømåen2012-06-02 18:46:17 +0200
commitcafdcd1c8a68fb23dd6e2841b427fb69f29dd62c (patch)
tree8a065b7ab2f0dd630c9912ffd3ece6c5007cee67 /engines/wintermute/Base
parent74ff79e90bb2862e8c84867ff50f56675c1b4c7e (diff)
downloadscummvm-rg350-cafdcd1c8a68fb23dd6e2841b427fb69f29dd62c.tar.gz
scummvm-rg350-cafdcd1c8a68fb23dd6e2841b427fb69f29dd62c.tar.bz2
scummvm-rg350-cafdcd1c8a68fb23dd6e2841b427fb69f29dd62c.zip
WINTERMUTE: Add in more of the missing Video-pieces, also, copy over the TheoraPlayer from SWORD25
Diffstat (limited to 'engines/wintermute/Base')
-rw-r--r--engines/wintermute/Base/BGame.cpp54
-rw-r--r--engines/wintermute/Base/BGame.h9
2 files changed, 51 insertions, 12 deletions
diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp
index c9b122759d..3a4e88a612 100644
--- a/engines/wintermute/Base/BGame.cpp
+++ b/engines/wintermute/Base/BGame.cpp
@@ -67,6 +67,8 @@
#include "engines/wintermute/Base/scriptables/SXMath.h"
#include "engines/wintermute/Base/scriptables/SXStore.h"
#include "engines/wintermute/Base/scriptables/SXString.h"
+#include "engines/wintermute/video/VidPlayer.h"
+#include "engines/wintermute/video/VidTheoraPlayer.h"
#include "common/textconsole.h"
#include "common/util.h"
#include "common/keyboard.h"
@@ -115,6 +117,9 @@ CBGame::CBGame(): CBObject(this) {
_systemFont = NULL;
_videoFont = NULL;
+ _videoPlayer = NULL;
+ _theoraPlayer = NULL;
+
_mainObject = NULL;
_activeObject = NULL;
@@ -304,6 +309,8 @@ CBGame::~CBGame() {
delete _scEngine;
delete _fontStorage;
delete _surfaceStorage;
+ delete _videoPlayer;
+ delete _theoraPlayer;
delete _soundMgr;
delete _debugMgr;
//SAFE_DELETE(_keyboardState);
@@ -326,6 +333,8 @@ CBGame::~CBGame() {
_scEngine = NULL;
_fontStorage = NULL;
_surfaceStorage = NULL;
+ _videoPlayer = NULL;
+ _theoraPlayer = NULL;
_soundMgr = NULL;
_debugMgr = NULL;
@@ -445,6 +454,9 @@ HRESULT CBGame::Initialize1() {
_scEngine = new CScEngine(this);
if (_scEngine == NULL) goto init_fail;
+
+ _videoPlayer = new CVidPlayer(this);
+ if(_videoPlayer==NULL) goto init_fail;
_transMgr = new CBTransitionMgr(this);
if (_transMgr == NULL) goto init_fail;
@@ -473,6 +485,7 @@ init_fail:
if (_soundMgr) delete _soundMgr;
if (_fileManager) delete _fileManager;
if (_scEngine) delete _scEngine;
+ if (_videoPlayer) delete _videoPlayer;
return E_FAIL;
}
@@ -1399,16 +1412,16 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS
if(Type < (int)VID_PLAY_POS || Type > (int)VID_PLAY_CENTER) Type = (int)VID_PLAY_STRETCH;
- /*if(SUCCEEDED(Game->m_VideoPlayer->Initialize(Filename, SubtitleFile)))
+ if(SUCCEEDED(Game->_videoPlayer->initialize(Filename, SubtitleFile)))
{
- if(SUCCEEDED(Game->m_VideoPlayer->Play((TVideoPlayback)Type, X, Y, FreezeMusic)))
+ if(SUCCEEDED(Game->_videoPlayer->play((TVideoPlayback)Type, X, Y, FreezeMusic)))
{
Stack->PushBool(true);
Script->Sleep(0);
}
else Stack->PushBool(false);
}
- else */Stack->PushBool(false);
+ else Stack->PushBool(false);
return S_OK;
}
@@ -1441,20 +1454,20 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS
if(Type < (int)VID_PLAY_POS || Type > (int)VID_PLAY_CENTER) Type = (int)VID_PLAY_STRETCH;
-
- /*SAFE_DELETE(m_TheoraPlayer);
- m_TheoraPlayer = new CVidTheoraPlayer(this);
- if(m_TheoraPlayer && SUCCEEDED(m_TheoraPlayer->Initialize(Filename, SubtitleFile)))
+
+ delete _theoraPlayer;
+ _theoraPlayer = new CVidTheoraPlayer(this);
+ if(_theoraPlayer && SUCCEEDED(_theoraPlayer->initialize(Filename, SubtitleFile)))
{
- m_TheoraPlayer->m_DontDropFrames = !DropFrames;
- if(SUCCEEDED(m_TheoraPlayer->Play((TVideoPlayback)Type, X, Y, true, FreezeMusic)))
+ _theoraPlayer->_dontDropFrames = !DropFrames;
+ if(SUCCEEDED(_theoraPlayer->play((TVideoPlayback)Type, X, Y, true, FreezeMusic)))
{
Stack->PushBool(true);
Script->Sleep(0);
}
else Stack->PushBool(false);
}
- else */Stack->PushBool(false);
+ else Stack->PushBool(false);
return S_OK;
}
@@ -4195,6 +4208,27 @@ HRESULT CBGame::SetWaitCursor(const char *Filename) {
} else return S_OK;
}
+//////////////////////////////////////////////////////////////////////////
+bool CBGame::IsVideoPlaying()
+{
+ if(_videoPlayer->isPlaying()) return true;
+ if(_theoraPlayer && _theoraPlayer->isPlaying()) return true;
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+HRESULT CBGame::StopVideo()
+{
+ if(_videoPlayer->isPlaying()) _videoPlayer->stop();
+ if(_theoraPlayer && _theoraPlayer->isPlaying())
+ {
+ _theoraPlayer->stop();
+ delete _theoraPlayer;
+ _theoraPlayer = NULL;
+ }
+ return S_OK;
+}
+
//////////////////////////////////////////////////////////////////////////
HRESULT CBGame::DrawCursor(CBSprite *Cursor) {
diff --git a/engines/wintermute/Base/BGame.h b/engines/wintermute/Base/BGame.h
index ac8138855f..2f9b6147ec 100644
--- a/engines/wintermute/Base/BGame.h
+++ b/engines/wintermute/Base/BGame.h
@@ -61,6 +61,8 @@ class CBSurfaceStorage;
class CSXStore;
class CSXMath;
class CBKeyboardState;
+class CVidPlayer;
+class CVidTheoraPlayer;
#define NUM_MUSIC_CHANNELS 5
@@ -263,8 +265,8 @@ public:
HRESULT Unfreeze();
HRESULT Freeze(bool IncludingMusic = true);
HRESULT FocusWindow(CUIWindow *Window);
-/* CVidPlayer* _videoPlayer;
- CVidTheoraPlayer* _theoraPlayer;*/
+ CVidPlayer* _videoPlayer;
+ CVidTheoraPlayer* _theoraPlayer;
bool _loadInProgress;
CUIWindow *_focusedWindow;
bool _editorForceScripts;
@@ -323,6 +325,9 @@ public:
uint32 _fps;
HRESULT UpdateMusicCrossfade();
+ bool IsVideoPlaying();
+ HRESULT StopVideo();
+
CBArray<CBObject *, CBObject *> _regObjects;
public:
virtual HRESULT DisplayContent(bool Update = true, bool DisplayAll = false);