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 | |
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')
-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 | ||||
-rw-r--r-- | engines/sword25/gfx/graphicengine.cpp | 3 | ||||
-rw-r--r-- | engines/sword25/kernel/kernel.cpp | 4 | ||||
-rw-r--r-- | engines/sword25/kernel/kernel.h | 2 | ||||
-rw-r--r-- | engines/sword25/kernel/service_ids.h | 4 | ||||
-rw-r--r-- | engines/sword25/module.mk | 4 |
8 files changed, 61 insertions, 61 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 diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index 14dabf9cc4..0a8638a5ec 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -223,9 +223,6 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) { rect = *fillRectPtr; } - if (rect.width() == 800 && rect.height() == 600) - debug(0, "[%d, %d, %d, %d], 0x%08x", rect.left, rect.top, rect.right, rect.bottom, color); - if (rect.width() > 0 && rect.height() > 0) { if (ca == 0xff) { _backSurface.fillRect(rect, color); diff --git a/engines/sword25/kernel/kernel.cpp b/engines/sword25/kernel/kernel.cpp index ba554fe043..3c3505a6b2 100644 --- a/engines/sword25/kernel/kernel.cpp +++ b/engines/sword25/kernel/kernel.cpp @@ -34,9 +34,7 @@ #include "common/system.h" #include "sword25/gfx/graphicengine.h" -#ifdef USE_THEORADEC #include "sword25/fmv/movieplayer.h" -#endif #include "sword25/input/inputengine.h" #include "sword25/kernel/kernel.h" #include "sword25/kernel/persistenceservice.h" @@ -439,14 +437,12 @@ ScriptEngine *Kernel::GetScript() { // ----------------------------------------------------------------------------- -#ifdef USE_THEORADEC /** * Returns a pointer to the movie player, or NULL if it is not active. */ MoviePlayer *Kernel::GetFMV() { return static_cast<MoviePlayer *>(GetService("fmv")); } -#endif // ----------------------------------------------------------------------------- diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index b36e24d05e..9876830053 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -201,12 +201,10 @@ public: */ ScriptEngine *GetScript(); -#ifdef USE_THEORADEC /** * Returns a pointer to the movie player, or NULL if it is not active */ MoviePlayer *GetFMV(); -#endif /** * Pauses for the specified amount of time diff --git a/engines/sword25/kernel/service_ids.h b/engines/sword25/kernel/service_ids.h index 36bc6e2803..2552d279cc 100644 --- a/engines/sword25/kernel/service_ids.h +++ b/engines/sword25/kernel/service_ids.h @@ -55,11 +55,7 @@ Service *InputEngine_CreateObject(Kernel *pKernel); Service *SoundEngine_CreateObject(Kernel *pKernel); Service *LuaScriptEngine_CreateObject(Kernel *pKernel); Service *Geometry_CreateObject(Kernel *pKernel); -#ifdef USE_THEORADEC Service *OggTheora_CreateObject(Kernel *pKernel); -#else -Service *OggTheora_CreateObject(Kernel *pKernel) { return NULL; } -#endif /** diff --git a/engines/sword25/module.mk b/engines/sword25/module.mk index 19f3c1d858..63ccfc5a3c 100644 --- a/engines/sword25/module.mk +++ b/engines/sword25/module.mk @@ -3,6 +3,8 @@ MODULE := engines/sword25 MODULE_OBJS := \ detection.o \ sword25.o \ + fmv/movieplayer.o \ + fmv/movieplayer_script.o \ gfx/animation.o \ gfx/animationdescription.o \ gfx/animationresource.o \ @@ -96,8 +98,6 @@ MODULE_OBJS := \ ifdef USE_THEORADEC MODULE_OBJS += \ - fmv/movieplayer.o \ - fmv/movieplayer_script.o \ fmv/theora_decoder.o \ fmv/yuvtorgba.o endif |