diff options
author | Nipun Garg | 2019-08-16 14:20:29 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:34 +0200 |
commit | c2a8a0c2c4192eab5ff8cdf855a561755c957356 (patch) | |
tree | e17d671b2052a744e9f01c1b56fffc017808ac97 /engines | |
parent | f0eb59cdee3f8ac0152b6075f68db6d6a9784f85 (diff) | |
download | scummvm-rg350-c2a8a0c2c4192eab5ff8cdf855a561755c957356.tar.gz scummvm-rg350-c2a8a0c2c4192eab5ff8cdf855a561755c957356.tar.bz2 scummvm-rg350-c2a8a0c2c4192eab5ff8cdf855a561755c957356.zip |
HDB: Fix PPC Double Click code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hdb/hdb.cpp | 19 | ||||
-rw-r--r-- | engines/hdb/input.cpp | 24 |
2 files changed, 22 insertions, 21 deletions
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 4b4bc86c21..68f505b931 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -408,25 +408,6 @@ void HDBGame::setTargetXY(int x, int y) { if (p->touchpWait) return; - // Double-Clicking on the player to open inventory? - if (g_hdb->isPPC()) { - if (x == px && y == py) { - static uint32 dblClickTimer = 0; - - if (dblClickTimer) { - debug("Double Click Timer: %d", dblClickTimer); - debug("Click Timer Diff: %d", (int)(g_system->getMillis() - dblClickTimer)); - } - - if (dblClickTimer && ((int)(g_system->getMillis() - dblClickTimer) < (int)(kGameFPS * 5 * 1000 / 60))) { - g_hdb->_window->openInventory(); - dblClickTimer = 0; - } else - dblClickTimer = g_system->getMillis(); - return; - } - } - // If we're attacking...don't do anything else AIState stateList[] = { STATE_ATK_CLUB_UP, STATE_ATK_CLUB_DOWN, STATE_ATK_CLUB_LEFT, STATE_ATK_CLUB_RIGHT, diff --git a/engines/hdb/input.cpp b/engines/hdb/input.cpp index 0a3cfb2d23..333c227d64 100644 --- a/engines/hdb/input.cpp +++ b/engines/hdb/input.cpp @@ -376,10 +376,30 @@ void Input::stylusDown(int x, int y) { return; } - // Toggle Walk Speed if we clicked Player - static uint32 lastRunning = g_system->getMillis(); + // Double-Clicking on the player to open inventory? int nx, ny; g_hdb->_ai->getPlayerXY(&nx, &ny); + if (g_hdb->isPPC()) { + if (nx == worldX && ny == worldY) { + static uint32 dblClickTimer = 0; + + if (dblClickTimer && ((int)(g_system->getMillis() - dblClickTimer) < (int)(kGameFPS * 1000 / 60))) { + g_hdb->_window->openInventory(); + dblClickTimer = 0; + g_hdb->_ai->togglePlayerRunning(); + if (g_hdb->_ai->playerRunning()) + g_hdb->_window->centerTextOut("Running Speed", g_hdb->_screenHeight - 32, kRunToggleDelay * kGameFPS); + else + g_hdb->_window->centerTextOut("Walking Speed", g_hdb->_screenHeight - 32, kRunToggleDelay * kGameFPS); + g_hdb->_sound->playSound(SND_SWITCH_USE); + return; + } else + dblClickTimer = g_system->getMillis(); + } + } + + // Toggle Walk Speed if we clicked Player + static uint32 lastRunning = g_system->getMillis(); if (nx == worldX && ny == worldY) { if (lastRunning > g_system->getMillis()) return; |