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/hdb/ai-use.cpp | |
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/hdb/ai-use.cpp')
-rw-r--r-- | engines/hdb/ai-use.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
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; } |