HDB: Add and call useAutoDoorOpenClose()

This commit is contained in:
Nipun Garg 2019-06-27 22:31:32 +05:30 committed by Eugene Sandulenko
parent 235040fb8a
commit 0daae85340
3 changed files with 28 additions and 5 deletions

View File

@ -952,10 +952,6 @@ void callbackDoorOpenClose(int x, int y) {
warning("STUB: AI: callbackDoorOpenClose required"); warning("STUB: AI: callbackDoorOpenClose required");
} }
void callbackAutoDoorOpenClose(int x, int y) {
warning("STUB: AI: callbackAutoDoorOpenClose required");
}
// Utility Functions // Utility Functions
void aiAnimateStanddown(AIEntity *e, int speed) { void aiAnimateStanddown(AIEntity *e, int speed) {
warning("STUB: AI: aiAnimateStanddown required"); warning("STUB: AI: aiAnimateStanddown required");

View File

@ -72,8 +72,32 @@ bool AI::useDoorOpenClose(AIEntity *e, int x, int y) {
warning("STUB: Define useDoorOpenClose"); warning("STUB: Define useDoorOpenClose");
return false; 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) { 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; return false;
} }

View File

@ -300,7 +300,10 @@ Common::Error HDBGame::run() {
_drawMan->drawSky(); _drawMan->drawSky();
warning("STUB: HDBGame::run: Add check for pause flag");
_ai->moveEnts(); _ai->moveEnts();
_ai->processCallbackList();
_map->draw(); _map->draw();
_ai->processCines(); _ai->processCines();