aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNipun Garg2019-07-03 05:58:45 +0530
committerEugene Sandulenko2019-09-03 17:17:08 +0200
commit70fb0e81cc46e4e2590a434c40cfd40d0e313186 (patch)
tree826e6be7cb9075a3ee758120808bd4d13061ccaf /engines
parentdd53729b810c1a3c89c06a7b6cccaee0a705edd7 (diff)
downloadscummvm-rg350-70fb0e81cc46e4e2590a434c40cfd40d0e313186.tar.gz
scummvm-rg350-70fb0e81cc46e4e2590a434c40cfd40d0e313186.tar.bz2
scummvm-rg350-70fb0e81cc46e4e2590a434c40cfd40d0e313186.zip
HDB: Add functions for Magic Egg
Diffstat (limited to 'engines')
-rw-r--r--engines/hdb/ai-player.cpp40
1 files changed, 36 insertions, 4 deletions
diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp
index ea2f6c92cd..80d131fd48 100644
--- a/engines/hdb/ai-player.cpp
+++ b/engines/hdb/ai-player.cpp
@@ -1400,19 +1400,51 @@ void aiPackageInit2(AIEntity *e) {
}
void aiMagicEggAction(AIEntity *e) {
- warning("STUB: AI: aiMagicEggAction required");
+ // if magic egg isn't moving somewhere, don't move it
+ if (!e->goalX)
+ return;
+
+ g_hdb->_ai->animateEntity(e);
}
void aiMagicEggInit(AIEntity *e) {
- warning("STUB: AI: aiMagicEggInit required");
+ e->moveSpeed = kPushMoveSpeed;
+ e->aiAction = aiMagicEggAction;
}
void aiMagicEggInit2(AIEntity *e) {
- warning("STUB: AI: aiMagicEggInit2 required");
+ // point all magic egg 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 aiMagicEggUse(AIEntity *e) {
- warning("STUB: AI: aiMagicEggUse required");
+ if (!scumm_strnicmp(e->luaFuncAction, "ai_", 3) || !scumm_strnicmp(e->luaFuncAction, "item_", 5)) {
+ int i = 0;
+ AIEntity *spawned = NULL;
+ while (aiEntList[i].type != END_AI_TYPES) {
+ if (!_stricmp(aiEntList[i].luaName, e->luaFuncAction)) {
+ spawned = g_hdb->_ai->spawn(aiEntList[i].type, e->dir, e->tileX, e->tileY, NULL, NULL, NULL, DIR_NONE, e->level, 0, 0, 1);
+ break;
+ }
+ i++;
+ }
+ if (spawned) {
+ g_hdb->_ai->addAnimateTarget(e->tileX * kTileWidth,
+ e->tileY * kTileHeight, 0, 3, ANIM_NORMAL, false, false, GROUP_EXPLOSION_BOOM_SIT);
+ warning("Play SND_BARREL_EXPLODE");
+ g_hdb->_ai->removeEntity(e);
+ }
+ }
}
void aiIceBlockAction(AIEntity *e) {