aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/ai-use.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-07-03 05:50:36 +0530
committerEugene Sandulenko2019-09-03 17:17:08 +0200
commitd88f4fb7c0a8600d57652419faa51b175a0aac10 (patch)
tree7b12f7709fb6b3db684e98c81976a8d68cae057e /engines/hdb/ai-use.cpp
parent7d08524b77a1bebf2ad5e472442525a57c29b70c (diff)
downloadscummvm-rg350-d88f4fb7c0a8600d57652419faa51b175a0aac10.tar.gz
scummvm-rg350-d88f4fb7c0a8600d57652419faa51b175a0aac10.tar.bz2
scummvm-rg350-d88f4fb7c0a8600d57652419faa51b175a0aac10.zip
HDB: Add callbackDoorOpenClose() and use function
Diffstat (limited to 'engines/hdb/ai-use.cpp')
-rw-r--r--engines/hdb/ai-use.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/engines/hdb/ai-use.cpp b/engines/hdb/ai-use.cpp
index 83a294d86a..188244ce1f 100644
--- a/engines/hdb/ai-use.cpp
+++ b/engines/hdb/ai-use.cpp
@@ -67,10 +67,30 @@ bool AI::useTouchplateOn(AIEntity *e, int x, int y, int targetX, int targetY, in
return false;
}
+void callbackDoorOpenClose(int x, int y) {
+ int tileIndex = g_hdb->_map->getMapBGTileIndex(x, y);
+
+ // is the door gonna close on something? if so, wait again
+ if (!g_hdb->_ai->findEntity(x, y)) {
+ g_hdb->_ai->addCallback(CALLBACK_DOOR_OPEN_CLOSE, x, y, kDelay5Seconds);
+ return;
+ }
+
+ g_hdb->_ai->addAnimateTarget(x, y, tileIndex, tileIndex + 3, ANIM_SLOW, false, true, NULL);
+ if (g_hdb->_map->onScreen(x, y))
+ warning("STUB: Play SND_DOOR_OPEN_CLOSE");
+ return;
+}
+
// Normal Door
bool AI::useDoorOpenClose(AIEntity *e, int x, int y) {
- warning("STUB: Define useDoorOpenClose");
- return false;
+ int tileIndex = g_hdb->_map->getMapBGTileIndex(x, y);
+
+ addAnimateTarget(x, y, tileIndex, tileIndex - 3, ANIM_SLOW, false, true, NULL);
+ addCallback(CALLBACK_DOOR_OPEN_CLOSE, x, y, kDelay5Seconds);
+ if (g_hdb->_map->onScreen(x, y))
+ warning("Play SND_DOOR_OPEN_CLOSE");
+ return true;
}
void callbackAutoDoorOpenClose(int x, int y) {