Skip to content
Permalink
Browse files

BLADERUNNER: Fix mouse in KIA after moonbus massacre ending

  • Loading branch information...
antoniou79 committed May 22, 2019
1 parent e4b8c0f commit 3322bc44db112d0f35118d80e835b27f6b76668b
Showing with 17 additions and 8 deletions.
  1. +16 −7 engines/bladerunner/bladerunner.cpp
  2. +1 −1 engines/bladerunner/bladerunner.h
@@ -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,16 +1865,21 @@ 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)
--_playerLosesControlCounter;

if (_playerLosesControlCounter == 0) {
_mouse->enable();
if (force) {
_playerLosesControlCounter = 0;
_mouse->enable(force);
} else {
if (_playerLosesControlCounter > 0) {
--_playerLosesControlCounter;
}
if (_playerLosesControlCounter == 0) {
_mouse->enable();
}
}
}

@@ -296,7 +296,7 @@ class BladeRunnerEngine : public Engine {

bool playerHasControl();
void playerLosesControl();
void playerGainsControl();
void playerGainsControl(bool force = false);
void playerDied();

bool saveGame(Common::WriteStream &stream, Graphics::Surface &thumbnail);

0 comments on commit 3322bc4

Please sign in to comment.
You can’t perform that action at this time.