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.
This commit is contained in:
Adrian Frühwirth 2018-01-30 00:03:19 +01:00 committed by Eugene Sandulenko
parent ce790bff1c
commit 90ce265ab8
3 changed files with 17 additions and 4 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;