[Scummvm-cvs-logs] SF.net SVN: scummvm:[53416] scummvm/trunk/engines/sword25

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Oct 13 15:07:17 CEST 2010


Revision: 53416
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53416&view=rev
Author:   thebluegr
Date:     2010-10-13 13:07:16 +0000 (Wed, 13 Oct 2010)

Log Message:
-----------
SWORD25: Added a ENABLE_THEORA define inside fmv/theora_decoder.h

This define can be used to disable building of the Theora decoder, and thus makes
libtheora optional (therefore resolving an item in the Sword25 TODO). Disabling the
Theora decoder will effectively disable the game's videos

Note that running the game with the Theora decoder disabled is still untested

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/fmv/movieplayer.cpp
    scummvm/trunk/engines/sword25/fmv/movieplayer.h
    scummvm/trunk/engines/sword25/fmv/movieplayer_script.cpp
    scummvm/trunk/engines/sword25/fmv/theora_decoder.cpp
    scummvm/trunk/engines/sword25/fmv/theora_decoder.h
    scummvm/trunk/engines/sword25/fmv/yuvtorgba.cpp
    scummvm/trunk/engines/sword25/fmv/yuvtorgba.h
    scummvm/trunk/engines/sword25/kernel/kernel.cpp
    scummvm/trunk/engines/sword25/kernel/kernel.h

Modified: scummvm/trunk/engines/sword25/fmv/movieplayer.cpp
===================================================================
--- scummvm/trunk/engines/sword25/fmv/movieplayer.cpp	2010-10-13 12:57:01 UTC (rev 53415)
+++ scummvm/trunk/engines/sword25/fmv/movieplayer.cpp	2010-10-13 13:07:16 UTC (rev 53416)
@@ -46,9 +46,14 @@
 #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 @@
 	return _decoder.getElapsedTime() / 1000.0;
 }
 
+#endif
+
 } // End of namespace Sword25

Modified: scummvm/trunk/engines/sword25/fmv/movieplayer.h
===================================================================
--- scummvm/trunk/engines/sword25/fmv/movieplayer.h	2010-10-13 12:57:01 UTC (rev 53415)
+++ scummvm/trunk/engines/sword25/fmv/movieplayer.h	2010-10-13 13:07:16 UTC (rev 53416)
@@ -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 @@
 } // End of namespace Sword25
 
 #endif
+
+#endif

Modified: scummvm/trunk/engines/sword25/fmv/movieplayer_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/fmv/movieplayer_script.cpp	2010-10-13 12:57:01 UTC (rev 53415)
+++ scummvm/trunk/engines/sword25/fmv/movieplayer_script.cpp	2010-10-13 13:07:16 UTC (rev 53416)
@@ -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 @@
 	{ 0, 0 }
 };
 
+#ifdef ENABLE_THEORA
 bool MoviePlayer::registerScriptBindings() {
 	Kernel *pKernel = Kernel::GetInstance();
 	BS_ASSERT(pKernel);
@@ -159,5 +196,6 @@
 
 	return true;
 }
+#endif
 
 } // End of namespace Sword25

Modified: scummvm/trunk/engines/sword25/fmv/theora_decoder.cpp
===================================================================
--- scummvm/trunk/engines/sword25/fmv/theora_decoder.cpp	2010-10-13 12:57:01 UTC (rev 53415)
+++ scummvm/trunk/engines/sword25/fmv/theora_decoder.cpp	2010-10-13 13:07:16 UTC (rev 53416)
@@ -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 @@
 }
 
 } // End of namespace Sword25
+
+#endif

Modified: scummvm/trunk/engines/sword25/fmv/theora_decoder.h
===================================================================
--- scummvm/trunk/engines/sword25/fmv/theora_decoder.h	2010-10-13 12:57:01 UTC (rev 53415)
+++ scummvm/trunk/engines/sword25/fmv/theora_decoder.h	2010-10-13 13:07:16 UTC (rev 53416)
@@ -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 @@
 } // End of namespace Sword25
 
 #endif
+
+#endif

Modified: scummvm/trunk/engines/sword25/fmv/yuvtorgba.cpp
===================================================================
--- scummvm/trunk/engines/sword25/fmv/yuvtorgba.cpp	2010-10-13 12:57:01 UTC (rev 53415)
+++ scummvm/trunk/engines/sword25/fmv/yuvtorgba.cpp	2010-10-13 13:07:16 UTC (rev 53416)
@@ -34,6 +34,8 @@
 
 #include "sword25/fmv/yuvtorgba.h"
 
+#ifdef ENABLE_THEORA
+
 namespace Sword25 {
 
 static const int PRECISION = 32768;
@@ -241,3 +243,5 @@
 }
 
 } // End of namespace Sword25
+
+#endif

Modified: scummvm/trunk/engines/sword25/fmv/yuvtorgba.h
===================================================================
--- scummvm/trunk/engines/sword25/fmv/yuvtorgba.h	2010-10-13 12:57:01 UTC (rev 53415)
+++ scummvm/trunk/engines/sword25/fmv/yuvtorgba.h	2010-10-13 13:07:16 UTC (rev 53416)
@@ -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 @@
 } // End of namespace Sword25
 
 #endif
+
+#endif

Modified: scummvm/trunk/engines/sword25/kernel/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/kernel.cpp	2010-10-13 12:57:01 UTC (rev 53415)
+++ scummvm/trunk/engines/sword25/kernel/kernel.cpp	2010-10-13 13:07:16 UTC (rev 53416)
@@ -430,12 +430,14 @@
 
 // -----------------------------------------------------------------------------
 
+#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
 
 // -----------------------------------------------------------------------------
 

Modified: scummvm/trunk/engines/sword25/kernel/kernel.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/kernel.h	2010-10-13 12:57:01 UTC (rev 53415)
+++ scummvm/trunk/engines/sword25/kernel/kernel.h	2010-10-13 13:07:16 UTC (rev 53416)
@@ -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 @@
 	 * 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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list