- Handle all remaining VecToAngle() calls.

This commit is contained in:
Mitchell Richters 2022-09-30 21:51:37 +10:00 committed by Christoph Oelckers
parent e7dff22095
commit 8bc34f3dac
38 changed files with 94 additions and 94 deletions

View file

@ -4681,7 +4681,7 @@ static Collision MoveThing(DBloodActor* actor)
}
}
if (actor->vel.X != 0 || actor->vel.Y != 0)
actor->spr.angle = VecToAngle(actor->vel);
actor->spr.angle = actor->vel.Angle();
return lhit;
}

View file

@ -353,7 +353,7 @@ void aiActivateDude(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
if (!actor->xspr.state)
{
aiChooseDirection(actor, VecToAngle(actor->xspr.TargetPos - actor->spr.pos));
aiChooseDirection(actor, (actor->xspr.TargetPos - actor->spr.pos).Angle());
actor->xspr.state = 1;
}
switch (actor->spr.type)

View file

@ -265,7 +265,7 @@ static void entryAIdle(DBloodActor* actor)
static void entryEStand(DBloodActor* actor)
{
sfxPlay3DSound(actor, 1100, -1, 0);
actor->spr.angle = VecToAngle(actor->xspr.TargetPos - actor->spr.pos);
actor->spr.angle = (actor->xspr.TargetPos - actor->spr.pos).Angle();
}
END_BLD_NS

View file

@ -730,7 +730,7 @@ void DropVoodooCb(DBloodActor* actor, sectortype*) // unused
evPostActor(actor, 0, kCallbackRemove);
return;
}
actor->spr.angle = VecToAngle(Owner->spr.pos - actor->spr.pos);
actor->spr.angle = (Owner->spr.pos - actor->spr.pos).Angle();
if (actor->hasX())
{
if (actor->xspr.data1 == 0)

View file

@ -1338,7 +1338,7 @@ void nnExtProcessSuperSprites()
debrisMove(i);
if (!debrisactor->vel.XY().isZero())
debrisactor->xspr.goalAng = VecToAngle(debrisactor->vel);
debrisactor->xspr.goalAng = debrisactor->vel.Angle();
debrisactor->norm_ang();
DAngle ang = debrisactor->spr.angle;
@ -3100,7 +3100,7 @@ void useVelocityChanger(DBloodActor* actor, sectortype* sect, DBloodActor* initi
pSprite->vel == vv;
}
auto vAng = VecToAngle(pSprite->vel);
auto vAng = pSprite->vel.Angle();
if (toAng)
{
@ -3113,7 +3113,7 @@ void useVelocityChanger(DBloodActor* actor, sectortype* sect, DBloodActor* initi
pSprite->vel.XY() = pt;
vAng = VecToAngle(pSprite->vel);
vAng = pSprite->vel.Angle();
}
if (chgDstAng)
@ -8949,7 +8949,7 @@ void aiPatrolThink(DBloodActor* actor)
}
}
nnExtAiSetDirection(actor, VecToAngle(markeractor->spr.pos - actor->spr.pos));
nnExtAiSetDirection(actor, (markeractor->spr.pos - actor->spr.pos).Angle());
if (aiPatrolMoving(actor->xspr.aiState) && !reached) return;
else if (uwater) aiPatrolState(actor, kAiStatePatrolMoveW);

View file

@ -480,7 +480,7 @@ void UpdateAimVector(PLAYER* pPlayer)
if (lpos.Z - zRange > bottom || lpos.Z + zRange < top)
continue;
DAngle angle = VecToAngle(pos2 - pos);
DAngle angle = (pos2 - pos).Angle();
DAngle deltaangle = absangle(angle, plActor->spr.angle);
if (deltaangle > DAngle::fromBuild(pWeaponTrack->angleRange))
continue;

View file

@ -3284,7 +3284,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER)
if (x < 512)
{
auto ang = actor->spr.angle;
actor->spr.angle = VecToAngle(actor->spr.pos.XY() - ps[p].pos);
actor->spr.angle = (actor->spr.pos.XY() - ps[p].pos).Angle();
fi.shoot(actor, FIRELASER);
actor->spr.angle = ang;
}

View file

@ -350,7 +350,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (dist < radius && cansee(act2->spr.pos.plusZ(-8), act2->sector(), actor->spr.pos.plusZ(-12), actor->sector()))
{
act2->hitang = VecToAngle(act2->spr.pos - actor->spr.pos);
act2->hitang = (act2->spr.pos - actor->spr.pos).Angle();
if (actor->spr.picnum == RPG && act2->spr.extra > 0)
act2->attackertype = RPG;

View file

@ -301,7 +301,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
continue;
}
act2->hitang = VecToAngle(act2->spr.pos - actor->spr.pos);
act2->hitang = (act2->spr.pos - actor->spr.pos).Angle();
if (actor->spr.picnum == RPG && act2->spr.extra > 0)
act2->attackertype = RPG;
@ -934,7 +934,7 @@ static void chickenarrow(DDukeActor* actor)
if (actor->seek_actor && actor->spr.hitag > 5)
{
DAngle ang, ang2;
ang = VecToAngle(ts->spr.pos - actor->spr.pos);
ang = (ts->spr.pos - actor->spr.pos).Angle();
ang2 = deltaangle(ang, actor->spr.angle);
// this was quite broken in the original code. Fixed so that it seeks properly
if (abs(ang2) < DAngle1 * 17.5)

View file

@ -262,7 +262,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
break;
}
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.angle, kang);
if (k > 6)
{
@ -280,7 +280,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
break;
}
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.angle, kang);
if (k > 6)
@ -508,7 +508,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
break;
case 5:
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation1(h->spr.angle, kang);
if (k > 4)
{
@ -518,7 +518,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
break;
case 7:
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.angle, kang);
if (k > 6)
{

View file

@ -256,7 +256,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
}
else if (OwnerAc->spr.picnum == MAMA)
{
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation1(h->spr.angle, kang);
if (k > 4)
{
@ -274,7 +274,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
break;
case EMPTYBIKE:
if (!isRRRA()) goto default_case;
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.angle, kang);
if (k > 6)
{
@ -286,7 +286,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
break;
case EMPTYBOAT:
if (!isRRRA()) goto default_case;
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.angle, kang);
if (k > 6)
{
@ -297,7 +297,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
t->picnum = EMPTYBOAT + k;
break;
case RPG:
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.angle, kang);
if (k > 6)
{
@ -309,7 +309,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
break;
case RPG2:
if (!isRRRA()) goto default_case;
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.angle, kang);
if (k > 6)
{
@ -322,7 +322,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case RECON:
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.angle, kang);
if (k > 6)
@ -641,7 +641,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
break;
case 5:
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation1(h->spr.angle, kang);
if (k > 4)
{
@ -651,7 +651,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
break;
case 7:
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.angle, kang);
if (k > 6)
{
@ -668,7 +668,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
bg = badguy(h);
if (bg && h->spr.statnum == 2 && h->spr.extra > 0)
{
kang = VecToAngle(h->spr.pos - viewVec);
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation1(h->spr.angle, kang);
if (k > 4)
{

View file

@ -357,7 +357,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
}
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * 16) / dist;
ang = VecToAngle(aimed->spr.pos - pos);
ang = (aimed->spr.pos - pos).Angle();
}
if (isWW2GI())
@ -401,7 +401,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
}
else
{
ang = VecToAngle(ps[j].pos - pos) + DAngle22_5 / 2 - randomAngle(22.5);
ang = (ps[j].pos - pos).Angle() + DAngle22_5 / 2 - randomAngle(22.5);
}
}
@ -908,8 +908,8 @@ static void shootlaser(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
bomb->vel.X = -1.25;
ssp(bomb, CLIPMASK0);
bomb->spr.cstat = CSTAT_SPRITE_ALIGNMENT_WALL;
auto delta = hit.hitWall->delta();
bomb->spr.angle = VecToAngle(-delta.X, -delta.Y) - DAngle90;
auto delta = -hit.hitWall->delta();
bomb->spr.angle = delta.Angle() - DAngle90;
bomb->temp_angle = bomb->spr.angle;
if (p >= 0)
@ -2815,7 +2815,7 @@ void processinput_d(int snum)
}
else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < 84)
{
auto ang = VecToAngle(clz.actor()->spr.pos - p->pos);
auto ang = (clz.actor()->spr.pos - p->pos).Angle();
p->vel.XY() -= ang.ToVector();
}
}

View file

@ -216,7 +216,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
double dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) * REPEAT_SCALE * 0.5) + 5;
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * 16) / dist;
ang = VecToAngle(aimed->spr.pos - pos);
ang = (aimed->spr.pos - pos).Angle();
}
if (atwith == SHOTSPARK1)
@ -254,7 +254,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
else
{
zvel += 0.5 - krandf(1);
ang = VecToAngle(ps[j].pos - pos) + DAngle22_5 / 2 - randomAngle(22.5);
ang = (ps[j].pos - pos).Angle() + DAngle22_5 / 2 - randomAngle(22.5);
}
}
@ -3471,7 +3471,7 @@ void processinput_r(int snum)
}
else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < 84)
{
auto ang = VecToAngle(clz.actor()->spr.pos - p->pos);
auto ang = (clz.actor()->spr.pos - p->pos).Angle();
p->vel.XY() -= ang.ToVector();
}
if (clz.actor()->spr.picnum == LADDER)

View file

@ -189,7 +189,7 @@ void AIAnubis::Tick(RunListEvent* ev)
{
if (move.actor() == pTarget)
{
auto nAngDiff = absangle(ap->spr.angle, VecToAngle(pTarget->spr.pos - ap->spr.pos));
auto nAngDiff = absangle(ap->spr.angle, (pTarget->spr.pos - ap->spr.pos).Angle());
if (nAngDiff < DAngle22_5 / 2)
{
ap->nAction = 2;
@ -224,7 +224,7 @@ void AIAnubis::Tick(RunListEvent* ev)
{
ap->vel.X = 0;
ap->vel.Y = 0;
ap->spr.angle = VecToAngle(pTarget->spr.pos - ap->spr.pos);
ap->spr.angle = (pTarget->spr.pos - ap->spr.pos).Angle();
ap->nAction = 3;
ap->nFrame = 0;

View file

@ -394,7 +394,7 @@ void AIFish::Tick(RunListEvent* ev)
pActor->nAction = 2;
pActor->nFrame = 0;
DAngle nAngle = VecToAngle(pTargetActor->spr.pos - pActor->spr.pos);
DAngle nAngle = (pTargetActor->spr.pos - pActor->spr.pos).Angle();
pActor->vel.Z = nAngle.Sin() * 2;
pActor->nCount = RandomSize(6) + 90;
@ -508,7 +508,7 @@ void AIFish::Tick(RunListEvent* ev)
if (pHitAct->spr.statnum == 100)
{
pActor->pTarget = coll.actor();
pActor->spr.angle = VecToAngle(pHitAct->spr.pos - pActor->spr.pos);
pActor->spr.angle = (pHitAct->spr.pos - pActor->spr.pos).Angle();
if (nAction != 3)
{

View file

@ -861,7 +861,7 @@ loc_flag:
DExhumedActor* t = sPlayerInput[nPlayer].pTarget;
// only autoaim if target is in front of the player.
assert(t->sector());
DAngle angletotarget = VecToAngle(t->spr.pos - pPlayerActor->spr.pos);
DAngle angletotarget = (t->spr.pos - pPlayerActor->spr.pos).Angle();
DAngle anglediff = absangle(pPlayerActor->spr.angle, angletotarget);
if (anglediff < DAngle90)
{

View file

@ -305,7 +305,7 @@ void AILavaDude::Tick(RunListEvent* ev)
{
if (coll.actor() == pTarget)
{
auto nAngDiff = absangle(pActor->spr.angle, VecToAngle(pTarget->spr.pos - pActor->spr.pos));
auto nAngDiff = absangle(pActor->spr.angle, (pTarget->spr.pos - pActor->spr.pos).Angle());
if (nAngDiff < DAngle22_5 / 2)
{
pActor->nAction = 2;

View file

@ -302,7 +302,7 @@ void AILion::Tick(RunListEvent* ev)
}
else
{
auto nAngDiff = absangle(pActor->spr.angle, VecToAngle(pTarget->spr.pos - pActor->spr.pos));
auto nAngDiff = absangle(pActor->spr.angle, (pTarget->spr.pos - pActor->spr.pos).Angle());
if (nAngDiff < DAngle22_5 / 2)
{
pActor->nAction = 3;
@ -427,7 +427,7 @@ void AILion::Tick(RunListEvent* ev)
{
if (nMov.actor() == pTarget)
{
auto nAngDiff = absangle(pActor->spr.angle, VecToAngle(pTarget->spr.pos - pActor->spr.pos));
auto nAngDiff = absangle(pActor->spr.angle, (pTarget->spr.pos - pActor->spr.pos).Angle());
if (nAngDiff < DAngle22_5 / 2)
{
pActor->nAction = 3;

View file

@ -589,7 +589,7 @@ DAngle GetAngleToSprite(DExhumedActor* a1, DExhumedActor* a2)
if (!a1 || !a2)
return -minAngle;
return VecToAngle(a2->spr.pos - a1->spr.pos);
return (a2->spr.pos - a1->spr.pos).Angle();
}
//---------------------------------------------------------------------------

View file

@ -284,7 +284,7 @@ void AIMummy::Tick(RunListEvent* ev)
{
if (nMov.actor() == pTarget)
{
auto nAngDiff = absangle(pActor->spr.angle, VecToAngle(pTarget->spr.pos - pActor->spr.pos));
auto nAngDiff = absangle(pActor->spr.angle, (pTarget->spr.pos - pActor->spr.pos).Angle());
if (nAngDiff < DAngle22_5 / 2)
{
pActor->nAction = 2;

View file

@ -2493,7 +2493,7 @@ void DoMovingSects()
int nTrail = sMoveSect[i].nTrailPoint;
// TrailPoint *pTrail = &sTrailPoint[nTrail];
auto nAngle = VecToAngle(sTrailPoint[nTrail].pos - pBlockInfo->pos);
auto nAngle = (sTrailPoint[nTrail].pos - pBlockInfo->pos).Angle();
auto vel = nAngle.ToVector() * sMoveSect[i].nMoveDist;
auto delta = sTrailPoint[nTrail].pos - pBlockInfo->pos;

View file

@ -301,7 +301,7 @@ void AIRoach::Tick(RunListEvent* ev)
pActor->vel.X = 0;
pActor->vel.Y = 0;
pActor->spr.angle = VecToAngle(pTarget->spr.pos - pActor->spr.pos);
pActor->spr.angle = (pTarget->spr.pos - pActor->spr.pos).Angle();
pActor->nFrame = 0;
}
@ -330,7 +330,7 @@ void AIRoach::Tick(RunListEvent* ev)
pActor->vel.X = 0;
pActor->vel.Y = 0;
pActor->spr.angle = VecToAngle(pTarget->spr.pos - pActor->spr.pos);
pActor->spr.angle = (pTarget->spr.pos - pActor->spr.pos).Angle();
pActor->nFrame = 0;
}

View file

@ -274,7 +274,7 @@ void AIScorp::Tick(RunListEvent* ev)
{
if (pTarget == nMov.actor())
{
auto nAngDiff = absangle(pActor->spr.angle, VecToAngle(pTarget->spr.pos - pActor->spr.pos));
auto nAngDiff = absangle(pActor->spr.angle, (pTarget->spr.pos - pActor->spr.pos).Angle());
if (nAngDiff < DAngle22_5 / 2)
{
pActor->nAction = 2;
@ -460,7 +460,7 @@ void AIScorp::Effect(RunListEvent* ev, DExhumedActor* pTarget, int mode)
{
pActor->vel.X = 0;
pActor->vel.Y = 0;
pActor->spr.angle = VecToAngle(pTarget->spr.pos - pActor->spr.pos);
pActor->spr.angle = (pTarget->spr.pos - pActor->spr.pos).Angle();
pActor->nIndex = RandomSize(2) + RandomSize(3);

View file

@ -466,7 +466,7 @@ void AISet::Tick(RunListEvent* ev)
{
if (pTarget == nMov.actor())
{
auto nAngDiff = absangle(pActor->spr.angle, VecToAngle(pTarget->spr.pos - pActor->spr.pos));
auto nAngDiff = absangle(pActor->spr.angle, (pTarget->spr.pos - pActor->spr.pos).Angle());
if (nAngDiff < DAngle22_5 / 2)
{
pActor->nAction = 4;

View file

@ -317,7 +317,7 @@ void AISpider::Tick(RunListEvent* ev)
{
if (nMov.actor() == pTarget)
{
auto nAngDiff = absangle(spp->spr.angle, VecToAngle(pTarget->spr.pos - spp->spr.pos));
auto nAngDiff = absangle(spp->spr.angle, (pTarget->spr.pos - spp->spr.pos).Angle());
if (nAngDiff < DAngle22_5 / 2)
{
spp->nAction = 2;

View file

@ -223,7 +223,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
}
actor->user.ActorActionFunc = nullptr;
// Get angle to player
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos - actor->spr.pos.Y) + DAngle180;
actor->spr.angle = (actor->user.targetActor->spr.pos - actor->spr.pos.Y).Angle() + DAngle180;
break;
case UZI_SMOKE+1: // Shotgun
@ -246,7 +246,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
DoActorBeginJump(actor);
actor->user.ActorActionFunc = nullptr;
// Get angle to player
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos - actor->spr.pos) + DAngle180;
actor->spr.angle = (actor->user.targetActor->spr.pos - actor->spr.pos).Angle() + DAngle180;
break;
default:

View file

@ -837,7 +837,7 @@ int DoActorCantMoveCloser(DSWActor* actor)
if (actor->user.track >= 0)
{
auto tp = Track[actor->user.track].TrackPoint + actor->user.point;
actor->spr.angle = VecToAngle(tp->pos - actor->spr.pos);
actor->spr.angle = (tp->pos - actor->spr.pos).Angle();
DoActorSetSpeed(actor, MID_SPEED);
actor->user.Flags |= (SPR_FIND_PLAYER);
@ -889,7 +889,7 @@ int DoActorMoveCloser(DSWActor* actor)
else
{
// turn to face player
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos - actor->spr.pos);
actor->spr.angle = (actor->user.targetActor->spr.pos - actor->spr.pos).Angle();
}
}
@ -1086,7 +1086,7 @@ int InitActorRunAway(DSWActor* actor)
if (actor->user.track >= 0)
{
auto tp = Track[actor->user.track].TrackPoint + actor->user.point;
actor->spr.angle = VecToAngle(tp->pos - actor->spr.pos);
actor->spr.angle = (tp->pos - actor->spr.pos).Angle();
DoActorSetSpeed(actor, FAST_SPEED);
actor->user.Flags |= (SPR_RUN_AWAY);
}
@ -1173,7 +1173,7 @@ int InitActorAttack(DSWActor* actor)
//NewStateGroup(actor, actor->user.ActorActionSet->Stand);
// face player when attacking
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos - actor->spr.pos);
actor->spr.angle = (actor->user.targetActor->spr.pos - actor->spr.pos).Angle();
// If it's your own kind, lay off!
if (actor->user.ID == actor->user.targetActor->user.ID && !actor->user.targetActor->user.PlayerP)
@ -1262,7 +1262,7 @@ int InitActorEvade(DSWActor* actor)
if (actor->user.track >= 0)
{
auto tp = Track[actor->user.track].TrackPoint + actor->user.point;
actor->spr.angle = VecToAngle(tp->pos - actor->spr.pos);
actor->spr.angle = (tp->pos - actor->spr.pos).Angle();
DoActorSetSpeed(actor, FAST_SPEED);
// NOT doing a RUN_AWAY
actor->user.Flags &= ~(SPR_RUN_AWAY);
@ -1289,7 +1289,7 @@ int InitActorWanderAround(DSWActor* actor)
if (actor->user.track >= 0)
{
auto tp = Track[actor->user.track].TrackPoint + actor->user.point;
actor->spr.angle = VecToAngle(tp->pos - actor->spr.pos);
actor->spr.angle = (tp->pos - actor->spr.pos).Angle();
DoActorSetSpeed(actor, NORM_SPEED);
}
@ -1312,7 +1312,7 @@ int InitActorFindPlayer(DSWActor* actor)
if (actor->user.track >= 0)
{
auto tp = Track[actor->user.track].TrackPoint + actor->user.point;
actor->spr.angle = VecToAngle(tp->pos - actor->spr.pos);
actor->spr.angle = (tp->pos - actor->spr.pos).Angle();
DoActorSetSpeed(actor, MID_SPEED);
actor->user.Flags |= (SPR_FIND_PLAYER);
@ -1497,7 +1497,7 @@ DAngle FindNewAngle(DSWActor* actor, int dir, double DistToMove)
DistToMove *= .375;
// Find angle to from the player
auto oang = VecToAngle(actor->user.targetActor->spr.pos - actor->spr.pos);
auto oang = (actor->user.targetActor->spr.pos - actor->spr.pos).Angle();
// choose a random angle array
switch (dir)

View file

@ -851,7 +851,7 @@ int DoBunnyBeginJumpAttack(DSWActor* actor)
{
DSWActor* target = actor->user.targetActor;
DAngle tang = VecToAngle(target->spr.pos - actor->spr.pos);
DAngle tang = (target->spr.pos - actor->spr.pos).Angle();
Collision coll = move_sprite(actor, DVector3(tang.ToVector() * 8, 0), actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_ACTOR, ACTORMOVETICS);
@ -1116,7 +1116,7 @@ int DoBunnyRipHeart(DSWActor* actor)
actor->user.WaitTics = 6 * 120;
// player face bunny
target->spr.angle = VecToAngle(actor->spr.pos - target->spr.pos);
target->spr.angle = (actor->spr.pos - target->spr.pos).Angle();
return 0;
}

View file

@ -113,7 +113,7 @@ int GetRotation(tspriteArray& tsprites, int tSpriteNum, const DVector2& view)
// Get which of the 8 angles of the sprite to draw (0-7)
// rotation ranges from 0-7
DAngle angle2 = VecToAngle(tsp->pos.X - view.X, tsp->pos.Y - view.Y);
DAngle angle2 = (tsp->pos - view).Angle();
rotation = (tsp->angle + DAngle180 + DAngle22_5 * 0.5 - angle2).Buildang() & 2047;
rotation = (rotation >> 8) & 7;

View file

@ -1917,12 +1917,12 @@ inline bool SectorIsUnderwaterArea(sectortype* sect)
inline bool PlayerFacingRange(PLAYER* pp, DSWActor* a, DAngle range)
{
return absangle(VecToAngle(a->spr.pos - pp->pos), pp->angle.ang) < range;
return absangle((a->spr.pos - pp->pos).Angle(), pp->angle.ang) < range;
}
inline bool FacingRange(DSWActor* a1, DSWActor* a2, DAngle range)
{
return absangle(VecToAngle(a1->spr.pos - a2->spr.pos), a2->spr.angle) < range;
return absangle((a1->spr.pos - a2->spr.pos).Angle(), a2->spr.angle) < range;
}
inline void SET_BOOL1(DSWActor* sp) { sp->spr.extra |= SPRX_BOOL1; }
inline void SET_BOOL2(DSWActor* sp) { sp->spr.extra |= SPRX_BOOL2; }
@ -2040,7 +2040,7 @@ inline void SetActorSizeX(DSWActor* sp)
inline bool Facing(DSWActor* actor1, DSWActor* actor2)
{
return absangle(VecToAngle(actor1->spr.pos - actor2->spr.pos), actor2->spr.angle) < DAngle90;
return absangle((actor1->spr.pos - actor2->spr.pos).Angle(), actor2->spr.angle) < DAngle90;
}
// Given a z height and sprite return the correct y repeat value

View file

@ -338,7 +338,7 @@ void MorphTornado(SECTOR_OBJECT* sop)
if ((sop->pmid - mpos).Length() > sop->morph_dist_max + sop->scale_dist)
{
// find and reverse angle
sop->morph_ang = VecToAngle(mpos - sop->pmid) + DAngle180;
sop->morph_ang = (mpos - sop->pmid).Angle() + DAngle180;
// move back some from last point
mpos = spos + sop->morph_ang.ToVector() * sop->morph_speed * 2;

View file

@ -1196,7 +1196,7 @@ DSWActor* DoPickTarget(DSWActor* actor, DAngle max_delta_ang, int skip_targets)
}
// Get the angle to the player
DAngle angle2 = VecToAngle(itActor->spr.pos - actor->spr.pos);
DAngle angle2 = (itActor->spr.pos - actor->spr.pos).Angle();
// Get the angle difference
@ -2543,7 +2543,7 @@ void DriveCrush(PLAYER* pp, DVector2* quad)
double const vel = pp->vect.Length() * 8;
if (vel < 70.3125)
{
DoActorBeginSlide(actor, VecToAngle(pp->vect.X, pp->vect.Y), vel);
DoActorBeginSlide(actor, pp->vect.Angle(), vel);
if (DoActorSlide(actor))
continue;
}
@ -6239,7 +6239,7 @@ void DoPlayerDeathCheckKick(PLAYER* pp)
{
pp->KillerActor = itActor;
plActor->user.slide_ang = VecToAngle(plActor->spr.pos - itActor->spr.pos);
plActor->user.slide_ang = (plActor->spr.pos - itActor->spr.pos).Angle();
plActor->user.slide_ang += RandomAngle(22.5) - DAngle22_5 / 2;
plActor->user.slide_vel = itActor->vel.X * 2;
@ -7108,7 +7108,7 @@ void domovethings(void)
// auto tracking mode for single player multi-game
if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex)
{
Player[screenpeek].angle.settarget(VecToAngle(Player[myconnectindex].pos - Player[screenpeek].pos));
Player[screenpeek].angle.settarget((Player[myconnectindex].pos - Player[screenpeek].pos).Angle());
}
if (!(pp->Flags & PF_DEAD))

View file

@ -1200,7 +1200,7 @@ int DoRipperRipHeart(DSWActor* actor)
actor->user.WaitTics = 6 * 120;
// player face ripper
target->spr.angle = VecToAngle(actor->spr.pos - target->spr.pos);
target->spr.angle = (actor->spr.pos - target->spr.pos).Angle();
return 0;
}

View file

@ -1204,7 +1204,7 @@ int DoRipper2RipHeart(DSWActor* actor)
actor->user.WaitTics = 6 * 120;
// player face ripper2
target->spr.angle = VecToAngle(actor->spr.pos - target->spr.pos);
target->spr.angle = (actor->spr.pos - target->spr.pos).Angle();
return 0;
}

View file

@ -492,7 +492,7 @@ int DoSkullWait(DSWActor* actor)
if (dist < 500)
{
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos - actor->spr.pos);
actor->spr.angle = (actor->user.targetActor->spr.pos - actor->spr.pos).Angle();
actor->vel.X = 8 + RandomRangeF(16);
actor->user.jump_speed = -700;
NewStateGroup(actor, sg_SkullJump);
@ -891,7 +891,7 @@ int DoBettyWait(DSWActor* actor)
if (dist < 8000)
{
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos - actor->spr.pos);
actor->spr.angle = (actor->user.targetActor->spr.pos - actor->spr.pos).Angle();
actor->vel.X = 8 + RandomRangeF(16);
actor->user.jump_speed = -700;
NewStateGroup(actor, sg_BettyJump);

View file

@ -1396,7 +1396,7 @@ void PlaceSectorObjectsOnTracks(void)
NextTrackPoint(sop);
sop->ang = VecToAngle((tpoint + sop->point)->pos - sop->pmid);
sop->ang = ((tpoint + sop->point)->pos - sop->pmid).Angle();
sop->ang_moving = sop->ang_tgt = sop->ang;
}
@ -1459,7 +1459,7 @@ void PlaceActorsOnTracks(void)
}
// check angle in the "forward" direction
actor->spr.angle = VecToAngle((tpoint + actor->user.point)->pos - actor->spr.pos);
actor->spr.angle = ((tpoint + actor->user.point)->pos - actor->spr.pos).Angle();
}
}
@ -1793,7 +1793,7 @@ void RefreshPoints(SECTOR_OBJECT* sop, const DVector2& move, bool dynamic)
{
if (!(wal.extra & WALLFX_DONT_SCALE))
{
auto ang = VecToAngle(pos - sop->pmid);
auto ang = (pos - sop->pmid).Angle();
if (sop->scale_type == SO_SCALE_RANDOM_POINT)
{
@ -2190,7 +2190,7 @@ DVector2 DoTrack(SECTOR_OBJECT* sop, short locktics)
// calculate an angle to the target
if (sop->vel)
sop->ang_moving = sop->ang_tgt = VecToAngle(tpoint->pos - sop->pmid);
sop->ang_moving = sop->ang_tgt = (tpoint->pos - sop->pmid).Angle();
// NOTE: Jittery ride - try new value out here
// NOTE: Put a loop around this (locktics) to make it more acuruate
@ -2450,7 +2450,7 @@ DVector2 DoTrack(SECTOR_OBJECT* sop, short locktics)
sop->target_dist = (sop->pmid.XY() - tpoint->pos.XY()).Length();
// calculate a new angle to the target
sop->ang_moving = sop->ang_tgt = VecToAngle(tpoint->pos - sop->pmid);
sop->ang_moving = sop->ang_tgt = (tpoint->pos - sop->pmid).Angle();
if ((sop->flags & SOBJ_ZDIFF_MODE))
{
@ -2728,7 +2728,7 @@ void DoAutoTurretObject(SECTOR_OBJECT* sop)
}
}
sop->ang_tgt = VecToAngle(actor->user.targetActor->spr.pos - sop->pmid);
sop->ang_tgt = (actor->user.targetActor->spr.pos - sop->pmid).Angle();
// get delta to target angle
delta_ang = deltaangle(sop->ang, sop->ang_tgt);
@ -2767,7 +2767,7 @@ void DoActorHitTrackEndPoint(DSWActor* actor)
if (actor->user.track >= 0)
{
auto tp = Track[actor->user.track].TrackPoint + actor->user.point;
actor->spr.angle = VecToAngle(tp->pos - actor->spr.pos);
actor->spr.angle = (tp->pos - actor->spr.pos).Angle();
}
else
{
@ -2784,7 +2784,7 @@ void DoActorHitTrackEndPoint(DSWActor* actor)
if (actor->user.track >= 0)
{
auto tp = Track[actor->user.track].TrackPoint + actor->user.point;
actor->spr.angle = VecToAngle(tp->pos - actor->spr.pos);
actor->spr.angle = (tp->pos - actor->spr.pos).Angle();
}
else
{
@ -3371,7 +3371,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
if (!(actor->user.Flags & (SPR_CLIMBING | SPR_DONT_UPDATE_ANG)))
{
actor->spr.angle = VecToAngle(tpoint->pos - actor->spr.pos);
actor->spr.angle = (tpoint->pos - actor->spr.pos).Angle();
}
double dist = (actor->spr.pos.XY() - tpoint->pos.XY()).Length();
@ -3387,7 +3387,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
if (!(actor->user.Flags & (SPR_CLIMBING | SPR_DONT_UPDATE_ANG)))
{
// calculate a new angle to the target
actor->spr.angle = VecToAngle(tpoint->pos - actor->spr.pos);
actor->spr.angle = (tpoint->pos - actor->spr.pos).Angle();
}
if (actor->user.Flags & (SPR_ZDIFF_MODE))
@ -3433,7 +3433,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
actor->vel.Z = 0;
actor->spr.angle = VecToAngle(tpoint->pos - actor->spr.pos);
actor->spr.angle = (tpoint->pos - actor->spr.pos).Angle();
ActorLeaveTrack(actor);
actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);

View file

@ -5495,7 +5495,7 @@ int PlayerCheckDeath(PLAYER* pp, DSWActor* weapActor)
DoPlayerBeginDie(pp);
// for death direction
actor->user.slide_ang = VecToAngle(actor->spr.pos - weapActor->spr.pos);
actor->user.slide_ang = (actor->spr.pos - weapActor->spr.pos).Angle();
// for death velocity
actor->user.slide_vel = actor->user.LastDamage * (5 / 16.);
@ -7890,7 +7890,7 @@ int MissileSeek(DSWActor* actor, int16_t delay_tics, DAngle aware_range/*, int16
if (goal != nullptr)
{
// move to correct angle
auto ang2tgt = VecToAngle(goal->spr.pos - actor->spr.pos);
auto ang2tgt = (goal->spr.pos - actor->spr.pos).Angle();
auto delta_ang = clamp(deltaangle(ang2tgt, actor->spr.angle), -DAngle45 / 8, DAngle45 / 8);
actor->spr.angle -= delta_ang;
@ -7934,7 +7934,7 @@ int ComboMissileSeek(DSWActor* actor, int16_t delay_tics, DAngle aware_range/*,
if (goal != nullptr)
{
// move to correct angle
auto ang2tgt = VecToAngle(goal->spr.pos - actor->spr.pos);
auto ang2tgt = (goal->spr.pos - actor->spr.pos).Angle();
auto delta_ang = clamp(deltaangle(ang2tgt, actor->spr.angle), -DAngle45 / 8, DAngle45 / 8);
actor->spr.angle -= delta_ang;
UpdateChangeXY(actor);
@ -7949,7 +7949,7 @@ int ComboMissileSeek(DSWActor* actor, int16_t delay_tics, DAngle aware_range/*,
void SetAngleFromChange(DSWActor* actor)
{
actor->spr.angle = VecToAngle(actor->user.change);
actor->spr.angle = actor->user.change.Angle();
}
//---------------------------------------------------------------------------
@ -15851,7 +15851,7 @@ int InitTurretMicro(DSWActor* actor, PLAYER* pp)
{
picked = ts->actor;
angle = VecToAngle(picked->spr.pos - npos);
angle = (picked->spr.pos - npos).Angle();
ts++;
}

View file

@ -35,12 +35,12 @@ constexpr double HORIZ_MULTF = 64.;
inline DAngle AngToSprite(DSWActor* actor, DSWActor* other)
{
return VecToAngle(actor->spr.pos - other->spr.pos);
return (actor->spr.pos - other->spr.pos).Angle();
}
inline DAngle AngToPlayer(PLAYER* player, DSWActor* other)
{
return VecToAngle(player->pos - other->spr.pos);
return (player->pos - other->spr.pos).Angle();
}