- floatified houndThinkChase.

This commit is contained in:
Christoph Oelckers 2022-09-27 22:09:15 +02:00
parent 71c1840566
commit 648ff00caf

View file

@ -105,9 +105,9 @@ static void houndThinkChase(DBloodActor* actor)
auto target = actor->GetTarget();
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
int nDist = approxDist(dvec);
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, nAngle);
if (target->xspr.health == 0)
{
aiNewState(actor, &houndSearch);
@ -119,18 +119,18 @@ static void houndThinkChase(DBloodActor* actor)
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;
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());
if (nDist < 0xb00 && nDist > 0x500 && abs(nDeltaAngle) < 85)
if (nDist < 0xb0 && nDist > 0x50 && nDeltaAngle < DAngle15)
aiNewState(actor, &houndBurn);
else if (nDist < 0x266 && abs(nDeltaAngle) < 85)
else if (nDist < 38.375 && nDeltaAngle < DAngle15)
aiNewState(actor, &houndBite);
return;
}