- floatified 2 functions in aicaleb.cpp

This commit is contained in:
Christoph Oelckers 2022-09-27 19:56:51 +02:00
parent 1c23a2aa32
commit 64619478fa

View file

@ -94,10 +94,10 @@ static void calebThinkGoto(DBloodActor* actor)
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr; auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY(); auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec); DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length(); double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle)); aiChooseDirection(actor, nAngle);
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery) if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
{ {
if (pXSector && pXSector->Underwater) if (pXSector && pXSector->Underwater)
aiNewState(actor, &tinycalebSwimSearch); aiNewState(actor, &tinycalebSwimSearch);
@ -213,10 +213,10 @@ static void calebThinkSwimGoto(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax); assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type); DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY(); auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec); DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length(); double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle)); aiChooseDirection(actor, nAngle);
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery) if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
aiNewState(actor, &tinycalebSwimSearch); aiNewState(actor, &tinycalebSwimSearch);
aiThinkTarget(actor); aiThinkTarget(actor);
} }