[Scummvm-git-logs] scummvm master -> 34b9afb6dbfdb4bb204435bff6af919e34ce29ac
bluegr
noreply at scummvm.org
Sun Jul 7 11:22:42 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:
34b9afb6db DGDS: Add "global" command to console, to debug globals
Commit: 34b9afb6dbfdb4bb204435bff6af919e34ce29ac
https://github.com/scummvm/scummvm/commit/34b9afb6dbfdb4bb204435bff6af919e34ce29ac
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2024-07-07T14:22:19+03:00
Commit Message:
DGDS: Add "global" command to console, to debug globals
Changed paths:
engines/dgds/console.cpp
engines/dgds/console.h
diff --git a/engines/dgds/console.cpp b/engines/dgds/console.cpp
index 7ab35fde2e6..bd0b604aeee 100644
--- a/engines/dgds/console.cpp
+++ b/engines/dgds/console.cpp
@@ -30,10 +30,12 @@
#include "dgds/console.h"
#include "dgds/decompress.h"
#include "dgds/dgds.h"
+#include "dgds/globals.h"
#include "dgds/includes.h"
#include "dgds/image.h"
#include "dgds/parser.h"
#include "dgds/resource.h"
+#include "dgds/scene.h"
#include "dgds/game_palettes.h"
#include "gui/debugger.h"
@@ -45,6 +47,7 @@ Console::Console(DgdsEngine *vm) : _vm(vm) {
registerCmd("filedump", WRAP_METHOD(Console, cmdFileDump));
registerCmd("imagedump", WRAP_METHOD(Console, cmdImageDump));
registerCmd("imagedumpall", WRAP_METHOD(Console, cmdImageDumpAll));
+ registerCmd("global", WRAP_METHOD(Console, cmdGlobal));
}
bool Console::cmdFileInfo(int argc, const char **argv) {
@@ -243,4 +246,27 @@ bool Console::cmdImageDump(int argc, const char **argv) {
#endif // USE_PNG
}
+bool Console::cmdGlobal(int argc, const char **argv) {
+ if (argc < 2) {
+ debugPrintf("Usage: %s <num> <val>\n", argv[0]);
+ debugPrintf("%s <num> returns the value of a global\n", argv[0]);
+ debugPrintf("%s <num> <val> sets the value of a global\n", argv[0]);
+ return true;
+ }
+
+ GDSScene *scene = _vm->getGDSScene();
+ int num = atoi(argv[1]);
+
+ if (argc == 2) {
+ int16 val = scene->getGlobal(num);
+ debugPrintf("Global %d is %d\n", num, val);
+ } else if (argc == 3) {
+ int16 newVal = atoi(argv[2]);
+ scene->setGlobal(num, newVal);
+ debugPrintf("Global %d set to %d\n", num, newVal);
+ }
+
+ return true;
+}
+
} // End of namespace Dgds
diff --git a/engines/dgds/console.h b/engines/dgds/console.h
index 04ad1fd5882..2586db2762e 100644
--- a/engines/dgds/console.h
+++ b/engines/dgds/console.h
@@ -40,6 +40,7 @@ private:
bool dumpImageFrame(const char *fname, int frame, const char *outpath);
bool cmdImageDumpAll(int argc, const char **argv);
bool cmdImageDump(int argc, const char **argv);
+ bool cmdGlobal(int argc, const char **argv);
DgdsEngine *_vm;
};
More information about the Scummvm-git-logs
mailing list