diff options
-rw-r--r-- | engines/touche/menu.cpp | 4 | ||||
-rw-r--r-- | engines/touche/touche.cpp | 14 | ||||
-rw-r--r-- | engines/touche/touche.h | 8 |
3 files changed, 19 insertions, 7 deletions
diff --git a/engines/touche/menu.cpp b/engines/touche/menu.cpp index 4511c3043e..6085e623fd 100644 --- a/engines/touche/menu.cpp +++ b/engines/touche/menu.cpp @@ -359,6 +359,7 @@ void ToucheEngine::handleMenuAction(void *menu, int actionId) { void ToucheEngine::handleOptions(int forceDisplay) { if (_disabledInputCounter == 0 || forceDisplay != 0) { setDefaultCursor(_currentKeyCharNum); + _gameState = kGameStateOptionsDialog; MenuData menuData; memset(&menuData, 0, sizeof(MenuData)); menuData.quit = false; @@ -440,6 +441,7 @@ void ToucheEngine::handleOptions(int forceDisplay) { if (displayQuitDialog()) quitGame(); } + _gameState = kGameStateGameLoop; } } @@ -552,6 +554,7 @@ void ToucheEngine::clearStatusString() { int ToucheEngine::displayQuitDialog() { debug(kDebugMenu, "ToucheEngine::displayQuitDialog()"); + _gameState = kGameStateQuitDialog; _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true); printStatusString(getString(-85)); int ret = 0; @@ -605,6 +608,7 @@ int ToucheEngine::displayQuitDialog() { _system->updateScreen(); } clearStatusString(); + _gameState = kGameStateGameLoop; _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); return ret; } diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp index 0c9f16ef6a..22c155d767 100644 --- a/engines/touche/touche.cpp +++ b/engines/touche/touche.cpp @@ -114,6 +114,7 @@ Common::Error ToucheEngine::go() { void ToucheEngine::restart() { _midiPlayer->stop(); + _gameState = kGameStateGameLoop; _displayQuitDialog = false; memset(_flagsTable, 0, sizeof(_flagsTable)); @@ -237,7 +238,7 @@ void ToucheEngine::syncSoundSettings() { _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); } - + void ToucheEngine::mainLoop() { restart(); @@ -301,8 +302,9 @@ void ToucheEngine::processEvents(bool handleKeyEvents) { _flagsTable[600] = event.kbd.keycode; if (event.kbd.keycode == Common::KEYCODE_ESCAPE) { if (_displayQuitDialog) { - if (displayQuitDialog()) + if (displayQuitDialog()) { quitGame(); + } } } else if (event.kbd.keycode == Common::KEYCODE_F5) { if (_flagsTable[618] == 0 && !_hideInventoryTexts) { @@ -3283,12 +3285,12 @@ void ToucheEngine::updatePalette() { _system->setPalette(_paletteBuffer, 0, 256); } -bool ToucheEngine::canLoadGameStateCurrently() { - return (_flagsTable[618] == 0 && !_hideInventoryTexts); +bool ToucheEngine::canLoadGameStateCurrently() { + return _gameState == kGameStateGameLoop && _flagsTable[618] == 0 && !_hideInventoryTexts; } -bool ToucheEngine::canSaveGameStateCurrently() { - return (_flagsTable[618] == 0 && !_hideInventoryTexts); +bool ToucheEngine::canSaveGameStateCurrently() { + return _gameState == kGameStateGameLoop && _flagsTable[618] == 0 && !_hideInventoryTexts; } } // namespace Touche diff --git a/engines/touche/touche.h b/engines/touche/touche.h index 3882699a52..8b4ea9c036 100644 --- a/engines/touche/touche.h +++ b/engines/touche/touche.h @@ -340,6 +340,12 @@ void readGameStateDescription(Common::ReadStream *f, char *description, int len) Common::String generateGameStateFileName(const char *target, int slot, bool prefixOnly = false); int getGameStateFileSlot(const char *filename); +enum GameState { + kGameStateGameLoop, + kGameStateOptionsDialog, + kGameStateQuitDialog +}; + class MidiPlayer; class ToucheEngine: public Engine { @@ -638,7 +644,7 @@ protected: bool _inp_rightMouseButtonPressed; int _disabledInputCounter; bool _hideInventoryTexts; - + GameState _gameState; bool _displayQuitDialog; int _saveLoadCurrentPage; int _saveLoadCurrentSlot; |