[Scummvm-git-logs] scummvm master -> 7648fd346f34cbd88ffb318d4fcbea4812ca6b27

dreammaster noreply at scummvm.org
Sun Dec 24 09:01:36 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:
7648fd346f M4: Beginnings of derived console class for Orion Burger


Commit: 7648fd346f34cbd88ffb318d4fcbea4812ca6b27
    https://github.com/scummvm/scummvm/commit/7648fd346f34cbd88ffb318d4fcbea4812ca6b27
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-23T23:01:22-10:00

Commit Message:
M4: Beginnings of derived console class for Orion Burger

Changed paths:
  A engines/m4/burger/console.cpp
  A engines/m4/burger/console.h
    engines/m4/burger/burger.cpp
    engines/m4/burger/burger.h
    engines/m4/console.cpp
    engines/m4/console.h
    engines/m4/m4.cpp
    engines/m4/m4.h
    engines/m4/module.mk
    engines/m4/riddle/riddle.cpp
    engines/m4/riddle/riddle.h


diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 3feafbe68d5..dd4214418e6 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -21,6 +21,7 @@
 
 #include "common/debug.h"
 #include "m4/burger/burger.h"
+#include "m4/burger/console.h"
 #include "m4/burger/vars.h"
 #include "m4/burger/core/conv.h"
 #include "m4/burger/gui/gui_gizmo.h"
@@ -161,6 +162,10 @@ M4::Vars *BurgerEngine::createVars() {
 	return new Burger::Vars();
 }
 
+void BurgerEngine::setupConsole() {
+	setDebugger(new Burger::Console());
+}
+
 void BurgerEngine::showEngineInfo() {
 	debug("Orion Burger\n");
 	debug("Game Version %s -- %s\n", "Giraffe", "September 27, 1996");
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 0a141a1ea66..3bc2ac7d668 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -67,6 +67,11 @@ protected:
 	 */
 	M4::Vars *createVars() override;
 
+	/**
+	 * Sets up the debugging console
+	 */
+	void setupConsole() override;
+
 public:
 	BurgerEngine(OSystem *syst, const M4GameDescription *gameDesc);
 	~BurgerEngine() override;
diff --git a/engines/m4/burger/console.cpp b/engines/m4/burger/console.cpp
new file mode 100644
index 00000000000..a9c4ea1597f
--- /dev/null
+++ b/engines/m4/burger/console.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "m4/burger/console.h"
+#include "m4/burger/vars.h"
+#include "m4/burger/burger.h"
+
+namespace M4 {
+namespace Burger {
+
+Console::Console() : M4::Console() {
+	registerCmd("test", WRAP_METHOD(Console, cmdTest));
+}
+
+bool Console::cmdTest(int argc, const char **argv) {
+	int tests = _G(flags)[kFirstTestPassed] ? 1 : 0 +
+		_G(flags)[kSecondTestPassed] ? 1 : 0 +
+		_G(flags)[kThirdTestPassed] ? 1 : 0 +
+		_G(flags)[kFourthTestPassed] ? 1 : 0 +
+		_G(flags)[kFifthTestPassed] ? 1 : 0;
+
+	debugPrintf("Tests passed = %d\n", tests);
+	return true;
+}
+
+
+} // End of namespace Burger
+} // End of namespace M4
diff --git a/engines/m4/burger/console.h b/engines/m4/burger/console.h
new file mode 100644
index 00000000000..b7e268d6959
--- /dev/null
+++ b/engines/m4/burger/console.h
@@ -0,0 +1,44 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef M4_BURGER_CONSOLE_H
+#define M4_BURGER_CONSOLE_H
+
+#include "m4/console.h"
+
+namespace M4 {
+namespace Burger {
+
+class Console : public M4::Console {
+private:
+	bool cmdTest(int argc, const char **argv);
+
+public:
+	Console();
+	~Console() override {
+	}
+};
+
+} // End of namespace Burger
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 5b6a81eb50c..8378c73d38e 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -20,8 +20,10 @@
  */
 
 #include "m4/console.h"
+#include "m4/m4.h"
 #include "m4/vars.h"
 #include "m4/burger/vars.h"
+#include "m4/burger/burger.h"
 
 namespace M4 {
 
@@ -34,9 +36,6 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("trigger",   WRAP_METHOD(Console, cmdTrigger));
 }
 
-Console::~Console() {
-}
-
 bool Console::cmdTeleport(int argc, const char **argv) {
 	if (argc == 2) {
 		_G(game).setRoom(atol(argv[1]));
diff --git a/engines/m4/console.h b/engines/m4/console.h
index a92d218cabd..b7a2848497c 100644
--- a/engines/m4/console.h
+++ b/engines/m4/console.h
@@ -29,7 +29,6 @@ namespace M4 {
 
 class Console : public GUI::Debugger {
 private:
-	bool cmdTest(int argc, const char **argv);
 	bool cmdTeleport(int argc, const char **argv);
 	bool cmdGlobal(int argc, const char **argv);
 	bool cmdItem(int argc, const char **argv);
@@ -39,7 +38,7 @@ private:
 
 public:
 	Console();
-	~Console() override;
+	~Console() override {}
 };
 
 } // End of namespace M4
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 61abe98acdc..67bdb7b5bdd 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -70,6 +70,7 @@ Common::Language M4Engine::getLanguage() const {
 	return _gameDescription->desc.language;
 }
 
+
 Common::Error M4Engine::run() {
 	// Initialize 320x200 paletted graphics mode
 	initGraphics(640, 480);
@@ -79,7 +80,7 @@ Common::Error M4Engine::run() {
 
 	if (vars->init()) {
 		// Set the console
-		setDebugger(new Console());
+		setupConsole();
 
 		// Check for launcher savegame to load
 		_useOriginalSaveLoad = ConfMan.getBool("original_menus");
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index a996fcad7ac..51349b24a38 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -69,6 +69,11 @@ protected:
 	 */
 	virtual Vars *createVars() = 0;
 
+	/**
+	 * Sets up the debugging console
+	 */
+	virtual void setupConsole() = 0;
+
 public:
 	Graphics::Screen *_screen = nullptr;
 
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 35a041d0d57..9868d874ca1 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -172,6 +172,7 @@ MODULE_OBJS = \
 	burger/rooms/section9/room951.o \
 	burger/rooms/section9/room971.o \
 	burger/burger.o \
+	burger/console.o \
 	burger/flags.o \
 	burger/hotkeys.o \
 	burger/inventory.o \
diff --git a/engines/m4/riddle/riddle.cpp b/engines/m4/riddle/riddle.cpp
index e8a7a452991..9216ee4f0e5 100644
--- a/engines/m4/riddle/riddle.cpp
+++ b/engines/m4/riddle/riddle.cpp
@@ -23,6 +23,7 @@
 #include "m4/riddle/riddle.h"
 #include "m4/riddle/vars.h"
 #include "m4/core/errors.h"
+#include "m4/console.h"
 
 namespace M4 {
 namespace Riddle {
@@ -44,6 +45,10 @@ M4::Vars *RiddleEngine::createVars() {
 	return new Riddle::Vars();
 }
 
+void RiddleEngine::setupConsole() {
+	setDebugger(new M4::Console());
+}
+
 void RiddleEngine::showEngineInfo() {
 	debug("The Riddle of Master Lu\n");
 	debug("Game Version %s -- %s\n", "2.05", "Dec 14, 1995");
diff --git a/engines/m4/riddle/riddle.h b/engines/m4/riddle/riddle.h
index cf7b7c10f96..57f0bd9cfd0 100644
--- a/engines/m4/riddle/riddle.h
+++ b/engines/m4/riddle/riddle.h
@@ -53,6 +53,11 @@ protected:
 	 */
 	M4::Vars *createVars() override;
 
+	/**
+	 * Sets up the debugging console
+	 */
+	void setupConsole() override;
+
 public:
 	RiddleEngine(OSystem *syst, const M4GameDescription *gameDesc);
 	~RiddleEngine() override {}




More information about the Scummvm-git-logs mailing list