diff options
author | Peter Kohaut | 2019-02-11 22:44:38 +0100 |
---|---|---|
committer | Peter Kohaut | 2019-02-11 22:49:18 +0100 |
commit | 916221dc562c9062839918d58d1a9968eb8f2b5e (patch) | |
tree | 9c4e29ef5c2b4004d8a08922ab4e4b67e6a700f1 | |
parent | 6854ea3ddd83798a9045307763bbb346d8a1736b (diff) | |
download | scummvm-rg350-916221dc562c9062839918d58d1a9968eb8f2b5e.tar.gz scummvm-rg350-916221dc562c9062839918d58d1a9968eb8f2b5e.tar.bz2 scummvm-rg350-916221dc562c9062839918d58d1a9968eb8f2b5e.zip |
BLADERUNNER: Added original logic for speech skipping
And some small cleanup of unnecessary comments.
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 37 | ||||
-rw-r--r-- | engines/bladerunner/bladerunner.h | 3 | ||||
-rw-r--r-- | engines/bladerunner/script/script.cpp | 16 | ||||
-rw-r--r-- | engines/bladerunner/ui/vk.cpp | 12 |
4 files changed, 33 insertions, 35 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 5aef48caa4..035ab22340 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -103,14 +103,18 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des _vqaIsPlaying = false; _vqaStopIsRequested = false; + _actorIsSpeaking = false; + _actorSpeakStopIsRequested = false; + _subtitlesEnabled = false; - _sitcomMode = true; + _sitcomMode = false; + _shortyMode = false; _playerLosesControlCounter = 0; _playerActorIdle = false; _playerDead = false; - _speechSkipped = false; + _gameOver = false; _gameAutoSave = -1; _gameIsLoading = false; @@ -401,11 +405,8 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { _gameVars = new int[_gameInfo->getGlobalVarCount()](); - // TODO: Init Actor AI Update counter - // Seed rand - // TODO: Sine and cosine lookup tables for intervals of 1.0, 4.0, and 12.0 _cosTable1024 = new Common::CosineTable(1024); // 10-bits = 1024 points for 2*PI; _sinTable1024 = new Common::SineTable(1024); @@ -469,8 +470,6 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { _playerActor->setFPS(15); _playerActor->timerStart(6, 200); - // TODO: Set actor ids (redundant?) - _policeMaze = new PoliceMaze(this); _textActorNames = new TextResource(this); @@ -563,7 +562,6 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { } void BladeRunnerEngine::initChapterAndScene() { - // TODO: Init actors... for (int i = 0, end = _gameInfo->getActorCount(); i != end; ++i) { _aiScripts->initialize(i); } @@ -611,8 +609,8 @@ void BladeRunnerEngine::shutdown() { } _shapes.clear(); - // TODO: Shutdown Scene delete _scene; + _scene = nullptr; if (_chapters) { if (_chapters->hasOpenResources()) @@ -693,7 +691,7 @@ void BladeRunnerEngine::shutdown() { _mainFont = nullptr; } - if(isArchiveOpen("SUBTITLES.MIX")) { + if (isArchiveOpen("SUBTITLES.MIX")) { closeArchive("SUBTITLES.MIX"); } if (_subtitles) { @@ -756,7 +754,6 @@ void BladeRunnerEngine::shutdown() { delete _gameInfo; _gameInfo = nullptr; - // TODO: Delete graphics surfaces here _surface4.free(); _surfaceBack.free(); _surfaceFront.free(); @@ -765,8 +762,6 @@ void BladeRunnerEngine::shutdown() { closeArchive("STARTUP.MIX"); } - // TODO: Delete MIXArchives here - delete _time; _time = nullptr; @@ -908,7 +903,6 @@ void BladeRunnerEngine::gameTick() { _policeMaze->tick(); - // TODO: Gun range announcements _zbuffer->clean(); _ambientSounds->tick(); @@ -963,8 +957,6 @@ void BladeRunnerEngine::gameTick() { _mouse->tick(p.x, p.y); _mouse->draw(_surfaceFront, p.x, p.y); - // TODO: Process AUD - if (_walkSoundId >= 0) { _audioPlayer->playAud(_gameInfo->getSfxTrack(_walkSoundId), _walkSoundVolume, _walkSoundBalance, _walkSoundBalance, 50, 0); _walkSoundId = -1; @@ -1066,8 +1058,11 @@ void BladeRunnerEngine::handleEvents() { } void BladeRunnerEngine::handleKeyUp(Common::Event &event) { - if (event.kbd.keycode == Common::KEYCODE_RETURN) { - _speechSkipped = true; + if (_actorIsSpeaking && event.kbd.keycode == Common::KEYCODE_RETURN) { + _actorSpeakStopIsRequested = true; + _actorIsSpeaking = false; + + return; } if (_vqaIsPlaying) { @@ -1077,8 +1072,7 @@ void BladeRunnerEngine::handleKeyUp(Common::Event &event) { return; } - // TODO: - if (!playerHasControl() /*|| ActorInWalkingLoop*/) { + if (!playerHasControl() || _isWalkingInterruptible) { return; } @@ -1133,8 +1127,7 @@ void BladeRunnerEngine::handleKeyDown(Common::Event &event) { return; } - //TODO: - if (!playerHasControl() /* || ActorWalkingLoop || ActorSpeaking || VqaIsPlaying */) { + if (!playerHasControl() || _isWalkingInterruptible || _actorIsSpeaking || _vqaIsPlaying) { return; } diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h index 74387b1807..deaf4fa462 100644 --- a/engines/bladerunner/bladerunner.h +++ b/engines/bladerunner/bladerunner.h @@ -188,7 +188,8 @@ public: bool _interruptWalking; bool _playerActorIdle; bool _playerDead; - bool _speechSkipped; + bool _actorIsSpeaking; + bool _actorSpeakStopIsRequested; bool _gameOver; int _gameAutoSave; bool _gameIsLoading; diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp index 14f34c4946..9e2097b2d9 100644 --- a/engines/bladerunner/script/script.cpp +++ b/engines/bladerunner/script/script.cpp @@ -318,9 +318,11 @@ void ScriptBase::Actor_Says_With_Pause(int actorId, int sentenceId, float pause, } Player_Loses_Control(); while (_vm->_gameIsRunning) { - _vm->_speechSkipped = false; + _vm->_actorIsSpeaking = true; + _vm->_actorSpeakStopIsRequested = false; _vm->gameTick(); - if (_vm->_speechSkipped || !actor->isSpeeching()) { + _vm->_actorIsSpeaking = false; + if (_vm->_actorSpeakStopIsRequested || !actor->isSpeeching()) { actor->speechStop(); break; } @@ -336,7 +338,7 @@ void ScriptBase::Actor_Says_With_Pause(int actorId, int sentenceId, float pause, } } - if (pause > 0.0f && !_vm->_speechSkipped) { + if (pause > 0.0f && !_vm->_actorSpeakStopIsRequested) { Delay(pause * 1000); } @@ -355,10 +357,12 @@ void ScriptBase::Actor_Voice_Over(int sentenceId, int actorId) { actor->speechPlay(sentenceId, true); Player_Loses_Control(); - while(_vm->_gameIsRunning) { - _vm->_speechSkipped = false; + while (_vm->_gameIsRunning) { + _vm->_actorIsSpeaking = true; + _vm->_actorSpeakStopIsRequested = false; _vm->gameTick(); - if(_vm->_speechSkipped || !actor->isSpeeching()) { + _vm->_actorIsSpeaking = false; + if (_vm->_actorSpeakStopIsRequested || !actor->isSpeeching()) { actor->speechStop(); break; } diff --git a/engines/bladerunner/ui/vk.cpp b/engines/bladerunner/ui/vk.cpp index ab2b5de221..6186452ad2 100644 --- a/engines/bladerunner/ui/vk.cpp +++ b/engines/bladerunner/ui/vk.cpp @@ -243,24 +243,24 @@ void VK::playSpeechLine(int actorId, int sentenceId, float duration) { actor->speechPlay(sentenceId, true); while (_vm->_gameIsRunning) { - // ActorSpeaking = 1; - _vm->_speechSkipped = false; + _vm->_actorIsSpeaking = true; + _vm->_actorSpeakStopIsRequested = false; _vm->gameTick(); - // ActorSpeaking = 0; - if (_vm->_speechSkipped || !actor->isSpeeching()) { + _vm->_actorIsSpeaking = false; + if (_vm->_actorSpeakStopIsRequested || !actor->isSpeeching()) { actor->speechStop(); break; } } - if (duration > 0.0f && !_vm->_speechSkipped) { + if (duration > 0.0f && !_vm->_actorSpeakStopIsRequested) { int timeEnd = duration * 1000.0f + _vm->_time->current(); while ((timeEnd > _vm->_time->current()) && _vm->_gameIsRunning) { _vm->gameTick(); } } - _vm->_speechSkipped = false; + _vm->_actorSpeakStopIsRequested = false; _vm->_mouse->enable(); } |