aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/input.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-06-28 22:02:41 +0530
committerEugene Sandulenko2019-09-03 17:17:04 +0200
commit0b87875a3ab088eed2ed33f4897aeddaf79b4147 (patch)
treec845d6f1b1dc22dc420b594a57061f0936ffd7df /engines/hdb/input.cpp
parentfe914ffd416279779bf40e8158d78db06b1e5fe7 (diff)
downloadscummvm-rg350-0b87875a3ab088eed2ed33f4897aeddaf79b4147.tar.gz
scummvm-rg350-0b87875a3ab088eed2ed33f4897aeddaf79b4147.tar.bz2
scummvm-rg350-0b87875a3ab088eed2ed33f4897aeddaf79b4147.zip
HDB: Unstub stylusDown()
Diffstat (limited to 'engines/hdb/input.cpp')
-rw-r--r--engines/hdb/input.cpp85
1 files changed, 82 insertions, 3 deletions
diff --git a/engines/hdb/input.cpp b/engines/hdb/input.cpp
index 12d415eccc..34dadc19b7 100644
--- a/engines/hdb/input.cpp
+++ b/engines/hdb/input.cpp
@@ -47,7 +47,87 @@ uint16 Input::getButtons() {
}
void Input::stylusDown(int x, int y) {
- warning("STUB: Input: stylusDown required");
+ int worldX, worldY;
+ GameState gs;
+ static uint32 delay = 0, time;
+
+ // Don't let the screen get clicked too fast
+ time = g_system->getMillis();
+ if (time - delay < 100)
+ return;
+ time = delay;
+
+ _stylusDown = true;
+ _stylusDownX = x;
+ _stylusDownY = y;
+ gs = g_hdb->getGameState();
+
+ switch (gs) {
+ case GAME_TITLE:
+ warning("STUB: Menu: changeToMenu required");
+ g_hdb->changeGameState();
+ break;
+ case GAME_MENU:
+ warning("STUB: Menu: processInput required");
+ break;
+ case GAME_PLAY:
+ // Is Player Dead? Click on TRY AGAIN
+ if (g_hdb->_ai->playerDead()) {
+ warning("STUB: TRY AGAIN is onscreen");
+ return;
+ }
+
+ // Is Dialog Active?
+ if (g_hdb->_window->dialogActive()) {
+ g_hdb->_window->closeDialog();
+ if (!g_hdb->_ai->cinematicsActive())
+ return;
+ }
+
+ // Is a Choice Dialog Active?
+ warning("STUB: stylusDown: Check Choice Dialog Active");
+
+ // Is MessageBar active?
+ warning("STUB: stylusDown: Check Message Bar Active");
+
+ // In a cinematic?
+ if (g_hdb->_ai->playerLocked())
+ return;
+
+ // Check for map dragging in debug Mode and place player there
+ warning("STUB: stylusDown: Check for Map dragging in Debug Mode");
+
+ // Clicked in the world
+ g_hdb->_map->getMapXY(&worldX, &worldY);
+ worldX = ((worldX + x) / kTileWidth) * kTileWidth;
+ worldY = ((worldY + y) / kTileHeight) * kTileHeight;
+
+ // Don't allow a click into INV/DELIVERIES area to go into the world
+ if (x >= (kScreenWidth - 32 * 5))
+ return;
+
+ // Toggle Walk Speed if we clicked Player
+ int nx, ny;
+ static uint32 lastRunning = g_system->getMillis();
+ g_hdb->_ai->getPlayerXY(&nx, &ny);
+ if (nx == worldX && ny == worldY) {
+ if (lastRunning > g_system->getMillis())
+ return;
+ lastRunning = g_system->getMillis() + 1000 * kRunToggleDelay;
+ g_hdb->_ai->togglePlayerRunning();
+ if (g_hdb->_ai->playerRunning())
+ g_hdb->_window->centerTextOut("Running Speed", kScreenHeight - 32, kRunToggleDelay * kGameFPS);
+ else
+ g_hdb->_window->centerTextOut("Walking Speed", kScreenHeight - 32, kRunToggleDelay * kGameFPS);
+ warning("STUB: Play SND_SWITCH_USE");
+ }
+
+ g_hdb->setTargetXY(worldX, worldY);
+ break;
+ case GAME_LOADING:
+ debug(9, "stylusDown: GAME_LOADING found");
+ break;
+ }
}
void stylusUp(int x, int y) {
@@ -58,5 +138,4 @@ void stylusMove(int x, int y) {
warning("STUB: Input: stylusMove required");
}
-}
-
+} // End of Namespace