aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPeter Kohaut2019-06-22 11:39:21 +0200
committerPeter Kohaut2019-06-22 11:40:47 +0200
commit4cd58f2fba25858d026a48eafea95ac3acd0620e (patch)
tree536cb3e84fef70e874f0d581d1f9c54a3d0cf4e2 /engines
parent9d0de3e168f4975ba2974ac71031fffdd008819f (diff)
downloadscummvm-rg350-4cd58f2fba25858d026a48eafea95ac3acd0620e.tar.gz
scummvm-rg350-4cd58f2fba25858d026a48eafea95ac3acd0620e.tar.bz2
scummvm-rg350-4cd58f2fba25858d026a48eafea95ac3acd0620e.zip
BLADERUNNER: Switch all keyUp events to keyDown
With keyDown events some parts of the game feels more responsive. This wasn't working before because of a issue in SDL library. Also added ability to skip talking with ESC key.
Diffstat (limited to 'engines')
-rw-r--r--engines/bladerunner/bladerunner.cpp68
-rw-r--r--engines/bladerunner/ui/kia.cpp36
-rw-r--r--engines/bladerunner/ui/kia_section_help.cpp4
-rw-r--r--engines/bladerunner/ui/kia_section_help.h1
-rw-r--r--engines/bladerunner/ui/kia_section_save.cpp19
-rw-r--r--engines/bladerunner/ui/kia_section_settings.cpp2
-rw-r--r--engines/bladerunner/ui/kia_section_settings.h2
-rw-r--r--engines/bladerunner/ui/ui_container.cpp1
-rw-r--r--engines/bladerunner/ui/ui_input_box.cpp16
-rw-r--r--engines/bladerunner/ui/ui_input_box.h1
10 files changed, 57 insertions, 93 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 0288af3c22..6a362c82b0 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -1118,7 +1118,10 @@ void BladeRunnerEngine::handleEvents() {
break;
case Common::EVENT_KEYDOWN:
- handleKeyDown(event);
+ // Process the actual key press only and filter out repeats
+ if (!event.kbdRepeat) {
+ handleKeyDown(event);
+ }
break;
case Common::EVENT_LBUTTONUP:
@@ -1156,13 +1159,6 @@ void BladeRunnerEngine::handleEvents() {
}
void BladeRunnerEngine::handleKeyUp(Common::Event &event) {
- if (_actorIsSpeaking && event.kbd.keycode == Common::KEYCODE_RETURN) {
- _actorSpeakStopIsRequested = true;
- _actorIsSpeaking = false;
-
- return;
- }
-
if (!playerHasControl() || _isWalkingInterruptible) {
return;
}
@@ -1171,44 +1167,6 @@ void BladeRunnerEngine::handleKeyUp(Common::Event &event) {
_kia->handleKeyUp(event.kbd);
return;
}
-
- if (_spinner->isOpen()) {
- return;
- }
-
- if (_elevator->isOpen()) {
- return;
- }
-
- if (_esper->isOpen()) {
- return;
- }
-
- if (_vk->isOpen()) {
- return;
- }
-
- if (_dialogueMenu->isOpen()) {
- return;
- }
-
- if (_scores->isOpen()) {
- return;
- }
-
- switch (event.kbd.keycode) {
- case Common::KEYCODE_TAB:
- _kia->openLastOpened();
- break;
- case Common::KEYCODE_ESCAPE:
- _kia->open(kKIASectionSettings);
- break;
- case Common::KEYCODE_SPACE:
- _combat->change();
- break;
- default:
- break;
- }
}
void BladeRunnerEngine::handleKeyDown(Common::Event &event) {
@@ -1218,13 +1176,20 @@ void BladeRunnerEngine::handleKeyDown(Common::Event &event) {
return;
}
- if (_vqaIsPlaying && !event.kbdRepeat && (event.kbd.keycode == Common::KEYCODE_ESCAPE || event.kbd.keycode == Common::KEYCODE_RETURN)) {
+ if (_vqaIsPlaying && (event.kbd.keycode == Common::KEYCODE_ESCAPE || event.kbd.keycode == Common::KEYCODE_RETURN)) {
_vqaStopIsRequested = true;
_vqaIsPlaying = false;
return;
}
+ if (_actorIsSpeaking && (event.kbd.keycode == Common::KEYCODE_ESCAPE || event.kbd.keycode == Common::KEYCODE_RETURN)) {
+ _actorSpeakStopIsRequested = true;
+ _actorIsSpeaking = false;
+
+ return;
+ }
+
if (!playerHasControl() || _isWalkingInterruptible || _actorIsSpeaking || _vqaIsPlaying) {
return;
}
@@ -1277,6 +1242,15 @@ void BladeRunnerEngine::handleKeyDown(Common::Event &event) {
case Common::KEYCODE_F10:
_kia->open(kKIASectionQuit);
break;
+ case Common::KEYCODE_TAB:
+ _kia->openLastOpened();
+ break;
+ case Common::KEYCODE_ESCAPE:
+ _kia->open(kKIASectionSettings);
+ break;
+ case Common::KEYCODE_SPACE:
+ _combat->change();
+ break;
default:
break;
}
diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp
index f3dea527df..b5b04415de 100644
--- a/engines/bladerunner/ui/kia.cpp
+++ b/engines/bladerunner/ui/kia.cpp
@@ -448,6 +448,16 @@ void KIA::handleKeyUp(const Common::KeyState &kbd) {
return;
}
+ if (_currentSection) {
+ _currentSection->handleKeyUp(kbd);
+ }
+}
+
+void KIA::handleKeyDown(const Common::KeyState &kbd) {
+ if (!isOpen()) {
+ return;
+ }
+
if (toupper(kbd.ascii) != kPogo[_pogoPos]) {
_pogoPos = 0;
}
@@ -460,28 +470,18 @@ void KIA::handleKeyUp(const Common::KeyState &kbd) {
}
}
}
- if (kbd.keycode == Common::KEYCODE_ESCAPE) {
+
+ switch (kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
if (!_forceOpen) {
open(kKIASectionNone);
}
- } else {
- if (_currentSection) {
- _currentSection->handleKeyUp(kbd);
- }
- }
- if (_currentSection && _currentSection->_scheduledSwitch) {
- open(kKIASectionNone);
- }
-}
+ break;
-void KIA::handleKeyDown(const Common::KeyState &kbd) {
- if (!isOpen()) {
- return;
- }
- switch (kbd.keycode) {
case Common::KEYCODE_F1:
open(kKIASectionHelp);
break;
+
case Common::KEYCODE_F2:
if (!_forceOpen) {
open(kKIASectionSave);
@@ -490,9 +490,11 @@ void KIA::handleKeyDown(const Common::KeyState &kbd) {
case Common::KEYCODE_F3:
open(kKIASectionLoad);
break;
+
case Common::KEYCODE_F10:
open(kKIASectionQuit);
break;
+
case Common::KEYCODE_F4:
if (_currentSectionId != kKIASectionCrimes) {
if (!_forceOpen) {
@@ -502,6 +504,7 @@ void KIA::handleKeyDown(const Common::KeyState &kbd) {
}
}
break;
+
case Common::KEYCODE_F5:
if (_currentSectionId != kKIASectionSuspects) {
if (!_forceOpen) {
@@ -511,6 +514,7 @@ void KIA::handleKeyDown(const Common::KeyState &kbd) {
}
}
break;
+
case Common::KEYCODE_F6:
if (_currentSectionId != kKIASectionClues) {
if (!_forceOpen) {
@@ -520,12 +524,14 @@ void KIA::handleKeyDown(const Common::KeyState &kbd) {
}
}
break;
+
default:
if (_currentSection) {
_currentSection->handleKeyDown(kbd);
}
break;
}
+
if (_currentSection && _currentSection->_scheduledSwitch) {
open(kKIASectionNone);
}
diff --git a/engines/bladerunner/ui/kia_section_help.cpp b/engines/bladerunner/ui/kia_section_help.cpp
index 20002da94c..1c4da14db7 100644
--- a/engines/bladerunner/ui/kia_section_help.cpp
+++ b/engines/bladerunner/ui/kia_section_help.cpp
@@ -73,10 +73,6 @@ void KIASectionHelp::draw(Graphics::Surface &surface){
_uiContainer->draw(surface);
}
-void KIASectionHelp::handleKeyUp(const Common::KeyState &kbd) {
- _uiContainer->handleKeyUp(kbd);
-}
-
void KIASectionHelp::handleMouseMove(int mouseX, int mouseY) {
_uiContainer->handleMouseMove(mouseX, mouseY);
}
diff --git a/engines/bladerunner/ui/kia_section_help.h b/engines/bladerunner/ui/kia_section_help.h
index 779ad9e427..eebcbb3e0a 100644
--- a/engines/bladerunner/ui/kia_section_help.h
+++ b/engines/bladerunner/ui/kia_section_help.h
@@ -44,7 +44,6 @@ public:
void draw(Graphics::Surface &surface) override;
- void handleKeyUp(const Common::KeyState &kbd) override;
void handleMouseMove(int mouseX, int mouseY) override;
void handleMouseDown(bool mainButton) override;
void handleMouseUp(bool mainButton) override;
diff --git a/engines/bladerunner/ui/kia_section_save.cpp b/engines/bladerunner/ui/kia_section_save.cpp
index aeff2b4a21..86f6b01c94 100644
--- a/engines/bladerunner/ui/kia_section_save.cpp
+++ b/engines/bladerunner/ui/kia_section_save.cpp
@@ -225,6 +225,15 @@ void KIASectionSave::draw(Graphics::Surface &surface){
void KIASectionSave::handleKeyUp(const Common::KeyState &kbd) {
if (_state == kStateNormal) {
_uiContainer->handleKeyUp(kbd);
+ }
+}
+
+void KIASectionSave::handleKeyDown(const Common::KeyState &kbd) {
+ if (_state == kStateNormal) {
+ if (kbd.keycode == Common::KEYCODE_DELETE && _selectedLineId != _newSaveLineId) {
+ changeState(kStateDelete);
+ }
+ _uiContainer->handleKeyDown(kbd);
} else if (_state == kStateOverwrite) {
if (kbd.keycode == Common::KEYCODE_RETURN) {
save();
@@ -238,16 +247,6 @@ void KIASectionSave::handleKeyUp(const Common::KeyState &kbd) {
}
}
-void KIASectionSave::handleKeyDown(const Common::KeyState &kbd) {
- if (_state == kStateNormal) {
- if (kbd.keycode == Common::KEYCODE_DELETE && _selectedLineId != _newSaveLineId) {
- changeState(kStateDelete);
- }
-
- _uiContainer->handleKeyDown(kbd);
- }
-}
-
void KIASectionSave::handleMouseMove(int mouseX, int mouseY) {
_mouseX = mouseX;
_mouseY = mouseY;
diff --git a/engines/bladerunner/ui/kia_section_settings.cpp b/engines/bladerunner/ui/kia_section_settings.cpp
index ae2f32e775..be143723e1 100644
--- a/engines/bladerunner/ui/kia_section_settings.cpp
+++ b/engines/bladerunner/ui/kia_section_settings.cpp
@@ -229,7 +229,7 @@ void KIASectionSettings::draw(Graphics::Surface &surface) {
_playerAgendaSelector->drawTooltip(surface, _mouseX, _mouseY);
}
-void KIASectionSettings::handleKeyUp(const Common::KeyState &kbd) {
+void KIASectionSettings::handleKeyDown(const Common::KeyState &kbd) {
if (toupper(kbd.ascii) != kLeary[_learyPos]) {
_learyPos = 0;
}
diff --git a/engines/bladerunner/ui/kia_section_settings.h b/engines/bladerunner/ui/kia_section_settings.h
index ffb408e33f..55ba5b657f 100644
--- a/engines/bladerunner/ui/kia_section_settings.h
+++ b/engines/bladerunner/ui/kia_section_settings.h
@@ -65,7 +65,7 @@ public:
void draw(Graphics::Surface &surface) override;
- void handleKeyUp(const Common::KeyState &kbd) override;
+ void handleKeyDown(const Common::KeyState &kbd) override;
void handleMouseMove(int mouseX, int mouseY) override;
void handleMouseDown(bool mainButton) override;
void handleMouseUp(bool mainButton) override;
diff --git a/engines/bladerunner/ui/ui_container.cpp b/engines/bladerunner/ui/ui_container.cpp
index a9b89ae933..6b9feb105a 100644
--- a/engines/bladerunner/ui/ui_container.cpp
+++ b/engines/bladerunner/ui/ui_container.cpp
@@ -56,7 +56,6 @@ void UIContainer::handleMouseScroll(int direction) {
}
}
-
void UIContainer::handleKeyUp(const Common::KeyState &kbd) {
for (Common::Array<UIComponent*>::iterator component = _components.begin(); component != _components.end(); ++component) {
(*component)->handleKeyUp(kbd);
diff --git a/engines/bladerunner/ui/ui_input_box.cpp b/engines/bladerunner/ui/ui_input_box.cpp
index e1b655ed89..5b62ada157 100644
--- a/engines/bladerunner/ui/ui_input_box.cpp
+++ b/engines/bladerunner/ui/ui_input_box.cpp
@@ -83,24 +83,16 @@ void UIInputBox::hide() {
_isVisible = false;
}
-void UIInputBox::handleKeyUp(const Common::KeyState &kbd) {
- if (_isVisible) {
- // Check for "Enter" in keyUp instead of in keyDown as keyDown is repeating characters
- // and that can screw up UX (which is not great in the original game either).
- if (kbd.keycode == Common::KEYCODE_RETURN && !_text.empty()) {
- if (_valueChangedCallback) {
- _valueChangedCallback(_callbackData, this);
- }
- }
- }
-}
-
void UIInputBox::handleKeyDown(const Common::KeyState &kbd) {
if (_isVisible) {
if (charIsValid(kbd) && _text.size() < _maxLength) {
_text += kbd.ascii;
} else if (kbd.keycode == Common::KEYCODE_BACKSPACE) {
_text.deleteLastChar();
+ } else if (kbd.keycode == Common::KEYCODE_RETURN && !_text.empty()) {
+ if (_valueChangedCallback) {
+ _valueChangedCallback(_callbackData, this);
+ }
}
}
}
diff --git a/engines/bladerunner/ui/ui_input_box.h b/engines/bladerunner/ui/ui_input_box.h
index e3aee9996e..ac58a6e4ed 100644
--- a/engines/bladerunner/ui/ui_input_box.h
+++ b/engines/bladerunner/ui/ui_input_box.h
@@ -55,7 +55,6 @@ public:
void show();
void hide();
- void handleKeyUp(const Common::KeyState &kbd) override;
void handleKeyDown(const Common::KeyState &kbd) override;
private: