diff options
author | Nipun Garg | 2019-07-02 04:22:05 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:07 +0200 |
commit | 2369415b305e9b0569548049196f9baf0cf58021 (patch) | |
tree | c2047e7494632486ede86dead2c65c53651afa72 | |
parent | 2c520373d93e6f5b7f2cf717842fa4e9b99c446f (diff) | |
download | scummvm-rg350-2369415b305e9b0569548049196f9baf0cf58021.tar.gz scummvm-rg350-2369415b305e9b0569548049196f9baf0cf58021.tar.bz2 scummvm-rg350-2369415b305e9b0569548049196f9baf0cf58021.zip |
HDB: Add Crate related functions
-rw-r--r-- | engines/hdb/ai-player.cpp | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp index 6c8ff006b7..a5a3649026 100644 --- a/engines/hdb/ai-player.cpp +++ b/engines/hdb/ai-player.cpp @@ -557,15 +557,46 @@ void aiSpacedudeInit2(AIEntity *e) { } void aiCrateAction(AIEntity *e) { - warning("STUB: AI: aiCrateAction required"); + // if crate isn't moving somewhere, don't move it + if (!e->goalX) { + // crate is stopped in the water... should it continue downstream? + // not if it's marked by the Number of the Beast! + if (e->state == STATE_FLOATING) { + if (e->value1 != 0x666) { + int flags = g_hdb->_map->getMapBGTileFlags(e->tileX, e->tileY); + if (flags & (kFlagPushRight | kFlagPushLeft | kFlagPushUp | kFlagPushDown)) { + g_hdb->_ai->setEntityGoal(e, e->tileX, e->tileY); + g_hdb->_ai->animateEntity(e); + } else + g_hdb->_ai->animEntFrames(e); + } else + g_hdb->_ai->animEntFrames(e); + } + return; + } + + g_hdb->_ai->animateEntity(e); } void aiCrateInit2(AIEntity *e) { - warning("STUB: AI: aiCrateInit2 required"); + // point all crate move frames to the standing one + e->movedownFrames = + e->moveleftFrames = + e->moverightFrames = + e->moveupFrames = 1; + + e->movedownGfx[0] = + e->moveupGfx[0] = + e->moveleftGfx[0] = + e->moverightGfx[0] = e->standdownGfx[0]; + + e->draw = e->standdownGfx[0]; // standing frame - doesn't move } void aiCrateInit(AIEntity *e) { - warning("STUB: AI: aiCrateInit required"); + e->moveSpeed = kPushMoveSpeed; + e->aiAction = aiCrateAction; + e->value1 = 0; } void aiBarrelLightAction(AIEntity *e) { |