diff options
Diffstat (limited to 'engines/sword25')
-rw-r--r-- | engines/sword25/fmv/movieplayer.cpp | 7 | ||||
-rw-r--r-- | engines/sword25/fmv/movieplayer.h | 4 | ||||
-rw-r--r-- | engines/sword25/fmv/movieplayer_script.cpp | 38 | ||||
-rw-r--r-- | engines/sword25/fmv/theora_decoder.cpp | 4 | ||||
-rw-r--r-- | engines/sword25/fmv/theora_decoder.h | 6 | ||||
-rw-r--r-- | engines/sword25/fmv/yuvtorgba.cpp | 4 | ||||
-rw-r--r-- | engines/sword25/fmv/yuvtorgba.h | 5 | ||||
-rw-r--r-- | engines/sword25/kernel/kernel.cpp | 2 | ||||
-rw-r--r-- | engines/sword25/kernel/kernel.h | 4 |
9 files changed, 74 insertions, 0 deletions
diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp index f6757b9a8e..81a39b385d 100644 --- a/engines/sword25/fmv/movieplayer.cpp +++ b/engines/sword25/fmv/movieplayer.cpp @@ -46,9 +46,14 @@ namespace Sword25 { #define FLT_EPSILON 1.192092896e-07F /* smallest such that 1.0+FLT_EPSILON != 1.0 */ Service *OggTheora_CreateObject(Kernel *pKernel) { +#ifdef ENABLE_THEORA return new MoviePlayer(pKernel); +#else + return NULL; +#endif } +#ifdef ENABLE_THEORA MoviePlayer::MoviePlayer(Kernel *pKernel) : Service(pKernel), _decoder(g_system->getMixer()) { if (!registerScriptBindings()) BS_LOG_ERRORLN("Script bindings could not be registered."); @@ -151,4 +156,6 @@ double MoviePlayer::getTime() { return _decoder.getElapsedTime() / 1000.0; } +#endif + } // End of namespace Sword25 diff --git a/engines/sword25/fmv/movieplayer.h b/engines/sword25/fmv/movieplayer.h index 96beb648c0..d661b4cb79 100644 --- a/engines/sword25/fmv/movieplayer.h +++ b/engines/sword25/fmv/movieplayer.h @@ -40,6 +40,8 @@ #include "sword25/fmv/theora_decoder.h" #include "sword25/gfx/bitmap.h" +#ifdef ENABLE_THEORA + namespace Sword25 { class MoviePlayer : public Service { @@ -143,3 +145,5 @@ private: } // End of namespace Sword25 #endif + +#endif diff --git a/engines/sword25/fmv/movieplayer_script.cpp b/engines/sword25/fmv/movieplayer_script.cpp index 13bb149672..7825911525 100644 --- a/engines/sword25/fmv/movieplayer_script.cpp +++ b/engines/sword25/fmv/movieplayer_script.cpp @@ -42,91 +42,127 @@ namespace Sword25 { int loadMovie(lua_State *L) { +#ifdef ENABLE_THEORA 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 ENABLE_THEORA 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 ENABLE_THEORA 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 ENABLE_THEORA 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 ENABLE_THEORA MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); FMVPtr->update(); +#endif return 0; } int isMovieLoaded(lua_State *L) { +#ifdef ENABLE_THEORA 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 ENABLE_THEORA 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 ENABLE_THEORA 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 ENABLE_THEORA 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 ENABLE_THEORA MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); lua_pushnumber(L, FMVPtr->getTime()); +#else + lua_pushnumber(L, 0); +#endif return 1; } @@ -147,6 +183,7 @@ const luaL_reg LIBRARY_FUNCTIONS[] = { { 0, 0 } }; +#ifdef ENABLE_THEORA bool MoviePlayer::registerScriptBindings() { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); @@ -159,5 +196,6 @@ bool MoviePlayer::registerScriptBindings() { return true; } +#endif } // End of namespace Sword25 diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp index 9b1951828e..af69730dea 100644 --- a/engines/sword25/fmv/theora_decoder.cpp +++ b/engines/sword25/fmv/theora_decoder.cpp @@ -37,6 +37,8 @@ */ #include "sword25/fmv/theora_decoder.h" + +#ifdef ENABLE_THEORA #include "sword25/fmv/yuvtorgba.h" #include "common/system.h" #include "sound/decoders/raw.h" @@ -490,3 +492,5 @@ Audio::QueuingAudioStream *TheoraDecoder::createAudioStream() { } } // End of namespace Sword25 + +#endif diff --git a/engines/sword25/fmv/theora_decoder.h b/engines/sword25/fmv/theora_decoder.h index 12d8035c0a..e63f395e6f 100644 --- a/engines/sword25/fmv/theora_decoder.h +++ b/engines/sword25/fmv/theora_decoder.h @@ -26,6 +26,10 @@ #ifndef SWORD25_THEORADECODER_H #define SWORD25_THEORADECODER_H +#define ENABLE_THEORA // comment out to disable the Theora decoder, which effectively disables the game's videos + +#ifdef ENABLE_THEORA + #include "graphics/video/video_decoder.h" #include "sound/audiostream.h" #include "sound/mixer.h" @@ -150,3 +154,5 @@ private: } // End of namespace Sword25 #endif + +#endif diff --git a/engines/sword25/fmv/yuvtorgba.cpp b/engines/sword25/fmv/yuvtorgba.cpp index 12d11b6784..1796388ab8 100644 --- a/engines/sword25/fmv/yuvtorgba.cpp +++ b/engines/sword25/fmv/yuvtorgba.cpp @@ -34,6 +34,8 @@ #include "sword25/fmv/yuvtorgba.h" +#ifdef ENABLE_THEORA + namespace Sword25 { static const int PRECISION = 32768; @@ -241,3 +243,5 @@ void YUVtoBGRA::translate(th_ycbcr_buffer &YUVBuffer, const th_info &theoraInfo, } } // End of namespace Sword25 + +#endif diff --git a/engines/sword25/fmv/yuvtorgba.h b/engines/sword25/fmv/yuvtorgba.h index 15fa85b7e4..16a403acdd 100644 --- a/engines/sword25/fmv/yuvtorgba.h +++ b/engines/sword25/fmv/yuvtorgba.h @@ -36,6 +36,9 @@ #define SWORD25_YUVTORGBA_H #include "sword25/kernel/common.h" +#include "sword25/fmv/theora_decoder.h" // for ENABLE_THEORA + +#ifdef ENABLE_THEORA #include <theora/theora.h> #include <theora/codec.h> @@ -49,3 +52,5 @@ public: } // End of namespace Sword25 #endif + +#endif diff --git a/engines/sword25/kernel/kernel.cpp b/engines/sword25/kernel/kernel.cpp index cccfc6ea53..cbe71edcbb 100644 --- a/engines/sword25/kernel/kernel.cpp +++ b/engines/sword25/kernel/kernel.cpp @@ -430,12 +430,14 @@ ScriptEngine *Kernel::GetScript() { // ----------------------------------------------------------------------------- +#ifdef ENABLE_THEORA /** * 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 29cf1b550c..0962957d10 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -55,6 +55,7 @@ #include "sword25/kernel/common.h" #include "sword25/kernel/window.h" #include "sword25/kernel/resmanager.h" +#include "sword25/fmv/theora_decoder.h" // for ENABLE_THEORA namespace Sword25 { @@ -200,10 +201,13 @@ public: * Returns a pointer to the script engine, or NULL if it is not active */ ScriptEngine *GetScript(); + +#ifdef ENABLE_THEORA /** * Returns a pointer to the movie player, or NULL if it is not active */ MoviePlayer *GetFMV(); +#endif /** * Pauses for the specified amount of time |