- floatified aiPodChase

This commit is contained in:
Christoph Oelckers 2022-09-27 22:12:12 +02:00
parent 6b6ab4e81e
commit 9586a2f16d

View file

@ -182,9 +182,9 @@ static void aiPodChase(DBloodActor* actor)
auto target = actor->GetTarget(); auto target = actor->GetTarget();
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY(); auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec); DAngle nAngle = VecToAngle(dvec);
int nDist = approxDist(dvec); double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle)); aiChooseDirection(actor, nAngle);
if (target->xspr.health == 0) { if (target->xspr.health == 0) {
switch (actor->spr.type) { switch (actor->spr.type) {
@ -199,16 +199,16 @@ static void aiPodChase(DBloodActor* actor)
} }
return; return;
} }
if (nDist <= pDudeInfo->seeDist) if (nDist <= pDudeInfo->SeeDist())
{ {
int nDeltaAngle = getincangle(actor->int_ang(), nAngle); DAngle nDeltaAngle = absangle(actor->spr.angle, nAngle);
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE; double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector())) if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->SeeDist() && abs(nDeltaAngle) <= pDudeInfo->Periphery())
{ {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
if (abs(nDeltaAngle) < 85 && target->spr.type != kDudePodGreen && target->spr.type != kDudePodFire) { if (nDeltaAngle < DAngle15 && target->spr.type != kDudePodGreen && target->spr.type != kDudePodFire) {
switch (actor->spr.type) { switch (actor->spr.type) {
case kDudePodGreen: case kDudePodGreen:
case kDudePodFire: case kDudePodFire: