diff options
author | Eugene Sandulenko | 2019-11-08 17:16:57 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-13 22:07:08 +0100 |
commit | a28bf11ca62e1b2171f5c4898be7c8598c84dbde (patch) | |
tree | cad7980932fcb2b07a51b0b4b07ab09e2e658a65 /engines/griffon | |
parent | 87d46434e3c95f5d82a5d3d81e2eaaeefa55709c (diff) | |
download | scummvm-rg350-a28bf11ca62e1b2171f5c4898be7c8598c84dbde.tar.gz scummvm-rg350-a28bf11ca62e1b2171f5c4898be7c8598c84dbde.tar.bz2 scummvm-rg350-a28bf11ca62e1b2171f5c4898be7c8598c84dbde.zip |
GRIFFON: Initial code for game modes
Diffstat (limited to 'engines/griffon')
-rw-r--r-- | engines/griffon/combat.cpp | 2 | ||||
-rw-r--r-- | engines/griffon/dialogs.cpp | 28 | ||||
-rw-r--r-- | engines/griffon/engine.cpp | 6 | ||||
-rw-r--r-- | engines/griffon/griffon.cpp | 24 | ||||
-rw-r--r-- | engines/griffon/griffon.h | 10 |
5 files changed, 44 insertions, 26 deletions
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp index e23596f15c..ffd07f35ac 100644 --- a/engines/griffon/combat.cpp +++ b/engines/griffon/combat.cpp @@ -1002,7 +1002,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { if (_npcInfo[npcnum].script == kScriptEndOfGame) { endOfGame(); - _gameEnd = true; + _gameMode = kGameModeEnd; } } } diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp index 4b0fbc682b..d149a8d199 100644 --- a/engines/griffon/dialogs.cpp +++ b/engines/griffon/dialogs.cpp @@ -184,7 +184,11 @@ void GriffonEngine::title(int mode) { _ticks = g_system->getMillis(); ticks1 = _ticks; - exitTitle = true; + saveLoadNew(); + + if (_gameMode == kGameModeNewGame) { + exitTitle = true; + } break; case 1: configMenu(); @@ -589,10 +593,9 @@ void GriffonEngine::saveLoadNew() { if (curRow == 0) { if (curCol == 0) { // NEW GAME - newGame(); + _gameMode = kGameModeNewGame; - if (_shouldQuit || _gameEnd) - return; + return; } else if (curCol == 1) { // SAVE GAME lowerLock = true; @@ -611,7 +614,7 @@ void GriffonEngine::saveLoadNew() { _shouldQuit = true; return; } - } + } if (lowerLock && tickPause < _ticks) { if ((curCol == 1) && saveState(curRow - 1)) { _secStart += _secsInGame; @@ -620,20 +623,11 @@ void GriffonEngine::saveLoadNew() { _saveSlot = curRow - 1; curRow = 0; } else if ((curCol == 2) && loadState(curRow - 1)) { - _player.walkSpeed = 1.1f; - _animSpeed = 0.5f; - _attacking = false; - _player.attackSpeed = 1.5f; - - _playingGardens = false; - _playingBoss = false; + _saveSlot = curRow - 1; - haltSoundChannel(-1); + _gameMode = kGameModeLoadGame; - _secsInGame = 0; - _saveSlot = curRow - 1; - loadMap(_curMap); - mainLoop(); + return; } tickPause = _ticks + 125; } diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp index 8c0b511490..b23dae9e5d 100644 --- a/engines/griffon/engine.cpp +++ b/engines/griffon/engine.cpp @@ -105,7 +105,7 @@ void GriffonEngine::mainLoop() { _console->onFrame(); updateEngine(); - } while (!_shouldQuit && !_gameEnd); + } while (!_shouldQuit && _gameMode != kGameModeEnd); } void GriffonEngine::updateEngine() { @@ -161,7 +161,7 @@ void GriffonEngine::updateEngine() { checkHit(); - if (_gameEnd) + if (_gameMode == kGameModeEnd) return; } @@ -244,7 +244,7 @@ void GriffonEngine::updateEngine() { if (_player.hp <= 0) { theEnd(); - _gameEnd = true; + _gameMode = kGameModeEnd; return; } diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp index 118ff0e846..264d0f0c6e 100644 --- a/engines/griffon/griffon.cpp +++ b/engines/griffon/griffon.cpp @@ -59,7 +59,7 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) { _mixer = nullptr; _shouldQuit = false; - _gameEnd = false; + _gameMode = kGameModeIntro; _musicChannel = -1; _menuChannel = -1; @@ -138,11 +138,27 @@ Common::Error GriffonEngine::run() { return Common::kNoError; while (!_shouldQuit) { - _gameEnd = false; - title(0); - if (!_shouldQuit && !_gameEnd) + if (_gameMode == kGameModeNewGame) { + newGame(); + } else if (_gameMode == kGameModeLoadGame) { + _player.walkSpeed = 1.1f; + _animSpeed = 0.5f; + _attacking = false; + _player.attackSpeed = 1.5f; + + _playingGardens = false; + _playingBoss = false; + + haltSoundChannel(-1); + + _secsInGame = 0; + loadMap(_curMap); + mainLoop(); + } + + if (!_shouldQuit && _gameMode != kGameModeEnd) saveLoadNew(); } diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h index f202437581..f766b9df7f 100644 --- a/engines/griffon/griffon.h +++ b/engines/griffon/griffon.h @@ -320,6 +320,14 @@ struct ObjectInfoStruct { int script; }; +enum { + kGameModeIntro, + kGameModeEnd, + kGameModeSaveLoad, + kGameModeNewGame, + kGameModeLoadGame +}; + class GriffonEngine : public Engine { public: GriffonEngine(OSystem *syst); @@ -331,7 +339,7 @@ public: private: Common::RandomSource *_rnd; bool _shouldQuit; - bool _gameEnd; + int _gameMode; Console *_console; |