[Scummvm-git-logs] scummvm master -> 08544fd7524a347e433fcbe1636cf3a63f5e84c9

bluegr noreply at scummvm.org
Sun Dec 15 19:37:27 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
08544fd752 TSAGE: Split engine into multiple subengines


Commit: 08544fd7524a347e433fcbe1636cf3a63f5e84c9
    https://github.com/scummvm/scummvm/commit/08544fd7524a347e433fcbe1636cf3a63f5e84c9
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2024-12-15T21:37:24+02:00

Commit Message:
TSAGE: Split engine into multiple subengines

Changed paths:
    engines/tsage/configure.engine
    engines/tsage/core.cpp
    engines/tsage/debugger.cpp
    engines/tsage/debugger.h
    engines/tsage/globals.cpp
    engines/tsage/module.mk
    engines/tsage/tsage.cpp


diff --git a/engines/tsage/configure.engine b/engines/tsage/configure.engine
index 2b8edf8266b..51c5b6a856b 100644
--- a/engines/tsage/configure.engine
+++ b/engines/tsage/configure.engine
@@ -1,3 +1,6 @@
 # This file is included from the main "configure" script
 # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine tsage "TsAGE" yes
+add_engine tsage "TsAGE" yes "ringworld blueforce ringworld2"
+add_engine ringworld "Ringworld: Revenge of the Patriarch" yes
+add_engine blueforce "Blue Force" yes
+add_engine ringworld2 "Return to Ringworld" yes
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 9d1c58cfce7..061bf3fce04 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -1597,10 +1597,13 @@ bool SceneItem::startAction(CursorType action, Event &event) {
 }
 
 void SceneItem::doAction(int action) {
+#ifdef ENABLE_RINGWORLD2
 	if (g_vm->getGameID() == GType_Ringworld2) {
 		Event dummyEvent;
 		((Ringworld2::SceneExt *)GLOBALS._sceneManager._scene)->display((CursorType)action, dummyEvent);
-	} else {
+	} else
+#endif
+	{
 		const char *msg = NULL;
 
 		if (g_vm->getLanguage() == Common::ES_ESP) {
@@ -1921,11 +1924,14 @@ void SceneHotspot::synchronize(Serializer &s) {
 
 bool SceneHotspot::startAction(CursorType action, Event &event) {
 	switch (g_vm->getGameID()) {
+#ifdef ENABLE_BLUEFORCE
 	case GType_BlueForce: {
 		BlueForce::SceneExt *scene = (BlueForce::SceneExt *)BF_GLOBALS._sceneManager._scene;
 		assert(scene);
 		return scene->display(action);
 	}
+#endif
+#ifdef ENABLE_RINGWORLD2
 	case GType_Ringworld2: {
 		switch (action) {
 		case CURSOR_LOOK:
@@ -1952,6 +1958,7 @@ bool SceneHotspot::startAction(CursorType action, Event &event) {
 
 		return ((Ringworld2::SceneExt *)GLOBALS._sceneManager._scene)->display(action, event);
 	}
+#endif
 	default:
 		return SceneItem::startAction(action, event);
 	}
@@ -2887,6 +2894,7 @@ void SceneObject::draw() {
 	GfxSurface frame = getFrame();
 	Region *priorityRegion = scene->_priorities.find(_priority);
 
+#ifdef ENABLE_RINGWORLD2
 	if (g_vm->getGameID() == GType_Ringworld2) {
 		switch (_effect) {
 		case EFFECT_SHADOW_MAP: {
@@ -2901,6 +2909,7 @@ void SceneObject::draw() {
 			break;
 		}
 	}
+#endif
 
 	GLOBALS.gfxManager().copyFrom(frame, destRect, priorityRegion);
 }
@@ -3011,10 +3020,12 @@ void BackgroundSceneObject::setup2(int visage, int stripFrameNum, int frameNum,
 void BackgroundSceneObject::copySceneToBackground() {
 	GLOBALS._sceneManager._scene->_backSurface.copyFrom(g_globals->gfxManager().getSurface(), 0, 0);
 
+#ifdef ENABLE_RINGWORLD2
 	// WORKAROUND: Since savegames don't store the active screen data, once we copy the
 	// foreground objects to the background, we have to prevent the scene being saved.
 	if (g_vm->getGameID() == GType_Ringworld2)
 		((Ringworld2::SceneExt *)GLOBALS._sceneManager._scene)->_preventSaving = true;
+#endif
 }
 
 /*--------------------------------------------------------------------------*/
diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp
index 0c66af23c42..e84f2458654 100644
--- a/engines/tsage/debugger.cpp
+++ b/engines/tsage/debugger.cpp
@@ -361,6 +361,8 @@ bool DemoDebugger::Cmd_MoveObject(int argc, const char **argv) {
 	return true;
 }
 
+#ifdef ENABLE_RINGWORLD
+
 /*
  * This command lists the objects available, and their ID
  */
@@ -531,6 +533,10 @@ bool RingworldDebugger::Cmd_MoveObject(int argc, const char **argv) {
 	return true;
 }
 
+#endif
+
+#ifdef ENABLE_BLUEFORCE
+
 /*
  * This command lists the objects available, and their ID
  */
@@ -629,6 +635,10 @@ bool BlueForceDebugger::Cmd_MoveObject(int argc, const char **argv) {
 	return true;
 }
 
+#endif
+
+#ifdef ENABLE_RINGWORLD2
+
 /*
  * This command lists the objects available, and their ID
  */
@@ -730,4 +740,7 @@ bool Ringworld2Debugger::Cmd_SetOutpostAlphaDebug(int argc, const char **argv) {
 	R2_GLOBALS._debugCardGame = true;
 	return true;
 }
+
+#endif
+
 } // End of namespace TsAGE
diff --git a/engines/tsage/debugger.h b/engines/tsage/debugger.h
index 0dea0e7973a..d2d44364c85 100644
--- a/engines/tsage/debugger.h
+++ b/engines/tsage/debugger.h
@@ -52,24 +52,30 @@ protected:
 	bool Cmd_MoveObject(int argc, const char **argv) override;
 };
 
+#ifdef ENABLE_RINGWORLD
 class RingworldDebugger : public Debugger {
 protected:
 	bool Cmd_ListObjects(int argc, const char **argv) override;
 	bool Cmd_MoveObject(int argc, const char **argv) override;
 };
+#endif
 
+#ifdef ENABLE_BLUEFORCE
 class BlueForceDebugger : public Debugger {
 protected:
 	bool Cmd_ListObjects(int argc, const char **argv) override;
 	bool Cmd_MoveObject(int argc, const char **argv) override;
 };
+#endif
 
+#ifdef ENABLE_RINGWORLD2
 class Ringworld2Debugger : public Debugger {
 protected:
 	bool Cmd_ListObjects(int argc, const char **argv) override;
 	bool Cmd_MoveObject(int argc, const char **argv) override;
 	bool Cmd_SetOutpostAlphaDebug(int argc, const char **argv) override;
 };
+#endif
 
 } // End of namespace TsAGE
 
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 843649a03e5..c157d3cb129 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -50,8 +50,10 @@ static SavedObject *classFactoryProc(const Common::String &className) {
 	if (className == "PaletteFader") return new PaletteFader();
 	if (className == "SceneText") return new SceneText();
 
+#ifdef ENABLE_RINGWORLD2
 	// Return to Ringworld specific classes
 	if (className == "Scene205_Star") return new Ringworld2::Star();
+#endif
 
 	return NULL;
 }
@@ -135,6 +137,7 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screen),
 	_sceneHandler = nullptr;
 
 	switch (g_vm->getGameID()) {
+#ifdef ENABLE_RINGWORLD
 	case GType_Ringworld:
 		if (!(g_vm->getFeatures() & GF_DEMO)) {
 			_inventory = new Ringworld::RingworldInvObjectList();
@@ -144,18 +147,21 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screen),
 		}
 		_sceneHandler = new SceneHandler();
 		break;
-
+#endif
+#ifdef ENABLE_BLUEFORCE
 	case GType_BlueForce:
 		_game = new BlueForce::BlueForceGame();
 		_inventory = new BlueForce::BlueForceInvObjectList();
 		_sceneHandler = new BlueForce::SceneHandlerExt();
 		break;
-
+#endif
+#ifdef ENABLE_RINGWORLD2
 	case GType_Ringworld2:
 		_inventory = new Ringworld2::Ringworld2InvObjectList();
 		_game = new Ringworld2::Ringworld2Game();
 		_sceneHandler = new Ringworld2::SceneHandlerExt();
 		break;
+#endif
 #ifdef TSAGE_SHERLOCK_ENABLED
 	case GType_Sherlock1:
 		_inventory = nullptr;
@@ -248,6 +254,8 @@ void TsAGE2Globals::synchronize(Serializer &s) {
 
 /*--------------------------------------------------------------------------*/
 
+#ifdef ENABLE_BLUEFORCE
+
 namespace BlueForce {
 
 BlueForceGlobals::BlueForceGlobals(): TsAGE2Globals() {
@@ -420,6 +428,10 @@ bool BlueForceGlobals::removeFlag(int flagNum) {
 
 } // end of namespace BlueForce
 
+#endif
+
+#ifdef ENABLE_RINGWORLD2
+
 namespace Ringworld2 {
 
 Ringworld2Globals::Ringworld2Globals() {
@@ -674,4 +686,6 @@ void Ringworld2Globals::synchronize(Serializer &s) {
 
 } // end of namespace Ringworld2
 
+#endif
+
 } // end of namespace TsAGE
diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk
index 222932b2234..34f674bd53d 100644
--- a/engines/tsage/module.mk
+++ b/engines/tsage/module.mk
@@ -1,6 +1,26 @@
 MODULE := engines/tsage
 
 MODULE_OBJS := \
+	converse.o \
+	core.o \
+	debugger.o \
+	dialogs.o \
+	events.o \
+	globals.o \
+	graphics.o \
+	metaengine.o \
+	resources.o \
+	saveload.o \
+	scenes.o \
+	screen.o \
+	sherlock/sherlock_logo.o \
+	sound.o \
+	staticres.o \
+	tsage.o \
+	user_interface.o
+
+ifdef ENABLE_BLUEFORCE
+MODULE_OBJS += \
 	blue_force/blueforce_dialogs.o \
 	blue_force/blueforce_logic.o \
 	blue_force/blueforce_scenes0.o \
@@ -13,16 +33,11 @@ MODULE_OBJS := \
 	blue_force/blueforce_scenes7.o \
 	blue_force/blueforce_scenes8.o \
 	blue_force/blueforce_scenes9.o \
-	blue_force/blueforce_speakers.o \
-	converse.o \
-	core.o \
-	debugger.o \
-	dialogs.o \
-	events.o \
-	globals.o \
-	graphics.o \
-	metaengine.o \
-	resources.o \
+	blue_force/blueforce_speakers.o
+endif
+
+ifdef ENABLE_RINGWORLD
+MODULE_OBJS += \
 	ringworld/ringworld_demo.o \
 	ringworld/ringworld_dialogs.o \
 	ringworld/ringworld_logic.o \
@@ -34,7 +49,11 @@ MODULE_OBJS := \
 	ringworld/ringworld_scenes6.o \
 	ringworld/ringworld_scenes8.o \
 	ringworld/ringworld_scenes10.o \
-	ringworld/ringworld_speakers.o \
+	ringworld/ringworld_speakers.o
+endif
+
+ifdef ENABLE_RINGWORLD2
+MODULE_OBJS += \
 	ringworld2/ringworld2_airduct.o \
 	ringworld2/ringworld2_dialogs.o \
 	ringworld2/ringworld2_logic.o \
@@ -44,15 +63,8 @@ MODULE_OBJS := \
 	ringworld2/ringworld2_scenes2.o \
 	ringworld2/ringworld2_scenes3.o \
 	ringworld2/ringworld2_speakers.o \
-	ringworld2/ringworld2_vampire.o \
-	saveload.o \
-	scenes.o \
-	screen.o \
-	sherlock/sherlock_logo.o \
-	sound.o \
-	staticres.o \
-	tsage.o \
-	user_interface.o
+	ringworld2/ringworld2_vampire.o
+endif
 
 # This module can be built as a plugin
 ifeq ($(ENABLE_TSAGE), DYNAMIC_PLUGIN)
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index 2d23ad1fe18..f873e46edf6 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -37,16 +37,24 @@ TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc)
 		_gameDescription(gameDesc) {
 	g_vm = this;
 
+#ifdef ENABLE_RINGWORLD
 	if (g_vm->getGameID() == GType_Ringworld) {
 		if (g_vm->getFeatures() & GF_DEMO)
 			setDebugger(new DemoDebugger());
 		else
 			setDebugger(new RingworldDebugger());
-	} else if (g_vm->getGameID() == GType_BlueForce)
+	} else
+#endif
+#ifdef ENABLE_BLUEFORCE
+	if (g_vm->getGameID() == GType_BlueForce)
 		setDebugger(new BlueForceDebugger());
-	else if (g_vm->getGameID() == GType_Ringworld2)
+	else
+#endif
+#ifdef ENABLE_RINGWORLD2
+	if (g_vm->getGameID() == GType_Ringworld2)
 		setDebugger(new Ringworld2Debugger());
-	else if (g_vm->getGameID() == GType_Sherlock1)
+	else
+#endif
 		setDebugger(new DemoDebugger());
 }
 
@@ -74,6 +82,7 @@ void TSageEngine::initialize() {
 
 	// Set up the resource manager
 	g_resourceManager = new ResourceManager();
+#ifdef ENABLE_RINGWORLD
 	if (g_vm->getGameID() == GType_Ringworld) {
 		if (g_vm->getFeatures() & GF_DEMO) {
 			// Add the single library file associated with the demo
@@ -84,7 +93,10 @@ void TSageEngine::initialize() {
 			g_resourceManager->addLib("TSAGE.RLB");
 			g_globals = new Globals();
 		}
-	} else if (g_vm->getGameID() == GType_BlueForce) {
+	} else
+#endif
+#ifdef ENABLE_BLUEFORCE
+	if (g_vm->getGameID() == GType_BlueForce) {
 		g_resourceManager->addLib("BLUE.RLB");
 		if (g_vm->getFeatures() & GF_FLOPPY) {
 			g_resourceManager->addLib("FILES.RLB");
@@ -97,7 +109,10 @@ void TSageEngine::initialize() {
 
 		// Reset all global variables
 		BF_GLOBALS.reset();
-	} else if (g_vm->getGameID() == GType_Ringworld2) {
+	} else
+#endif
+#ifdef ENABLE_RINGWORLD2
+	if (g_vm->getGameID() == GType_Ringworld2) {
 		g_resourceManager->addLib("R2RW.RLB");
 		g_globals = new Ringworld2::Ringworld2Globals();
 
@@ -106,7 +121,9 @@ void TSageEngine::initialize() {
 
 		// Reset all global variables
 		R2_GLOBALS.reset();
-	} else if (g_vm->getGameID() == GType_Sherlock1) {
+	} else
+#endif
+	if (g_vm->getGameID() == GType_Sherlock1) {
 #ifdef TSAGE_SHERLOCK_ENABLED
 		g_resourceManager->addLib("SF3.RLB");
 		g_globals = new Globals();




More information about the Scummvm-git-logs mailing list