[Scummvm-git-logs] scummvm master -> 2b003aaecb514df4ec365ea7d59df3ef6d490c06
dreammaster
noreply at scummvm.org
Sat Mar 22 02:52:43 UTC 2025
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:
2b003aaecb GOT: Fix flags getting reset after loading savegame
Commit: 2b003aaecb514df4ec365ea7d59df3ef6d490c06
https://github.com/scummvm/scummvm/commit/2b003aaecb514df4ec365ea7d59df3ef6d490c06
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-03-21T19:51:27-07:00
Commit Message:
GOT: Fix flags getting reset after loading savegame
Changed paths:
engines/got/console.cpp
engines/got/console.h
engines/got/got.cpp
engines/got/vars.cpp
engines/got/vars.h
diff --git a/engines/got/console.cpp b/engines/got/console.cpp
index 93188fc2919..b39f66e950a 100644
--- a/engines/got/console.cpp
+++ b/engines/got/console.cpp
@@ -41,6 +41,7 @@ Console::Console() : GUI::Debugger() {
registerCmd("freeze", WRAP_METHOD(Console, cmdFreeze));
registerCmd("level", WRAP_METHOD(Console, cmdLevel));
registerCmd("flying", WRAP_METHOD(Console, cmdFlying));
+ registerCmd("flag", WRAP_METHOD(Console, cmdFlag));
}
Console::~Console() {
@@ -150,4 +151,37 @@ bool Console::cmdFlying(int argc, const char **argv) {
return true;
}
+bool Console::cmdFlag(int argc, const char **argv) {
+ if (argc == 1) {
+ for (int start = 0; start < 64; start += 10) {
+ Common::String line;
+ for (int i = start; i < (start == 60 ? 64 : (start + 10)); ++i) {
+ if ((i % 5) == 0)
+ line += " ";
+ line += Common::String::format("%c",
+ _G(setup)._flags[i] ? 'T' : 'F');
+ }
+
+ debugPrintf("%s\n", line.c_str());
+ }
+ } else {
+ int flag = atoi(argv[1]);
+
+ if (flag < 1 || flag > 64) {
+ debugPrintf("Flags must be from 1 to 64\n");
+ } else if (argc == 2) {
+ debugPrintf("Flag #%d is %s\n", flag,
+ _G(setup)._flags[flag - 1] ? "true" : "false");
+ } else {
+ bool val = tolower(argv[2][0]) == 't';
+ _G(setup)._flags[flag - 1] = val;
+
+ debugPrintf("Flag #%d is %s\n", flag,
+ val ? "true" : "false");
+ }
+ }
+
+ return true;
+}
+
} // namespace Got
diff --git a/engines/got/console.h b/engines/got/console.h
index 1b61d8d76e6..9c2c6e3e5a8 100644
--- a/engines/got/console.h
+++ b/engines/got/console.h
@@ -38,6 +38,7 @@ private:
bool cmdFreeze(int argc, const char **argv);
bool cmdLevel(int argc, const char **argv);
bool cmdFlying(int argc, const char **argv);
+ bool cmdFlag(int argc, const char **argv);
public:
Console();
diff --git a/engines/got/got.cpp b/engines/got/got.cpp
index e7351194d7c..a533eba14d3 100644
--- a/engines/got/got.cpp
+++ b/engines/got/got.cpp
@@ -122,7 +122,10 @@ Common::Error GotEngine::syncGame(Common::Serializer &s) {
if (area == 0)
area = 1;
- g_vars->setArea(area);
+ if (area != _G(area)) {
+ _G(area) = area;
+ g_vars->loadArea();
+ }
}
_G(thorInfo).sync(s);
diff --git a/engines/got/vars.cpp b/engines/got/vars.cpp
index 69d382ab28f..4c30cf38290 100644
--- a/engines/got/vars.cpp
+++ b/engines/got/vars.cpp
@@ -76,6 +76,11 @@ Vars::~Vars() {
void Vars::setArea(int areaNum) {
_area = areaNum;
_setup = Setup();
+ loadArea();
+}
+
+void Vars::loadArea() {
+ int areaNum = _area;
_setup._areaNum = areaNum;
_sdData.setArea(areaNum);
diff --git a/engines/got/vars.h b/engines/got/vars.h
index 3988179a1e9..e0b6da2c6a8 100644
--- a/engines/got/vars.h
+++ b/engines/got/vars.h
@@ -92,6 +92,7 @@ public:
void load();
void setArea(int areaNum);
+ void loadArea();
void clearKeyFlags();
void resetEndGameFlags();
More information about the Scummvm-git-logs
mailing list