[Scummvm-git-logs] scummvm master -> 95b14a9ab65c44670c8cd18bc281c145078f6499

antoniou79 a.antoniou79 at gmail.com
Wed Jun 16 18:45:56 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
95b14a9ab6 BLADERUNNER: Fix KIA blink at Esc on last line spoken


Commit: 95b14a9ab65c44670c8cd18bc281c145078f6499
    https://github.com/scummvm/scummvm/commit/95b14a9ab65c44670c8cd18bc281c145078f6499
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2021-06-16T21:45:01+03:00

Commit Message:
BLADERUNNER: Fix KIA blink at Esc on last line spoken

Also restore dual skip funtionality for Esc and Return keys down (video and spoken non-queued dialogue)

Previous behavior restored as a quality of life feature, that is quite practical on eg. Android port (easy access to "Esc", not so easy to "Return"). The issues that led to reverting previous to the original behavior (only Esc key for video, only Return key for dialogue) should be resolved now by the intermediate commits.

Changed paths:
    engines/bladerunner/bladerunner.cpp
    engines/bladerunner/script/script.cpp


diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index c45f1b2c73..c33821b86f 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -1047,7 +1047,6 @@ void BladeRunnerEngine::gameLoop() {
 }
 
 void BladeRunnerEngine::gameTick() {
-
 	handleEvents();
 
 	if (!_gameIsRunning || !_windowIsActive) {
@@ -1281,7 +1280,6 @@ void BladeRunnerEngine::handleEvents() {
 		return;
 	}
 
-	uint32 timeNow = _time->currentSystem();
 	Common::Event event;
 	Common::EventManager *eventMan = _system->getEventManager();
 	while (eventMan->pollEvent(event)) {
@@ -1297,7 +1295,7 @@ void BladeRunnerEngine::handleEvents() {
 				// First hit (fire) has a bigger delay (kKeyRepeatInitialDelay) before repeated events are fired from the same key
 				if (event.kbd.keycode == Common::KEYCODE_ESCAPE || event.kbd.keycode == Common::KEYCODE_RETURN) {
 					_currentKeyDown = event.kbd.keycode;
-					_keyRepeatTimeLast = timeNow;
+					_keyRepeatTimeLast =  _time->currentSystem();
 					_keyRepeatTimeDelay = kKeyRepeatInitialDelay;
 				}
 				handleKeyDown(event);
@@ -1337,7 +1335,12 @@ void BladeRunnerEngine::handleEvents() {
 		}
 	}
 
-	if ((_currentKeyDown == Common::KEYCODE_ESCAPE || _currentKeyDown == Common::KEYCODE_RETURN) && (timeNow - _keyRepeatTimeLast >= _keyRepeatTimeDelay)) {
+	// The switch clause above handles multiple events.
+	// Some of those may lead to their own internal gameTick() loops (which will call handleEvents()).
+	// Thus, we need to get a new timeNow value here to ensure we're not comparing with a stale version.
+	uint32 timeNow = _time->currentSystem();
+	if ((_currentKeyDown == Common::KEYCODE_ESCAPE || _currentKeyDown == Common::KEYCODE_RETURN)
+	    && (timeNow - _keyRepeatTimeLast >= _keyRepeatTimeDelay)) {
 		// create a "new" keydown event
 		event.type = Common::EVENT_KEYDOWN;
 		// kbdRepeat field will be unused here since we emulate the kbd repeat behavior anyway, but it's good to set it for consistency
@@ -1366,29 +1369,34 @@ void BladeRunnerEngine::handleKeyUp(Common::Event &event) {
 }
 
 void BladeRunnerEngine::handleKeyDown(Common::Event &event) {
-	if (_vqaIsPlaying && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
-		// Note: Do not use Return key to skip a VQA cutscene - Original also only uses the Esc key here
-		//       While no glitches were attirubuted to using Return for skipping cutscenes
-		//       it's ultimately better to have the original behavior here
-		//       and not have a key skipping multiple stuff at the same time.
+	if (_vqaIsPlaying
+	    && (event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
+		// Note: Original only uses the Esc key here
 		_vqaStopIsRequested = true;
 		_vqaIsPlaying = false;
 
 		return;
 	}
 
-	if (_actorIsSpeaking && event.kbd.keycode == Common::KEYCODE_RETURN) {
-		// Note: Do not use Esc key to skip dialogue - Original also only uses the Return key here
-		//       Using Esc to skip dialogue causes a few bad glitches such as:
-		//        - Kia dialogue will blink fast after last line spoken is skipped
-		//        - In certain sequences (eg. Zuben dumping soup on McCoy) the frames won't play correctly
-		//          and that may lead to dead end situation (for the Zuben example, the scene is locked with no exits enabled).
+	if (_vqaStopIsRequested
+	    && (event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
+		 return;
+	}
+
+	if (_actorIsSpeaking
+	    && (event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
+		// Note: Original only uses the Return key here
 		_actorSpeakStopIsRequested = true;
 		_actorIsSpeaking = false;
 
 		return;
 	}
 
+	if (_actorSpeakStopIsRequested
+	    && (event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
+		 return;
+	}
+
 	if (!playerHasControl() || _isWalkingInterruptible || _actorIsSpeaking || _vqaIsPlaying) {
 		return;
 	}
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index 9402a2a41e..52067dcf54 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -350,6 +350,7 @@ void ScriptBase::Actor_Says_With_Pause(int actorId, int sentenceId, float pause,
 	if (pause > 0.0f && !_vm->_actorSpeakStopIsRequested) {
 		Delay(pause * 1000u);
 	}
+	_vm->_actorSpeakStopIsRequested = false;
 	Player_Gains_Control();
 }
 
@@ -375,6 +376,7 @@ void ScriptBase::Actor_Voice_Over(int sentenceId, int actorId) {
 			break;
 		}
 	}
+	_vm->_actorSpeakStopIsRequested = false;
 	Player_Gains_Control();
 }
 




More information about the Scummvm-git-logs mailing list