aboutsummaryrefslogtreecommitdiff
path: root/engines/griffon
diff options
context:
space:
mode:
authorEugene Sandulenko2019-11-06 17:28:57 +0100
committerEugene Sandulenko2019-11-13 22:07:08 +0100
commitf6da6210081d2f272c37fb1bda13931345f27967 (patch)
tree92a61a588c8e0707e13eb2ff86dace3ece316331 /engines/griffon
parent4d97f9c65426185f362ebdb0918fd857548c46f8 (diff)
downloadscummvm-rg350-f6da6210081d2f272c37fb1bda13931345f27967.tar.gz
scummvm-rg350-f6da6210081d2f272c37fb1bda13931345f27967.tar.bz2
scummvm-rg350-f6da6210081d2f272c37fb1bda13931345f27967.zip
GRIFFON: Removed recursiveness on end game
Diffstat (limited to 'engines/griffon')
-rw-r--r--engines/griffon/combat.cpp4
-rw-r--r--engines/griffon/cutscenes.cpp2
-rw-r--r--engines/griffon/dialogs.cpp3
-rw-r--r--engines/griffon/engine.cpp5
-rw-r--r--engines/griffon/griffon.cpp9
-rw-r--r--engines/griffon/griffon.h1
6 files changed, 17 insertions, 7 deletions
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index f140674186..59814ef504 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -612,7 +612,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
}
- if (_npcInfo[npcnum].spriteset == kMonsterOneWing || _npcInfo[npcnum].spriteset == kMonsterTwoWing ||
+ if (_npcInfo[npcnum].spriteset == kMonsterOneWing || _npcInfo[npcnum].spriteset == kMonsterTwoWing ||
_npcInfo[npcnum].spriteset == kMonsterBlackKnight || _npcInfo[npcnum].spriteset == kMonsterFireHydra) {
int ff = (int)(RND() * _player.level);
if (ff == 0) {
@@ -1001,7 +1001,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
if (_npcInfo[npcnum].script == kScriptEndOfGame)
- endOfGame();
+ _gameEnd = true;
}
}
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 1be04338d6..f615db4df2 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -520,8 +520,6 @@ void GriffonEngine::theEnd() {
_fp = 0;
}
}
-
- title(0);
}
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 0e3e67b328..21d54a0641 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -507,6 +507,9 @@ void GriffonEngine::saveLoadNew() {
if (curCol == 0) {
// NEW GAME
newGame();
+
+ if (_shouldQuit || _gameEnd)
+ return;
} else if (curCol == 1) {
// LOAD GAME
lowerLock = true;
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index f7e89bb0d8..c90b9a05cd 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -75,7 +75,7 @@ void GriffonEngine::mainLoop() {
_console->onFrame();
updateEngine();
- } while (!_shouldQuit);
+ } while (!_shouldQuit && !_gameEnd);
}
void GriffonEngine::updateEngine() {
@@ -131,6 +131,9 @@ void GriffonEngine::updateEngine() {
_player.opy = _player.py;
checkHit();
+
+ if (_gameEnd)
+ return;
}
for (int i = 0; i < kMaxFloat; i++) {
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 42659ffee9..0263f891df 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -46,6 +46,7 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_mixer = nullptr;
_shouldQuit = false;
+ _gameEnd = false;
_musicChannel = -1;
_menuChannel = -1;
@@ -118,11 +119,15 @@ Common::Error GriffonEngine::run() {
return Common::kNoError;
while (!_shouldQuit) {
+ _gameEnd = false;
+
title(0);
- if (!_shouldQuit)
+ if (!_shouldQuit && !_gameEnd)
+ saveLoadNew();
- saveLoadNew();
+ if (_gameEnd)
+ endOfGame();
}
return Common::kNoError;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index e7b9c82a43..c6abe7fc2d 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -329,6 +329,7 @@ public:
private:
Common::RandomSource *_rnd;
bool _shouldQuit;
+ bool _gameEnd;
Console *_console;