diff options
author | Eugene Sandulenko | 2010-10-19 20:52:06 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-10-19 20:52:06 +0000 |
commit | bbd95da899c496c10a4050b7b3cfd3f8dc8aa6b3 (patch) | |
tree | 53122d619c22e501328dd0cd034a08c3605a6ab3 /engines/sword25/fmv | |
parent | d94435eebd8ab8e21a4a28a0274cae02910cb41d (diff) | |
download | scummvm-rg350-bbd95da899c496c10a4050b7b3cfd3f8dc8aa6b3.tar.gz scummvm-rg350-bbd95da899c496c10a4050b7b3cfd3f8dc8aa6b3.tar.bz2 scummvm-rg350-bbd95da899c496c10a4050b7b3cfd3f8dc8aa6b3.zip |
SWORD25: Fix engine exit when running without theoradec
svn-id: r53622
Diffstat (limited to 'engines/sword25/fmv')
-rw-r--r-- | engines/sword25/fmv/movieplayer.cpp | 56 | ||||
-rw-r--r-- | engines/sword25/fmv/movieplayer.h | 11 | ||||
-rw-r--r-- | engines/sword25/fmv/movieplayer_script.cpp | 38 |
3 files changed, 59 insertions, 46 deletions
diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp index 29d84ba87b..8152b7d949 100644 --- a/engines/sword25/fmv/movieplayer.cpp +++ b/engines/sword25/fmv/movieplayer.cpp @@ -39,8 +39,6 @@ #include "sword25/package/packagemanager.h" #include "sword25/sfx/soundengine.h" -#ifdef USE_THEORADEC - #define INDIRECTRENDERING 1 namespace Sword25 { @@ -53,6 +51,7 @@ Service *OggTheora_CreateObject(Kernel *pKernel) { return new MoviePlayer(pKernel); } +#ifdef USE_THEORADEC MoviePlayer::MoviePlayer(Kernel *pKernel) : Service(pKernel), _decoder(g_system->getMixer()) { if (!registerScriptBindings()) BS_LOG_ERRORLN("Script bindings could not be registered."); @@ -178,7 +177,56 @@ double MoviePlayer::getTime() { return _decoder.getElapsedTime() / 1000.0; } -} // End of namespace Sword25 +#else // USE_THEORADEC -#endif +MoviePlayer::MoviePlayer(Kernel *pKernel) : Service(pKernel) { + if (!registerScriptBindings()) + BS_LOG_ERRORLN("Script bindings could not be registered."); + else + BS_LOGLN("Script bindings registered."); +} + +MoviePlayer::~MoviePlayer() { +} +bool MoviePlayer::loadMovie(const Common::String &Filename, unsigned int Z) { + return true; +} + +bool MoviePlayer::unloadMovie() { + return true; +} + +bool MoviePlayer::play() { + return true; +} + +bool MoviePlayer::pause() { + return true; +} + +void MoviePlayer::update() { +} + +bool MoviePlayer::isMovieLoaded() { + return true; +} + +bool MoviePlayer::isPaused() { + return true; +} + +float MoviePlayer::getScaleFactor() { + return 1.0f; +} + +void MoviePlayer::setScaleFactor(float ScaleFactor) { +} + +double MoviePlayer::getTime() { + return 1.0; +} + +#endif // USE_THEORADEC + +} // End of namespace Sword25 diff --git a/engines/sword25/fmv/movieplayer.h b/engines/sword25/fmv/movieplayer.h index 26b5cdd0d8..350407cea5 100644 --- a/engines/sword25/fmv/movieplayer.h +++ b/engines/sword25/fmv/movieplayer.h @@ -37,12 +37,14 @@ #include "common/scummsys.h" // for USE_THEORADEC -#ifdef USE_THEORADEC #include "sword25/kernel/common.h" #include "sword25/kernel/service.h" -#include "sword25/fmv/theora_decoder.h" #include "sword25/gfx/bitmap.h" +#ifdef USE_THEORADEC +#include "sword25/fmv/theora_decoder.h" +#endif + namespace Sword25 { class MoviePlayer : public Service { @@ -138,16 +140,17 @@ public: private: bool registerScriptBindings(); + +#ifdef USE_THEORADEC TheoraDecoder _decoder; Graphics::Surface *_backSurface; int _outX, _outY; RenderObjectPtr<Bitmap> _outputBitmap; +#endif }; } // End of namespace Sword25 #endif - -#endif diff --git a/engines/sword25/fmv/movieplayer_script.cpp b/engines/sword25/fmv/movieplayer_script.cpp index 5305fa82fd..ea1a9c3a6b 100644 --- a/engines/sword25/fmv/movieplayer_script.cpp +++ b/engines/sword25/fmv/movieplayer_script.cpp @@ -44,127 +44,91 @@ namespace Sword25 { int loadMovie(lua_State *L) { -#ifdef USE_THEORADEC MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); lua_pushbooleancpp(L, FMVPtr->loadMovie(luaL_checkstring(L, 1), lua_gettop(L) == 2 ? static_cast<uint>(luaL_checknumber(L, 2)) : 10)); -#else - lua_pushbooleancpp(L, true); -#endif return 1; } int unloadMovie(lua_State *L) { -#ifdef USE_THEORADEC MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); lua_pushbooleancpp(L, FMVPtr->unloadMovie()); -#else - lua_pushbooleancpp(L, true); -#endif return 1; } int play(lua_State *L) { -#ifdef USE_THEORADEC MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); lua_pushbooleancpp(L, FMVPtr->play()); -#else - lua_pushbooleancpp(L, true); -#endif return 1; } int pause(lua_State *L) { -#ifdef USE_THEORADEC MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); lua_pushbooleancpp(L, FMVPtr->pause()); -#else - lua_pushbooleancpp(L, true); -#endif return 1; } int update(lua_State *L) { -#ifdef USE_THEORADEC MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); FMVPtr->update(); -#endif return 0; } int isMovieLoaded(lua_State *L) { -#ifdef USE_THEORADEC MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); lua_pushbooleancpp(L, FMVPtr->isMovieLoaded()); -#else - lua_pushbooleancpp(L, true); -#endif return 1; } int isPaused(lua_State *L) { -#ifdef USE_THEORADEC MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); lua_pushbooleancpp(L, FMVPtr->isPaused()); -#else - lua_pushbooleancpp(L, false); -#endif return 1; } int getScaleFactor(lua_State *L) { -#ifdef USE_THEORADEC MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); lua_pushnumber(L, FMVPtr->getScaleFactor()); -#else - lua_pushnumber(L, 1); -#endif return 1; } int setScaleFactor(lua_State *L) { -#ifdef USE_THEORADEC MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); FMVPtr->setScaleFactor(static_cast<float>(luaL_checknumber(L, 1))); -#endif return 0; } int getTime(lua_State *L) { -#ifdef USE_THEORADEC MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); lua_pushnumber(L, FMVPtr->getTime()); -#else - lua_pushnumber(L, 0); -#endif return 1; } @@ -185,7 +149,6 @@ const luaL_reg LIBRARY_FUNCTIONS[] = { { 0, 0 } }; -#ifdef USE_THEORADEC bool MoviePlayer::registerScriptBindings() { ScriptEngine *pScript = Kernel::GetInstance()->GetScript(); BS_ASSERT(pScript); @@ -196,6 +159,5 @@ bool MoviePlayer::registerScriptBindings() { return true; } -#endif } // End of namespace Sword25 |