diff options
author | Adrian Frühwirth | 2018-01-30 00:03:19 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2018-01-31 19:23:56 +0100 |
commit | 90ce265ab89bf6f0898813c578e0ec5abce37512 (patch) | |
tree | 27ba6935d299da7f67b505392e243df278f805fa | |
parent | ce790bff1c14d9329ef60b456da25ec67dbf185e (diff) | |
download | scummvm-rg350-90ce265ab89bf6f0898813c578e0ec5abce37512.tar.gz scummvm-rg350-90ce265ab89bf6f0898813c578e0ec5abce37512.tar.bz2 scummvm-rg350-90ce265ab89bf6f0898813c578e0ec5abce37512.zip |
TUCKER: Print infobar string if no savegame exists
Before, the ingame load dialog pretended to allow loading savegames from
all possible slots even if no savegames existed.
This introduces the original interpreter's behavior which instead loads
a resource string from infobar.txt informing the user that no savegames
are available.
-rw-r--r-- | engines/tucker/saveload.cpp | 5 | ||||
-rw-r--r-- | engines/tucker/tucker.cpp | 15 | ||||
-rw-r--r-- | engines/tucker/tucker.h | 1 |
3 files changed, 17 insertions, 4 deletions
diff --git a/engines/tucker/saveload.cpp b/engines/tucker/saveload.cpp index 92da2d4d9b..8ed969c88e 100644 --- a/engines/tucker/saveload.cpp +++ b/engines/tucker/saveload.cpp @@ -126,4 +126,9 @@ bool TuckerEngine::canSaveGameStateCurrently() { return !_player && _cursorType < 2; } +bool TuckerEngine::existsSavegame() { + Common::String pattern = generateGameStateFileName(_targetName.c_str(), 0, true); + return !_saveFileMan->listSavefiles(pattern).empty(); +} + } // namespace Tucker diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index cf28b1b656..d9e14b32fb 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -27,6 +27,7 @@ #include "common/debug.h" #include "common/error.h" #include "common/keyboard.h" +#include "common/savefile.h" #include "common/textconsole.h" #include "engines/util.h" @@ -1314,13 +1315,19 @@ void TuckerEngine::updateSfxData3_2() { } void TuckerEngine::saveOrLoad() { + bool hasSavegame = existsSavegame(); + if (!_leftMouseButtonPressed) { _mouseClick = 0; } if (_currentSaveLoadGameState > 0) { - drawSpeechText(_scrollOffset + 120, 170, _infoBarBuf, _saveOrLoadGamePanel + 19, 102); - int len = getStringWidth(_saveOrLoadGamePanel + 19, _infoBarBuf); - drawStringInteger(_currentSaveLoadGameState, len / 2 + 128, 160, 2); + if (_saveOrLoadGamePanel == 0 && !hasSavegame) { + drawSpeechText(_scrollOffset + 120, 170, _infoBarBuf, _saveOrLoadGamePanel + 21, 102); + } else { + drawSpeechText(_scrollOffset + 120, 170, _infoBarBuf, _saveOrLoadGamePanel + 19, 102); + int len = getStringWidth(_saveOrLoadGamePanel + 19, _infoBarBuf); + drawStringInteger(_currentSaveLoadGameState, len / 2 + 128, 160, 2); + } } else { drawSpeechText(_scrollOffset + 120, 170, _infoBarBuf, 21, 102); } @@ -1348,7 +1355,7 @@ void TuckerEngine::saveOrLoad() { if (_mousePosX > 260 && _mousePosX < 290 && _mousePosY > 152 && _mousePosY < 168) { if (_saveOrLoadGamePanel == 1) { saveGameState(_currentSaveLoadGameState, ""); - } else if (_currentSaveLoadGameState > 0) { + } else if (hasSavegame && _currentSaveLoadGameState > 0) { loadGameState(_currentSaveLoadGameState); } _forceRedrawPanelItems = true; diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h index 60468046e3..58ffa24d02 100644 --- a/engines/tucker/tucker.h +++ b/engines/tucker/tucker.h @@ -579,6 +579,7 @@ protected: virtual Common::Error saveGameState(int num, const Common::String &description); virtual bool canLoadGameStateCurrently(); virtual bool canSaveGameStateCurrently(); + virtual bool existsSavegame(); TuckerConsole *_console; |