[Scummvm-git-logs] scummvm master -> 693557487d66daaecabb81b15ee68f31283c8d77
sev-
noreply at scummvm.org
Sat Apr 29 10:14:16 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:
693557487d PINK: Clear global game variables on New Game
Commit: 693557487d66daaecabb81b15ee68f31283c8d77
https://github.com/scummvm/scummvm/commit/693557487d66daaecabb81b15ee68f31283c8d77
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2023-04-29T12:14:13+02:00
Commit Message:
PINK: Clear global game variables on New Game
This addresses the cause for #13869 PINK: Can't pickup the poker in sir Manley's house
However, this will not retroactively fix the broken saved games that carry stale global game variables from other playthroughs
It will also will not set the "appropriate" global game variables if the player uses the debug console to jump to different modules and pages back and forth.
Changed paths:
engines/pink/constants.h
engines/pink/cursor_mgr.cpp
engines/pink/gui.cpp
engines/pink/objects/module.cpp
engines/pink/objects/pages/game_page.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index 91a81ef05a5..f5629671291 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -131,11 +131,6 @@ enum {
kPerilPDAClickableSecondFrameCursorID = 143
};
-enum {
- kLoadingSave = 1,
- kLoadingNewGame = 0
-};
-
enum {
kOrbMajorVersion = 2,
kOrbMinorVersion = 0,
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index c06452d5d74..77fa9544c5d 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -34,6 +34,7 @@ CursorMgr::CursorMgr(PinkEngine *game, Page *page)
void CursorMgr::setCursor(byte index, Common::Point point, const Common::String &itemName) {
switch (index) {
case kClickableFirstFrameCursor:
+ // fall through
case kPDAClickableFirstFrameCursor:
startAnimation(index);
hideItem();
diff --git a/engines/pink/gui.cpp b/engines/pink/gui.cpp
index d898f567393..3a35d23e4bf 100644
--- a/engines/pink/gui.cpp
+++ b/engines/pink/gui.cpp
@@ -210,8 +210,7 @@ void PinkEngine::executeMenuCommand(uint id) {
switch (id) {
case kNewGameAction: {
- const Common::String moduleName = _modules[0]->getName();
- initModule(moduleName, "", nullptr);
+ initModule(_modules[0]->getName(), "", nullptr);
break;
}
case kLoadSave:
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 45f89bf7c54..a8485fbe4db 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -65,7 +65,7 @@ void Module::init(bool isLoadingSave, const Common::String &pageName) {
void Module::changePage(const Common::String &pageName) {
_page->unload();
_page = findPage(pageName);
- _page->init(kLoadingNewGame);
+ _page->init(false);
}
GamePage *Module::findPage(const Common::String &pageName) const {
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 2fedaa0f121..da8f2bc0051 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -185,7 +185,7 @@ void GamePage::unload() {
void GamePage::clear() {
Page::clear();
- _variables.clear(1);
+ _variables.clear(true);
for (uint i = 0; i < _handlers.size(); ++i) {
delete _handlers[i];
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index fd55e15c6fd..6d75b4eb61c 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -187,13 +187,19 @@ void PinkEngine::initModule(const Common::String &moduleName, const Common::Stri
if (_module)
removeModule();
+ if (moduleName == _modules[0]->getName()) {
+ // new game
+ _variables.clear();
+ debugC(6, kPinkDebugGeneral, "Global Game Variables cleared");
+ }
+
addModule(moduleName);
if (saveFile)
_module->loadState(*saveFile);
debugC(6, kPinkDebugGeneral, "Module added");
- _module->init(saveFile ? kLoadingSave : kLoadingNewGame, pageName);
+ _module->init(saveFile != nullptr, pageName);
}
void PinkEngine::changeScene() {
More information about the Scummvm-git-logs
mailing list