HDB: Add animGrabbing()

This commit is contained in:
Nipun Garg 2019-06-22 05:42:55 +05:30 committed by Eugene Sandulenko
parent d5dca7ea7c
commit db838a656e
2 changed files with 36 additions and 0 deletions

View File

@ -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)

View File

@ -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);