aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/input.cpp
diff options
context:
space:
mode:
authorStrangerke2019-09-19 08:05:36 +0200
committerStrangerke2019-09-19 08:10:49 +0200
commit0344e0adce3361f68c3ec0b92c86878e635e80ad (patch)
tree596b8dd7ee4a1ebe0efc7680b67e15cec5ec2399 /engines/hdb/input.cpp
parentcd2f87942f79f11afdf63af26e91edc089b96973 (diff)
downloadscummvm-rg350-0344e0adce3361f68c3ec0b92c86878e635e80ad.tar.gz
scummvm-rg350-0344e0adce3361f68c3ec0b92c86878e635e80ad.tar.bz2
scummvm-rg350-0344e0adce3361f68c3ec0b92c86878e635e80ad.zip
HDB: Simplify some code
Diffstat (limited to 'engines/hdb/input.cpp')
-rw-r--r--engines/hdb/input.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/engines/hdb/input.cpp b/engines/hdb/input.cpp
index df6d02e002..093f525ec4 100644
--- a/engines/hdb/input.cpp
+++ b/engines/hdb/input.cpp
@@ -439,28 +439,16 @@ void Input::stylusMove(int x, int y) {
}
void Input::updateMouse(int newX, int newY) {
- _mouseX = newX;
- _mouseY = newY;
-
- if (_mouseX < 0)
- _mouseX = 0;
- else if (_mouseX >= g_hdb->_screenWidth)
- _mouseX = g_hdb->_screenWidth - 1;
-
- if (_mouseY < 0)
- _mouseY = 0;
- else if (_mouseY >= g_hdb->_screenHeight)
- _mouseY = g_hdb->_screenHeight - 1;
+ _mouseX = CLIP(newX, 0, g_hdb->_screenWidth - 1);
+ _mouseY = CLIP(newY, 0, g_hdb->_screenHeight - 1);
// Turn Cursor back on?
- if (!g_hdb->_gfx->getPointer()) {
+ if (!g_hdb->_gfx->getPointer())
g_hdb->_gfx->showPointer(true);
- }
// Check if LButton is being dragged
- if (_mouseLButton) {
+ if (_mouseLButton)
stylusMove(_mouseX, _mouseY);
- }
}
void Input::updateMouseButtons(int l, int m, int r) {
@@ -510,7 +498,7 @@ void Input::updateMouseButtons(int l, int m, int r) {
}
void Input::updateKeys(Common::Event event, bool keyDown) {
- static int current = 0, last = 0;
+ static bool current = false, last = false;
if (keyDown && event.kbd.keycode == _keyQuit) {
g_hdb->quitGame();
@@ -522,13 +510,13 @@ void Input::updateKeys(Common::Event event, bool keyDown) {
// PAUSE key pressed?
last = current;
if (keyDown && event.kbd.keycode == Common::KEYCODE_p && g_hdb->getGameState() == GAME_PLAY) {
- current = 1;
+ current = true;
if (!last) {
g_hdb->togglePause();
g_hdb->_sound->playSound(SND_POP);
}
} else
- current = 0;
+ current = false;
if (!g_hdb->getPause()) {
if (event.kbd.keycode == _keyUp) {