diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 32 | ||||
-rw-r--r-- | engines/bladerunner/bladerunner.h | 5 | ||||
-rw-r--r-- | engines/bladerunner/script/script.cpp | 11 | ||||
-rw-r--r-- | engines/bladerunner/script/script.h | 4 |
4 files changed, 45 insertions, 7 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index aa2850a1c9..2279feb787 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -60,6 +60,7 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst) { _windowIsActive = true; _gameIsRunning = true; + _playerLosesControlCounter = 0; _ambientSounds = new AmbientSounds(this); _audioPlayer = new AudioPlayer(this); @@ -335,13 +336,13 @@ void BladeRunnerEngine::loopActorSpeaking() { if (!_audioSpeech->isPlaying()) return; - // playerLosesControl(); + playerLosesControl(); do { gameTick(); } while (_audioSpeech->isPlaying()); - // playerGainsControl(); + playerGainsControl(); } void BladeRunnerEngine::outtakePlay(int id, bool noLocalization, int container) { @@ -415,9 +416,34 @@ Common::SeekableReadStream *BladeRunnerEngine::getResourceStream(const Common::S return 0; } +bool BladeRunnerEngine::playerHasControl() { + return _playerLosesControlCounter == 0; +} + +void BladeRunnerEngine::playerLosesControl() { + if (++_playerLosesControlCounter == 1) { + _mouse->disable(); + } + debug("Player Lost Control (%d)", _playerLosesControlCounter); +} + +void BladeRunnerEngine::playerGainsControl() { + if (_playerLosesControlCounter == 0) { + warning("Unbalanced call to BladeRunnerEngine::playerGainsControl"); + } + + if (_playerLosesControlCounter > 0) + --_playerLosesControlCounter; + + debug("Player Gained Control (%d)", _playerLosesControlCounter); + + if (_playerLosesControlCounter == 0) { + _mouse->enable(); + } +} + void BladeRunnerEngine::ISez(const char *str) { debug("\t%s", str); } - } // End of namespace BladeRunner diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h index 06a1a7ae34..0abd1429ac 100644 --- a/engines/bladerunner/bladerunner.h +++ b/engines/bladerunner/bladerunner.h @@ -56,6 +56,7 @@ class BladeRunnerEngine : public Engine { public: bool _gameIsRunning; bool _windowIsActive; + int _playerLosesControlCounter; AmbientSounds *_ambientSounds; AudioPlayer *_audioPlayer; @@ -116,6 +117,10 @@ public: Common::SeekableReadStream *getResourceStream(const Common::String &name); + bool playerHasControl(); + void playerLosesControl(); + void playerGainsControl(); + void ISez(const char *str); }; diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp index 62754bea3c..5788936536 100644 --- a/engines/bladerunner/script/script.cpp +++ b/engines/bladerunner/script/script.cpp @@ -172,8 +172,15 @@ void ScriptBase::Actor_Clue_Add_To_Database(int a0, int a1, int a2, int a3, int // ScriptBase::Animation_Stop // ScriptBase::Animation_Skip_To_Frame // ScriptBase::Delay -// ScriptBase::Player_Loses_Control -// ScriptBase::Player_Gains_Control + +void ScriptBase::Player_Loses_Control() { + _vm->playerLosesControl(); +} + +void ScriptBase::Player_Gains_Control() { + _vm->playerGainsControl(); +} + // ScriptBase::Player_Set_Combat_Mode // ScriptBase::Player_Query_Combat_Mode // ScriptBase::Player_Set_Combat_Mode_Access diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h index 82f7be8bb5..e399a64f29 100644 --- a/engines/bladerunner/script/script.h +++ b/engines/bladerunner/script/script.h @@ -131,8 +131,8 @@ protected: // Animation_Stop // Animation_Skip_To_Frame // Delay - // Player_Loses_Control - // Player_Gains_Control + void Player_Loses_Control(); + void Player_Gains_Control(); // Player_Set_Combat_Mode // Player_Query_Combat_Mode // Player_Set_Combat_Mode_Access |