diff --git a/source/games/blood/src/aicerber.cpp b/source/games/blood/src/aicerber.cpp index 02959b2eb..2ef46a66b 100644 --- a/source/games/blood/src/aicerber.cpp +++ b/source/games/blood/src/aicerber.cpp @@ -338,9 +338,9 @@ static void cerberusThinkChase(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) { switch (actor->spr.type) { @@ -367,16 +367,18 @@ static void cerberusThinkChase(DBloodActor* actor) } - 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() && nDeltaAngle <= pDudeInfo->Periphery()) + { aiSetTarget(actor, actor->GetTarget()); - if (nDist < 0x1b00 && nDist > 0xd00 && abs(nDeltaAngle) < 85) { + if (nDist < 0x1b0 && nDist > 0xd0 && nDeltaAngle < DAngle15) + { switch (actor->spr.type) { case kDudeCerberusTwoHead: aiNewState(actor, &cerberusBurn); @@ -387,7 +389,8 @@ static void cerberusThinkChase(DBloodActor* actor) } } - else if (nDist < 0xb00 && nDist > 0x500 && abs(nDeltaAngle) < 85) { + else if (nDist < 0xb0 && nDist > 0x50 && nDeltaAngle < DAngle15) + { switch (actor->spr.type) { case kDudeCerberusTwoHead: aiNewState(actor, &cerberus3Burn); @@ -397,11 +400,9 @@ static void cerberusThinkChase(DBloodActor* actor) break; } } - else if (nDist < 0x200 && abs(nDeltaAngle) < 85) + else if (nDist < 0x20 && nDeltaAngle < DAngle15) { - int dx = dvec.X * worldtoint; - int dy = dvec.Y * worldtoint; - int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); switch (actor->spr.type) { case kDudeCerberusTwoHead: switch (hit) {