aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/ai-player.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-07-03 23:09:40 +0530
committerEugene Sandulenko2019-09-03 17:17:10 +0200
commit478c10a1fb8516b16b6f3d40aba6f8c5385fc16a (patch)
tree5edd62d5220bbe5ea5aeca6d8b3217d9b11bfca3 /engines/hdb/ai-player.cpp
parent9da57f1eb76ce20c3943070f618559ccdda57b2e (diff)
downloadscummvm-rg350-478c10a1fb8516b16b6f3d40aba6f8c5385fc16a.tar.gz
scummvm-rg350-478c10a1fb8516b16b6f3d40aba6f8c5385fc16a.tar.bz2
scummvm-rg350-478c10a1fb8516b16b6f3d40aba6f8c5385fc16a.zip
HDB: Unstub aiVortexianAction
Diffstat (limited to 'engines/hdb/ai-player.cpp')
-rw-r--r--engines/hdb/ai-player.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp
index 323b308c46..599844be03 100644
--- a/engines/hdb/ai-player.cpp
+++ b/engines/hdb/ai-player.cpp
@@ -1638,7 +1638,36 @@ void aiGooCupInit2(AIEntity *e) {
}
void aiVortexianAction(AIEntity *e) {
- warning("STUB: AI: aiVortexianAction required");
+ // anim the alpha blending : down to 32, up to 180, back down...
+ e->value2 += e->value1;
+ if ((e->value2 & 0xff) > 128) {
+ e->value2 = (e->value2 & 0xff00) | 128;
+ e->value1 = -e->value1;
+ } else if ((e->value2 & 0xff) < 32) {
+ e->value2 = (e->value2 & 0xff00) | 32;
+ e->value1 = -e->value1;
+ }
+
+ // anim the shape
+ e->animFrame++;
+ if (e->animFrame >= e->standdownFrames) {
+ e->animFrame = 0;
+
+ // every 4th frame, check for player collision &
+ // do an autosave
+ AIEntity *p = g_hdb->_ai->getPlayer();
+ if (abs(p->x - e->x) < 4 && abs(p->y - e->y) < 4) {
+ if (!(e->value2 & 0xff00)) {
+ // let's make sure we don't autosave every frikken second!
+ e->value2 |= 0xff00;
+
+ g_hdb->saveWhenReady(kAutoSaveSlot);
+ g_hdb->_window->openMessageBar("Saving progress at Vortexian...", 1);
+ }
+ } else
+ e->value2 &= 0x00ff;
+ }
+ e->draw = e->standdownGfx[e->animFrame];
}
void aiVortexianUse(AIEntity *e) {