BLADERUNNER: Fix mouse in KIA after moonbus massacre ending

This commit is contained in:
Thanasis Antoniou 2019-05-23 02:17:56 +03:00
parent e4b8c0f4e3
commit 3322bc44db
2 changed files with 17 additions and 8 deletions

View file

@ -323,6 +323,10 @@ Common::Error BladeRunnerEngine::run() {
// additional code for gracefully handling end-game after _endCredits->show()
_gameOver = false;
_gameIsRunning = true;
if (!playerHasControl()) {
// force a player gains control
playerGainsControl(true);
}
if (_mouse->isDisabled()) {
// force a mouse enable here since otherwise, after end-game,
// we need extra call(s) to mouse->enable to get the _disabledCounter to 0
@ -1861,17 +1865,22 @@ void BladeRunnerEngine::playerLosesControl() {
}
}
void BladeRunnerEngine::playerGainsControl() {
if (_playerLosesControlCounter == 0) {
void BladeRunnerEngine::playerGainsControl(bool force) {
if (!force && _playerLosesControlCounter == 0) {
warning("Unbalanced call to BladeRunnerEngine::playerGainsControl");
}
if (_playerLosesControlCounter > 0)
if (force) {
_playerLosesControlCounter = 0;
_mouse->enable(force);
} else {
if (_playerLosesControlCounter > 0) {
--_playerLosesControlCounter;
}
if (_playerLosesControlCounter == 0) {
_mouse->enable();
}
}
}
void BladeRunnerEngine::playerDied() {

View file

@ -296,7 +296,7 @@ public:
bool playerHasControl();
void playerLosesControl();
void playerGainsControl();
void playerGainsControl(bool force = false);
void playerDied();
bool saveGame(Common::WriteStream &stream, Graphics::Surface &thumbnail);