diff options
author | Nipun Garg | 2019-07-14 02:56:35 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:20 +0200 |
commit | 469c2245b4080d75e46268d427ab13c39e8a8f36 (patch) | |
tree | da3119e1127ff38dfc08e02ae8a974711a11273e | |
parent | 73414fdc4795f074ad3fe9023ca2695b17b1da0d (diff) | |
download | scummvm-rg350-469c2245b4080d75e46268d427ab13c39e8a8f36.tar.gz scummvm-rg350-469c2245b4080d75e46268d427ab13c39e8a8f36.tar.bz2 scummvm-rg350-469c2245b4080d75e46268d427ab13c39e8a8f36.zip |
HDB: Add moveMap() and startMoveMap()
-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); |