diff options
author | Nipun Garg | 2019-06-25 00:50:51 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:59 +0200 |
commit | 087f84b38b94ee56e67c874cb281bec057f6cb80 (patch) | |
tree | 7c55d8c4d6996e9162f1c04d924a38f4e6e3a23e /engines/hdb | |
parent | bb674ec9c190bd19f4ce9e26c20e6ad92cb89986 (diff) | |
download | scummvm-rg350-087f84b38b94ee56e67c874cb281bec057f6cb80.tar.gz scummvm-rg350-087f84b38b94ee56e67c874cb281bec057f6cb80.tar.bz2 scummvm-rg350-087f84b38b94ee56e67c874cb281bec057f6cb80.zip |
HDB: Add aiOmniBotMissile functions
Diffstat (limited to 'engines/hdb')
-rw-r--r-- | engines/hdb/ai-bots.cpp | 40 | ||||
-rw-r--r-- | engines/hdb/ai-player.cpp | 12 |
2 files changed, 40 insertions, 12 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 diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp index 940ddcb94c..32de22b2f2 100644 --- a/engines/hdb/ai-player.cpp +++ b/engines/hdb/ai-player.cpp @@ -380,18 +380,6 @@ void aiRailRiderOnAction(AIEntity *e) { warning("STUB: AI: aiRailRiderOnAction required"); } -void aiOmniBotMissileAction(AIEntity *e) { - warning("STUB: AI: aiOmniBotMissileAction required"); -} - -void aiOmniBotMissileInit(AIEntity *e) { - warning("STUB: AI: aiOmniBotMissileInit required"); -} - -void aiOmniBotMissileInit2(AIEntity *e) { - warning("STUB: AI: aiOmniBotMissileInit2 required"); -} - void aiSlugAttackAction(AIEntity *e) { warning("STUB: AI: aiSlugAttackAction required"); } |