[Scummvm-git-logs] scummvm master -> 2b112dbb40d2c698b540b416d0e7008209fd2704

mgerhardy martin.gerhardy at gmail.com
Tue Dec 15 11:47:12 UTC 2020


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

Summary:
09859f0e34 TWINE: debug output
2d42bcfb62 GUI: added new debugger command to execute a file line by line
510ef40a9d TWINE: missing newlines to console output
2b112dbb40 TWINE: format the code


Commit: 09859f0e340a0643b224d0c38a7a0865c84a3bf6
    https://github.com/scummvm/scummvm/commit/09859f0e340a0643b224d0c38a7a0865c84a3bf6
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-15T12:17:43+01:00

Commit Message:
TWINE: debug output

Changed paths:
    engines/twine/gamestate.h


diff --git a/engines/twine/gamestate.h b/engines/twine/gamestate.h
index a04827ecc4..1941bef949 100644
--- a/engines/twine/gamestate.h
+++ b/engines/twine/gamestate.h
@@ -116,6 +116,7 @@ public:
 
 	inline void setFlag(uint8 index, uint8 value) {
 		gameFlags[index] = value;
+		debug(2, "Set gameflag[%u]=%u", index, value);
 	}
 
 	/**


Commit: 2d42bcfb627b82fc1c254f3a9d79186341bc6f11
    https://github.com/scummvm/scummvm/commit/2d42bcfb627b82fc1c254f3a9d79186341bc6f11
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-15T12:46:07+01:00

Commit Message:
GUI: added new debugger command to execute a file line by line

Changed paths:
    gui/debugger.cpp
    gui/debugger.h


diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index c56a6e09c5..a06ca186e2 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -23,6 +23,7 @@
 // NB: This is really only necessary if USE_READLINE is defined
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
+#include "common/file.h"
 #include "common/debug.h"
 #include "common/debug-channels.h"
 #include "common/system.h"
@@ -72,6 +73,7 @@ Debugger::Debugger() {
 	registerCmd("md5",				WRAP_METHOD(Debugger, cmdMd5));
 	registerCmd("md5mac",			WRAP_METHOD(Debugger, cmdMd5Mac));
 #endif
+	registerCmd("exec",				WRAP_METHOD(Debugger, cmdExecFile));
 
 	registerCmd("debuglevel",		WRAP_METHOD(Debugger, cmdDebugLevel));
 	registerCmd("debugflag_list",		WRAP_METHOD(Debugger, cmdDebugFlagsList));
@@ -764,6 +766,28 @@ bool Debugger::cmdDebugFlagEnable(int argc, const char **argv) {
 	return true;
 }
 
+bool Debugger::cmdExecFile(int argc, const char **argv) {
+	if (argc <= 1) {
+		debugPrintf("Expected to get the file with debug commands\n");
+		return false;
+	}
+	const Common::String filename(argv[1]);
+	Common::File file;
+	if (!file.open(filename)) {
+		debugPrintf("Can't open file %s\n", filename.c_str());
+		return false;
+	}
+	for (;;) {
+		const Common::String &line = file.readLine();
+		if (line.empty()) {
+			break;
+		}
+		parseCommand(line.c_str());
+	}
+
+	return true;
+}
+
 bool Debugger::cmdDebugFlagDisable(int argc, const char **argv) {
 	if (argc < 2) {
 		debugPrintf("debugflag_disable [<flag> | all]\n");
diff --git a/gui/debugger.h b/gui/debugger.h
index c667d1cbe2..dd69a89492 100644
--- a/gui/debugger.h
+++ b/gui/debugger.h
@@ -242,6 +242,7 @@ protected:
 	bool cmdDebugFlagsList(int argc, const char **argv);
 	bool cmdDebugFlagEnable(int argc, const char **argv);
 	bool cmdDebugFlagDisable(int argc, const char **argv);
+	bool cmdExecFile(int argc, const char **argv);
 
 #ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
 private:


Commit: 510ef40a9db169bdd72c65d8fdca81ed70d00c09
    https://github.com/scummvm/scummvm/commit/510ef40a9db169bdd72c65d8fdca81ed70d00c09
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-15T12:46:07+01:00

Commit Message:
TWINE: missing newlines to console output

Changed paths:
    engines/twine/console.cpp


diff --git a/engines/twine/console.cpp b/engines/twine/console.cpp
index a0db2a5e76..e7fa51d79e 100644
--- a/engines/twine/console.cpp
+++ b/engines/twine/console.cpp
@@ -63,40 +63,40 @@ TwinEConsole::~TwinEConsole() {
 	}
 
 bool TwinEConsole::doToggleZoneRendering(int argc, const char **argv) {
-	TOGGLE_DEBUG(_engine->_debugScene->showingZones, "zone rendering")
+	TOGGLE_DEBUG(_engine->_debugScene->showingZones, "zone rendering\n")
 	return true;
 }
 
 bool TwinEConsole::doSkipSceneActorsBut(int argc, const char **argv) {
 	if (argc < 2) {
-		debugPrintf("Usage: give actor id of scene or -1 to disable");
+		debugPrintf("Usage: give actor id of scene or -1 to disable\n");
 		return false;
 	}
 	const int16 actorIdx = atoi(argv[1]);
-	debugPrintf("Only load actor %d in the next scene", actorIdx);
+	debugPrintf("Only load actor %d in the next scene\n", actorIdx);
 	_engine->_debugScene->onlyLoadActor = actorIdx;
 	return true;
 }
 
 bool TwinEConsole::doToggleFreeCamera(int argc, const char **argv) {
-	TOGGLE_DEBUG(_engine->_debugGrid->useFreeCamera, "free camera movement")
+	TOGGLE_DEBUG(_engine->_debugGrid->useFreeCamera, "free camera movement\n")
 	return true;
 }
 
 bool TwinEConsole::doToggleSceneChanges(int argc, const char **argv) {
-	TOGGLE_DEBUG(_engine->_debugGrid->canChangeScenes, "scene switching via keybinding")
+	TOGGLE_DEBUG(_engine->_debugGrid->canChangeScenes, "scene switching via keybinding\n")
 	return true;
 }
 
 bool TwinEConsole::doSetInventoryFlag(int argc, const char **argv) {
 	if (argc <= 1) {
-		debugPrintf("Expected to get a inventory flag index as first parameter");
+		debugPrintf("Expected to get a inventory flag index as first parameter\n");
 		return false;
 	}
 
 	const uint8 idx = atoi(argv[1]);
 	if (idx >= NUM_INVENTORY_ITEMS) {
-		debugPrintf("given index exceeds the max allowed value of %i", NUM_INVENTORY_ITEMS - 1);
+		debugPrintf("given index exceeds the max allowed value of %i\n", NUM_INVENTORY_ITEMS - 1);
 		return false;
 	}
 	const uint8 val = argc == 3 ? atoi(argv[2]) : 0;
@@ -107,7 +107,7 @@ bool TwinEConsole::doSetInventoryFlag(int argc, const char **argv) {
 
 bool TwinEConsole::doSetGameFlag(int argc, const char **argv) {
 	if (argc <= 1) {
-		debugPrintf("Expected to get a game flag index as first parameter");
+		debugPrintf("Expected to get a game flag index as first parameter\n");
 		return false;
 	}
 
@@ -121,13 +121,13 @@ bool TwinEConsole::doSetGameFlag(int argc, const char **argv) {
 bool TwinEConsole::doPrintGameFlag(int argc, const char **argv) {
 	if (argc <= 1) {
 		for (int i = 0; i < NUM_GAME_FLAGS; ++i) {
-			debugPrintf("[%03d] = %d", i, _engine->_gameState->gameFlags[i]);
+			debugPrintf("[%03d] = %d\n", i, _engine->_gameState->gameFlags[i]);
 		}
 		return true;
 	}
 
 	const uint8 idx = atoi(argv[1]);
-	debugPrintf("[%03d] = %d", idx, _engine->_gameState->gameFlags[idx]);
+	debugPrintf("[%03d] = %d\n", idx, _engine->_gameState->gameFlags[idx]);
 
 	return true;
 }
@@ -143,10 +143,10 @@ bool TwinEConsole::doGiveKey(int argc, const char **argv) {
 
 bool TwinEConsole::doToggleDebug(int argc, const char **argv) {
 	if (_engine->cfgfile.Debug) {
-		debugPrintf("Disabling debug mode");
+		debugPrintf("Disabling debug mode\n");
 		_engine->cfgfile.Debug = false;
 	} else {
-		debugPrintf("Enabling debug mode");
+		debugPrintf("Enabling debug mode\n");
 		_engine->cfgfile.Debug = true;
 	}
 	return true;
@@ -157,7 +157,7 @@ bool TwinEConsole::doListMenuText(int argc, const char **argv) {
 	for (int32 i = 0; i < 1000; ++i) {
 		char buf[256];
 		if (_engine->_text->getMenuText(i, buf, sizeof(buf))) {
-			debugPrintf("%4i: %s", i, buf);
+			debugPrintf("%4i: %s\n", i, buf);
 		}
 	}
 	return true;
@@ -165,7 +165,7 @@ bool TwinEConsole::doListMenuText(int argc, const char **argv) {
 
 bool TwinEConsole::doSetHeroPosition(int argc, const char **argv) {
 	if (argc < 4) {
-		debugPrintf("Current hero position: %i:%i:%i", _engine->_scene->sceneHero->x, _engine->_scene->sceneHero->y, _engine->_scene->sceneHero->z);
+		debugPrintf("Current hero position: %i:%i:%i\n", _engine->_scene->sceneHero->x, _engine->_scene->sceneHero->y, _engine->_scene->sceneHero->z);
 		return true;
 	}
 	const int16 x = atoi(argv[1]);
@@ -179,12 +179,12 @@ bool TwinEConsole::doSetHeroPosition(int argc, const char **argv) {
 
 bool TwinEConsole::doChangeScene(int argc, const char **argv) {
 	if (argc <= 1) {
-		debugPrintf("Expected to get a scene index as first parameter");
+		debugPrintf("Expected to get a scene index as first parameter\n");
 		return false;
 	}
 	byte newSceneIndex = atoi(argv[1]);
 	if (newSceneIndex >= LBA1SceneId::SceneIdMax) {
-		debugPrintf("Scene index out of bounds");
+		debugPrintf("Scene index out of bounds\n");
 		return false;
 	}
 	_engine->_scene->needChangeScene = atoi(argv[1]);


Commit: 2b112dbb40d2c698b540b416d0e7008209fd2704
    https://github.com/scummvm/scummvm/commit/2b112dbb40d2c698b540b416d0e7008209fd2704
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-15T12:46:07+01:00

Commit Message:
TWINE: format the code

Changed paths:
    engines/twine/gamestate.h


diff --git a/engines/twine/gamestate.h b/engines/twine/gamestate.h
index 1941bef949..6e48cecea0 100644
--- a/engines/twine/gamestate.h
+++ b/engines/twine/gamestate.h
@@ -26,8 +26,8 @@
 #include "common/savefile.h"
 #include "common/scummsys.h"
 #include "twine/actor.h"
-#include "twine/menu.h"
 #include "twine/holomap.h"
+#include "twine/menu.h"
 
 namespace TwinE {
 
@@ -65,7 +65,7 @@ enum InventoryItems {
 	kEmptyBottle = 22,
 	kFerryTicket = 23,
 	kKeypad = 24,
-	kCoffeeCan  = 25,
+	kCoffeeCan = 25,
 	kiBonusList = 26,
 	kiCloverLeaf = 27,
 	MaxInventoryItems = 28
@@ -196,9 +196,9 @@ public:
 
 	char playerName[30];
 
-	int32 gameChoices[10];         // inGameMenuData
-	int32 numChoices = 0;          // numOfOptionsInChoice
-	int32 choiceAnswer = 0;        // inGameMenuAnswer
+	int32 gameChoices[10];  // inGameMenuData
+	int32 numChoices = 0;   // numOfOptionsInChoice
+	int32 choiceAnswer = 0; // inGameMenuAnswer
 
 	/** Initialize all engine variables */
 	void initEngineVars();




More information about the Scummvm-git-logs mailing list