HDB: Add entityFace()

This commit is contained in:
Nipun Garg 2019-07-01 08:58:46 +05:30 committed by Eugene Sandulenko
parent f2150cd89a
commit 016e0baca8
2 changed files with 14 additions and 10 deletions

View File

@ -1619,16 +1619,6 @@ void AI::animEntFrames(AIEntity *e) {
}
}
void AI::animLuaEntity(const char *initName, AIState st) {
for (Common::Array<AIEntity *>::iterator it = _ents->begin(); it != _ents->end(); it++) {
if (Common::matchString((*it)->entityName, initName)) {
(*it)->state = st;
(*it)->animFrame = 0;
(*it)->animDelay = (*it)->animCycle;
}
}
}
void AI::drawEnts(int x, int y, int w, int h) {
static int stunAnim = 0;
@ -1814,6 +1804,19 @@ void AI::animGrabbing() {
_player->animFrame = 5;
}
void AI::entityFace(const char *luaName, int dir) {
AIEntity *e = locateEntity(luaName);
e->dir = (AIDir)dir;
switch (e->dir) {
case DIR_UP: e->state = STATE_STANDUP; break;
case DIR_DOWN: e->state = STATE_STANDDOWN; break;
case DIR_LEFT: e->state = STATE_STANDLEFT; break;
case DIR_RIGHT: e->state = STATE_STANDRIGHT; break;
case DIR_NONE: break;
}
}
void AI::moveEnts() {
static int frameDelay = kAnimFrameDelay;
AIEntity *e;

View File

@ -760,6 +760,7 @@ public:
void drawEnts(int x, int y, int w, int h);
void drawLevel2Ents();
void animGrabbing();
void entityFace(const char *luaName, int dir);
void moveEnts();