- VecToAngle() with XY() inside to .Angle() replacements.

This commit is contained in:
Mitchell Richters 2022-09-30 21:38:21 +10:00 committed by Christoph Oelckers
parent c00c8d196e
commit 9b98388215
26 changed files with 95 additions and 95 deletions

View file

@ -3951,7 +3951,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode)
missileActor->spr.picnum = 2123;
missileActor->SetTarget(actorHit);
missileActor->xspr.TargetPos.Z = (missileActor->spr.pos.Z - actorHit->spr.pos.Z);
missileActor->xspr.goalAng = VecToAngle(missileActor->spr.pos.XY() - actorHit->spr.pos.XY()) - actorHit->spr.angle;
missileActor->xspr.goalAng = (missileActor->spr.pos.XY() - actorHit->spr.pos.XY()).Angle() - actorHit->spr.angle;
missileActor->xspr.state = 1;
actPostSprite(missileActor, kStatFlare);
missileActor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;

View file

@ -109,7 +109,7 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
double nDist2 = (tvec - pos2).Length();
if (nDist2 < nClosest)
{
DAngle nAngle = VecToAngle(pos2.XY() - pos.XY());
DAngle nAngle = (pos2.XY() - pos.XY()).Angle();
DAngle nDeltaAngle = absangle(nAngle, actor->spr.angle);
if (nDeltaAngle <= DAngle45)
{
@ -176,7 +176,7 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
double nDist2 = (tvec - pos2).Length();
if (nDist2 < nClosest)
{
DAngle nAngle = VecToAngle(pos2.XY() - pos.XY());
DAngle nAngle = (pos2.XY() - pos.XY()).Angle();
DAngle nDeltaAngle = absangle(nAngle, actor->spr.angle);
if (nDeltaAngle <= DAngle45)
{

View file

@ -136,7 +136,7 @@ void BlastSSeqCallback(int, DBloodActor* actor)
double nDist2 = (tvec - pos2).Length();
if (nDist2 < nClosest)
{
DAngle nAngle = VecToAngle(pos2.XY() - pos.XY());
DAngle nAngle = (pos2.XY() - pos.XY()).Angle();
DAngle nDeltaAngle = absangle(nAngle, actor->spr.angle);
if (nDeltaAngle <= DAngle45)
{

View file

@ -123,7 +123,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
double nDist2 = (tvec - pos2).Length();
if (nDist2 < nClosest)
{
DAngle nAngle = VecToAngle(pos2.XY() - pos.XY());
DAngle nAngle = (pos2.XY() - pos.XY()).Angle();
DAngle nDeltaAngle = absangle(nAngle, actor->spr.angle);
if (nDeltaAngle <= DAngle45)
{

View file

@ -94,7 +94,7 @@ void tchernobogBurnSeqCallback(int, DBloodActor* actor)
double nDist2 = (tvec - pos2).Length();
if (nDist2 < nClosest)
{
DAngle nAngle = VecToAngle(pos2.XY() - pos.XY());
DAngle nAngle = (pos2.XY() - pos.XY()).Angle();
DAngle nDeltaAngle = absangle(nAngle, actor->spr.angle);
if (nDeltaAngle <= DAngle45)
{
@ -150,7 +150,7 @@ void tchernobogBurnSeqCallback2(int, DBloodActor* actor)
double nDist2 = (tvec - pos2).Length();
if (nDist2 < nClosest)
{
DAngle nAngle = VecToAngle(pos2.XY() - pos.XY());
DAngle nAngle = (pos2.XY() - pos.XY()).Angle();
DAngle nDeltaAngle = absangle(nAngle, actor->spr.angle);
if (nDeltaAngle <= DAngle45)
{

View file

@ -1794,7 +1794,7 @@ void dudeLeechOperate(DBloodActor* actor, const EVENT& event)
atpos.XY() += actTarget->vel.XY() * nDist * 0.0375;
auto angBak = actor->spr.angle;
actor->spr.angle = VecToAngle(atpos - actor->spr.pos.XY());
actor->spr.angle = (atpos - actor->spr.pos.XY()).Angle();
DVector3 dv;
dv.XY() = actor->spr.angle.ToVector() * 64;
double tz = actTarget->spr.pos.Z - (actTarget->spr.yrepeat * pDudeInfo->aimHeight) * REPEAT_SCALE;

View file

@ -1552,7 +1552,7 @@ void ProcessInput(PLAYER* pPlayer)
DBloodActor* fragger = pPlayer->fragger;
if (fragger)
{
pPlayer->angle.addadjustment(deltaangle(pPlayer->angle.ang, VecToAngle(fragger->spr.pos.XY() - actor->spr.pos.XY())));
pPlayer->angle.addadjustment(deltaangle(pPlayer->angle.ang, (fragger->spr.pos.XY() - actor->spr.pos.XY()).Angle()));
}
pPlayer->deathTime += 4;
if (!bSeqStat)

View file

@ -272,7 +272,7 @@ void LifeLeechOperate(DBloodActor* actor, EVENT event)
{
pos.XY() += target->vel.XY() * nDist * (65536. / 0x1aaaaa);
auto angBak = actor->spr.angle;
actor->spr.angle = VecToAngle(pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (pos.XY() - actor->spr.pos.XY()).Angle();
double tz = target->spr.pos.Z - (target->spr.yrepeat * pDudeInfo->aimHeight) * REPEAT_SCALE;
auto dvec = DVector3(actor->spr.angle.ToVector(), ((tz - top - 1) / nDist) * (1. / 16.));
int nMissileType = kMissileLifeLeechAltNormal + (actor->xspr.data3 ? 1 : 0);

View file

@ -1494,7 +1494,7 @@ void FireSpread(int nTrigger, PLAYER* pPlayer)
DBloodActor* actor = pPlayer->actor;
assert(nTrigger > 0 && nTrigger <= kMaxSpread);
DVector3 aim = pPlayer->flt_aim();
DAngle angle = (VecToAngle(aim.XY()) + ((DAngle20 * (nTrigger - 1)) / kMaxSpread - DAngle10));
DAngle angle = ((aim.XY()).Angle() + ((DAngle20 * (nTrigger - 1)) / kMaxSpread - DAngle10));
DVector3 dv = DVector3(angle.ToVector(), aim.Z);
sfxPlay3DSound(pPlayer->actor, 431, -1, 0);
@ -1522,7 +1522,7 @@ void AltFireSpread(int nTrigger, PLAYER* pPlayer)
DBloodActor* actor = pPlayer->actor;
assert(nTrigger > 0 && nTrigger <= kMaxSpread);
DVector3 aim = pPlayer->flt_aim();
DAngle angle = (VecToAngle(aim.XY()) + ((DAngle20 * (nTrigger - 1)) / kMaxSpread - DAngle10));
DAngle angle = ((aim.XY()).Angle() + ((DAngle20 * (nTrigger - 1)) / kMaxSpread - DAngle10));
DVector3 dv = DVector3(angle.ToVector(), aim.Z);
sfxPlay3DSound(pPlayer->actor, 431, -1, 0);
@ -1558,7 +1558,7 @@ void AltFireSpread2(int nTrigger, PLAYER* pPlayer)
DBloodActor* actor = pPlayer->actor;
assert(nTrigger > 0 && nTrigger <= kMaxSpread);
DVector3 aim = pPlayer->flt_aim();
DAngle angle = (VecToAngle(aim.XY()) + ((DAngle20 * (nTrigger - 1)) / kMaxSpread - DAngle10));
DAngle angle = ((aim.XY()).Angle() + ((DAngle20 * (nTrigger - 1)) / kMaxSpread - DAngle10));
DVector3 dv = DVector3(angle.ToVector(), aim.Z);
sfxPlay3DSound(pPlayer->actor, 431, -1, 0);

View file

@ -643,7 +643,7 @@ void movecrane(DDukeActor *actor, int crane)
case STAT_ZOMBIEACTOR:
case STAT_STANDABLE:
case STAT_PLAYER:
actor->spr.angle = VecToAngle(cpt.pole - actor->spr.pos.XY());
actor->spr.angle = (cpt.pole - actor->spr.pos.XY()).Angle();
SetActor(a2, DVector3( cpt.pole.X, cpt.pole.Y, a2->spr.pos.Z ));
actor->temp_data[0]++;
return;
@ -752,7 +752,7 @@ void movecrane(DDukeActor *actor, int crane)
{
if (actor->vel.X < 12)
actor->vel.X += 0.5;
actor->spr.angle = VecToAngle(cpt.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (cpt.pos.XY() - actor->spr.pos.XY()).Angle();
ssp(actor, CLIPMASK0);
if (((actor->spr.pos.X - cpt.pos.X) * (actor->spr.pos.X - cpt.pos.X) + (actor->spr.pos.Y - cpt.pos.Y) * (actor->spr.pos.Y - cpt.pos.Y)) < (8 * 8))
actor->temp_data[0]++;
@ -1492,7 +1492,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
{
// if(actor->spr.pal == 12)
{
auto delta = absangle(ps[p].angle.ang, VecToAngle(actor->spr.pos.XY() - ps[p].pos.XY()));
auto delta = absangle(ps[p].angle.ang, (actor->spr.pos.XY() - ps[p].pos.XY()).Angle());
if (delta < DAngle22_5 / 2 && PlayerInput(p, SB_OPEN))
if (ps[p].toggle_key_flag == 1)
{
@ -1502,7 +1502,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
{
if (act2->spr.picnum == queball || act2->spr.picnum == stripeball)
{
delta = absangle(ps[p].angle.ang, VecToAngle(act2->spr.pos.XY() - ps[p].pos.XY()));
delta = absangle(ps[p].angle.ang, (act2->spr.pos.XY() - ps[p].pos.XY()).Angle());
if (delta < DAngle22_5 / 2)
{
double l;
@ -1524,7 +1524,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
}
if (x < 32 && actor->sector() == ps[p].cursector)
{
actor->spr.angle = VecToAngle(actor->spr.pos.XY() - ps[p].pos.XY());
actor->spr.angle = (actor->spr.pos.XY() - ps[p].pos.XY()).Angle();
actor->vel.X = 3;
}
}
@ -1676,7 +1676,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
actor->temp_data[2] = 0;
}
else actor->temp_angle +=
deltaangle(actor->temp_angle, VecToAngle(ps[p].pos.XY() - actor->spr.pos.XY())) / 3;
deltaangle(actor->temp_angle, (ps[p].pos.XY() - actor->spr.pos.XY()).Angle()) / 3;
}
else if (actor->temp_data[0] == 2 || actor->temp_data[0] == 3)
{
@ -1703,7 +1703,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
fi.shoot(actor, firelaser);
}
}
actor->spr.angle += deltaangle(actor->spr.angle, VecToAngle(ps[p].pos.XY() - actor->spr.pos.XY())) * 0.25;
actor->spr.angle += deltaangle(actor->spr.angle, (ps[p].pos.XY() - actor->spr.pos.XY()).Angle()) * 0.25;
}
if (actor->temp_data[0] != 2 && actor->temp_data[0] != 3 && Owner)
@ -1714,7 +1714,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
a = actor->spr.angle;
actor->vel.X *= 0.5;
}
else a = VecToAngle(Owner->spr.pos.XY() - actor->spr.pos.XY());
else a = (Owner->spr.pos.XY() - actor->spr.pos.XY()).Angle();
if (actor->temp_data[0] == 1 || actor->temp_data[0] == 4) // Found a locator and going with it
{
@ -2777,7 +2777,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
Owner = actor->GetOwner();
if(actor->vel.X != 0)
{
auto curangle = VecToAngle(Owner->spr.pos.XY() - actor->spr.pos.XY());
auto curangle = (Owner->spr.pos.XY() - actor->spr.pos.XY()).Angle();
auto diffangle = deltaangle(actor->spr.angle, curangle) * 0.125;
actor->temp_angle += diffangle;
@ -2798,7 +2798,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
if (dist2 < 1280)//20480)
{
auto saved_angle = actor->spr.angle;
actor->spr.angle = VecToAngle(actor->spr.pos.XY() - ps[p].pos.XY());
actor->spr.angle = (actor->spr.pos.XY() - ps[p].pos.XY()).Angle();
fi.shoot(actor, RPG);
actor->spr.angle = saved_angle;
}
@ -3319,7 +3319,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER)
{
// Huh?
//auto ta = actor->spr.angle;
//actor->spr.angle = VecToAngle(ps[p].pos.XY() - actor->spr.pos.XY());
//actor->spr.angle = (ps[p].pos.XY() - actor->spr.pos.XY()).Angle();
//actor->spr.angle = ta;
actor->SetOwner(nullptr);
return;
@ -3327,7 +3327,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER)
}
else actor->vel.X = 16;
auto ang = VecToAngle(Owner->spr.pos.XY() - actor->spr.pos.XY());
auto ang = (Owner->spr.pos.XY() - actor->spr.pos.XY()).Angle();
auto angdiff = deltaangle(actor->spr.angle, ang) / 8;
actor->spr.angle += angdiff;
@ -3339,7 +3339,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER)
else
{
actor->temp_angle +=
deltaangle(actor->temp_angle + DAngle90, VecToAngle(ps[p].pos.XY() - actor->spr.pos.XY())) * 0.25;
deltaangle(actor->temp_angle + DAngle90, (ps[p].pos.XY() - actor->spr.pos.XY()).Angle()) * 0.25;
sc->ceilingshade = 0;
}
j = fi.ifhitbyweapon(actor);
@ -4299,7 +4299,7 @@ void handle_se27(DDukeActor* actor)
{
ud.cameraactor = actor;
actor->temp_data[0] = 999;
actor->spr.angle += deltaangle(actor->spr.angle, VecToAngle(ps[p].pos.XY() - actor->spr.pos.XY())) * 0.125;
actor->spr.angle += deltaangle(actor->spr.angle, (ps[p].pos.XY() - actor->spr.pos.XY()).Angle()) * 0.125;
actor->spr.yint = 100 + int((actor->spr.pos.Z - ps[p].pos.Z) * (256. / 257.));
}
@ -4314,7 +4314,7 @@ void handle_se27(DDukeActor* actor)
}
else
{
actor->spr.angle = VecToAngle(ps[p].pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (ps[p].pos.XY() - actor->spr.pos.XY()).Angle();
if (actor->temp_data[0] == 999)
{
@ -5014,9 +5014,9 @@ void alterang(int ang, DDukeActor* actor, int playernum)
auto Owner = actor->GetOwner();
if (Owner->isPlayer())
goalang = VecToAngle(actor->ovel - actor->spr.pos.XY());
goalang = (actor->ovel - actor->spr.pos.XY()).Angle();
else
goalang = VecToAngle(Owner->spr.pos.XY() - actor->spr.pos.XY());
goalang = (Owner->spr.pos.XY() - actor->spr.pos.XY()).Angle();
if (actor->vel.X != 0 && actor->spr.picnum != TILE_DRONE)
{

View file

@ -2118,7 +2118,7 @@ static void greenslime(DDukeActor *actor)
}
else if (xx < 64 && ps[p].quick_kick == 0)
{
auto ang = absangle(ps[p].angle.ang, VecToAngle(actor->spr.pos.XY() - ps[p].pos.XY()));
auto ang = absangle(ps[p].angle.ang, (actor->spr.pos.XY() - ps[p].pos.XY()).Angle());
if (ang < DAngle22_5)
ps[p].quick_kick = 14;
}
@ -2379,7 +2379,7 @@ static void greenslime(DDukeActor *actor)
{
if (actor->vel.X < 2) actor->vel.X += 0.25;
actor->vel.X = 4 - BobVal(512 + actor->temp_data[1]) * 2;
actor->spr.angle += deltaangle(actor->spr.angle, VecToAngle(ps[p].pos.XY() - actor->spr.pos.XY())) * 0.125;
actor->spr.angle += deltaangle(actor->spr.angle, (ps[p].pos.XY() - actor->spr.pos.XY()).Angle()) * 0.125;
// TJR
}
@ -3492,8 +3492,8 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (a & face_player)
{
if (ps[playernum].newOwner != nullptr)
goalang = VecToAngle(ps[playernum].opos.XY() - actor->spr.pos.XY());
else goalang = VecToAngle(ps[playernum].pos.XY() - actor->spr.pos.XY());
goalang = (ps[playernum].opos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[playernum].pos.XY() - actor->spr.pos.XY()).Angle();
angdif = deltaangle(actor->spr.angle, goalang) * 0.25;
if (angdif > -DAngle22_5 / 8 && angdif < nullAngle) angdif = nullAngle;
actor->spr.angle += angdif;
@ -3505,8 +3505,8 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (a & face_player_slow)
{
if (ps[playernum].newOwner != nullptr)
goalang = VecToAngle(ps[playernum].opos.XY() - actor->spr.pos.XY());
else goalang = VecToAngle(ps[playernum].pos.XY() - actor->spr.pos.XY());
goalang = (ps[playernum].opos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[playernum].pos.XY() - actor->spr.pos.XY()).Angle();
angdif = DAngle22_5 * 0.25 * Sgn(deltaangle(actor->spr.angle, goalang).Degrees()); // this looks very wrong...
actor->spr.angle += angdif;
}
@ -3521,7 +3521,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (a & face_player_smart)
{
DVector2 newpos = ps[playernum].pos.XY() + (ps[playernum].vel.XY() * (4. / 3.));
goalang = VecToAngle(newpos - actor->spr.pos.XY());
goalang = (newpos - actor->spr.pos.XY()).Angle();
angdif = deltaangle(actor->spr.angle, goalang) * 0.25;
if (angdif > -DAngle22_5/16 && angdif < nullAngle) angdif = nullAngle;
actor->spr.angle += angdif;
@ -3626,7 +3626,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
{
daxvel = -(1024 - xvel) * maptoworld;
angdif = VecToAngle(ps[playernum].pos.XY() - actor->spr.pos.XY());
angdif = (ps[playernum].pos.XY() - actor->spr.pos.XY()).Angle();
if (xvel < 512)
{

View file

@ -3449,8 +3449,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a & face_player)
{
if (ps[pnum].newOwner != nullptr)
goalang = VecToAngle(ps[pnum].opos.XY() - actor->spr.pos.XY());
else goalang = VecToAngle(ps[pnum].pos.XY() - actor->spr.pos.XY());
goalang = (ps[pnum].opos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[pnum].pos.XY() - actor->spr.pos.XY()).Angle();
angdif = deltaangle(actor->spr.angle, goalang) * 0.25;
if (angdif > -DAngle22_5 / 8 && angdif < nullAngle) angdif = nullAngle;
actor->spr.angle += angdif;
@ -3462,8 +3462,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a & face_player_slow)
{
if (ps[pnum].newOwner != nullptr)
goalang = VecToAngle(ps[pnum].opos.XY() - actor->spr.pos.XY());
else goalang = VecToAngle(ps[pnum].pos.XY() - actor->spr.pos.XY());
goalang = (ps[pnum].opos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[pnum].pos.XY() - actor->spr.pos.XY()).Angle();
angdif = DAngle22_5 * 0.25 * Sgn(deltaangle(actor->spr.angle, goalang).Degrees()); // this looks very wrong...
actor->spr.angle += angdif;
}
@ -3473,8 +3473,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a & antifaceplayerslow)
{
if (ps[pnum].newOwner != nullptr)
goalang = (VecToAngle(ps[pnum].opos.XY() - actor->spr.pos.XY()) + DAngle180);
else goalang = (VecToAngle(ps[pnum].pos.XY() - actor->spr.pos.XY()) + DAngle180);
goalang = ((ps[pnum].opos.XY() - actor->spr.pos.XY()).Angle() + DAngle180);
else goalang = ((ps[pnum].pos.XY() - actor->spr.pos.XY()).Angle() + DAngle180);
angdif = DAngle22_5 * 0.25 * Sgn(deltaangle(actor->spr.angle, goalang).Degrees()); // this looks very wrong...
actor->spr.angle += angdif;
}
@ -3534,7 +3534,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a & face_player_smart)
{
DVector2 newpos = ps[pnum].pos.XY() + (ps[pnum].vel.XY() * (4. / 3.));
goalang = VecToAngle(newpos - actor->spr.pos.XY());
goalang = (newpos - actor->spr.pos.XY()).Angle();
angdif = deltaangle(actor->spr.angle, goalang) * 0.25;
if (angdif > -DAngle22_5 / 16 && angdif < nullAngle) angdif = nullAngle;
actor->spr.angle += angdif;
@ -3633,7 +3633,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{
daxvel = -(1024 - xvel) * maptoworld;
angdif = VecToAngle(ps[pnum].pos.XY() - actor->spr.pos.XY());
angdif = (ps[pnum].pos.XY() - actor->spr.pos.XY()).Angle();
if (xvel < 512)
{

View file

@ -202,8 +202,8 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case FORCESPHERE:
if (t->statnum == STAT_MISC && OwnerAc)
{
auto sqa = VecToAngle( OwnerAc->spr.pos.XY() - ps[screenpeek].pos.XY());
auto sqb = VecToAngle(OwnerAc->spr.pos.XY() - t->pos.XY());
auto sqa = ( OwnerAc->spr.pos.XY() - ps[screenpeek].pos.XY()).Angle();
auto sqb = (OwnerAc->spr.pos.XY() - t->pos.XY()).Angle();
if (absangle(sqa, sqb) > DAngle90)
{
@ -222,7 +222,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
t->xrepeat = 0;
else
{
t->angle = VecToAngle(viewVec - t->pos.XY());
t->angle = (viewVec - t->pos.XY()).Angle();
t->pos.XY() = OwnerAc->spr.pos.XY() + t->angle.ToVector();
}
}
@ -593,7 +593,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
else
{
// Alter the shadow's position so that it appears behind the sprite itself.
auto look = VecToAngle(shadowspr->pos.XY() - ps[screenpeek].pos.XY());
auto look = (shadowspr->pos.XY() - ps[screenpeek].pos.XY()).Angle();
shadowspr->pos.XY() += look.ToVector() * 2;
}
}

View file

@ -197,8 +197,8 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case FORCESPHERE:
if (t->statnum == STAT_MISC && OwnerAc)
{
auto sqa = VecToAngle(OwnerAc->spr.pos.XY() - ps[screenpeek].pos.XY());
auto sqb = VecToAngle(OwnerAc->spr.pos.XY() - t->pos.XY());
auto sqa = (OwnerAc->spr.pos.XY() - ps[screenpeek].pos.XY()).Angle();
auto sqb = (OwnerAc->spr.pos.XY() - t->pos.XY()).Angle();
if (absangle(sqa, sqb) > DAngle90)
{
@ -216,7 +216,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
t->xrepeat = 0;
else
{
t->angle = VecToAngle(viewVec - t->pos.XY());
t->angle = (viewVec - t->pos.XY()).Angle();
t->pos.XY() = OwnerAc->spr.pos.XY() + t->angle.ToVector();
}
}
@ -749,7 +749,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
else
{
// Alter the shadow's position so that it appears behind the sprite itself.
auto look = VecToAngle(shadowspr->pos.XY() - ps[screenpeek].pos.XY());
auto look = (shadowspr->pos.XY() - ps[screenpeek].pos.XY()).Angle();
shadowspr->pos.XY() += look.ToVector() * 2;
}
}

View file

@ -2428,9 +2428,9 @@ int ParseState::parse(void)
{
DAngle ang;
if (g_ac->isPlayer() && ud.multimode > 1)
ang = absangle(ps[otherp].angle.ang, VecToAngle(ps[g_p].pos.XY() - ps[otherp].pos.XY()));
ang = absangle(ps[otherp].angle.ang, (ps[g_p].pos.XY() - ps[otherp].pos.XY()).Angle());
else
ang = absangle(ps[g_p].angle.ang, VecToAngle(g_ac->spr.pos.XY() - ps[g_p].pos.XY()));
ang = absangle(ps[g_p].angle.ang, (g_ac->spr.pos.XY() - ps[g_p].pos.XY()).Angle());
j = ang < DAngle22_5;
}
@ -3110,7 +3110,7 @@ int ParseState::parse(void)
int i = *(insptr++); // ID of def
// g_ac->lastvx and lastvy are last known location of target.
int ang = VecToAngle(g_ac->ovel - g_ac->spr.pos.XY()).Buildang();
int ang = (g_ac->ovel - g_ac->spr.pos.XY()).Angle().Buildang();
SetGameVarID(i, ang, g_ac, g_p);
break;
}

View file

@ -160,7 +160,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, DVector3 spos, DAng
{
double x;
int j = findplayer(actor, &x);
sang = VecToAngle(ps[j].opos.XY() - spos.XY());
sang = (ps[j].opos.XY() - spos.XY()).Angle();
if (actor->spr.picnum == BOSS5)
{
@ -185,7 +185,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, DVector3 spos, DAng
zvel = -ps[p].horizon.sum().Tan() * 40.5;
// WTF???
DAngle myang = DAngle90 - (DAngle180 - abs(abs(VecToAngle(spos.XY() - ps[p].pos.XY()) - sang) - DAngle180));
DAngle myang = DAngle90 - (DAngle180 - abs(abs((spos.XY() - ps[p].pos.XY()).Angle() - sang) - DAngle180));
if (ps[p].GetActor()->vel.X != 0)
vel = ((myang / DAngle90) * ps[p].GetActor()->vel.X) + 25;
if (actor->sector()->lotag == 2 && (krand() % 5) == 0)
@ -251,7 +251,7 @@ static void shootknee(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
double x;
auto pactor = ps[findplayer(actor, &x)].GetActor();
zvel = ((pactor->spr.pos.Z - pos.Z) * 16) / (x + 1/16.);
ang = VecToAngle(pactor->spr.pos.XY() - pos.XY());
ang = (pactor->spr.pos.XY() - pos.XY()).Angle();
}
hitscan(pos, sectp, DVector3(ang.ToVector() * 1024, zvel * 64), hit, CLIPMASK1);
@ -603,7 +603,7 @@ static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int a
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
ang = VecToAngle(aimed->spr.pos.XY() - pos.XY());
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
zvel = -ps[p].horizon.sum().Tan() * 49.;
@ -714,7 +714,7 @@ static void shootrpg(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atw
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
if (aimed->spr.picnum != RECON)
ang = VecToAngle(aimed->spr.pos.XY() - pos.XY());
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
zvel = -ps[p].horizon.sum().Tan() * 40.5;
@ -727,7 +727,7 @@ static void shootrpg(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atw
{
double x;
int j = findplayer(actor, &x);
ang = VecToAngle(ps[j].opos.XY() - pos.XY());
ang = (ps[j].opos.XY() - pos.XY()).Angle();
if (actor->spr.picnum == BOSS3)
{
double zoffs = 32;
@ -953,7 +953,7 @@ static void shootgrowspark(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
}
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.XY() - pos.XY());
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
{
@ -1048,7 +1048,7 @@ static void shootshrinker(DDukeActor* actor, int p, const DVector3& pos, DAngle
double dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) * REPEAT_SCALE * 0.5);
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
zvel = ((aimed->spr.pos.Z - pos.Z - dal - 4) * 48) / dist;
ang = VecToAngle(aimed->spr.pos.XY() - pos.XY());
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
zvel = -ps[p].horizon.sum().Tan() * 49.;

View file

@ -100,7 +100,7 @@ static void shootmelee(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int a
double x;
auto pactor = ps[findplayer(actor, &x)].GetActor();
zvel = ((pactor->spr.pos.Z - pos.Z) * 16) / (x + 1 / 16.);
ang = VecToAngle(pactor->spr.pos.XY() - pos.XY());
ang = (pactor->spr.pos.XY() - pos.XY()).Angle();
}
hitscan(pos, sectp, DVector3(ang.ToVector() * 1024, zvel * 64), hit, CLIPMASK1);
@ -508,7 +508,7 @@ static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int a
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
ang = VecToAngle(aimed->spr.pos.XY() - pos.XY());
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
{
@ -625,7 +625,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
if (aimed->spr.picnum != RECON)
ang = VecToAngle(aimed->spr.pos.XY() - pos.XY());
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
zvel = -ps[p].horizon.sum().Tan() * 40.5;
@ -645,7 +645,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw
{
double x;
int j = findplayer(actor, &x);
ang = VecToAngle(ps[j].opos.XY() - pos.XY());
ang = (ps[j].opos.XY() - pos.XY()).Angle();
if (actor->spr.picnum == BOSS3)
pos.Z -= 32;
else if (actor->spr.picnum == BOSS2)
@ -779,7 +779,7 @@ static void shootwhip(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int at
double dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) * REPEAT_SCALE * 0.5) -12;
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
ang = VecToAngle(aimed->spr.pos.XY() - pos.XY());
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
zvel = -ps[p].horizon.sum().Tan() * 49.;

View file

@ -1039,7 +1039,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
{
proj->vel.X *= 0.75;
proj->spr.angle -= targ->spr.angle * 2 + DAngle180;
targ->spr.angle = VecToAngle(targ->spr.pos.XY() - proj->spr.pos.XY()) - DAngle90;
targ->spr.angle = (targ->spr.pos.XY() - proj->spr.pos.XY()).Angle() - DAngle90;
if (S_CheckSoundPlaying(POOLBALLHIT) < 2)
S_PlayActorSound(POOLBALLHIT, targ);
}

View file

@ -2077,7 +2077,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
{
proj->vel.X *= 0.75;
proj->spr.angle -= targ->spr.angle * 2 + DAngle180;
targ->spr.angle = VecToAngle(targ->spr.pos.XY() - proj->spr.pos.XY()) - DAngle90;
targ->spr.angle = (targ->spr.pos.XY() - proj->spr.pos.XY()).Angle() - DAngle90;
if (S_CheckSoundPlaying(POOLBALLHIT) < 2)
S_PlayActorSound(POOLBALLHIT, targ);
}

View file

@ -499,7 +499,7 @@ void initwaterdrip(DDukeActor* actj, DDukeActor* actor)
actor->spr.pos.Z -= 18;
}
else actor->spr.pos.Z -= 13;
actor->spr.angle = VecToAngle(ps[connecthead].pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (ps[connecthead].pos.XY() - actor->spr.pos.XY()).Angle();
actor->vel.X = 3 - krandf(2);
ssp(actor, CLIPMASK0);
}

View file

@ -532,7 +532,7 @@ int seq_GetSeqPicnum(int16_t nSeq, int16_t edx, int16_t ebx)
int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal)
{
tspritetype* pTSprite = mytspriteArray->get(nSprite);
DAngle nAngle = VecToAngle(nCamerapos.XY() - pTSprite->pos.XY());
DAngle nAngle = (nCamerapos.XY() - pTSprite->pos.XY()).Angle();
int nSeqOffset = (((pTSprite->angle + DAngle90 + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8;
@ -595,7 +595,7 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
}
else
{
DAngle nAngle = VecToAngle(nCamerapos.XY() - pTSprite->pos.XY());
DAngle nAngle = (nCamerapos.XY() - pTSprite->pos.XY()).Angle();
val = (((pTSprite->angle + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8;
}

View file

@ -365,7 +365,7 @@ void DoShadows(tspriteArray& tsprites, tspritetype* tsp, double viewz)
else
{
// Alter the shadow's position so that it appears behind the sprite itself.
auto look = VecToAngle(tSpr->pos.XY() - Player[screenpeek].si.XY());
auto look = (tSpr->pos.XY() - Player[screenpeek].si.XY()).Angle();
tSpr->pos.XY() += look.ToVector() * 2;
}

View file

@ -5459,7 +5459,7 @@ void DoPlayerStopOperate(PLAYER* pp)
if (TEST_BOOL1(rsp))
pp->angle.ang = pp->angle.oang = rsp->spr.angle;
else
pp->angle.ang = pp->angle.oang = VecToAngle(pp->sop_remote->pmid.XY() - pp->pos.XY());
pp->angle.ang = pp->angle.oang = (pp->sop_remote->pmid.XY() - pp->pos.XY()).Angle();
}
if (pp->sop_control)

View file

@ -599,7 +599,7 @@ void GameInterface::UpdateSounds(void)
if (TEST_BOOL1(rsp))
tang = rsp->spr.angle;
else
tang = VecToAngle(pp->sop_remote->pmid.XY() - pp->pos.XY());
tang = (pp->sop_remote->pmid.XY() - pp->pos.XY()).Angle();
}
else tang = pp->angle.ang;

View file

@ -823,7 +823,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop)
sop->clipbox_vdist[sop->clipbox_num] = (sop->pmid.XY() - itActor->spr.pos.XY()).Length();
auto ang2 = VecToAngle(itActor->spr.pos.XY() - sop->pmid.XY());
auto ang2 = (itActor->spr.pos.XY() - sop->pmid.XY()).Angle();
sop->clipbox_ang[sop->clipbox_num] = deltaangle(ang2, sop->ang);
sop->clipbox_num++;

View file

@ -5144,7 +5144,7 @@ int ActorHealth(DSWActor* actor, short amt)
PlaySound(DIGI_NINJACHOKE, actor, v3df_follow);
InitPlasmaFountain(nullptr, actor);
InitBloodSpray(actor,false,105);
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()) + DAngle90;
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle() + DAngle90;
actor->spr.cstat &= ~(CSTAT_SPRITE_YFLIP);
if (sw_ninjahack)
NewStateGroup(actor, sg_NinjaHariKari);
@ -11789,7 +11789,7 @@ int DoSerpRing(DSWActor* actor)
{
extern STATE* sg_SkullJump[];
actor->user.ID = SKULL_R0;
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
actor->vel.X = dist * (3. / 64) + RandomRangeF(16);
actor->user.jump_speed = -800;
change_actor_stat(actor, STAT_ENEMY);
@ -11840,7 +11840,7 @@ int InitLavaThrow(DSWActor* actor)
short w;
// get angle to player and also face player when attacking
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
double nz = ActorZOfTop(actor) + (ActorSizeZ(actor) * 0.25);
@ -12890,7 +12890,7 @@ int WeaponAutoAimZvel(DSWActor* actor, DSWActor* missileActor, double *zvel, DAn
hitActor->user.Flags |= (SPR_TARGETED);
hitActor->user.Flags |= (SPR_ATTACKED);
missileActor->spr.angle = VecToAngle(hitActor->spr.pos.XY() - missileActor->spr.pos.XY());
missileActor->spr.angle = (hitActor->spr.pos.XY() - missileActor->spr.pos.XY()).Angle();
double dist = (missileActor->spr.pos.XY() - hitActor->spr.pos.XY()).Length();
if (dist != 0)
@ -12990,7 +12990,7 @@ DSWActor* WeaponAutoAimHitscan(DSWActor* actor, double *z, DAngle *ang, bool tes
picked->user.Flags |= (SPR_TARGETED);
picked->user.Flags |= (SPR_ATTACKED);
*ang = VecToAngle(picked->spr.pos.XY() - actor->spr.pos.XY());
*ang = (picked->spr.pos.XY() - actor->spr.pos.XY()).Angle();
// find the distance to the target
double dist = (actor->spr.pos.XY() - picked->spr.pos.XY()).Length();
@ -14112,7 +14112,7 @@ int InitMicro(PLAYER* pp)
{
picked = ts->actor;
angle = VecToAngle(picked->spr.pos.XY() - pp->pos.XY());
angle = (picked->spr.pos.XY() - pp->pos.XY()).Angle();
ts++;
}
@ -14539,7 +14539,7 @@ int InitSerpSpell(DSWActor* actor)
for (i = 0; i < 2; i++)
{
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
auto actorNew = SpawnActor(STAT_MISSILE, SERP_METEOR, &sg_SerpMeteor[0][0], actor->sector(), actor->spr.pos, actor->spr.angle, 93.75);
@ -14643,7 +14643,7 @@ int InitSerpMonstSpell(DSWActor* actor)
for (i = 0; i < 1; i++)
{
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
auto actorNew = SpawnActor(STAT_MISSILE, SERP_METEOR, &sg_SerpMeteor[0][0], actor->sector(), actor->spr.pos, actor->spr.angle, 31.25);
@ -14719,7 +14719,7 @@ int InitEnemyRocket(DSWActor* actor)
PlaySound(DIGI_NINJARIOTATTACK, actor, v3df_none);
// get angle to player and also face player when attacking
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
// Spawn a shot
@ -14792,7 +14792,7 @@ int InitEnemyRail(DSWActor* actor)
PlaySound(DIGI_RAILFIRE, actor, v3df_dontpan|v3df_doppler);
// get angle to player and also face player when attacking
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
// add a bit of randomness
if (RANDOM_P2(1024) < 512)
@ -14865,7 +14865,7 @@ int InitZillaRocket(DSWActor* actor)
PlaySound(DIGI_NINJARIOTATTACK, actor, v3df_none);
// get angle to player and also face player when attacking
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
for (int i = 0; i < (int)SIZ(mp); i++)
{
@ -14924,7 +14924,7 @@ int InitEnemyStar(DSWActor* actor)
int dist;
// get angle to player and also face player when attacking
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
// Spawn a shot
auto actorNew = SpawnActor(STAT_MISSILE, STAR1, s_Star, actor->sector(),
@ -14960,7 +14960,7 @@ int InitEnemyCrossbow(DSWActor* actor)
int dist;
// get angle to player and also face player when attacking
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
// Spawn a shot
auto actorNew = SpawnActor(STAT_MISSILE, CROSSBOLT, &s_CrossBolt[0][0], actor->sector(),
@ -15003,7 +15003,7 @@ int InitSkelSpell(DSWActor* actor)
PlaySound(DIGI_SPELEC, actor, v3df_none);
// get angle to player and also face player when attacking
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
// Spawn a shot
auto actorNew = SpawnActor(STAT_MISSILE, ELECTRO_ENEMY, s_Electro, actor->sector(),
@ -15036,7 +15036,7 @@ int InitSkelSpell(DSWActor* actor)
int InitCoolgFire(DSWActor* actor)
{
// get angle to player and also face player when attacking
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
// Spawn a shot
// Inserting and setting up variables
@ -17121,7 +17121,7 @@ int InitEnemyFireball(DSWActor* actor)
PlaySound(DIGI_FIREBALL1, actor, v3df_none);
// get angle to player and also face player when attacking
actor->spr.angle = VecToAngle(targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->spr.angle = (targetActor->spr.pos.XY() - actor->spr.pos.XY()).Angle();
double size_z = ActorSizeZ(actor) * 0.625;
double nz = actor->spr.pos.Z - size_z + 4;