From 478c10a1fb8516b16b6f3d40aba6f8c5385fc16a Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Wed, 3 Jul 2019 23:09:40 +0530 Subject: HDB: Unstub aiVortexianAction --- engines/hdb/ai-player.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'engines/hdb/ai-player.cpp') 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) { -- cgit v1.2.3