aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/ai-bots.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-06-25 00:50:51 +0530
committerEugene Sandulenko2019-09-03 17:16:59 +0200
commit087f84b38b94ee56e67c874cb281bec057f6cb80 (patch)
tree7c55d8c4d6996e9162f1c04d924a38f4e6e3a23e /engines/hdb/ai-bots.cpp
parentbb674ec9c190bd19f4ce9e26c20e6ad92cb89986 (diff)
downloadscummvm-rg350-087f84b38b94ee56e67c874cb281bec057f6cb80.tar.gz
scummvm-rg350-087f84b38b94ee56e67c874cb281bec057f6cb80.tar.bz2
scummvm-rg350-087f84b38b94ee56e67c874cb281bec057f6cb80.zip
HDB: Add aiOmniBotMissile functions
Diffstat (limited to 'engines/hdb/ai-bots.cpp')
-rw-r--r--engines/hdb/ai-bots.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/engines/hdb/ai-bots.cpp b/engines/hdb/ai-bots.cpp
index 25d734a720..24e9cfb116 100644
--- a/engines/hdb/ai-bots.cpp
+++ b/engines/hdb/ai-bots.cpp
@@ -129,4 +129,44 @@ void aiOmniBotAction(AIEntity *e) {
e->sequence--;
}
+void aiOmniBotMissileInit(AIEntity *e) {
+ e->state = STATE_MOVEDOWN;
+ e->aiAction = aiOmniBotMissileAction;
+}
+
+void aiOmniBotMissileInit2(AIEntity *e) {
+ for (int i = 0; i < e->movedownFrames;i++)
+ e->moveleftGfx[i] = e->moverightGfx[i] = e->moveupGfx[i] = e->movedownGfx[i];
+
+ e->moveleftFrames = e->moverightFrames = e->moveupFrames = e->movedownFrames;
+ e->draw = e->movedownGfx[0];
+}
+
+void aiOmniBotMissileAction(AIEntity *e) {
+ AIEntity *p = g_hdb->_ai->getPlayer();
+
+ g_hdb->_ai->animEntFrames(e);
+ e->x += e->xVel;
+ e->y += e->yVel;
+ e->tileX = e->x / kTileWidth;
+ e->tileY = e->y / kTileHeight;
+
+ // Did we hit a solid wall?
+ int result;
+ AIEntity *hit = g_hdb->_ai->legalMoveOverWaterIgnore(e->tileX, e->tileY, e->level, &result, e);
+
+ if (hit || !result) {
+ g_hdb->_ai->addAnimateTarget(e->x, e->y, 0, 3, ANIM_FAST, false, false, "steam_puff_sit");
+ g_hdb->_ai->removeEntity(e);
+ }
+
+ // On Even tiles, check for hitting player
+ if (onEvenTile(e->x, e->y))
+ if (e->onScreen && (p->level == e->level) && g_hdb->_ai->checkPlayerCollision(e->x, e->y, 4) && !g_hdb->_ai->playerDead()) {
+ g_hdb->_ai->killPlayer(DEATH_NORMAL);
+ g_hdb->_ai->addAnimateTarget(e->x, e->y, 0, 3, ANIM_FAST, false, false, "steam_puff_sit");
+ g_hdb->_ai->removeEntity(e);
+ }
+}
+
} // End of Namespace