aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-06-22 05:42:55 +0530
committerEugene Sandulenko2019-09-03 17:16:54 +0200
commitdb838a656eb85755659ff93769269b66490652f7 (patch)
treee45f18db399b00ce98334e470618a7816f9063eb
parentd5dca7ea7c3ab63060b1ecefc9dc31b1ada8004d (diff)
downloadscummvm-rg350-db838a656eb85755659ff93769269b66490652f7.tar.gz
scummvm-rg350-db838a656eb85755659ff93769269b66490652f7.tar.bz2
scummvm-rg350-db838a656eb85755659ff93769269b66490652f7.zip
HDB: Add animGrabbing()
-rw-r--r--engines/hdb/ai-funcs.cpp35
-rw-r--r--engines/hdb/ai.h1
2 files changed, 36 insertions, 0 deletions
diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp
index 992fbf61a7..ea02353598 100644
--- a/engines/hdb/ai-funcs.cpp
+++ b/engines/hdb/ai-funcs.cpp
@@ -1185,6 +1185,41 @@ void AI::drawEnts(int x, int y, int w, int h) {
}
}
+void AI::animGrabbing() {
+ if (_player->state == STATE_GRABUP ||
+ _player->state == STATE_GRABDOWN ||
+ _player->state == STATE_GRABLEFT ||
+ _player->state == STATE_GRABRIGHT)
+ return;
+
+ AIState s;
+
+ switch (_player->dir) {
+ case DIR_UP:
+ s = STATE_GRABUP;
+ _player->draw = _getGfx[DIR_UP];
+ break;
+ case DIR_DOWN:
+ s = STATE_GRABDOWN;
+ _player->draw = _getGfx[DIR_DOWN];
+ break;
+ case DIR_LEFT:
+ s = STATE_GRABLEFT;
+ _player->draw = _getGfx[DIR_LEFT];
+ break;
+ case DIR_RIGHT:
+ s = STATE_GRABRIGHT;
+ _player->draw = _getGfx[DIR_RIGHT];
+ break;
+ default:
+ warning("AI-FUNCS: animGrabbing: DIR_NONE found");
+ break;
+ }
+
+ _player->state = s;
+ _player->animFrame = 5;
+}
+
bool AI::checkFloating(int x, int y) {
for (Common::Array<AIEntity *>::iterator it = _floats->begin(); it != _floats->end(); it++) {
if ((*it)->tileX == x && (*it)->tileY == y)
diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h
index 6e6247b593..8206a2ce8e 100644
--- a/engines/hdb/ai.h
+++ b/engines/hdb/ai.h
@@ -578,6 +578,7 @@ public:
void animEntFrames(AIEntity *e);
void animLuaEntity(const char *initName, AIState st);
void drawEnts(int x, int y, int w, int h);
+ void animGrabbing();
bool checkFloating(int x, int y);