diff --git a/src/actor.h b/src/actor.h index fca932f8f4..f1b51c77ef 100644 --- a/src/actor.h +++ b/src/actor.h @@ -818,12 +818,12 @@ public: return P_AproxDistance(X() - otherx, Y() - othery); } - fixed_t AngleTo(fixed_t otherx, fixed_t othery) + fixed_t __f_AngleTo(fixed_t otherx, fixed_t othery) { return R_PointToAngle2(X(), Y(), otherx, othery); } - fixed_t AngleTo(fixedvec2 other) + fixed_t __f_AngleTo(fixedvec2 other) { return R_PointToAngle2(X(), Y(), other.x, other.y); } @@ -861,27 +861,27 @@ public: return xs_RoundToInt(DVector3(X() - otherpos.x, Y() - otherpos.y, Z() - otherpos.z).Length()); } - angle_t AngleTo(AActor *other, bool absolute = false) + angle_t __f_AngleTo(AActor *other, bool absolute = false) { fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this); return R_PointToAngle2(X(), Y(), otherpos.x, otherpos.y); } - angle_t AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const + angle_t __f_AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const { return R_PointToAngle2(X(), Y(), other->X() + oxofs, other->Y() + oyofs); } - DAngle _f_AngleTo(AActor *other, bool absolute = false) + DAngle AngleTo(AActor *other, bool absolute = false) { fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this); - return vectoyaw(otherpos.x - X(), otherpos.y - Y()); + return VecToAngle(otherpos.x - X(), otherpos.y - Y()); } - DAngle _f_AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const + DAngle AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const { fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this); - return vectoyaw(otherpos.y + oxofs - Y(), otherpos.x + oyofs - X()); + return VecToAngle(otherpos.y + oxofs - Y(), otherpos.x + oyofs - X()); } fixedvec2 Vec2To(AActor *other) const @@ -1321,7 +1321,7 @@ public: void AngleFromVel() { - Angles.Yaw = vectoyaw(vel.x, vel.y); + Angles.Yaw = VecToAngle(vel.x, vel.y); } void VelFromAngle() diff --git a/src/b_func.cpp b/src/b_func.cpp index 62f2eb89b6..981ea56b27 100644 --- a/src/b_func.cpp +++ b/src/b_func.cpp @@ -127,7 +127,7 @@ bool DBot::Check_LOS (AActor *to, angle_t vangle) if (vangle == 0) return false; //Looker seems to be blind. - return absangle(player->mo->AngleTo(to) - player->mo->_f_angle()) <= vangle/2; + return absangle(player->mo->__f_AngleTo(to) - player->mo->_f_angle()) <= vangle/2; } //------------------------------------- @@ -224,14 +224,14 @@ shootmissile: dist = player->mo->AproxDistance (enemy); m = dist / GetDefaultByType (player->ReadyWeapon->ProjectileType)->Speed; bglobal.SetBodyAt (enemy->X() + enemy->vel.x*m*2, enemy->Y() + enemy->vel.y*m*2, enemy->Z(), 1); - angle = player->mo->AngleTo(bglobal.body1); + angle = player->mo->__f_AngleTo(bglobal.body1); if (Check_LOS (enemy, SHOOTFOV)) no_fire = false; } else { //Other weapons, mostly instant hit stuff. - angle = player->mo->AngleTo(enemy); + angle = player->mo->__f_AngleTo(enemy); aiming_penalty = 0; if (enemy->flags & MF_SHADOW) aiming_penalty += (pr_botdofire()%25)+10; @@ -519,7 +519,7 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd) { if (bglobal.FakeFire (actor, bglobal.body1, cmd) >= SAFE_SELF_MISDIST) { - ang = actor->AngleTo(bglobal.body1); + ang = actor->__f_AngleTo(bglobal.body1); return ang; } } @@ -529,7 +529,7 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd) { if (bglobal.FakeFire (player->mo, enemy, cmd) >= SAFE_SELF_MISDIST) { - ang = player->mo->AngleTo(enemy); + ang = player->mo->__f_AngleTo(enemy); return ang; } } diff --git a/src/b_move.cpp b/src/b_move.cpp index 02fd77049b..94b15ecfbf 100644 --- a/src/b_move.cpp +++ b/src/b_move.cpp @@ -39,7 +39,7 @@ void DBot::Roam (ticcmd_t *cmd) if (Reachable(dest)) { // Straight towards it. - angle = player->mo->AngleTo(dest); + angle = player->mo->__f_AngleTo(dest); } else if (player->mo->movedir < 8) // turn towards movement direction if not there yet { diff --git a/src/b_think.cpp b/src/b_think.cpp index eb7acf3a27..eb86d5af6a 100644 --- a/src/b_think.cpp +++ b/src/b_think.cpp @@ -102,7 +102,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd) if (missile && (player->mo->AproxDistance(missile)mo->AngleTo(missile); + angle = player->mo->__f_AngleTo(missile); cmd->ucmd.sidemove = sleft ? -SIDERUN : SIDERUN; cmd->ucmd.forwardmove = -FORWARDRUN; //Back IS best. @@ -168,7 +168,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd) sleft = !sleft; } - angle = player->mo->AngleTo(enemy); + angle = player->mo->__f_AngleTo(enemy); if (player->ReadyWeapon == NULL || player->mo->AproxDistance(enemy) > @@ -209,7 +209,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd) goto roam; } - angle = player->mo->AngleTo(mate); + angle = player->mo->__f_AngleTo(mate); matedist = player->mo->AproxDistance(mate); if (matedist > (FRIEND_DIST*2)) @@ -244,7 +244,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd) (pr_botmove()%100)>skill.isp) && player->ReadyWeapon != NULL && !(player->ReadyWeapon->WeaponFlags & WIF_WIMPY_WEAPON)) dest = enemy;//Dont let enemy kill the bot by supressive fire. So charge enemy. else //hide while t_fight, but keep view at enemy. - angle = player->mo->AngleTo(enemy); + angle = player->mo->__f_AngleTo(enemy); } //Just a monster, so kill it. else dest = enemy; diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index f22b962896..facff37936 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -3147,7 +3147,7 @@ void FParser::SF_MoveCamera(void) } // set step variables based on distance and speed - mobjangle = cam->AngleTo(target); + mobjangle = cam->__f_AngleTo(target); xydist = cam->Distance2D(target); xstep = FixedMul(finecosine[mobjangle >> ANGLETOFINESHIFT], movespeed); diff --git a/src/g_doom/a_revenant.cpp b/src/g_doom/a_revenant.cpp index 12c76dc338..44dedfe2cf 100644 --- a/src/g_doom/a_revenant.cpp +++ b/src/g_doom/a_revenant.cpp @@ -79,7 +79,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer) return 0; // change angle - DAngle exact = self->_f_AngleTo(dest); + DAngle exact = self->AngleTo(dest); DAngle diff = deltaangle(self->Angles.Yaw, exact); if (diff < 0) diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 277d60d4d7..83190d0aca 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -658,7 +658,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact) } else { // Seek - angle = self->_f_AngleTo(target); + angle = self->AngleTo(target); newAngle = true; } } diff --git a/src/g_hexen/a_blastradius.cpp b/src/g_hexen/a_blastradius.cpp index 541b6bface..b587122e3a 100644 --- a/src/g_hexen/a_blastradius.cpp +++ b/src/g_hexen/a_blastradius.cpp @@ -33,13 +33,13 @@ void BlastActor (AActor *victim, fixed_t strength, fixed_t speed, AActor *Owner, return; } - angle = Owner->AngleTo(victim); + angle = Owner->__f_AngleTo(victim); angle >>= ANGLETOFINESHIFT; victim->vel.x = FixedMul (speed, finecosine[angle]); victim->vel.y = FixedMul (speed, finesine[angle]); // Spawn blast puff - ang = victim->AngleTo(Owner); + ang = victim->__f_AngleTo(Owner); ang >>= ANGLETOFINESHIFT; pos = victim->Vec3Offset( FixedMul (victim->radius+FRACUNIT, finecosine[ang]), diff --git a/src/g_hexen/a_clericholy.cpp b/src/g_hexen/a_clericholy.cpp index 5fd158510f..2221326017 100644 --- a/src/g_hexen/a_clericholy.cpp +++ b/src/g_hexen/a_clericholy.cpp @@ -274,7 +274,7 @@ static void CHolyTailFollow (AActor *actor, fixed_t dist) child = actor->tracer; if (child) { - an = actor->AngleTo(child) >> ANGLETOFINESHIFT; + an = actor->__f_AngleTo(child) >> ANGLETOFINESHIFT; oldDistance = child->AproxDistance (actor); if (P_TryMove (child, actor->X()+FixedMul(dist, finecosine[an]), actor->Y()+FixedMul(dist, finesine[an]), true)) diff --git a/src/g_hexen/a_dragon.cpp b/src/g_hexen/a_dragon.cpp index d11089f1ba..61141a65a1 100644 --- a/src/g_hexen/a_dragon.cpp +++ b/src/g_hexen/a_dragon.cpp @@ -71,7 +71,7 @@ static void DragonSeek (AActor *actor, DAngle thresh, DAngle turnMax) { // attack the destination mobj if it's attackable AActor *oldTarget; - if (absangle(actor->_f_angle() - actor->AngleTo(target)) < ANGLE_45/2) + if (absangle(actor->_f_angle() - actor->__f_AngleTo(target)) < ANGLE_45/2) { oldTarget = actor->target; actor->target = target; @@ -96,7 +96,7 @@ static void DragonSeek (AActor *actor, DAngle thresh, DAngle turnMax) { AActor *bestActor = NULL; bestAngle = ANGLE_MAX; - angleToTarget = actor->AngleTo(actor->target); + angleToTarget = actor->__f_AngleTo(actor->target); for (i = 0; i < 5; i++) { if (!target->args[i]) @@ -109,7 +109,7 @@ static void DragonSeek (AActor *actor, DAngle thresh, DAngle turnMax) { continue; } - angleToSpot = actor->AngleTo(mo); + angleToSpot = actor->__f_AngleTo(mo); if (absangle(angleToSpot-angleToTarget) < bestAngle) { bestAngle = absangle(angleToSpot-angleToTarget); @@ -190,7 +190,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFlight) self->target = NULL; return 0; } - angle = self->AngleTo(self->target); + angle = self->__f_AngleTo(self->target); if (absangle(self->_f_angle()-angle) < ANGLE_45/2 && self->CheckMeleeRange()) { int damage = pr_dragonflight.HitDice (8); diff --git a/src/g_hexen/a_fighterplayer.cpp b/src/g_hexen/a_fighterplayer.cpp index d85783915d..e6c251c734 100644 --- a/src/g_hexen/a_fighterplayer.cpp +++ b/src/g_hexen/a_fighterplayer.cpp @@ -27,7 +27,7 @@ static FRandom pr_fpatk ("FPunchAttack"); void AdjustPlayerAngle (AActor *pmo, FTranslatedLineTarget *t) { - DAngle difference = deltaangle(pmo->Angles.Yaw, pmo->_f_AngleTo(t->linetarget);); + DAngle difference = deltaangle(pmo->Angles.Yaw, pmo->AngleTo(t->linetarget)); if (fabs(difference) > MAX_ANGLE_ADJUST) { if (difference > 0) diff --git a/src/g_hexen/a_firedemon.cpp b/src/g_hexen/a_firedemon.cpp index cbfffdd1d2..175048a2cd 100644 --- a/src/g_hexen/a_firedemon.cpp +++ b/src/g_hexen/a_firedemon.cpp @@ -173,7 +173,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredChase) { if (pr_firedemonchase() < 30) { - ang = self->AngleTo(target); + ang = self->__f_AngleTo(target); if (pr_firedemonchase() < 128) ang += ANGLE_90; else diff --git a/src/g_hexen/a_flies.cpp b/src/g_hexen/a_flies.cpp index 397874b9e8..b9127e9c31 100644 --- a/src/g_hexen/a_flies.cpp +++ b/src/g_hexen/a_flies.cpp @@ -84,9 +84,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FlyBuzz) return 0; } - self->Angles.Yaw = self->_f_AngleTo(targ); + self->Angles.Yaw = self->AngleTo(targ); self->args[0]++; - angle_t ang = self->AngleTo(targ); + angle_t ang = self->__f_AngleTo(targ); ang >>= ANGLETOFINESHIFT; if (!P_TryMove(self, self->X() + 6 * finecosine[ang], self->Y() + 6 * finesine[ang], true)) { diff --git a/src/g_hexen/a_hexenspecialdecs.cpp b/src/g_hexen/a_hexenspecialdecs.cpp index 8c54de6f2a..13cc8e669c 100644 --- a/src/g_hexen/a_hexenspecialdecs.cpp +++ b/src/g_hexen/a_hexenspecialdecs.cpp @@ -117,7 +117,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PotteryCheck) if (playeringame[i]) { AActor *pmo = players[i].mo; - if (P_CheckSight (self, pmo) && (absangle(pmo->AngleTo(self) - pmo->_f_angle()) <= ANGLE_45)) + if (P_CheckSight (self, pmo) && (absangle(pmo->__f_AngleTo(self) - pmo->_f_angle()) <= ANGLE_45)) { // Previous state (pottery bit waiting state) self->SetState (self->state - 1); return 0; diff --git a/src/g_hexen/a_korax.cpp b/src/g_hexen/a_korax.cpp index 3d0304ad31..e420105bd1 100644 --- a/src/g_hexen/a_korax.cpp +++ b/src/g_hexen/a_korax.cpp @@ -509,7 +509,7 @@ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z, z -= source->floorclip; th = Spawn (type, x, y, z, ALLOW_REPLACE); th->target = source; // Originator - an = th->_f_AngleTo(dest); + an = th->AngleTo(dest); if (dest->flags & MF_SHADOW) { // Invisible target an += pr_kmissile.Random2() * (45/256.); diff --git a/src/g_hexen/a_magelightning.cpp b/src/g_hexen/a_magelightning.cpp index a492159060..1fa343d2d7 100644 --- a/src/g_hexen/a_magelightning.cpp +++ b/src/g_hexen/a_magelightning.cpp @@ -195,7 +195,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip) } else { - self->Angles.Yaw = self->_f_AngleTo(target); + self->Angles.Yaw = self->AngleTo(target); self->vel.x = 0; self->vel.y = 0; P_ThrustMobj (self, self->Angles.Yaw, self->Speed>>1); diff --git a/src/g_raven/a_minotaur.cpp b/src/g_raven/a_minotaur.cpp index 0a519fb141..9dea5856a1 100644 --- a/src/g_raven/a_minotaur.cpp +++ b/src/g_raven/a_minotaur.cpp @@ -415,7 +415,7 @@ void P_MinotaurSlam (AActor *source, AActor *target) fixed_t thrust; int damage; - angle = source->AngleTo(target); + angle = source->__f_AngleTo(target); angle >>= ANGLETOFINESHIFT; thrust = 16*FRACUNIT+(pr_minotaurslam()<<10); target->vel.x += FixedMul (thrust, finecosine[angle]); diff --git a/src/g_shared/a_bridge.cpp b/src/g_shared/a_bridge.cpp index 11df5e4950..5f9409f906 100644 --- a/src/g_shared/a_bridge.cpp +++ b/src/g_shared/a_bridge.cpp @@ -112,7 +112,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit) if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / 100); self->Angles.Yaw += rotationspeed; - self->SetOrigin(self->target->Vec3Angle(rotationradius, self->_f_angle(), 0), true); + self->SetOrigin(self->target->Vec3Angle(rotationradius*FRACUNIT, self->_f_angle(), 0), true); self->floorz = self->target->floorz; self->ceilingz = self->target->ceilingz; return 0; diff --git a/src/g_shared/a_camera.cpp b/src/g_shared/a_camera.cpp index 02f52b107b..bb23d4f4f1 100644 --- a/src/g_shared/a_camera.cpp +++ b/src/g_shared/a_camera.cpp @@ -177,7 +177,7 @@ void AAimingCamera::Tick () DVector2 vect(fv3.x, fv3.y); double dz = Z() - tracer->Z() - tracer->height/2; double dist = vect.Length(); - DAngle desiredPitch = dist != 0.f ? vectoyaw(dist, dz) : 0.; + DAngle desiredPitch = dist != 0.f ? VecToAngle(dist, dz) : 0.; DAngle diff = deltaangle(Angles.Pitch, desiredPitch); if (fabs (diff) < MaxPitchChange) { diff --git a/src/g_shared/a_movingcamera.cpp b/src/g_shared/a_movingcamera.cpp index bb6b33b697..dff298035c 100644 --- a/src/g_shared/a_movingcamera.cpp +++ b/src/g_shared/a_movingcamera.cpp @@ -422,7 +422,7 @@ bool APathFollower::Interpolate () } if (args[2] & 2) { // adjust yaw - Angles.Yaw = vectoyaw(dx, dy); + Angles.Yaw = VecToAngle(dx, dy); } if (args[2] & 4) { // adjust pitch; use floats for precision @@ -430,7 +430,7 @@ bool APathFollower::Interpolate () double fdy = FIXED2DBL(dy); double fdz = FIXED2DBL(-dz); double dist = g_sqrt (fdx*fdx + fdy*fdy); - Angles.Pitch = dist != 0.f ? vectoyaw(dist, fdz) : 0.; + Angles.Pitch = dist != 0.f ? VecToAngle(dist, fdz) : 0.; } } else @@ -633,7 +633,7 @@ bool AMovingCamera::Interpolate () if (Super::Interpolate ()) { - Angles.Yaw = _f_AngleTo(tracer, true); + Angles.Yaw = AngleTo(tracer, true); if (args[2] & 4) { // Also aim camera's pitch; use floats for precision @@ -641,7 +641,7 @@ bool AMovingCamera::Interpolate () double dy = FIXED2DBL(Y() - tracer->Y()); double dz = FIXED2DBL(Z() - tracer->Z() - tracer->height/2); double dist = g_sqrt (dx*dx + dy*dy); - Angles.Pitch = dist != 0.f ? vectoyaw(dist, dz) : 0.; + Angles.Pitch = dist != 0.f ? VecToAngle(dist, dz) : 0.; } return true; diff --git a/src/g_shared/sbar_mugshot.cpp b/src/g_shared/sbar_mugshot.cpp index e3aa8b6889..44ecccd911 100644 --- a/src/g_shared/sbar_mugshot.cpp +++ b/src/g_shared/sbar_mugshot.cpp @@ -366,7 +366,7 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags) if (player->mo != NULL) { // The next 12 lines are from the Doom statusbar code. - badguyangle = player->mo->AngleTo(player->attacker); + badguyangle = player->mo->__f_AngleTo(player->attacker); if (badguyangle > player->mo->_f_angle()) { // whether right or left diff --git a/src/g_strife/a_spectral.cpp b/src/g_strife/a_spectral.cpp index cc171837df..491c231d3b 100644 --- a/src/g_strife/a_spectral.cpp +++ b/src/g_strife/a_spectral.cpp @@ -102,7 +102,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2) if (!dest || dest->health <= 0 || self->Speed == 0 || !self->CanSeek(dest)) return 0; - DAngle exact = self->_f_AngleTo(dest); + DAngle exact = self->AngleTo(dest); DAngle diff = deltaangle(self->Angles.Yaw, exact); if (diff < 0) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 37198025b2..8df47366a0 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -1117,7 +1117,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang if (facetalker) { A_FaceTarget (npc); - pc->Angles.Yaw = pc->_f_AngleTo(npc); + pc->Angles.Yaw = pc->AngleTo(npc); } if ((npc->flags & MF_FRIENDLY) || (npc->flags4 & MF4_NOHATEPLAYERS)) { diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 9249e41eae..3ca1ce73c9 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -430,7 +430,7 @@ bool P_HitFriend(AActor * self) if (self->flags&MF_FRIENDLY && self->target != NULL) { - angle_t angle = self->AngleTo(self->target); + angle_t angle = self->__f_AngleTo(self->target); fixed_t dist = self->AproxDistance (self->target); P_AimLineAttack (self, angle, dist, &t, 0, true); if (t.linetarget != NULL && t.linetarget != self->target) @@ -1191,7 +1191,7 @@ bool P_IsVisible(AActor *lookee, AActor *other, INTBOOL allaround, FLookExParams if (fov && fov < ANGLE_MAX) { - angle_t an = lookee->AngleTo(other) - lookee->_f_angle(); + angle_t an = lookee->__f_AngleTo(other) - lookee->_f_angle(); if (an > (fov / 2) && an < (ANGLE_MAX - (fov / 2))) { @@ -2462,7 +2462,7 @@ void A_DoChase (VMFrameStack *stack, AActor *actor, bool fastchase, FState *mele { if (pr_chase() < 100) { - angle_t ang = actor->AngleTo(actor->target); + angle_t ang = actor->__f_AngleTo(actor->target); if (pr_chase() < 128) ang += ANGLE_90; else ang -= ANGLE_90; actor->vel.x = 13 * finecosine[ang>>ANGLETOFINESHIFT]; @@ -2836,7 +2836,7 @@ void A_Face (AActor *self, AActor *other, angle_t _max_turn, angle_t _max_pitch, DAngle ang_offset = ANGLE2DBL(_ang_offset); DAngle max_pitch = ANGLE2DBL(_max_pitch); DAngle pitch_offset = ANGLE2DBL(_pitch_offset); - DAngle other_angle = self->_f_AngleTo(other); + DAngle other_angle = self->AngleTo(other); DAngle delta = deltaangle(self->Angles.Yaw, other_angle); @@ -2993,7 +2993,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail) self->flags &= ~MF_AMBUSH; - self->Angles.Yaw = self->_f_AngleTo(self->target); + self->Angles.Yaw = self->AngleTo(self->target); self->Angles.Pitch = ANGLE2DBL(P_AimLineAttack (self, self->_f_angle(), MISSILERANGE, &t, ANGLE_1*60, 0, self->target)); if (t.linetarget == NULL) @@ -3002,11 +3002,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail) fixedvec2 pos = self->Vec2To(self->target); DVector2 xydiff(pos.x, pos.y); double zdiff = (self->target->Z() + (self->target->height>>1)) - (self->Z() + (self->height>>1) - self->floorclip); - self->Angles.Pitch = -vectoyaw(xydiff.Length(), zdiff); + self->Angles.Pitch = -VecToAngle(xydiff.Length(), zdiff); } // Let the aim trail behind the player - self->Angles.Yaw = self->_f_AngleTo(self->target, -self->target->vel.x * 3, -self->target->vel.y * 3); + self->Angles.Yaw = self->AngleTo(self->target, -self->target->vel.x * 3, -self->target->vel.y * 3); if (self->target->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE)) { diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 90b43323c2..79fa3868d4 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1164,7 +1164,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } else { - ang = origin->AngleTo(target); + ang = origin->__f_AngleTo(target); } // Calculate this as float to avoid overflows so that the diff --git a/src/p_map.cpp b/src/p_map.cpp index 1bde7ef3ac..8b4f813228 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -3379,7 +3379,7 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop) if (!ontop) { fixed_t speed; - DAngle angle = BlockingMobj->_f_AngleTo(mo) + ((pr_bounce() % 16) - 8); + DAngle angle = BlockingMobj->AngleTo(mo) + ((pr_bounce() % 16) - 8); speed = P_AproxDistance(mo->vel.x, mo->vel.y); speed = FixedMul(speed, mo->wallbouncefactor); // [GZ] was 0.75, using wallbouncefactor seems more consistent mo->Angles.Yaw = ANGLE2DBL(angle); @@ -3531,7 +3531,7 @@ struct aim_t { res.linetarget = th; res.pitch = pitch; - res.angleFromSource = vectoyaw(th->X() - startpos.x, th->Y() - startpos.y); + res.angleFromSource = VecToAngle(th->X() - startpos.x, th->Y() - startpos.y); res.unlinked = unlinked; res.frac = frac; } @@ -4604,7 +4604,7 @@ void P_TraceBleed(int damage, AActor *target, AActor *missile) pitch = 0; } P_TraceBleed(damage, target->X(), target->Y(), target->Z() + target->height / 2, - target, missile->AngleTo(target), + target, missile->__f_AngleTo(target), pitch); } @@ -5400,7 +5400,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo { vz *= 0.8f; } - angle_t ang = bombspot->AngleTo(thing) >> ANGLETOFINESHIFT; + angle_t ang = bombspot->__f_AngleTo(thing) >> ANGLETOFINESHIFT; thing->vel.x += fixed_t(finecosine[ang] * thrust); thing->vel.y += fixed_t(finesine[ang] * thrust); if (!(flags & RADF_NODAMAGE)) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index b93fea96d7..f09e9dccee 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1654,16 +1654,16 @@ int P_FaceMobj (AActor *source, AActor *target, DAngle *delta) { DAngle diff; - diff = deltaangle(source->Angles.Yaw, source->_f_AngleTo(target)); + diff = deltaangle(source->Angles.Yaw, source->AngleTo(target)); if (diff > 0) { *delta = diff; - return 0; + return 1; } else { *delta = -diff; - return 1; + return 0; } } @@ -2094,7 +2094,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly) // Don't change the angle if there's THRUREFLECT on the monster. if (!(BlockingMobj->flags7 & MF7_THRUREFLECT)) { - DAngle angle = BlockingMobj->_f_AngleTo(mo); + DAngle angle = BlockingMobj->AngleTo(mo); bool dontReflect = (mo->AdjustReflectionAngle(BlockingMobj, angle)); // Change angle for deflection/reflection @@ -3188,7 +3188,7 @@ bool AActor::IsOkayToAttack (AActor *link) // to only allow the check to succeed if the enemy was in a ~84� FOV of the player if (flags3 & MF3_SCREENSEEKER) { - angle_t angle = Friend->AngleTo(link) - Friend->_f_angle(); + angle_t angle = Friend->__f_AngleTo(link) - Friend->_f_angle(); angle >>= 24; if (angle>226 || angle<30) { @@ -5432,7 +5432,7 @@ void P_BloodSplatter (fixedvec3 pos, AActor *originator) } if (bloodtype >= 1) { - P_DrawSplash2 (40, pos.x, pos.y, pos.z, 0u - originator->AngleTo(pos), 2, bloodcolor); + P_DrawSplash2 (40, pos.x, pos.y, pos.z, 0u - originator->__f_AngleTo(pos), 2, bloodcolor); } } @@ -5472,7 +5472,7 @@ void P_BloodSplatter2 (fixedvec3 pos, AActor *originator) } if (bloodtype >= 1) { - P_DrawSplash2 (100, pos.x, pos.y, pos.z, 0u - originator->AngleTo(pos), 2, bloodcolor); + P_DrawSplash2 (100, pos.x, pos.y, pos.z, 0u - originator->__f_AngleTo(pos), 2, bloodcolor); } } @@ -6013,7 +6013,7 @@ AActor *P_OldSpawnMissile(AActor *source, AActor *owner, AActor *dest, PClassAct P_PlaySpawnSound(th, source); th->target = owner; // record missile's originator - th->Angles.Yaw = source->_f_AngleTo(dest); + th->Angles.Yaw = source->AngleTo(dest); th->VelFromAngle(); dist = source->AproxDistance (dest); diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 8a8f21c505..72cdc140bd 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -2279,7 +2279,7 @@ void DPusher::Tick () if ((speed > 0) && (P_CheckSight (thing, m_Source, SF_IGNOREVISIBILITY))) { - angle_t pushangle = thing->AngleTo(sx, sy); + angle_t pushangle = thing->__f_AngleTo(sx, sy); if (m_Source->GetClass()->TypeName == NAME_PointPusher) pushangle += ANG180; // away pushangle >>= ANGLETOFINESHIFT; diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index c7c9836a34..2d91b197a3 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -356,7 +356,7 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int f // Rotate 90 degrees, so that walking perpendicularly across // teleporter linedef causes thing to exit in the direction // indicated by the exit thing. - angle = vectoyaw(line->dx, line->dy) - searcher->Angles.Yaw + 90; + angle = VecToAngle(line->dx, line->dy) - searcher->Angles.Yaw + 90; // Sine, cosine of angle adjustment s = FLOAT2FIXED(angle.Sin()); diff --git a/src/p_things.cpp b/src/p_things.cpp index 324ec95aab..674a64bd4b 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -308,7 +308,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam else { nolead: - mobj->Angles.Yaw = mobj->_f_AngleTo(targ); + mobj->Angles.Yaw = mobj->AngleTo(targ); aim.Resize (fspeed); mobj->vel.x = fixed_t(aim[0]); mobj->vel.y = fixed_t(aim[1]); diff --git a/src/po_man.cpp b/src/po_man.cpp index 586e84d91b..f2ca3c1852 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -1043,7 +1043,7 @@ static void RotatePt (DAngle an, fixed_t *x, fixed_t *y, fixed_t startSpotX, fix double c = an.Cos(); *x = (xs_CRoundToInt(tr_x * c - tr_y*s) & 0xfffffe00) + startSpotX; - *y = (xs_CRoundToInt(tr_x * s + tr_y*c) & 0xfffffe00) + startSpotX; + *y = (xs_CRoundToInt(tr_x * s + tr_y*c) & 0xfffffe00) + startSpotY; } //========================================================================== diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 685cec2138..501bcff8d3 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1262,7 +1262,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile) if (CMF_OFFSETPITCH & flags) { DVector2 velocity (missile->vel.x, missile->vel.y); - Pitch += vectoyaw(velocity.Length(), missile->vel.z); + Pitch += VecToAngle(velocity.Length(), missile->vel.z); } missilespeed = abs(fixed_t(Pitch.Cos() * missile->Speed)); missile->vel.z = fixed_t(Pitch.Sin() * missile->Speed); @@ -1921,7 +1921,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) if (aim) { - self->Angles.Yaw = self->_f_AngleTo(self->target); + self->Angles.Yaw = self->AngleTo(self->target); } self->Angles.Pitch = ANGLE2DBL(P_AimLineAttack (self, self->_f_angle(), MISSILERANGE, &t, ANGLE_1*60, 0, aim ? self->target : NULL)); if (t.linetarget == NULL && aim) @@ -1931,12 +1931,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) DVector2 xydiff(pos.x, pos.y); double zdiff = (self->target->Z() + (self->target->height>>1)) - (self->Z() + (self->height>>1) - self->floorclip); - self->Angles.Pitch = vectoyaw(xydiff.Length(), zdiff); + self->Angles.Pitch = VecToAngle(xydiff.Length(), zdiff); } // Let the aim trail behind the player if (aim) { - saved_angle = self->Angles.Yaw = self->_f_AngleTo(self->target, -self->target->vel.x * 3, -self->target->vel.y * 3); + saved_angle = self->Angles.Yaw = self->AngleTo(self->target, -self->target->vel.x * 3, -self->target->vel.y * 3); if (aim == CRF_AIMDIRECT) { @@ -1946,7 +1946,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) FLOAT2FIXED(spawnofs_xy * self->Angles.Yaw.Cos()), FLOAT2FIXED(spawnofs_xy * self->Angles.Yaw.Sin()))); spawnofs_xy = 0; - self->Angles.Yaw = self->_f_AngleTo(self->target,- self->target->vel.x * 3, -self->target->vel.y * 3); + self->Angles.Yaw = self->AngleTo(self->target,- self->target->vel.x * 3, -self->target->vel.y * 3); } if (self->target->flags & MF_SHADOW) @@ -3792,7 +3792,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF) { ang = self->_f_angle(); } - else ang = self->AngleTo (target); + else ang = self->__f_AngleTo (target); angle += ang; @@ -4041,7 +4041,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS) if (fov && (fov < ANGLE_MAX)) { - an = viewport->AngleTo(target) - viewport->_f_angle(); + an = viewport->__f_AngleTo(target) - viewport->_f_angle(); if (an > (fov / 2) && an < (ANGLE_MAX - (fov / 2))) { @@ -4121,7 +4121,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetLOS) if (fov && (fov < ANGLE_MAX)) { - an = target->AngleTo(self) - target->_f_angle(); + an = target->__f_AngleTo(self) - target->_f_angle(); if (an > (fov / 2) && an < (ANGLE_MAX - (fov / 2))) { @@ -5097,7 +5097,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack) A_FaceTarget (self); // Target can dodge if it can see enemy - angle_t angle = self->target->AngleTo(self) - self->target->_f_angle(); + angle_t angle = self->target->__f_AngleTo(self) - self->target->_f_angle(); angle >>= 24; bool dodge = (P_CheckSight(self->target, self) && (angle>226 || angle<30)); @@ -5133,7 +5133,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack) if (pr_cabullet() < hitchance) { // Compute position for spawning blood/puff - angle = self->target->AngleTo(self); + angle = self->target->__f_AngleTo(self); fixedvec3 bloodpos = self->target->Vec3Angle(self->target->radius, angle, self->target->height >> 1); diff --git a/src/vectors.h b/src/vectors.h index e5a348fdf5..6c171317a7 100644 --- a/src/vectors.h +++ b/src/vectors.h @@ -1087,19 +1087,19 @@ inline TAngle diffangle(const TAngle &a1, double a2) return fabs((a1 - a2).Normalize180()); } -inline TAngle vectoyaw(double x, double y) +inline TAngle VecToAngle(double x, double y) { return g_atan2(y, x) * (180.0 / M_PI); } template -inline TAngle vectoyaw (const TVector2 &vec) +inline TAngle VecToAngle (const TVector2 &vec) { return (T)g_atan2(vec.Y, vec.X) * (180.0 / M_PI); } template -inline TAngle vectoyaw (const TVector3 &vec) +inline TAngle VecToAngle (const TVector3 &vec) { return (T)g_atan2(vec.Y, vec.X) * (180.0 / M_PI); }