From 4905233ef0b5394d67767b39fbafb3f963515fa2 Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Thu, 27 Jun 2019 06:14:38 +0530 Subject: HDB: Add floatEntity() --- engines/hdb/ai-funcs.cpp | 12 ++++++++++++ engines/hdb/ai.h | 1 + 2 files changed, 13 insertions(+) (limited to 'engines/hdb') diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp index c65c2672d0..28642c4c26 100644 --- a/engines/hdb/ai-funcs.cpp +++ b/engines/hdb/ai-funcs.cpp @@ -1541,6 +1541,18 @@ bool AI::checkPlayerCollision(int x, int y, int border) { return (x > (_player->x - 32 + border) && x < (_player->x - 32 - border) && y >(_player->y - 32 + border) && y < (_player->y - 32 - border)); } +void AI::floatEntity(AIEntity *e, AIState state) { + for (Common::Array::iterator it = _ents->begin(); it != _ents->end(); it++) { + if (e == *it) { + _floats->push_back(*it); + _ents->erase(it); + break; + } + } + e->state = state; + e->level = 1; +} + bool AI::checkFloating(int x, int y) { for (Common::Array::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 ec8c200244..3aa7bde5a2 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -709,6 +709,7 @@ public: void addToPathList(int x, int y, int type, AIDir dir); ArrowPath *findArrowPath(int x, int y); + void floatEntity(AIEntity *e, AIState state); bool checkFloating(int x, int y); bool getTableEnt(AIType type); -- cgit v1.2.3