mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-19 07:01:09 +00:00
- floatified gillThinkChase
This commit is contained in:
parent
523400772e
commit
edf6c69159
1 changed files with 10 additions and 10 deletions
|
@ -116,9 +116,9 @@ static void gillThinkChase(DBloodActor* actor)
|
|||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
auto target = actor->GetTarget();
|
||||
int dx = target->int_pos().X - actor->int_pos().X;
|
||||
int dy = target->int_pos().Y - actor->int_pos().Y;
|
||||
aiChooseDirection(actor, VecToAngle(dx, dy));
|
||||
auto dv = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dv);
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (actor->xspr.health == 0)
|
||||
{
|
||||
if (pXSector && pXSector->Underwater)
|
||||
|
@ -135,20 +135,20 @@ static void gillThinkChase(DBloodActor* actor)
|
|||
aiNewState(actor, &gillBeastSearch);
|
||||
return;
|
||||
}
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
double nDist = dv.Length();
|
||||
if (nDist <= pDudeInfo->SeeDist())
|
||||
{
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dx, dy));
|
||||
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());
|
||||
actor->dudeSlope = nDist == 0 ? 0 : DivScale(target->int_pos().Z - actor->int_pos().Z, nDist, 10);
|
||||
if (nDist < 921 && abs(nDeltaAngle) < 28)
|
||||
actor->dudeSlope = nDist == 0 ? 0 : (target->spr.pos.Z - actor->spr.pos.Z) / nDist * 16384;
|
||||
if (nDist < 57.5625 && abs(nDeltaAngle) < DAngle1 * 5)
|
||||
{
|
||||
int hit = HitScan_(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
|
||||
int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dv, 0), CLIPMASK1, 0);
|
||||
switch (hit)
|
||||
{
|
||||
case -1:
|
||||
|
|
Loading…
Reference in a new issue