diff options
author | Nipun Garg | 2019-06-27 22:31:32 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:02 +0200 |
commit | 0daae853408a8a1e7a35bef52dee88a79fac4541 (patch) | |
tree | 9c767d728a58ad47a04082cd0da72db77624be70 /engines | |
parent | 235040fb8a331d0cd5bccd6877966ffb1f3ed928 (diff) | |
download | scummvm-rg350-0daae853408a8a1e7a35bef52dee88a79fac4541.tar.gz scummvm-rg350-0daae853408a8a1e7a35bef52dee88a79fac4541.tar.bz2 scummvm-rg350-0daae853408a8a1e7a35bef52dee88a79fac4541.zip |
HDB: Add and call useAutoDoorOpenClose()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hdb/ai-player.cpp | 4 | ||||
-rw-r--r-- | engines/hdb/ai-use.cpp | 26 | ||||
-rw-r--r-- | engines/hdb/hdb.cpp | 3 |
3 files changed, 28 insertions, 5 deletions
diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp index e3997494c8..7cfcb24fcf 100644 --- a/engines/hdb/ai-player.cpp +++ b/engines/hdb/ai-player.cpp @@ -952,10 +952,6 @@ void callbackDoorOpenClose(int x, int y) { warning("STUB: AI: callbackDoorOpenClose required"); } -void callbackAutoDoorOpenClose(int x, int y) { - warning("STUB: AI: callbackAutoDoorOpenClose required"); -} - // Utility Functions void aiAnimateStanddown(AIEntity *e, int speed) { warning("STUB: AI: aiAnimateStanddown required"); diff --git a/engines/hdb/ai-use.cpp b/engines/hdb/ai-use.cpp index 4abb1023bb..83a294d86a 100644 --- a/engines/hdb/ai-use.cpp +++ b/engines/hdb/ai-use.cpp @@ -72,8 +72,32 @@ bool AI::useDoorOpenClose(AIEntity *e, int x, int y) { warning("STUB: Define useDoorOpenClose"); return false; } + +void callbackAutoDoorOpenClose(int x, int y) { + int tileIndex = g_hdb->_map->getMapBGTileIndex(x, y); + + // Is the door going to close on something? + if (g_hdb->_ai->findEntity(x, y)) { + g_hdb->_ai->addCallback(CALLBACK_AUTODOOR_OPEN_CLOSE, x, y, kDelay5Seconds); + return; + } + + g_hdb->_ai->addAnimateTarget(x, y, tileIndex, tileIndex + 3, ANIM_SLOW, true, true, NULL); + if (g_hdb->_map->onScreen(x, y)) + warning("STUB: callbackAutoDoorOpenClose: Play SND_DOOR_OPEN_CLOSE"); + return; +} + bool AI::useAutoDoorOpenClose(AIEntity *e, int x, int y) { - warning("STUB: Define useAutoDoorOpenClose"); + int tileIndex = g_hdb->_map->getMapBGTileIndex(x, y); + + if (autoActive(x, y)) + return false; + + addAnimateTarget(x, y, tileIndex, tileIndex - 3, ANIM_SLOW, false, true, NULL); + addCallback(CALLBACK_AUTODOOR_OPEN_CLOSE, x, y, kDelay5Seconds); + if (g_hdb->_map->onScreen(x, y)) + warning("useAutoDoorOpenClose: Play SND_DOOR_OPEN_CLOSE"); return false; } diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 238033c1bb..78774e1082 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -300,7 +300,10 @@ Common::Error HDBGame::run() { _drawMan->drawSky(); + warning("STUB: HDBGame::run: Add check for pause flag"); + _ai->moveEnts(); + _ai->processCallbackList(); _map->draw(); _ai->processCines(); |