[Scummvm-git-logs] scummvm master -> 32dbd828dce7d1a501191aa9c2d79bc0c74cab24

digitall noreply at scummvm.org
Sat Jul 23 21:57:05 UTC 2022


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:
32dbd828dc SAGA2: Add Automap Cheat to Console Command


Commit: 32dbd828dce7d1a501191aa9c2d79bc0c74cab24
    https://github.com/scummvm/scummvm/commit/32dbd828dce7d1a501191aa9c2d79bc0c74cab24
Author: D G Turner (digitall at scummvm.org)
Date: 2022-07-23T22:56:45+01:00

Commit Message:
SAGA2: Add Automap Cheat to Console Command

Changed paths:
    engines/saga2/automap.cpp
    engines/saga2/automap.h
    engines/saga2/console.cpp
    engines/saga2/console.h


diff --git a/engines/saga2/automap.cpp b/engines/saga2/automap.cpp
index e9f6376cfb2..133876a9bef 100644
--- a/engines/saga2/automap.cpp
+++ b/engines/saga2/automap.cpp
@@ -49,7 +49,7 @@ extern GameWorld            *currentWorld;
 
 requestInfo     rInfo;
 
-static AutoMap     *pAutoMap = nullptr;
+AutoMap *pAutoMap = nullptr;
 
 /* ===================================================================== *
    Constants
diff --git a/engines/saga2/automap.h b/engines/saga2/automap.h
index 7738e7b73ba..b5224153c2a 100644
--- a/engines/saga2/automap.h
+++ b/engines/saga2/automap.h
@@ -80,6 +80,9 @@ public:
 	APPFUNCV(cmdAutoMapPgDn);
 
 	gPanel *keyTest(int16 key);
+
+	void setCheatFlag(bool flag) { _autoMapCheat = flag; }
+	bool getCheatFlag() { return _autoMapCheat; }
 private:
 	bool activate(gEventType why);       // activate the control
 	void deactivate();
diff --git a/engines/saga2/console.cpp b/engines/saga2/console.cpp
index 13fb44e8fa9..23d8ae06f3a 100644
--- a/engines/saga2/console.cpp
+++ b/engines/saga2/console.cpp
@@ -25,6 +25,7 @@
 #include "image/png.h"
 
 #include "saga2/saga2.h"
+#include "saga2/automap.h"
 #include "saga2/objects.h"
 #include "saga2/player.h"
 #include "saga2/mapfeatr.h"
@@ -36,6 +37,7 @@ namespace Saga2 {
 
 extern GameObject *objectList;
 extern WorldMapData *mapList;
+extern AutoMap *pAutoMap;
 
 Console::Console(Saga2Engine *vm) : GUI::Debugger() {
 	_vm = vm;
@@ -89,6 +91,8 @@ Console::Console(Saga2Engine *vm) : GUI::Debugger() {
 	registerCmd("play_voice", WRAP_METHOD(Console, cmdPlayVoice));
 
 	registerCmd("invis", WRAP_METHOD(Console, cmdInvisibility));
+
+	registerCmd("map_cheat", WRAP_METHOD(Console, cmdMapCheat));
 }
 
 Console::~Console() {
@@ -468,4 +472,17 @@ bool Console::cmdInvisibility(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdMapCheat(int argc, const char **argv) {
+	if (argc != 2)
+		debugPrintf("Usage: %s <1/0>\n", argv[0]);
+	else {
+		bool cheat = atoi(argv[1]);
+		if (pAutoMap) {
+			pAutoMap->setCheatFlag(cheat);
+		}
+	}
+
+	return true;
+}
+
 }
diff --git a/engines/saga2/console.h b/engines/saga2/console.h
index df677f4d02e..6db905dc00f 100644
--- a/engines/saga2/console.h
+++ b/engines/saga2/console.h
@@ -114,6 +114,9 @@ private:
 
 	// Input: <1/0>. Sets the invisibility effect on the party.
 	bool cmdInvisibility(int argc, const char **argv);
+
+	// Input: <1/0>. Sets state of Automap cheat for testing.
+	bool cmdMapCheat(int argc, const char **argv);
 };
 
 }




More information about the Scummvm-git-logs mailing list