SCUMM: LOOM (Towns): Implement original save menu quirk with slot 0

This commit is contained in:
AndywinXp 2022-11-26 23:43:47 +01:00 committed by Eugene Sandulenko
parent 918b7f95f1
commit 939a9bba39
2 changed files with 17 additions and 12 deletions

View File

@ -860,20 +860,20 @@ void ScummEngine::listSavegames(bool *marks, int num) {
Common::StringArray files;
Common::String prefix = makeSavegameName(99, false);
prefix.setChar('*', prefix.size()-2);
prefix.setChar(0, prefix.size()-1);
memset(marks, false, num * sizeof(bool)); //assume no savegames for this title
prefix.setChar('*', prefix.size() - 2);
prefix.setChar(0, prefix.size() - 1);
memset(marks, false, num * sizeof(bool)); // Assume no savegames for this title
files = _saveFileMan->listSavefiles(prefix);
for (Common::StringArray::const_iterator file = files.begin(); file != files.end(); ++file) {
//Obtain the last 2 digits of the filename, since they correspond to the save slot
slot[0] = file->c_str()[file->size()-2];
slot[1] = file->c_str()[file->size()-1];
// Obtain the last 2 digits of the filename, since they correspond to the save slot
slot[0] = file->c_str()[file->size() - 2];
slot[1] = file->c_str()[file->size() - 1];
slot[2] = 0;
slotNum = atoi(slot);
if (slotNum >= 0 && slotNum < num)
marks[slotNum] = true; //mark this slot as valid
marks[slotNum] = true; // Mark this slot as valid
}
}

View File

@ -464,16 +464,21 @@ void ScummEngine_v4::o4_saveLoadGame() {
break;
case 0xC0: // Test if the save file exists
{
Common::InSaveFile *file;
bool avail_saves[100];
Common::InSaveFile *file = nullptr;
bool availableSaves[100];
listSavegames(avail_saves, ARRAYSIZE(avail_saves));
listSavegames(availableSaves, ARRAYSIZE(availableSaves));
Common::String filename = makeSavegameName(slot, false);
if (avail_saves[slot] && (file = _saveFileMan->openForLoading(filename))) {
// LOOM Towns explicitly sets the result to 6 if the selected slot is 0
if (availableSaves[slot] && (file = _saveFileMan->openForLoading(filename))) {
result = 6; // Save file exists
delete file;
} else if (_game.id == GID_LOOM && _game.platform == Common::kPlatformFMTowns && slot == 0) {
// LOOM Towns explicitly sets the result to 6 if the selected slot is 0
result = 6;
} else
result = 7; // Save file does not exist
result = (_game.id == GID_LOOM && _game.platform == Common::kPlatformFMTowns) ? 8 : 7; // Save file does not exist
}
break;
default: