diff options
-rw-r--r-- | engines/hdb/hdb.cpp | 26 | ||||
-rw-r--r-- | engines/hdb/hdb.h | 2 | ||||
-rw-r--r-- | engines/hdb/map.h | 6 |
3 files changed, 34 insertions, 0 deletions
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 13d44f2b03..3c1930c038 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -454,6 +454,32 @@ void HDBGame::setTargetXY(int x, int y) { } } +void HDBGame::startMoveMap(int x, int y) { + _dx = x; + _dy = y; +} + +void HDBGame::moveMap(int x, int y) { + int ox, oy; + + g_hdb->_map->getMapXY(&ox, &oy); + + ox += (_dx - x) / 8; + oy += (_dy - y) / 8; + + if (ox < 0) + ox = 0; + else if (ox > g_hdb->_map->mapPixelWidth() - 240) + ox = g_hdb->_map->mapPixelWidth() - 240; + + if (oy < 0) + oy = 0; + else if (oy > g_hdb->_map->mapPixelHeight() - 320) + oy = g_hdb->_map->mapPixelHeight() - 320; + + g_hdb->_map->setMapXY(ox, oy); +} + // PLAYER is trying to use this entity void HDBGame::useEntity(AIEntity *e) { warning("STUB: HDBGame::useEntity incomplete"); diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h index cb6c1f1cda..6de28097d1 100644 --- a/engines/hdb/hdb.h +++ b/engines/hdb/hdb.h @@ -196,6 +196,8 @@ public: } void changeGameState(); void paint(); + void moveMap(int x, int y); // Get Stylus Coords and Scroll + void startMoveMap(int x, int y); // Start Dragging Map void setTargetXY(int x, int y); void useEntity(AIEntity *e); diff --git a/engines/hdb/map.h b/engines/hdb/map.h index 40191f7f4d..1822c86234 100644 --- a/engines/hdb/map.h +++ b/engines/hdb/map.h @@ -95,6 +95,12 @@ public: return true; return false; } + int mapPixelWidth() { + return _width * kTileWidth; + } + int mapPixelHeight() { + return _height * kTileHeight; + } uint32 getMapBGTileFlags(int x, int y); uint32 getMapFGTileFlags(int x, int y); |