From 93be6abf58c902bcbe33b6d7f535ea477b6e6afc Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 11 Nov 2019 11:30:02 +0100 Subject: GRIFFON: Fix the menu logic. Finally! --- engines/griffon/combat.cpp | 2 +- engines/griffon/engine.cpp | 6 +++--- engines/griffon/griffon.cpp | 17 ++++++++++++++--- engines/griffon/griffon.h | 6 ++---- 4 files changed, 20 insertions(+), 11 deletions(-) (limited to 'engines/griffon') diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp index ebd5876eb4..a21ce7f4f0 100644 --- a/engines/griffon/combat.cpp +++ b/engines/griffon/combat.cpp @@ -1004,7 +1004,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { if (_npcInfo[npcnum].script == kScriptEndOfGame) { endOfGame(); - _gameMode = kGameModeEnd; + _gameMode = kGameModeIntro; } } } diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp index 19519bb3da..a1eb5139ac 100644 --- a/engines/griffon/engine.cpp +++ b/engines/griffon/engine.cpp @@ -107,7 +107,7 @@ void GriffonEngine::mainLoop() { _console->onFrame(); updateEngine(); - } while (!_shouldQuit && _gameMode != kGameModeEnd && _gameMode != kGameModeNewGame); + } while (!_shouldQuit && _gameMode == kGameModePlay); } void GriffonEngine::updateEngine() { @@ -163,7 +163,7 @@ void GriffonEngine::updateEngine() { checkHit(); - if (_gameMode == kGameModeEnd) + if (_gameMode != kGameModePlay) return; } @@ -246,7 +246,7 @@ void GriffonEngine::updateEngine() { if (_player.hp <= 0) { theEnd(); - _gameMode = kGameModeEnd; + _gameMode = kGameModeIntro; return; } diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp index 85e1e367ae..7632623e49 100644 --- a/engines/griffon/griffon.cpp +++ b/engines/griffon/griffon.cpp @@ -137,13 +137,20 @@ Common::Error GriffonEngine::run() { if (_shouldQuit) return Common::kNoError; + _gameMode = kGameModeIntro; + while (!_shouldQuit) { - if (_gameMode != kGameModeNewGame) + switch (_gameMode) { + case kGameModeIntro: + case kGameModePlay: title(0); + break; - if (_gameMode == kGameModeNewGame) { + case kGameModeNewGame: newGame(); - } else if (_gameMode == kGameModeLoadGame) { + break; + + case kGameModeLoadGame: _player.walkSpeed = 1.1f; _animSpeed = 0.5f; _attacking = false; @@ -157,6 +164,10 @@ Common::Error GriffonEngine::run() { _secsInGame = 0; loadMap(_curMap); mainLoop(); + break; + + default: + error("Bad game mode: %d", _gameMode); } } diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h index 611ecc8de2..f2e397e233 100644 --- a/engines/griffon/griffon.h +++ b/engines/griffon/griffon.h @@ -322,11 +322,9 @@ struct ObjectInfoStruct { enum { kGameModeIntro, - kGameModeEnd, - kGameModeSaveLoad, + kGameModePlay, kGameModeNewGame, - kGameModeLoadGame, - kGameModePlay + kGameModeLoadGame }; class GriffonEngine : public Engine { -- cgit v1.2.3