aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/input.cpp
diff options
context:
space:
mode:
authorStrangerke2019-08-05 23:39:36 +0200
committerEugene Sandulenko2019-09-03 17:17:32 +0200
commit161553db9bbfb9f08f936f7b38e2f2ddcf793e07 (patch)
tree92914964d339ee0d6d320c8d335362c32baba57e /engines/hdb/input.cpp
parent22251ec2a77445d09f9f1100cd2752339acd075f (diff)
downloadscummvm-rg350-161553db9bbfb9f08f936f7b38e2f2ddcf793e07.tar.gz
scummvm-rg350-161553db9bbfb9f08f936f7b38e2f2ddcf793e07.tar.bz2
scummvm-rg350-161553db9bbfb9f08f936f7b38e2f2ddcf793e07.zip
HDB: Reduce some more variable scopes, simplify a couple of checks in input.cpp
Diffstat (limited to 'engines/hdb/input.cpp')
-rw-r--r--engines/hdb/input.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/engines/hdb/input.cpp b/engines/hdb/input.cpp
index 99506a5de9..fb7f127cdf 100644
--- a/engines/hdb/input.cpp
+++ b/engines/hdb/input.cpp
@@ -136,8 +136,8 @@ void Input::setButtons(uint16 b) {
g_hdb->_window->setSelectedDelivery(current);
} else if (_buttons & kButtonRight) {
- int amount = g_hdb->_ai->getDeliveriesAmount();
- int current = g_hdb->_window->getSelectedDelivery();
+ int amount = g_hdb->_ai->getDeliveriesAmount();
+ int current = g_hdb->_window->getSelectedDelivery();
current++;
if (current == amount)
@@ -156,7 +156,6 @@ void Input::setButtons(uint16 b) {
// select weapon?
if (_buttons & kButtonB) {
static AIType lastWeaponSelected = AI_NONE;
- Tile *gfx;
if (!g_hdb->getActionMode()) {
g_hdb->_window->closeInv();
@@ -164,7 +163,7 @@ void Input::setButtons(uint16 b) {
}
AIType t = g_hdb->_ai->getInvItemType(g_hdb->_window->getInvSelect());
- gfx = g_hdb->_ai->getInvItemGfx(g_hdb->_window->getInvSelect());
+ Tile *gfx = g_hdb->_ai->getInvItemGfx(g_hdb->_window->getInvSelect());
switch (t) {
case ITEM_CLUB:
@@ -205,8 +204,8 @@ void Input::setButtons(uint16 b) {
g_hdb->_sound->playSound(SND_MENU_SLIDER);
g_hdb->_window->setInvSelect(current);
} else if (_buttons & kButtonRight) {
- int amount = g_hdb->_ai->getInvMax();
- int current = g_hdb->_window->getInvSelect();
+ int amount = g_hdb->_ai->getInvMax();
+ int current = g_hdb->_window->getInvSelect();
if (!amount)
return;
@@ -226,10 +225,10 @@ void Input::setButtons(uint16 b) {
g_hdb->_sound->playSound(SND_MENU_SLIDER);
g_hdb->_window->setInvSelect(current);
} else if (_buttons & kButtonUp) {
- int amount = g_hdb->_ai->getInvMax();
- int current = g_hdb->_window->getInvSelect();
+ int amount = g_hdb->_ai->getInvMax();
+ int current = g_hdb->_window->getInvSelect();
- if (!amount || amount < 6)
+ if (amount < 6)
return;
if (current - 5 >= 0)
@@ -238,10 +237,10 @@ void Input::setButtons(uint16 b) {
g_hdb->_sound->playSound(SND_MENU_SLIDER);
g_hdb->_window->setInvSelect(current);
} else if (_buttons & kButtonDown) {
- int amount = g_hdb->_ai->getInvMax();
- int current = g_hdb->_window->getInvSelect();
+ int amount = g_hdb->_ai->getInvMax();
+ int current = g_hdb->_window->getInvSelect();
- if (!amount || amount < 6)
+ if (amount < 6)
return;
if (current + 5 < amount)
@@ -346,9 +345,10 @@ void Input::stylusDown(int x, int y) {
}
// Is MessageBar active?
- if (g_hdb->_window->msgBarActive())
+ if (g_hdb->_window->msgBarActive()) {
if (g_hdb->_window->checkMsgClose(x, y))
return;
+ }
// In a cinematic?
if (g_hdb->_ai->playerLocked())
@@ -380,8 +380,8 @@ void Input::stylusDown(int x, int y) {
}
// Toggle Walk Speed if we clicked Player
- int nx, ny;
static uint32 lastRunning = g_system->getMillis();
+ int nx, ny;
g_hdb->_ai->getPlayerXY(&nx, &ny);
if (nx == worldX && ny == worldY) {
if (lastRunning > g_system->getMillis())
@@ -426,7 +426,6 @@ void Input::stylusMove(int x, int y) {
}
void Input::updateMouse(int newX, int newY) {
-
if (g_hdb->isPPC())
return;
@@ -579,11 +578,10 @@ void Input::updateKeys(Common::Event event, bool keyDown) {
g_hdb->_menu->setMenuKey(0);
}
} else if (event.kbd.keycode == _keyDebug) {
- if (keyDown) {
+ if (keyDown)
buttons |= kButtonExit;
- } else {
+ else
buttons &= ~kButtonExit;
- }
}
setButtons(buttons);