1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-14 17:14:29 +02:00

#14 enemies use flipmap info for pathfinding

This commit is contained in:
XProger
2017-08-29 05:13:29 +03:00
parent a8ebe9da20
commit 66bee62a25
2 changed files with 6 additions and 6 deletions

View File

@@ -29,6 +29,8 @@ struct Character : Controller {
vec3 velocity;
float angleExt;
float speed;
int stepHeight;
int dropHeight;
int zone;
int box;
@@ -38,6 +40,9 @@ struct Character : Controller {
Collision collision;
Character(IGame *game, int entity, float health) : Controller(game, entity), health(health), tilt(0.0f), stand(STAND_GROUND), lastInput(0), velocity(0.0f), angleExt(0.0f) {
stepHeight = 256;
dropHeight = -256;
animation.initOverrides();
rotHead = rotChest = quat(0, 0, 0, 1);
@@ -56,7 +61,7 @@ struct Character : Controller {
}
uint16* getZones() {
return flying ? level->zones[0].fly : level->zones[0].ground1;
return flying ? level->zones[level->isFlipped].fly : (stepHeight == 256 ? level->zones[level->isFlipped].ground1 : level->zones[level->isFlipped].ground2);
}
void rotateY(float delta) {

View File

@@ -57,8 +57,6 @@ struct Enemy : Character {
float length; // dist from center to head (jaws)
float aggression;
int radius;
int stepHeight;
int dropHeight;
Character *target;
Path *path;
@@ -73,9 +71,6 @@ struct Enemy : Character {
bool targetCanAttack;
Enemy(IGame *game, int entity, float health, int radius, float length, float aggression) : Character(game, entity, health), ai(AI_RANDOM), mood(MOOD_SLEEP), wound(false), nextState(0), targetBox(-1), thinkTime(1.0f / 30.0f), length(length), aggression(aggression), radius(radius), target(NULL), path(NULL) {
stepHeight = 256;
dropHeight = -256;
jointChest = jointHead = -1;
targetDist = +INF;