GROOVIE: Fix 11th Hour scripts loading savegame 0

When The 11th Hour shows the load/restart dialog during the intro, it calls
loadgame with slot 0. It is not clear to me what this means, but it should not
load a savegame, because only slots 1-9 can be used with the original UI. In
ScummVM, this would load the autosave, which probably causes problems, though
the only thing I noticed is it stops the music, which does not happen in the
original interpreter.

This commit adds an exception for The 11th Hour to not load a savegame when
loadgame is called with slot 0. To still support loading the autosave form the
ScummVM UI, the slot is set to 0xFF in this case, which is interpreted by
loadgame to mean actually loading slot 0.
This commit is contained in:
Coen Rampen
2021-11-17 21:55:09 +01:00
parent cb97a47828
commit acad76683d
+25 -1
View File
@@ -244,7 +244,14 @@ void Script::directGameLoad(int slot) {
midiInitScriptSize = sizeof(t7gMidiInitScript);
}
} else if (_version == kGroovieT11H) {
setVariable(0xF, slot);
// WORKAROUND Slot 0 is sometimes loaded by scripts (f.e. showing the
// load/restart dialog during the intro). The intention is not clear to
// me, but it is not for loading a savegame (only slots 1-9 can be used
// in the original UI). In order to be able to distinguish this case
// from the case where the slot 0 savegame is loaded from the ScummVM
// UI, the slot variable is set to 0xFF here. This means that the slot
// 0 savegame should actually be loaded.
setVariable(0xF, slot == 0 ? 0xFF : slot);
_currentInstruction = 0xE78D;
return;
} else if (_version == kGroovieCDY) {
@@ -475,6 +482,23 @@ bool Script::hotspot(Common::Rect rect, uint16 address, uint8 cursor) {
}
void Script::loadgame(uint slot) {
// WORKAROUND The game scripts sometimes call loadgame with slot 0 (f.e.
// during the intro when showing the load/restart dialog). The meaning of
// this is not clear to me, but it is not for loading a savegame, because
// only slots 1-9 are usable with the original UI.
// In case slot 0 is loaded from the ScummVM UI, the slot parameter has
// been set to 0xFF.
if (_vm->getEngineVersion() == kGroovieT11H) {
if (slot == 0) {
// Loadgame slot 0 has been called by the game scripts.
// TODO Figure out if anything needs to be done.
return;
} else if (slot == 0xFF) {
// Slot 0 has been loaded from the ScummVM UI.
slot = 0;
}
}
_vm->_musicPlayer->stop();
Common::InSaveFile *file = SaveLoad::openForLoading(ConfMan.getActiveDomainName(), slot);