diff options
author | Nipun Garg | 2019-07-03 05:56:27 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:08 +0200 |
commit | 5617ec541ae9965e6547343930e0b76c8ac0d170 (patch) | |
tree | f6ac6f6df46b26a26b9c56107f978134df874edf | |
parent | c0e2f9b4794b0d539407358c4090a16acf367ca5 (diff) | |
download | scummvm-rg350-5617ec541ae9965e6547343930e0b76c8ac0d170.tar.gz scummvm-rg350-5617ec541ae9965e6547343930e0b76c8ac0d170.tar.bz2 scummvm-rg350-5617ec541ae9965e6547343930e0b76c8ac0d170.zip |
HDB: Add Gem functions
-rw-r--r-- | engines/hdb/ai-player.cpp | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp index 05a757abf2..982b7d1731 100644 --- a/engines/hdb/ai-player.cpp +++ b/engines/hdb/ai-player.cpp @@ -1187,27 +1187,27 @@ void aiEnvelopeGreenInit2(AIEntity *e) { } void aiGemBlueInit(AIEntity *e) { - warning("STUB: AI: aiGemBlueInit required"); + e->aiAction = aiGemAction; } void aiGemBlueInit2(AIEntity *e) { - warning("STUB: AI: aiGemBlueInit2 required"); + e->draw = e->standdownGfx[0]; } void aiGemRedInit(AIEntity *e) { - warning("STUB: AI: aiGemRedInit required"); + e->aiAction = aiGemAction; } void aiGemRedInit2(AIEntity *e) { - warning("STUB: AI: aiGemRedInit2 required"); + e->draw = e->standdownGfx[0]; } void aiGemGreenInit(AIEntity *e) { - warning("STUB: AI: aiGemGreenInit required"); + e->aiAction = aiGemAction; } void aiGemGreenInit2(AIEntity *e) { - warning("STUB: AI: aiGemGreenInit2 required"); + e->draw = e->standdownGfx[0]; } void aiTeaCupInit(AIEntity *e) { @@ -1511,19 +1511,36 @@ void aiMonkeystoneUse2(AIEntity *e) { } void aiGemAction(AIEntity *e) { - warning("STUB: AI: aiGemAction required"); -} + AIEntity *p; + int tolerance; + + e->animFrame++; + if (e->animFrame >= e->standdownFrames) { + e->animFrame = 0; + + // every 4th frame, check for player collision & + // add to inventory if it happens + p = g_hdb->_ai->getPlayer(); + tolerance = 16; + if (g_hdb->_ai->playerRunning()) + tolerance = 24; -void aiGemAction2(AIEntity *e) { - warning("STUB: AI: aiGemAction2 required"); + if (e->onScreen && abs(p->x - e->x) < tolerance && abs(p->y - e->y) < tolerance && e->level == p->level) { + g_hdb->_ai->addAnimateTarget(e->x, e->y, 0, 3, ANIM_NORMAL, false, false, GEM_FLASH); + g_hdb->_ai->addToInventory(e); + warning("Play SND_GET_GEM"); + return; + } + } + e->draw = e->standdownGfx[e->animFrame]; } void aiGemWhiteInit(AIEntity *e) { - warning("STUB: AI: aiGemWhiteInit required"); + e->aiAction = aiGemAction; } void aiGemWhiteInit2(AIEntity *e) { - warning("STUB: AI: aiGemWhiteInit2 required"); + e->draw = e->standdownGfx[0]; } void aiGooCupUse(AIEntity *e) { |