[Scummvm-git-logs] scummvm master -> 83707bfa7fde9a6259facd627050d865eaac33d3

dreammaster noreply at scummvm.org
Mon Feb 13 04:23:02 UTC 2023


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:
83707bfa7f MM: Set up Xeen and MM1 as their own sub-engines


Commit: 83707bfa7fde9a6259facd627050d865eaac33d3
    https://github.com/scummvm/scummvm/commit/83707bfa7fde9a6259facd627050d865eaac33d3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-12T20:22:43-08:00

Commit Message:
MM: Set up Xeen and MM1 as their own sub-engines

Changed paths:
    engines/mm/configure.engine
    engines/mm/detection.cpp
    engines/mm/detection_tables.h
    engines/mm/metaengine.cpp
    engines/mm/module.mk
    engines/mm/shared/xeen/file.cpp
    engines/mm/shared/xeen/file.h


diff --git a/engines/mm/configure.engine b/engines/mm/configure.engine
index 98e48a9ede9..a0ae11630d4 100644
--- a/engines/mm/configure.engine
+++ b/engines/mm/configure.engine
@@ -1,3 +1,5 @@
 # This file is included from the main "configure" script
 # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine mm "Might and Magic" yes
+add_engine mm "Might and Magic" no "mm1 xeen"
+add_engine mm1 "Might and Magic 1" no
+add_engine xeen "Might and Magic Xeen" yes
diff --git a/engines/mm/detection.cpp b/engines/mm/detection.cpp
index e87b2db6d15..5fe7b5dcc71 100644
--- a/engines/mm/detection.cpp
+++ b/engines/mm/detection.cpp
@@ -26,13 +26,17 @@
 #include "mm/mm.h"
 
 static const PlainGameDescriptor MIGHT_AND_MAGIC_GAMES[] = {
+#ifdef ENABLE_MM1
 	{ "mm1", "Might and Magic: Book One - Secret of the Inner Sanctum"},
 	{ "mm1_enh", "Might and Magic: Book One - Secret of the Inner Sanctum - Enhanced"},
+#endif
+#ifdef ENABLE_XEEN
 	{ "cloudsofxeen", "Might and Magic IV: Clouds of Xeen" },
 	{ "darksideofxeen", "Might and Magic V: Darkside of Xeen" },
 	{ "worldofxeen", "Might and Magic: World of Xeen" },
 	{ "swordsofxeen", "Might and Magic: Swords of Xeen" },
-	{0, 0}
+#endif
+	{ 0, 0 }
 };
 
 static const DebugChannelDef DEBUG_FLAT_LIST[] = {
diff --git a/engines/mm/detection_tables.h b/engines/mm/detection_tables.h
index f97f2542999..acdf564e1e9 100644
--- a/engines/mm/detection_tables.h
+++ b/engines/mm/detection_tables.h
@@ -22,6 +22,7 @@
 namespace MM {
 
 static const MightAndMagicGameDescription GAME_DESCRIPTIONS[] = {
+#ifdef ENABLE_MM1
 	{
 		// Might and Magic 1
 		{
@@ -51,7 +52,9 @@ static const MightAndMagicGameDescription GAME_DESCRIPTIONS[] = {
 		GType_MightAndMagic1,
 		GF_ENHANCED
 	},
+#endif
 
+#ifdef ENABLE_XEEN
 	{
 		// World of Xeen
 		{
@@ -320,6 +323,7 @@ static const MightAndMagicGameDescription GAME_DESCRIPTIONS[] = {
 		GType_Swords,
 		0
 	},
+#endif
 
 	{ AD_TABLE_END_MARKER, 0, 0 }
 };
diff --git a/engines/mm/metaengine.cpp b/engines/mm/metaengine.cpp
index 125b1ea47f3..85a62110f25 100644
--- a/engines/mm/metaengine.cpp
+++ b/engines/mm/metaengine.cpp
@@ -29,11 +29,15 @@
 #include "common/translation.h"
 
 #include "mm/detection.h"
+#ifdef ENABLE_MM1
 #include "mm/mm1/mm1.h"
+#endif
+#ifdef ENABLE_XEEN
 #include "mm/xeen/xeen.h"
 #include "mm/xeen/metaengine.h"
 #include "mm/xeen/worldofxeen/worldofxeen.h"
 #include "mm/xeen/swordsofxeen/swordsofxeen.h"
+#endif
 
 class MMMetaEngine : public AdvancedMetaEngine {
 private:
@@ -67,9 +71,12 @@ Common::Error MMMetaEngine::createInstance(OSystem *syst, Engine **engine, const
 	const MM::MightAndMagicGameDescription *gd = (const MM::MightAndMagicGameDescription *)desc;
 
 	switch (gd->gameID) {
+#ifdef ENABLE_MM1
 	case MM::GType_MightAndMagic1:
 		*engine = new MM::MM1::MM1Engine(syst, gd);
 		break;
+#endif
+#ifdef ENABLE_XEEN
 	case MM::GType_Clouds:
 	case MM::GType_DarkSide:
 	case MM::GType_WorldOfXeen:
@@ -78,6 +85,7 @@ Common::Error MMMetaEngine::createInstance(OSystem *syst, Engine **engine, const
 	case MM::GType_Swords:
 		*engine = new MM::Xeen::SwordsOfXeen::SwordsOfXeenEngine(syst, gd);
 		break;
+#endif
 	default:
 		return Common::kUnsupportedGameidError;
 	}
@@ -86,25 +94,30 @@ Common::Error MMMetaEngine::createInstance(OSystem *syst, Engine **engine, const
 }
 
 SaveStateList MMMetaEngine::listSaves(const char *target) const {
+#ifdef ENABLE_XEEN
 	if (isXeenGame(target))
 		// Fallback original code for Xeen
 		return MM::Xeen::XeenMetaEngine::listSaves(this, target);
-
+#endif
 	return AdvancedMetaEngine::listSaves(target);
 }
 
 SaveStateDescriptor MMMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+#ifdef ENABLE_XEEN
 	if (isXeenGame(target))
 		// Fallback original code for Xeen
 		return MM::Xeen::XeenMetaEngine::querySaveMetaInfos(this, target, slot);
+#endif
 
 	return AdvancedMetaEngine::querySaveMetaInfos(target, slot);
 }
 
 Common::KeymapArray MMMetaEngine::initKeymaps(const char *target) const {
+#ifdef ENABLE_MM1
 	const Common::String gameId = getGameId(target);
 	if (gameId == "mm1" || gameId == "mm1_enh")
 		return MM::MM1::MetaEngine::initKeymaps();
+#endif
 
 	return Common::KeymapArray();
 }
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index 69969865f3b..0f052310a0a 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -8,6 +8,13 @@ MODULE_OBJS := \
 	utils/strings.o \
 	utils/strings_data.o \
 	utils/xeen_font.o \
+	shared/xeen/cc_archive.o \
+	shared/xeen/file.o \
+	shared/xeen/sprites.o \
+	shared/xeen/xsurface.o
+
+ifdef ENABLE_MM1
+MODULE_OBJS += \
 	mm1/console.o \
 	mm1/events.o \
 	mm1/globals.o \
@@ -187,7 +194,11 @@ MODULE_OBJS := \
 	mm1/maps/map51.o \
 	mm1/maps/map52.o \
 	mm1/maps/map53.o \
-	mm1/maps/map54.o \
+	mm1/maps/map54.o
+endif
+
+ifdef ENABLE_XEEN
+MODULE_OBJS += \
 	xeen/worldofxeen/clouds_cutscenes.o \
 	xeen/worldofxeen/darkside_cutscenes.o \
 	xeen/worldofxeen/worldofxeen_cutscenes.o \
@@ -245,11 +256,8 @@ MODULE_OBJS := \
 	xeen/sprites.o \
 	xeen/subtitles.o \
 	xeen/window.o \
-	xeen/xeen.o \
-	shared/xeen/cc_archive.o \
-	shared/xeen/file.o \
-	shared/xeen/sprites.o \
-	shared/xeen/xsurface.o
+	xeen/xeen.o
+endif
 
 # This module can be built as a plugin
 ifeq ($(ENABLE_MM), DYNAMIC_PLUGIN)
diff --git a/engines/mm/shared/xeen/file.cpp b/engines/mm/shared/xeen/file.cpp
index 5d50021d8b6..f31fd216552 100644
--- a/engines/mm/shared/xeen/file.cpp
+++ b/engines/mm/shared/xeen/file.cpp
@@ -20,14 +20,15 @@
  */
 
 #include "mm/shared/xeen/file.h"
+#ifdef ENABLE_XEEN
 #include "mm/xeen/files.h"
 #include "mm/xeen/xeen.h"
+#endif
 
 namespace MM {
 namespace Shared {
 namespace Xeen {
 
-
 File::File(const Common::String &filename) {
 	File::open(filename);
 }
@@ -36,11 +37,14 @@ File::File(const Common::String &filename, Common::Archive &archive) {
 	File::open(filename, archive);
 }
 
+#ifdef ENABLE_XEEN
 File::File(const Common::String &filename, int ccMode) {
 	File::open(filename, ccMode);
 }
+#endif
 
 bool File::open(const Common::Path &filename) {
+#ifdef ENABLE_XEEN
 	MM::Xeen::XeenEngine *engine = dynamic_cast<MM::Xeen::XeenEngine *>(g_engine);
 
 	if (engine) {
@@ -57,6 +61,10 @@ bool File::open(const Common::Path &filename) {
 		if (!Common::File::open(filename))
 			error("Could not open file - %s", filename.toString().c_str());
 	}
+#else
+	if (!Common::File::open(filename))
+		error("Could not open file - %s", filename.toString().c_str());
+#endif
 
 	return true;
 }
@@ -67,6 +75,7 @@ bool File::open(const Common::Path &filename, Common::Archive &archive) {
 	return true;
 }
 
+#ifdef ENABLE_XEEN
 bool File::open(const Common::String &filename, int ccMode) {
 	MM::Xeen::XeenEngine *engine = dynamic_cast<MM::Xeen::XeenEngine *>(g_engine);
 	assert(engine);
@@ -112,6 +121,7 @@ void File::setCurrentArchive(int ccMode) {
 
 	assert(fm._currentArchive);
 }
+#endif
 
 Common::String File::readString() {
 	Common::String result;
@@ -124,6 +134,7 @@ Common::String File::readString() {
 }
 
 bool File::exists(const Common::String &filename) {
+#ifdef ENABLE_XEEN
 	MM::Xeen::XeenEngine *engine = dynamic_cast<MM::Xeen::XeenEngine *>(g_engine);
 
 	if (engine) {
@@ -140,8 +151,12 @@ bool File::exists(const Common::String &filename) {
 	} else {
 		return Common::File::exists(filename);
 	}
+#else
+	return Common::File::exists(filename);
+#endif
 }
 
+#ifdef ENABLE_XEEN
 bool File::exists(const Common::String &filename, int ccMode) {
 	MM::Xeen::XeenEngine *engine = dynamic_cast<MM::Xeen::XeenEngine *>(g_engine);
 	assert(engine);
@@ -154,6 +169,7 @@ bool File::exists(const Common::String &filename, int ccMode) {
 
 	return result;
 }
+#endif
 
 bool File::exists(const Common::String &filename, Common::Archive &archive) {
 	return archive.hasFile(filename);
diff --git a/engines/mm/shared/xeen/file.h b/engines/mm/shared/xeen/file.h
index d2dc5b7aaf9..8da8cba0dca 100644
--- a/engines/mm/shared/xeen/file.h
+++ b/engines/mm/shared/xeen/file.h
@@ -36,10 +36,12 @@ namespace Xeen {
 class File : public Common::File {
 private:
 public:
+#ifdef ENABLE_XEEN
 	/**
 	 * Sets which archive is used by default
 	 */
 	static void setCurrentArchive(int ccMode);
+#endif
 
 	/**
 	 * Synchronizes a boolean array as a bitfield set
@@ -49,10 +51,11 @@ public:
 	File() : Common::File() {
 	}
 	File(const Common::String &filename);
-	File(const Common::String &filename, int ccMode);
 	File(const Common::String &filename, Common::Archive &archive);
-	~File() override {
-	}
+#ifdef ENABLE_XEEN
+	File(const Common::String &filename, int ccMode);
+#endif
+	~File() override {}
 
 	/**
 	 * Opens the given file, throwing an error if it can't be opened
@@ -63,11 +66,12 @@ public:
 	 * Opens the given file, throwing an error if it can't be opened
 	 */
 	bool open(const Common::Path &filename, Common::Archive &archive) override;
-
+#ifdef ENABLE_XEEN
 	/**
 	 * Opens the given file, throwing an error if it can't be opened
 	 */
 	virtual bool open(const Common::String &filename, int ccMode);
+#endif
 
 	/**
 	 * Opens the given file
@@ -96,6 +100,7 @@ public:
 	 */
 	static bool exists(const Common::String &filename);
 
+#ifdef ENABLE_XEEN
 	/**
 	 * Checks if a given file exists
 	 *
@@ -104,6 +109,7 @@ public:
 	 * @return	true if the file exists, false otherwise
 	 */
 	static bool exists(const Common::String &filename, int ccMode);
+#endif
 
 	/**
 	 * Checks if a given file exists




More information about the Scummvm-git-logs mailing list