aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/ai-player.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-07-02 04:23:20 +0530
committerEugene Sandulenko2019-09-03 17:17:07 +0200
commit77ebf4ae50f08fdde20261bf902852c410e9448c (patch)
tree97f3279816fff4afdde1866e5a933ac93cc1fb2c /engines/hdb/ai-player.cpp
parent3b35cb5aa73088459ec223a2ed0f01355eaf1b2f (diff)
downloadscummvm-rg350-77ebf4ae50f08fdde20261bf902852c410e9448c.tar.gz
scummvm-rg350-77ebf4ae50f08fdde20261bf902852c410e9448c.tar.bz2
scummvm-rg350-77ebf4ae50f08fdde20261bf902852c410e9448c.zip
HDB: Add Exploding Barrel related functions
Diffstat (limited to 'engines/hdb/ai-player.cpp')
-rw-r--r--engines/hdb/ai-player.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp
index da2ccd75af..a2ff6ef771 100644
--- a/engines/hdb/ai-player.cpp
+++ b/engines/hdb/ai-player.cpp
@@ -668,19 +668,41 @@ void aiBarrelExplosionAction(AIEntity *e) {
}
void aiBarrelExplode(AIEntity *e) {
- warning("STUB: AI: aiBarrelExplode required");
+ e->state = STATE_EXPLODING;
+ e->animDelay = e->animCycle;
+ e->animFrame = 0;
+ warning("STUB: Play SND_BARREL_EXPLODE");
+ g_hdb->_map->setBoomBarrel(e->tileX, e->tileY, 0);
}
void aiBarrelExplodeInit(AIEntity *e) {
- warning("STUB: AI: aiBarrelExplodeInit required");
+ e->moveSpeed = kPushMoveSpeed;
+ e->aiAction = aiBarrelExplodeAction;
+ g_hdb->_map->setBoomBarrel(e->tileX, e->tileY, 1);
}
void aiBarrelExplodeInit2(AIEntity *e) {
- warning("STUB: AI: aiBarrelExplodeInit2 required");
+ // point all exploding barrel MOVE frames to the standing one
+ e->blinkFrames =
+ e->movedownFrames =
+ e->moveleftFrames =
+ e->moverightFrames =
+ e->moveupFrames = 1;
+
+ e->blinkGfx[0] =
+ 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 aiBarrelExplodeAction(AIEntity *e) {
- warning("STUB: AI: aiBarrelExplodeAction required");
+ if (e->goalX)
+ g_hdb->_ai->animateEntity(e);
+ else if (e->state == STATE_EXPLODING)
+ g_hdb->_ai->animEntFrames(e);
}
void aiBarrelExplodeSpread(AIEntity *e) {
@@ -688,11 +710,14 @@ void aiBarrelExplodeSpread(AIEntity *e) {
}
void aiBarrelExplosionEnd(int x, int y) {
- warning("STUB: AI: aiBarrelExplosionEnd(int, int) required");
+ g_hdb->_map->setExplosion(x, y, 0);
}
void aiBarrelBlowup(AIEntity *e, int x, int y) {
- warning("STUB: AI: aiBarrelBlowup required");
+ g_hdb->_ai->addAnimateTarget(x * kTileWidth,
+ y * kTileHeight, 0, 3, ANIM_NORMAL, false, false, GROUP_EXPLOSION_BOOM_SIT);
+ g_hdb->_map->setExplosion(x, y, 1);
+ g_hdb->_ai->addCallback(AI_BARREL_EXPLOSION_END, x, y, e->animCycle * 4);
}
void aiScientistInit(AIEntity *e) {