mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- block direct comparisons of TAngle with floats
This commit is contained in:
parent
f0fbdba593
commit
3d2578820b
19 changed files with 64 additions and 60 deletions
|
@ -2075,7 +2075,7 @@ void DAutomap::drawSubsectors()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the floor's rotation to the texture origin.
|
// Apply the floor's rotation to the texture origin.
|
||||||
if (rotation != 0)
|
if (rotation != nullAngle)
|
||||||
{
|
{
|
||||||
rotate(&originpt.x, &originpt.y, rotation);
|
rotate(&originpt.x, &originpt.y, rotation);
|
||||||
}
|
}
|
||||||
|
@ -2704,7 +2704,7 @@ void DAutomap::drawLineCharacter(const mline_t *lineguy, size_t lineguylines, do
|
||||||
l.a.y *= scale;
|
l.a.y *= scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (angle != 0)
|
if (angle != nullAngle)
|
||||||
rotate(&l.a.x, &l.a.y, angle);
|
rotate(&l.a.x, &l.a.y, angle);
|
||||||
|
|
||||||
l.a.x += x;
|
l.a.x += x;
|
||||||
|
@ -2719,7 +2719,7 @@ void DAutomap::drawLineCharacter(const mline_t *lineguy, size_t lineguylines, do
|
||||||
l.b.y *= scale;
|
l.b.y *= scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (angle != 0)
|
if (angle != nullAngle)
|
||||||
rotate(&l.b.x, &l.b.y, angle);
|
rotate(&l.b.x, &l.b.y, angle);
|
||||||
|
|
||||||
l.b.x += x;
|
l.b.x += x;
|
||||||
|
|
|
@ -739,7 +739,7 @@ void F2DDrawer::AddPoly(FGameTexture *texture, FVector2 *points, int npoints,
|
||||||
poly.mColor1.g = uint8_t(colormap.FadeColor.g * fadelevel);
|
poly.mColor1.g = uint8_t(colormap.FadeColor.g * fadelevel);
|
||||||
poly.mColor1.b = uint8_t(colormap.FadeColor.b * fadelevel);
|
poly.mColor1.b = uint8_t(colormap.FadeColor.b * fadelevel);
|
||||||
|
|
||||||
bool dorotate = rotation != 0;
|
bool dorotate = rotation != nullAngle;
|
||||||
|
|
||||||
float cosrot = (float)cos(rotation.Radians());
|
float cosrot = (float)cos(rotation.Radians());
|
||||||
float sinrot = (float)sin(rotation.Radians());
|
float sinrot = (float)sin(rotation.Radians());
|
||||||
|
|
|
@ -2596,7 +2596,7 @@ FxExpression *FxMultiAssign::Resolve(FCompileContext &ctx)
|
||||||
auto rets = VMRight->GetReturnTypes();
|
auto rets = VMRight->GetReturnTypes();
|
||||||
if (Base.Size() == 1)
|
if (Base.Size() == 1)
|
||||||
{
|
{
|
||||||
Right->ScriptPosition.Message(MSG_ERROR, "Multi-assignment with only one element", VMRight->Function->SymbolName.GetChars());
|
Right->ScriptPosition.Message(MSG_ERROR, "Multi-assignment with only one element in function %s", VMRight->Function->SymbolName.GetChars());
|
||||||
delete this;
|
delete this;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1260,6 +1260,7 @@ public:
|
||||||
return Degrees - other.Degrees;
|
return Degrees - other.Degrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
constexpr TAngle operator* (TAngle other) const
|
constexpr TAngle operator* (TAngle other) const
|
||||||
{
|
{
|
||||||
return Degrees * other.Degrees;
|
return Degrees * other.Degrees;
|
||||||
|
@ -1269,6 +1270,7 @@ public:
|
||||||
{
|
{
|
||||||
return Degrees / other.Degrees;
|
return Degrees / other.Degrees;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TAngle &operator+= (vec_t other)
|
TAngle &operator+= (vec_t other)
|
||||||
|
@ -1356,6 +1358,7 @@ public:
|
||||||
return Degrees != other.Degrees;
|
return Degrees != other.Degrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
constexpr bool operator< (vec_t other) const
|
constexpr bool operator< (vec_t other) const
|
||||||
{
|
{
|
||||||
return Degrees < other;
|
return Degrees < other;
|
||||||
|
@ -1385,6 +1388,7 @@ public:
|
||||||
{
|
{
|
||||||
return Degrees != other;
|
return Degrees != other;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Ensure the angle is between [0.0,360.0) degrees
|
// Ensure the angle is between [0.0,360.0) degrees
|
||||||
TAngle Normalized360() const
|
TAngle Normalized360() const
|
||||||
|
|
|
@ -355,11 +355,11 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
|
||||||
// The next 12 lines are from the Doom statusbar code.
|
// The next 12 lines are from the Doom statusbar code.
|
||||||
DAngle badguyangle = player->mo->AngleTo(player->attacker);
|
DAngle badguyangle = player->mo->AngleTo(player->attacker);
|
||||||
DAngle diffang = deltaangle(player->mo->Angles.Yaw, badguyangle);
|
DAngle diffang = deltaangle(player->mo->Angles.Yaw, badguyangle);
|
||||||
if (diffang > 45.)
|
if (diffang > DAngle::fromDeg(45.))
|
||||||
{ // turn face right
|
{ // turn face right
|
||||||
damage_angle = 2;
|
damage_angle = 2;
|
||||||
}
|
}
|
||||||
else if (diffang < -45.)
|
else if (diffang < DAngle::fromDeg(-45.))
|
||||||
{ // turn face left
|
{ // turn face left
|
||||||
damage_angle = 0;
|
damage_angle = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -914,7 +914,7 @@ bool MapLoader::LoadSegs (MapData * map)
|
||||||
DAngle seg_angle = DAngle::fromBam(segangle << 16);
|
DAngle seg_angle = DAngle::fromBam(segangle << 16);
|
||||||
DAngle delta_angle = absangle(ptp_angle, seg_angle);
|
DAngle delta_angle = absangle(ptp_angle, seg_angle);
|
||||||
|
|
||||||
if (delta_angle >= 1.)
|
if (delta_angle >= DAngle::fromDeg(1.))
|
||||||
{
|
{
|
||||||
double dis = (li->v2->fPos() - li->v1->fPos()).Length();
|
double dis = (li->v2->fPos() - li->v1->fPos()).Length();
|
||||||
DVector2 delta = seg_angle.ToVector(dis);
|
DVector2 delta = seg_angle.ToVector(dis);
|
||||||
|
@ -2022,7 +2022,7 @@ void MapLoader::LoopSidedefs (bool firstloop)
|
||||||
|
|
||||||
ang = (ang2 - ang1).Normalized360();
|
ang = (ang2 - ang1).Normalized360();
|
||||||
|
|
||||||
if (ang != 0 && ang <= bestang)
|
if (ang != nullAngle && ang <= bestang)
|
||||||
{
|
{
|
||||||
bestright = right;
|
bestright = right;
|
||||||
bestang = ang;
|
bestang = ang;
|
||||||
|
|
|
@ -151,9 +151,9 @@ bool DBot::Check_LOS (AActor *to, DAngle vangle)
|
||||||
{
|
{
|
||||||
if (!P_CheckSight (player->mo, to, SF_SEEPASTBLOCKEVERYTHING))
|
if (!P_CheckSight (player->mo, to, SF_SEEPASTBLOCKEVERYTHING))
|
||||||
return false; // out of sight
|
return false; // out of sight
|
||||||
if (vangle >= 360.)
|
if (vangle >= DAngle::fromDeg(360.))
|
||||||
return true;
|
return true;
|
||||||
if (vangle == 0)
|
if (vangle == nullAngle)
|
||||||
return false; //Looker seems to be blind.
|
return false; //Looker seems to be blind.
|
||||||
|
|
||||||
return absangle(player->mo->AngleTo(to), player->mo->Angles.Yaw) <= (vangle/2);
|
return absangle(player->mo->AngleTo(to), player->mo->Angles.Yaw) <= (vangle/2);
|
||||||
|
@ -221,11 +221,11 @@ void DBot::Dofire (ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
//Special rules for RL
|
//Special rules for RL
|
||||||
an = FireRox (enemy, cmd);
|
an = FireRox (enemy, cmd);
|
||||||
if(an != 0)
|
if(an != nullAngle)
|
||||||
{
|
{
|
||||||
Angle = an;
|
Angle = an;
|
||||||
//have to be somewhat precise. to avoid suicide.
|
//have to be somewhat precise. to avoid suicide.
|
||||||
if (absangle(an, player->mo->Angles.Yaw) < 12.)
|
if (absangle(an, player->mo->Angles.Yaw) < DAngle::fromDeg(12.))
|
||||||
{
|
{
|
||||||
t_rocket = 9;
|
t_rocket = 9;
|
||||||
no_fire = false;
|
no_fire = false;
|
||||||
|
@ -255,10 +255,10 @@ void DBot::Dofire (ticcmd_t *cmd)
|
||||||
if (aiming_value <= 0)
|
if (aiming_value <= 0)
|
||||||
aiming_value = 1;
|
aiming_value = 1;
|
||||||
m = DAngle::fromDeg(((SHOOTFOV/2)-(aiming_value*SHOOTFOV/200))); //Higher skill is more accurate
|
m = DAngle::fromDeg(((SHOOTFOV/2)-(aiming_value*SHOOTFOV/200))); //Higher skill is more accurate
|
||||||
if (m <= 0)
|
if (m <= nullAngle)
|
||||||
m = DAngle::fromDeg(1.); //Prevents lock.
|
m = DAngle::fromDeg(1.); //Prevents lock.
|
||||||
|
|
||||||
if (m != 0)
|
if (m != nullAngle)
|
||||||
{
|
{
|
||||||
if (increase)
|
if (increase)
|
||||||
Angle += m;
|
Angle += m;
|
||||||
|
@ -266,7 +266,7 @@ void DBot::Dofire (ticcmd_t *cmd)
|
||||||
Angle -= m;
|
Angle -= m;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (absangle(Angle, player->mo->Angles.Yaw) < 4.)
|
if (absangle(Angle, player->mo->Angles.Yaw) < DAngle::fromDeg(4.))
|
||||||
{
|
{
|
||||||
increase = !increase;
|
increase = !increase;
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,12 +363,12 @@ void DBot::TurnToAng ()
|
||||||
|
|
||||||
DAngle distance = deltaangle(player->mo->Angles.Yaw, Angle);
|
DAngle distance = deltaangle(player->mo->Angles.Yaw, Angle);
|
||||||
|
|
||||||
if (fabs (distance) < OKAYRANGE && !enemy)
|
if (fabs (distance) < DAngle::fromDeg(OKAYRANGE) && !enemy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
distance /= TURNSENS;
|
distance /= TURNSENS;
|
||||||
if (fabs (distance) > maxturn)
|
if (fabs (distance) > DAngle::fromDeg(maxturn))
|
||||||
distance = DAngle::fromDeg(distance < 0 ? -maxturn : maxturn);
|
distance = DAngle::fromDeg(distance < nullAngle ? -maxturn : maxturn);
|
||||||
|
|
||||||
player->mo->Angles.Yaw += distance;
|
player->mo->Angles.Yaw += distance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2739,7 +2739,7 @@ void FParser::SF_MoveCamera(void)
|
||||||
DAngle anglenow = targetangle;
|
DAngle anglenow = targetangle;
|
||||||
const DAngle diffangle = deltaangle(cam->Angles.Yaw, targetangle);
|
const DAngle diffangle = deltaangle(cam->Angles.Yaw, targetangle);
|
||||||
|
|
||||||
if (movespeed > 0 && anglespeed == 0.)
|
if (movespeed > 0 && anglespeed == nullAngle)
|
||||||
{
|
{
|
||||||
if (!finishedmove)
|
if (!finishedmove)
|
||||||
{
|
{
|
||||||
|
@ -2749,7 +2749,7 @@ void FParser::SF_MoveCamera(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (diffangle > 0)
|
if (diffangle > nullAngle)
|
||||||
{
|
{
|
||||||
anglenow = (cam->Angles.Yaw + anglespeed).Normalized360();
|
anglenow = (cam->Angles.Yaw + anglespeed).Normalized360();
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ void DScroller::Serialize(FSerializer &arc)
|
||||||
static void RotationComp(const sector_t *sec, int which, double dx, double dy, double &tdx, double &tdy)
|
static void RotationComp(const sector_t *sec, int which, double dx, double dy, double &tdx, double &tdy)
|
||||||
{
|
{
|
||||||
DAngle an = sec->GetAngle(which);
|
DAngle an = sec->GetAngle(which);
|
||||||
if (an == 0)
|
if (an == nullAngle)
|
||||||
{
|
{
|
||||||
tdx = dx;
|
tdx = dx;
|
||||||
tdy = dy;
|
tdy = dy;
|
||||||
|
|
|
@ -2495,7 +2495,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckIfTargetInLOS)
|
||||||
|
|
||||||
fov = min<DAngle>(fov, DAngle::fromDeg(360.));
|
fov = min<DAngle>(fov, DAngle::fromDeg(360.));
|
||||||
|
|
||||||
if (fov > 0)
|
if (fov > nullAngle)
|
||||||
{
|
{
|
||||||
DAngle an = absangle(viewport->AngleTo(target), viewport->Angles.Yaw);
|
DAngle an = absangle(viewport->AngleTo(target), viewport->Angles.Yaw);
|
||||||
|
|
||||||
|
@ -2573,7 +2573,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckIfInTargetLOS)
|
||||||
doCheckSight = false;
|
doCheckSight = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fov > 0 && (fov < 360.))
|
if (fov > nullAngle && (fov < DAngle::fromDeg(360.)))
|
||||||
{
|
{
|
||||||
DAngle an = absangle(target->AngleTo(self), target->Angles.Yaw);
|
DAngle an = absangle(target->AngleTo(self), target->Angles.Yaw);
|
||||||
|
|
||||||
|
@ -3432,7 +3432,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WolfAttack)
|
||||||
|
|
||||||
// Target can dodge if it can see enemy
|
// Target can dodge if it can see enemy
|
||||||
DAngle angle = absangle(self->target->Angles.Yaw, self->target->AngleTo(self));
|
DAngle angle = absangle(self->target->Angles.Yaw, self->target->AngleTo(self));
|
||||||
bool dodge = (P_CheckSight(self->target, self) && angle < 30. * 256. / 360.); // 30 byteangles ~ 21°
|
bool dodge = (P_CheckSight(self->target, self) && angle < DAngle::fromDeg(30. * 256. / 360.)); // 30 byteangles ~ 21°
|
||||||
|
|
||||||
// Distance check is simplistic
|
// Distance check is simplistic
|
||||||
DVector2 vec = self->Vec2To(self->target);
|
DVector2 vec = self->Vec2To(self->target);
|
||||||
|
@ -4751,16 +4751,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_FaceMovementDirection)
|
||||||
//Done because using anglelimit directly causes a signed/unsigned mismatch.
|
//Done because using anglelimit directly causes a signed/unsigned mismatch.
|
||||||
|
|
||||||
//Code borrowed from A_Face*.
|
//Code borrowed from A_Face*.
|
||||||
if (anglelimit > 0)
|
if (anglelimit > nullAngle)
|
||||||
{
|
{
|
||||||
DAngle delta = -deltaangle(current, angle);
|
DAngle delta = -deltaangle(current, angle);
|
||||||
if (fabs(delta) > anglelimit)
|
if (fabs(delta) > anglelimit)
|
||||||
{
|
{
|
||||||
if (delta < 0)
|
if (delta < nullAngle)
|
||||||
{
|
{
|
||||||
current += anglelimit + offset;
|
current += anglelimit + offset;
|
||||||
}
|
}
|
||||||
else if (delta > 0)
|
else if (delta > nullAngle)
|
||||||
{
|
{
|
||||||
current -= anglelimit + offset;
|
current -= anglelimit + offset;
|
||||||
}
|
}
|
||||||
|
@ -4778,13 +4778,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_FaceMovementDirection)
|
||||||
DAngle current = mobj->Angles.Pitch;
|
DAngle current = mobj->Angles.Pitch;
|
||||||
const DVector2 velocity = mobj->Vel.XY();
|
const DVector2 velocity = mobj->Vel.XY();
|
||||||
DAngle pitch = -VecToAngle(velocity.Length(), mobj->Vel.Z);
|
DAngle pitch = -VecToAngle(velocity.Length(), mobj->Vel.Z);
|
||||||
if (pitchlimit > 0)
|
if (pitchlimit > nullAngle)
|
||||||
{
|
{
|
||||||
DAngle pdelta = deltaangle(current, pitch);
|
DAngle pdelta = deltaangle(current, pitch);
|
||||||
|
|
||||||
if (fabs(pdelta) > pitchlimit)
|
if (fabs(pdelta) > pitchlimit)
|
||||||
{
|
{
|
||||||
if (pdelta > 0)
|
if (pdelta > nullAngle)
|
||||||
{
|
{
|
||||||
current -= min(pitchlimit, pdelta);
|
current -= min(pitchlimit, pdelta);
|
||||||
}
|
}
|
||||||
|
|
|
@ -595,7 +595,7 @@ static int P_Move (AActor *actor)
|
||||||
{
|
{
|
||||||
DAngle anglediff = deltaangle(oldangle, actor->Angles.Yaw);
|
DAngle anglediff = deltaangle(oldangle, actor->Angles.Yaw);
|
||||||
|
|
||||||
if (anglediff != 0)
|
if (anglediff != nullAngle)
|
||||||
{
|
{
|
||||||
move = move.Rotated(anglediff);
|
move = move.Rotated(anglediff);
|
||||||
oldangle = actor->Angles.Yaw;
|
oldangle = actor->Angles.Yaw;
|
||||||
|
@ -1274,7 +1274,7 @@ int P_IsVisible(AActor *lookee, AActor *other, INTBOOL allaround, FLookExParams
|
||||||
if (mindist && dist < mindist)
|
if (mindist && dist < mindist)
|
||||||
return false; // [KS] too close
|
return false; // [KS] too close
|
||||||
|
|
||||||
if (fov != 0)
|
if (fov != nullAngle)
|
||||||
{
|
{
|
||||||
DAngle an = absangle(lookee->AngleTo(other), lookee->Angles.Yaw);
|
DAngle an = absangle(lookee->AngleTo(other), lookee->Angles.Yaw);
|
||||||
|
|
||||||
|
@ -2228,11 +2228,11 @@ void A_Wander(AActor *self, int flags)
|
||||||
{
|
{
|
||||||
self->Angles.Yaw = DAngle::fromDeg(floor(self->Angles.Yaw.Degrees / 45) * 45.);
|
self->Angles.Yaw = DAngle::fromDeg(floor(self->Angles.Yaw.Degrees / 45) * 45.);
|
||||||
DAngle delta = deltaangle(self->Angles.Yaw, DAngle::fromDeg(self->movedir * 45));
|
DAngle delta = deltaangle(self->Angles.Yaw, DAngle::fromDeg(self->movedir * 45));
|
||||||
if (delta < 0)
|
if (delta < nullAngle)
|
||||||
{
|
{
|
||||||
self->Angles.Yaw -= DAngle::fromDeg(45);
|
self->Angles.Yaw -= DAngle::fromDeg(45);
|
||||||
}
|
}
|
||||||
else if (delta > 0)
|
else if (delta > nullAngle)
|
||||||
{
|
{
|
||||||
self->Angles.Yaw += DAngle::fromDeg(45);
|
self->Angles.Yaw += DAngle::fromDeg(45);
|
||||||
}
|
}
|
||||||
|
@ -2381,11 +2381,11 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
|
||||||
{
|
{
|
||||||
actor->Angles.Yaw = DAngle::fromDeg(floor(actor->Angles.Yaw.Degrees / 45) * 45.);
|
actor->Angles.Yaw = DAngle::fromDeg(floor(actor->Angles.Yaw.Degrees / 45) * 45.);
|
||||||
DAngle delta = deltaangle(actor->Angles.Yaw, DAngle::fromDeg(actor->movedir * 45));
|
DAngle delta = deltaangle(actor->Angles.Yaw, DAngle::fromDeg(actor->movedir * 45));
|
||||||
if (delta < 0)
|
if (delta < nullAngle)
|
||||||
{
|
{
|
||||||
actor->Angles.Yaw -= DAngle::fromDeg(45);
|
actor->Angles.Yaw -= DAngle::fromDeg(45);
|
||||||
}
|
}
|
||||||
else if (delta > 0)
|
else if (delta > nullAngle)
|
||||||
{
|
{
|
||||||
actor->Angles.Yaw += DAngle::fromDeg(45);
|
actor->Angles.Yaw += DAngle::fromDeg(45);
|
||||||
}
|
}
|
||||||
|
@ -2944,9 +2944,9 @@ void A_Face(AActor *self, AActor *other, DAngle max_turn, DAngle max_pitch, DAng
|
||||||
|
|
||||||
// 0 means no limit. Also, if we turn in a single step anyways, no need to go through the algorithms.
|
// 0 means no limit. Also, if we turn in a single step anyways, no need to go through the algorithms.
|
||||||
// It also means that there is no need to check for going past the other.
|
// It also means that there is no need to check for going past the other.
|
||||||
if (max_turn != 0 && (max_turn < fabs(delta)))
|
if (max_turn != nullAngle && (max_turn < fabs(delta)))
|
||||||
{
|
{
|
||||||
if (delta > 0)
|
if (delta > nullAngle)
|
||||||
{
|
{
|
||||||
self->Angles.Yaw -= max_turn + ang_offset;
|
self->Angles.Yaw -= max_turn + ang_offset;
|
||||||
}
|
}
|
||||||
|
@ -2962,7 +2962,7 @@ void A_Face(AActor *self, AActor *other, DAngle max_turn, DAngle max_pitch, DAng
|
||||||
|
|
||||||
// [DH] Now set pitch. In order to maintain compatibility, this can be
|
// [DH] Now set pitch. In order to maintain compatibility, this can be
|
||||||
// disabled and is so by default.
|
// disabled and is so by default.
|
||||||
if (max_pitch <= 180.)
|
if (max_pitch <= DAngle::fromDeg(180.))
|
||||||
{
|
{
|
||||||
DVector2 dist = self->Vec2To(other);
|
DVector2 dist = self->Vec2To(other);
|
||||||
|
|
||||||
|
@ -2997,7 +2997,7 @@ void A_Face(AActor *self, AActor *other, DAngle max_turn, DAngle max_pitch, DAng
|
||||||
|
|
||||||
DAngle other_pitch = -DAngle::ToDegrees(g_asin(dist_z / ddist)).Normalized180();
|
DAngle other_pitch = -DAngle::ToDegrees(g_asin(dist_z / ddist)).Normalized180();
|
||||||
|
|
||||||
if (max_pitch != 0)
|
if (max_pitch != nullAngle)
|
||||||
{
|
{
|
||||||
if (self->Angles.Pitch > other_pitch)
|
if (self->Angles.Pitch > other_pitch)
|
||||||
{
|
{
|
||||||
|
@ -3020,7 +3020,7 @@ void A_Face(AActor *self, AActor *other, DAngle max_turn, DAngle max_pitch, DAng
|
||||||
|
|
||||||
|
|
||||||
// This will never work well if the turn angle is limited.
|
// This will never work well if the turn angle is limited.
|
||||||
if (max_turn == 0 && (self->Angles.Yaw == other_angle) && other->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE) )
|
if (max_turn == nullAngle && (self->Angles.Yaw == other_angle) && other->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE) )
|
||||||
{
|
{
|
||||||
self->Angles.Yaw += DAngle::fromDeg(pr_facetarget.Random2() * (45 / 256.));
|
self->Angles.Yaw += DAngle::fromDeg(pr_facetarget.Random2() * (45 / 256.));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2970,7 +2970,7 @@ void FSlide::HitSlideLine(line_t* ld)
|
||||||
|
|
||||||
deltaangle = ::deltaangle(lineangle, moveangle); // V
|
deltaangle = ::deltaangle(lineangle, moveangle); // V
|
||||||
movelen = tmmove.Length();
|
movelen = tmmove.Length();
|
||||||
if (icyfloor && (deltaangle > 45) && (deltaangle < 135))
|
if (icyfloor && (deltaangle > DAngle::fromDeg(45)) && (deltaangle < DAngle::fromDeg(135)))
|
||||||
{
|
{
|
||||||
moveangle = ::deltaangle(deltaangle, lineangle);
|
moveangle = ::deltaangle(deltaangle, lineangle);
|
||||||
movelen /= 2; // absorb
|
movelen /= 2; // absorb
|
||||||
|
@ -4050,8 +4050,8 @@ struct aim_t
|
||||||
lastfloorplane = lastceilingplane = NULL;
|
lastfloorplane = lastceilingplane = NULL;
|
||||||
|
|
||||||
// check the initial sector for 3D-floors and portals
|
// check the initial sector for 3D-floors and portals
|
||||||
bool ceilingportalstate = (aimdir & aim_t::aim_up) && toppitch < 0 && !lastsector->PortalBlocksMovement(sector_t::ceiling);
|
bool ceilingportalstate = (aimdir & aim_t::aim_up) && toppitch < nullAngle && !lastsector->PortalBlocksMovement(sector_t::ceiling);
|
||||||
bool floorportalstate = (aimdir & aim_t::aim_down) && bottompitch > 0 && !lastsector->PortalBlocksMovement(sector_t::floor);
|
bool floorportalstate = (aimdir & aim_t::aim_down) && bottompitch > nullAngle && !lastsector->PortalBlocksMovement(sector_t::floor);
|
||||||
|
|
||||||
for (auto rover : lastsector->e->XFloor.ffloors)
|
for (auto rover : lastsector->e->XFloor.ffloors)
|
||||||
{
|
{
|
||||||
|
@ -4151,11 +4151,11 @@ struct aim_t
|
||||||
sector_t *exitsec = frontflag ? li->backsector : li->frontsector;
|
sector_t *exitsec = frontflag ? li->backsector : li->frontsector;
|
||||||
lastsector = entersec;
|
lastsector = entersec;
|
||||||
// check portal in backsector when aiming up/downward is possible, the line doesn't have portals on both sides and there's actually a portal in the backsector
|
// check portal in backsector when aiming up/downward is possible, the line doesn't have portals on both sides and there's actually a portal in the backsector
|
||||||
if ((planestocheck & aim_up) && toppitch < 0 && open.top != LINEOPEN_MAX && !entersec->PortalBlocksMovement(sector_t::ceiling))
|
if ((planestocheck & aim_up) && toppitch < nullAngle && open.top != LINEOPEN_MAX && !entersec->PortalBlocksMovement(sector_t::ceiling))
|
||||||
{
|
{
|
||||||
EnterSectorPortal(sector_t::ceiling, in->frac, entersec, toppitch, min<DAngle>(nullAngle, bottompitch));
|
EnterSectorPortal(sector_t::ceiling, in->frac, entersec, toppitch, min<DAngle>(nullAngle, bottompitch));
|
||||||
}
|
}
|
||||||
if ((planestocheck & aim_down) && bottompitch > 0 && open.bottom != LINEOPEN_MIN && !entersec->PortalBlocksMovement(sector_t::floor))
|
if ((planestocheck & aim_down) && bottompitch > nullAngle && open.bottom != LINEOPEN_MIN && !entersec->PortalBlocksMovement(sector_t::floor))
|
||||||
{
|
{
|
||||||
EnterSectorPortal(sector_t::floor, in->frac, entersec, max<DAngle>(nullAngle, toppitch), bottompitch);
|
EnterSectorPortal(sector_t::floor, in->frac, entersec, max<DAngle>(nullAngle, toppitch), bottompitch);
|
||||||
}
|
}
|
||||||
|
@ -4367,7 +4367,7 @@ DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLin
|
||||||
double shootz = t1->Center() - t1->Floorclip + t1->AttackOffset();
|
double shootz = t1->Center() - t1->Floorclip + t1->AttackOffset();
|
||||||
|
|
||||||
// can't shoot outside view angles
|
// can't shoot outside view angles
|
||||||
if (vrange == 0)
|
if (vrange == nullAngle)
|
||||||
{
|
{
|
||||||
if (t1->player == NULL || !t1->Level->IsFreelookAllowed())
|
if (t1->player == NULL || !t1->Level->IsFreelookAllowed())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1686,7 +1686,7 @@ FPathTraverse::~FPathTraverse()
|
||||||
//
|
//
|
||||||
int P_CheckFov(AActor* t1, AActor* t2, double fov)
|
int P_CheckFov(AActor* t1, AActor* t2, double fov)
|
||||||
{
|
{
|
||||||
return absangle(t1->AngleTo(t2), t1->Angles.Yaw) <= fov;
|
return absangle(t1->AngleTo(t2), t1->Angles.Yaw) <= DAngle::fromDeg(fov);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckFov, P_CheckFov)
|
DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckFov, P_CheckFov)
|
||||||
|
|
|
@ -1692,7 +1692,7 @@ int P_FaceMobj (AActor *source, AActor *target, DAngle *delta)
|
||||||
DAngle diff;
|
DAngle diff;
|
||||||
|
|
||||||
diff = deltaangle(source->Angles.Yaw, source->AngleTo(target));
|
diff = deltaangle(source->Angles.Yaw, source->AngleTo(target));
|
||||||
if (diff > 0)
|
if (diff > nullAngle)
|
||||||
{
|
{
|
||||||
*delta = diff;
|
*delta = diff;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2237,7 +2237,7 @@ explode:
|
||||||
// For that we need to adjust the start point, and the movement vector.
|
// For that we need to adjust the start point, and the movement vector.
|
||||||
DAngle anglediff = deltaangle(oldangle, mo->Angles.Yaw);
|
DAngle anglediff = deltaangle(oldangle, mo->Angles.Yaw);
|
||||||
|
|
||||||
if (anglediff != 0)
|
if (anglediff != nullAngle)
|
||||||
{
|
{
|
||||||
move = move.Rotated(anglediff);
|
move = move.Rotated(anglediff);
|
||||||
oldangle = mo->Angles.Yaw;
|
oldangle = mo->Angles.Yaw;
|
||||||
|
@ -3250,7 +3250,7 @@ bool AActor::AdjustReflectionAngle (AActor *thing, DAngle &angle)
|
||||||
if (thing->flags4&MF4_SHIELDREFLECT)
|
if (thing->flags4&MF4_SHIELDREFLECT)
|
||||||
{
|
{
|
||||||
// Shield reflection (from the Centaur)
|
// Shield reflection (from the Centaur)
|
||||||
if (absangle(angle, thing->Angles.Yaw) > 45)
|
if (absangle(angle, thing->Angles.Yaw) > DAngle::fromDeg(45))
|
||||||
return true; // Let missile explode
|
return true; // Let missile explode
|
||||||
|
|
||||||
if (thing->flags7 & MF7_NOSHIELDREFLECT) return true;
|
if (thing->flags7 & MF7_NOSHIELDREFLECT) return true;
|
||||||
|
@ -3378,7 +3378,7 @@ bool AActor::IsOkayToAttack (AActor *link)
|
||||||
if (flags3 & MF3_SCREENSEEKER)
|
if (flags3 & MF3_SCREENSEEKER)
|
||||||
{
|
{
|
||||||
DAngle angle = absangle(Friend->AngleTo(link), Friend->Angles.Yaw);
|
DAngle angle = absangle(Friend->AngleTo(link), Friend->Angles.Yaw);
|
||||||
if (angle < 30 * (256./360.))
|
if (angle < DAngle::fromDeg(30 * (256./360.)))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6965,7 +6965,7 @@ DEFINE_ACTION_FUNCTION(AActor, SpawnPlayerMissile)
|
||||||
PARAM_BOOL(noautoaim);
|
PARAM_BOOL(noautoaim);
|
||||||
PARAM_INT(aimflags);
|
PARAM_INT(aimflags);
|
||||||
AActor *missileactor;
|
AActor *missileactor;
|
||||||
if (angle == 1e37) angle = self->Angles.Yaw;
|
if (angle == DAngle::fromDeg(1e37)) angle = self->Angles.Yaw;
|
||||||
AActor *misl = P_SpawnPlayerMissile(self, x, y, z, type, angle, lt, &missileactor, nofreeaim, noautoaim, aimflags);
|
AActor *misl = P_SpawnPlayerMissile(self, x, y, z, type, angle, lt, &missileactor, nofreeaim, noautoaim, aimflags);
|
||||||
if (numret > 0) ret[0].SetObject(misl);
|
if (numret > 0) ret[0].SetObject(misl);
|
||||||
if (numret > 1) ret[1].SetObject(missileactor), numret = 2;
|
if (numret > 1) ret[1].SetObject(missileactor), numret = 2;
|
||||||
|
|
|
@ -87,7 +87,7 @@ bool FLevelLocals::EV_Thing_Spawn (int tid, AActor *source, int type, DAngle ang
|
||||||
if (P_TestMobjLocation (mobj))
|
if (P_TestMobjLocation (mobj))
|
||||||
{
|
{
|
||||||
rtn++;
|
rtn++;
|
||||||
mobj->Angles.Yaw = (angle != 1000000. ? angle : spot->Angles.Yaw);
|
mobj->Angles.Yaw = (angle != DAngle::fromDeg(1000000.) ? angle : spot->Angles.Yaw);
|
||||||
if (fog)
|
if (fog)
|
||||||
{
|
{
|
||||||
P_SpawnTeleportFog(mobj, spot->Pos(), false, true);
|
P_SpawnTeleportFog(mobj, spot->Pos(), false, true);
|
||||||
|
@ -776,7 +776,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, double xofs, double yofs, do
|
||||||
if (flags & WARPF_COPYPITCH)
|
if (flags & WARPF_COPYPITCH)
|
||||||
caller->SetPitch(reference->Angles.Pitch, false);
|
caller->SetPitch(reference->Angles.Pitch, false);
|
||||||
|
|
||||||
if (pitch != 0)
|
if (pitch != nullAngle)
|
||||||
caller->SetPitch(caller->Angles.Pitch + pitch, false);
|
caller->SetPitch(caller->Angles.Pitch + pitch, false);
|
||||||
|
|
||||||
if (flags & WARPF_COPYVELOCITY)
|
if (flags & WARPF_COPYVELOCITY)
|
||||||
|
|
|
@ -415,7 +415,7 @@ void HWScenePortalBase::ClearClipper(HWDrawInfo *di, Clipper *clipper)
|
||||||
DAngle startAngle = (DVector2(lines[i].glseg.x2, lines[i].glseg.y2) - outer_di->Viewpoint.Pos).Angle() + angleOffset;
|
DAngle startAngle = (DVector2(lines[i].glseg.x2, lines[i].glseg.y2) - outer_di->Viewpoint.Pos).Angle() + angleOffset;
|
||||||
DAngle endAngle = (DVector2(lines[i].glseg.x1, lines[i].glseg.y1) - outer_di->Viewpoint.Pos).Angle() + angleOffset;
|
DAngle endAngle = (DVector2(lines[i].glseg.x1, lines[i].glseg.y1) - outer_di->Viewpoint.Pos).Angle() + angleOffset;
|
||||||
|
|
||||||
if (deltaangle(endAngle, startAngle) < 0)
|
if (deltaangle(endAngle, startAngle) < nullAngle)
|
||||||
{
|
{
|
||||||
clipper->SafeRemoveClipRangeRealAngles(startAngle.BAMs(), endAngle.BAMs());
|
clipper->SafeRemoveClipRangeRealAngles(startAngle.BAMs(), endAngle.BAMs());
|
||||||
}
|
}
|
||||||
|
|
|
@ -486,7 +486,7 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
||||||
const float cx = (flip) ? -psp->Coord[i].X : psp->Coord[i].X;
|
const float cx = (flip) ? -psp->Coord[i].X : psp->Coord[i].X;
|
||||||
Vert.v[i] += FVector2(cx * scalex, psp->Coord[i].Y * scale);
|
Vert.v[i] += FVector2(cx * scalex, psp->Coord[i].Y * scale);
|
||||||
}
|
}
|
||||||
if (psp->rotation != 0.0 || !psp->scale.isZero())
|
if (psp->rotation != nullAngle || !psp->scale.isZero())
|
||||||
{
|
{
|
||||||
// [MC] Sets up the alignment for starting the pivot at, in a corner.
|
// [MC] Sets up the alignment for starting the pivot at, in a corner.
|
||||||
float anchorx, anchory;
|
float anchorx, anchory;
|
||||||
|
|
|
@ -180,8 +180,8 @@ DEFINE_GLOBAL(LocalViewPitch);
|
||||||
void R_SetFOV (FRenderViewpoint &viewpoint, DAngle fov)
|
void R_SetFOV (FRenderViewpoint &viewpoint, DAngle fov)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (fov < 5.) fov = DAngle::fromDeg(5.);
|
if (fov < DAngle::fromDeg(5.)) fov = DAngle::fromDeg(5.);
|
||||||
else if (fov > 170.) fov = DAngle::fromDeg(170.);
|
else if (fov > DAngle::fromDeg(170.)) fov = DAngle::fromDeg(170.);
|
||||||
if (fov != viewpoint.FieldOfView)
|
if (fov != viewpoint.FieldOfView)
|
||||||
{
|
{
|
||||||
viewpoint.FieldOfView = fov;
|
viewpoint.FieldOfView = fov;
|
||||||
|
@ -263,7 +263,7 @@ void R_SetWindow (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, int wind
|
||||||
if (viewwindow.centerxwide != viewwindow.centerx)
|
if (viewwindow.centerxwide != viewwindow.centerx)
|
||||||
{ // centerxwide is what centerx would be if the display was not widescreen
|
{ // centerxwide is what centerx would be if the display was not widescreen
|
||||||
fov = DAngle::ToDegrees(2 * atan(viewwindow.centerx * tan(fov.Radians()/2) / double(viewwindow.centerxwide)));
|
fov = DAngle::ToDegrees(2 * atan(viewwindow.centerx * tan(fov.Radians()/2) / double(viewwindow.centerxwide)));
|
||||||
if (fov > 170.) fov = DAngle::fromDeg(170.);
|
if (fov > DAngle::fromDeg(170.)) fov = DAngle::fromDeg(170.);
|
||||||
}
|
}
|
||||||
viewwindow.FocalTangent = tan(fov.Radians() / 2);
|
viewwindow.FocalTangent = tan(fov.Radians() / 2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue