aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-08-04 08:35:27 -0400
committerPaul Gilbert2015-08-04 08:35:27 -0400
commitcb568dbbbe6ff335bbc884192a553751da5f16fc (patch)
tree5e2f7d89c10f72c1cd827c7289c509334a8a01f6
parentd4653b15a4f7651eded7855bac465c0acae91bde (diff)
downloadscummvm-rg350-cb568dbbbe6ff335bbc884192a553751da5f16fc.tar.gz
scummvm-rg350-cb568dbbbe6ff335bbc884192a553751da5f16fc.tar.bz2
scummvm-rg350-cb568dbbbe6ff335bbc884192a553751da5f16fc.zip
SHERLOCK: RT: Fix using Escape in darts minigame
-rw-r--r--engines/sherlock/tattoo/tattoo_darts.cpp21
-rw-r--r--engines/sherlock/tattoo/tattoo_darts.h1
2 files changed, 16 insertions, 6 deletions
diff --git a/engines/sherlock/tattoo/tattoo_darts.cpp b/engines/sherlock/tattoo/tattoo_darts.cpp
index e2fa4f6de8..806b3ff32c 100644
--- a/engines/sherlock/tattoo/tattoo_darts.cpp
+++ b/engines/sherlock/tattoo/tattoo_darts.cpp
@@ -68,6 +68,7 @@ Darts::Darts(SherlockEngine *vm) : _vm(vm) {
_oldDartButtons = false;
_handX = 0;
_compPlay = 1;
+ _escapePressed = false;
}
void Darts::playDarts(GameType gameType) {
@@ -208,12 +209,9 @@ void Darts::playDarts(GameType gameType) {
events.clearEvents();
if ((playerNum == 0 && _compPlay == 1) || _compPlay == 0 || done) {
- if (events.kbHit()) {
- Common::KeyState keyState = events.getKey();
- if (keyState.keycode == Common::KEYCODE_ESCAPE) {
- done = true;
- idx = 10;
- }
+ if (_escapePressed) {
+ done = true;
+ idx = 10;
}
} else {
events.wait(20);
@@ -245,6 +243,7 @@ void Darts::playDarts(GameType gameType) {
void Darts::initDarts() {
_dartInfo = Common::Rect(430, 245, 430 + 205, 245 + 150);
+ _escapePressed = false;
if (_gameType == GAME_CRICKET) {
_dartInfo = Common::Rect(430, 245, 430 + 205, 245 + 150);
@@ -406,6 +405,9 @@ bool Darts::dartHit() {
// Keyboard check
if (events.kbHit()) {
+ if (events.getKey().keycode == Common::KEYCODE_ESCAPE)
+ _escapePressed = true;
+
events.clearEvents();
return true;
}
@@ -889,6 +891,8 @@ int Darts::throwDart(int dartNum, int computer) {
// Wait for a hit
while (!dartHit() && !_vm->shouldQuit())
;
+ if (_escapePressed)
+ return 0;
} else {
events.wait(1);
}
@@ -907,7 +911,12 @@ int Darts::throwDart(int dartNum, int computer) {
}
horiz = drawHand(targetPos.x, computer);
+ if (_escapePressed)
+ return 0;
+
height = doPowerBar(Common::Point(DART_BAR_VX, DART_HEIGHT_Y), DART_COLOR_FORE, targetPos.y, 1);
+ if (_escapePressed)
+ return 0;
// Invert height
height = 101 - height;
diff --git a/engines/sherlock/tattoo/tattoo_darts.h b/engines/sherlock/tattoo/tattoo_darts.h
index f65ec19d10..ab6b1c8204 100644
--- a/engines/sherlock/tattoo/tattoo_darts.h
+++ b/engines/sherlock/tattoo/tattoo_darts.h
@@ -55,6 +55,7 @@ private:
bool _oldDartButtons;
int _handX;
Common::Point _handSize;
+ bool _escapePressed;
/**
* Initialize game variables