mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-17 15:33:23 +00:00
HDB: Add lookAtXY and lookAtEntity
This commit is contained in:
parent
977a264462
commit
c31fb72e69
@ -100,4 +100,59 @@ bool AI::walkThroughEnt(AIType type) {
|
|||||||
void AI::getItemSound(AIType type) {
|
void AI::getItemSound(AIType type) {
|
||||||
warning("STUB: AI: getItemSound required");
|
warning("STUB: AI: getItemSound required");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AI::lookAtEntity(AIEntity *e) {
|
||||||
|
lookAtXY(e->tileX, e->tileY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change player direction to XY
|
||||||
|
void AI::lookAtXY(int x, int y) {
|
||||||
|
int distX, distY;
|
||||||
|
|
||||||
|
distX = abs(_player->tileX - x);
|
||||||
|
distY = abs(_player->tileY - y);
|
||||||
|
|
||||||
|
if (distX > distY) {
|
||||||
|
// X takes precedence
|
||||||
|
if (x < _player->tileX) {
|
||||||
|
_player->dir = DIR_LEFT;
|
||||||
|
} else if (x > _player->tileX) {
|
||||||
|
_player->dir = DIR_RIGHT;
|
||||||
|
} else if (y < _player->tileY) {
|
||||||
|
_player->dir = DIR_UP;
|
||||||
|
} else {
|
||||||
|
_player->dir = DIR_DOWN;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Y takes precedence
|
||||||
|
if (y < _player->tileY) {
|
||||||
|
_player->dir = DIR_UP;
|
||||||
|
} else if (y > _player->tileY) {
|
||||||
|
_player->dir = DIR_DOWN;
|
||||||
|
} else if (x < _player->tileX) {
|
||||||
|
_player->dir = DIR_LEFT;
|
||||||
|
} else {
|
||||||
|
_player->dir = DIR_RIGHT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (_player->dir) {
|
||||||
|
case DIR_UP:
|
||||||
|
_player->state = STATE_STANDUP;
|
||||||
|
warning("STUB: Set _player->draw to Player standup_gfx");
|
||||||
|
break;
|
||||||
|
case DIR_DOWN:
|
||||||
|
_player->state = STATE_STANDDOWN;
|
||||||
|
warning("STUB: Set _player->draw to Player standdown_gfx");
|
||||||
|
break;
|
||||||
|
case DIR_LEFT:
|
||||||
|
_player->state = STATE_STANDLEFT;
|
||||||
|
warning("STUB: Set _player->draw to Player standleft_gfx");
|
||||||
|
break;
|
||||||
|
case DIR_RIGHT:
|
||||||
|
_player->state = STATE_STANDRIGHT;
|
||||||
|
warning("STUB: Set _player->draw to Player standright_gfx");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} // End of Namespace
|
} // End of Namespace
|
||||||
|
@ -404,6 +404,7 @@ public:
|
|||||||
bool getTableEnt(AIType type);
|
bool getTableEnt(AIType type);
|
||||||
bool walkThroughEnt(AIType type);
|
bool walkThroughEnt(AIType type);
|
||||||
void getItemSound(AIType type);
|
void getItemSound(AIType type);
|
||||||
|
void lookAtEntity(AIEntity *e);
|
||||||
|
|
||||||
// Player Functions
|
// Player Functions
|
||||||
AIEntity *getPlayer() {
|
AIEntity *getPlayer() {
|
||||||
@ -475,6 +476,10 @@ public:
|
|||||||
void cineFadeIn(bool isBlack, int steps);
|
void cineFadeIn(bool isBlack, int steps);
|
||||||
void cineFadeOut(bool isBlack, int steps);
|
void cineFadeOut(bool isBlack, int steps);
|
||||||
|
|
||||||
|
// Waypoint & Movement Functions
|
||||||
|
void lookAtXY(int x, int y);
|
||||||
|
|
||||||
|
// Cinematic Variables
|
||||||
Common::Array<CineCommand *> _cine;
|
Common::Array<CineCommand *> _cine;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user