mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-11 03:34:13 +00:00
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.
This commit is contained in:
parent
475f231ac4
commit
693557487d
@ -131,11 +131,6 @@ enum {
|
||||
kPerilPDAClickableSecondFrameCursorID = 143
|
||||
};
|
||||
|
||||
enum {
|
||||
kLoadingSave = 1,
|
||||
kLoadingNewGame = 0
|
||||
};
|
||||
|
||||
enum {
|
||||
kOrbMajorVersion = 2,
|
||||
kOrbMinorVersion = 0,
|
||||
|
@ -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();
|
||||
|
@ -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:
|
||||
|
@ -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 {
|
||||
|
@ -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];
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user