From 3d2578820b0c96016ffdd89482f19dc8d00110ae Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 26 Aug 2022 17:21:34 +0200 Subject: [PATCH] - block direct comparisons of TAngle with floats --- src/am_map.cpp | 6 +++--- src/common/2d/v_2ddrawer.cpp | 2 +- src/common/scripting/backend/codegen.cpp | 2 +- src/common/utility/vectors.h | 4 ++++ src/g_statusbar/sbar_mugshot.cpp | 4 ++-- src/maploader/maploader.cpp | 4 ++-- src/playsim/bots/b_func.cpp | 14 ++++++------- src/playsim/bots/b_move.cpp | 6 +++--- src/playsim/fragglescript/t_func.cpp | 4 ++-- src/playsim/mapthinkers/a_scroll.cpp | 2 +- src/playsim/p_actionfunctions.cpp | 16 +++++++------- src/playsim/p_enemy.cpp | 22 ++++++++++---------- src/playsim/p_map.cpp | 12 +++++------ src/playsim/p_maputl.cpp | 2 +- src/playsim/p_mobj.cpp | 10 ++++----- src/playsim/p_things.cpp | 4 ++-- src/rendering/hwrenderer/scene/hw_portal.cpp | 2 +- src/rendering/hwrenderer/scene/hw_weapon.cpp | 2 +- src/rendering/r_utility.cpp | 6 +++--- 19 files changed, 64 insertions(+), 60 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 02fcefcbc8..9f1e58f7f1 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2075,7 +2075,7 @@ void DAutomap::drawSubsectors() } // Apply the floor's rotation to the texture origin. - if (rotation != 0) + if (rotation != nullAngle) { 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; } - if (angle != 0) + if (angle != nullAngle) rotate(&l.a.x, &l.a.y, angle); l.a.x += x; @@ -2719,7 +2719,7 @@ void DAutomap::drawLineCharacter(const mline_t *lineguy, size_t lineguylines, do l.b.y *= scale; } - if (angle != 0) + if (angle != nullAngle) rotate(&l.b.x, &l.b.y, angle); l.b.x += x; diff --git a/src/common/2d/v_2ddrawer.cpp b/src/common/2d/v_2ddrawer.cpp index debb2a73d2..367fdbc336 100644 --- a/src/common/2d/v_2ddrawer.cpp +++ b/src/common/2d/v_2ddrawer.cpp @@ -739,7 +739,7 @@ void F2DDrawer::AddPoly(FGameTexture *texture, FVector2 *points, int npoints, poly.mColor1.g = uint8_t(colormap.FadeColor.g * 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 sinrot = (float)sin(rotation.Radians()); diff --git a/src/common/scripting/backend/codegen.cpp b/src/common/scripting/backend/codegen.cpp index 96ceef6c52..b274c88f91 100644 --- a/src/common/scripting/backend/codegen.cpp +++ b/src/common/scripting/backend/codegen.cpp @@ -2596,7 +2596,7 @@ FxExpression *FxMultiAssign::Resolve(FCompileContext &ctx) auto rets = VMRight->GetReturnTypes(); 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; return nullptr; } diff --git a/src/common/utility/vectors.h b/src/common/utility/vectors.h index 30f37114b8..2d6e9f08be 100644 --- a/src/common/utility/vectors.h +++ b/src/common/utility/vectors.h @@ -1260,6 +1260,7 @@ public: return Degrees - other.Degrees; } + /* constexpr TAngle operator* (TAngle other) const { return Degrees * other.Degrees; @@ -1269,6 +1270,7 @@ public: { return Degrees / other.Degrees; } + */ /* TAngle &operator+= (vec_t other) @@ -1356,6 +1358,7 @@ public: return Degrees != other.Degrees; } + /* constexpr bool operator< (vec_t other) const { return Degrees < other; @@ -1385,6 +1388,7 @@ public: { return Degrees != other; } + */ // Ensure the angle is between [0.0,360.0) degrees TAngle Normalized360() const diff --git a/src/g_statusbar/sbar_mugshot.cpp b/src/g_statusbar/sbar_mugshot.cpp index 2fe24fae2a..3f79b96435 100644 --- a/src/g_statusbar/sbar_mugshot.cpp +++ b/src/g_statusbar/sbar_mugshot.cpp @@ -355,11 +355,11 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags) // The next 12 lines are from the Doom statusbar code. DAngle badguyangle = player->mo->AngleTo(player->attacker); DAngle diffang = deltaangle(player->mo->Angles.Yaw, badguyangle); - if (diffang > 45.) + if (diffang > DAngle::fromDeg(45.)) { // turn face right damage_angle = 2; } - else if (diffang < -45.) + else if (diffang < DAngle::fromDeg(-45.)) { // turn face left damage_angle = 0; } diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 1f28e13ed1..f57a51b650 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -914,7 +914,7 @@ bool MapLoader::LoadSegs (MapData * map) DAngle seg_angle = DAngle::fromBam(segangle << 16); 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(); DVector2 delta = seg_angle.ToVector(dis); @@ -2022,7 +2022,7 @@ void MapLoader::LoopSidedefs (bool firstloop) ang = (ang2 - ang1).Normalized360(); - if (ang != 0 && ang <= bestang) + if (ang != nullAngle && ang <= bestang) { bestright = right; bestang = ang; diff --git a/src/playsim/bots/b_func.cpp b/src/playsim/bots/b_func.cpp index 85a64bec00..07cdd08d0c 100644 --- a/src/playsim/bots/b_func.cpp +++ b/src/playsim/bots/b_func.cpp @@ -151,9 +151,9 @@ bool DBot::Check_LOS (AActor *to, DAngle vangle) { if (!P_CheckSight (player->mo, to, SF_SEEPASTBLOCKEVERYTHING)) return false; // out of sight - if (vangle >= 360.) + if (vangle >= DAngle::fromDeg(360.)) return true; - if (vangle == 0) + if (vangle == nullAngle) return false; //Looker seems to be blind. 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 an = FireRox (enemy, cmd); - if(an != 0) + if(an != nullAngle) { Angle = an; //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; no_fire = false; @@ -255,10 +255,10 @@ void DBot::Dofire (ticcmd_t *cmd) if (aiming_value <= 0) aiming_value = 1; 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. - if (m != 0) + if (m != nullAngle) { if (increase) Angle += m; @@ -266,7 +266,7 @@ void DBot::Dofire (ticcmd_t *cmd) Angle -= m; } - if (absangle(Angle, player->mo->Angles.Yaw) < 4.) + if (absangle(Angle, player->mo->Angles.Yaw) < DAngle::fromDeg(4.)) { increase = !increase; } diff --git a/src/playsim/bots/b_move.cpp b/src/playsim/bots/b_move.cpp index 805d12870e..77f50cadd2 100644 --- a/src/playsim/bots/b_move.cpp +++ b/src/playsim/bots/b_move.cpp @@ -363,12 +363,12 @@ void DBot::TurnToAng () DAngle distance = deltaangle(player->mo->Angles.Yaw, Angle); - if (fabs (distance) < OKAYRANGE && !enemy) + if (fabs (distance) < DAngle::fromDeg(OKAYRANGE) && !enemy) return; distance /= TURNSENS; - if (fabs (distance) > maxturn) - distance = DAngle::fromDeg(distance < 0 ? -maxturn : maxturn); + if (fabs (distance) > DAngle::fromDeg(maxturn)) + distance = DAngle::fromDeg(distance < nullAngle ? -maxturn : maxturn); player->mo->Angles.Yaw += distance; } diff --git a/src/playsim/fragglescript/t_func.cpp b/src/playsim/fragglescript/t_func.cpp index cbb76a0ece..cb16567851 100644 --- a/src/playsim/fragglescript/t_func.cpp +++ b/src/playsim/fragglescript/t_func.cpp @@ -2739,7 +2739,7 @@ void FParser::SF_MoveCamera(void) DAngle anglenow = targetangle; const DAngle diffangle = deltaangle(cam->Angles.Yaw, targetangle); - if (movespeed > 0 && anglespeed == 0.) + if (movespeed > 0 && anglespeed == nullAngle) { if (!finishedmove) { @@ -2749,7 +2749,7 @@ void FParser::SF_MoveCamera(void) } else { - if (diffangle > 0) + if (diffangle > nullAngle) { anglenow = (cam->Angles.Yaw + anglespeed).Normalized360(); } diff --git a/src/playsim/mapthinkers/a_scroll.cpp b/src/playsim/mapthinkers/a_scroll.cpp index 6e5ba7ad0a..e0a561ad84 100644 --- a/src/playsim/mapthinkers/a_scroll.cpp +++ b/src/playsim/mapthinkers/a_scroll.cpp @@ -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) { DAngle an = sec->GetAngle(which); - if (an == 0) + if (an == nullAngle) { tdx = dx; tdy = dy; diff --git a/src/playsim/p_actionfunctions.cpp b/src/playsim/p_actionfunctions.cpp index 3132b91ffc..4e42cc0cce 100644 --- a/src/playsim/p_actionfunctions.cpp +++ b/src/playsim/p_actionfunctions.cpp @@ -2495,7 +2495,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckIfTargetInLOS) fov = min(fov, DAngle::fromDeg(360.)); - if (fov > 0) + if (fov > nullAngle) { DAngle an = absangle(viewport->AngleTo(target), viewport->Angles.Yaw); @@ -2573,7 +2573,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckIfInTargetLOS) doCheckSight = false; } - if (fov > 0 && (fov < 360.)) + if (fov > nullAngle && (fov < DAngle::fromDeg(360.))) { 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 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 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. //Code borrowed from A_Face*. - if (anglelimit > 0) + if (anglelimit > nullAngle) { DAngle delta = -deltaangle(current, angle); if (fabs(delta) > anglelimit) { - if (delta < 0) + if (delta < nullAngle) { current += anglelimit + offset; } - else if (delta > 0) + else if (delta > nullAngle) { current -= anglelimit + offset; } @@ -4778,13 +4778,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_FaceMovementDirection) DAngle current = mobj->Angles.Pitch; const DVector2 velocity = mobj->Vel.XY(); DAngle pitch = -VecToAngle(velocity.Length(), mobj->Vel.Z); - if (pitchlimit > 0) + if (pitchlimit > nullAngle) { DAngle pdelta = deltaangle(current, pitch); if (fabs(pdelta) > pitchlimit) { - if (pdelta > 0) + if (pdelta > nullAngle) { current -= min(pitchlimit, pdelta); } diff --git a/src/playsim/p_enemy.cpp b/src/playsim/p_enemy.cpp index ea90795313..f264155674 100644 --- a/src/playsim/p_enemy.cpp +++ b/src/playsim/p_enemy.cpp @@ -595,7 +595,7 @@ static int P_Move (AActor *actor) { DAngle anglediff = deltaangle(oldangle, actor->Angles.Yaw); - if (anglediff != 0) + if (anglediff != nullAngle) { move = move.Rotated(anglediff); oldangle = actor->Angles.Yaw; @@ -1274,7 +1274,7 @@ int P_IsVisible(AActor *lookee, AActor *other, INTBOOL allaround, FLookExParams if (mindist && dist < mindist) return false; // [KS] too close - if (fov != 0) + if (fov != nullAngle) { 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.); DAngle delta = deltaangle(self->Angles.Yaw, DAngle::fromDeg(self->movedir * 45)); - if (delta < 0) + if (delta < nullAngle) { self->Angles.Yaw -= DAngle::fromDeg(45); } - else if (delta > 0) + else if (delta > nullAngle) { 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.); DAngle delta = deltaangle(actor->Angles.Yaw, DAngle::fromDeg(actor->movedir * 45)); - if (delta < 0) + if (delta < nullAngle) { actor->Angles.Yaw -= DAngle::fromDeg(45); } - else if (delta > 0) + else if (delta > nullAngle) { 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. // 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; } @@ -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 // disabled and is so by default. - if (max_pitch <= 180.) + if (max_pitch <= DAngle::fromDeg(180.)) { 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(); - if (max_pitch != 0) + if (max_pitch != nullAngle) { 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. - 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.)); } diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index 8dcd22d525..f7da67f7be 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -2970,7 +2970,7 @@ void FSlide::HitSlideLine(line_t* ld) deltaangle = ::deltaangle(lineangle, moveangle); // V movelen = tmmove.Length(); - if (icyfloor && (deltaangle > 45) && (deltaangle < 135)) + if (icyfloor && (deltaangle > DAngle::fromDeg(45)) && (deltaangle < DAngle::fromDeg(135))) { moveangle = ::deltaangle(deltaangle, lineangle); movelen /= 2; // absorb @@ -4050,8 +4050,8 @@ struct aim_t lastfloorplane = lastceilingplane = NULL; // check the initial sector for 3D-floors and portals - bool ceilingportalstate = (aimdir & aim_t::aim_up) && toppitch < 0 && !lastsector->PortalBlocksMovement(sector_t::ceiling); - bool floorportalstate = (aimdir & aim_t::aim_down) && bottompitch > 0 && !lastsector->PortalBlocksMovement(sector_t::floor); + bool ceilingportalstate = (aimdir & aim_t::aim_up) && toppitch < nullAngle && !lastsector->PortalBlocksMovement(sector_t::ceiling); + bool floorportalstate = (aimdir & aim_t::aim_down) && bottompitch > nullAngle && !lastsector->PortalBlocksMovement(sector_t::floor); for (auto rover : lastsector->e->XFloor.ffloors) { @@ -4151,11 +4151,11 @@ struct aim_t sector_t *exitsec = frontflag ? li->backsector : li->frontsector; 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 - 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(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(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(); // can't shoot outside view angles - if (vrange == 0) + if (vrange == nullAngle) { if (t1->player == NULL || !t1->Level->IsFreelookAllowed()) { diff --git a/src/playsim/p_maputl.cpp b/src/playsim/p_maputl.cpp index ecc4e1ce21..aca40e741d 100644 --- a/src/playsim/p_maputl.cpp +++ b/src/playsim/p_maputl.cpp @@ -1686,7 +1686,7 @@ FPathTraverse::~FPathTraverse() // 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) diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 2070edc389..78b2c25056 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -1692,7 +1692,7 @@ int P_FaceMobj (AActor *source, AActor *target, DAngle *delta) DAngle diff; diff = deltaangle(source->Angles.Yaw, source->AngleTo(target)); - if (diff > 0) + if (diff > nullAngle) { *delta = diff; return 1; @@ -2237,7 +2237,7 @@ explode: // For that we need to adjust the start point, and the movement vector. DAngle anglediff = deltaangle(oldangle, mo->Angles.Yaw); - if (anglediff != 0) + if (anglediff != nullAngle) { move = move.Rotated(anglediff); oldangle = mo->Angles.Yaw; @@ -3250,7 +3250,7 @@ bool AActor::AdjustReflectionAngle (AActor *thing, DAngle &angle) if (thing->flags4&MF4_SHIELDREFLECT) { // 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 if (thing->flags7 & MF7_NOSHIELDREFLECT) return true; @@ -3378,7 +3378,7 @@ bool AActor::IsOkayToAttack (AActor *link) if (flags3 & MF3_SCREENSEEKER) { DAngle angle = absangle(Friend->AngleTo(link), Friend->Angles.Yaw); - if (angle < 30 * (256./360.)) + if (angle < DAngle::fromDeg(30 * (256./360.))) { return true; } @@ -6965,7 +6965,7 @@ DEFINE_ACTION_FUNCTION(AActor, SpawnPlayerMissile) PARAM_BOOL(noautoaim); PARAM_INT(aimflags); 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); if (numret > 0) ret[0].SetObject(misl); if (numret > 1) ret[1].SetObject(missileactor), numret = 2; diff --git a/src/playsim/p_things.cpp b/src/playsim/p_things.cpp index c818fb6182..0089a29c22 100644 --- a/src/playsim/p_things.cpp +++ b/src/playsim/p_things.cpp @@ -87,7 +87,7 @@ bool FLevelLocals::EV_Thing_Spawn (int tid, AActor *source, int type, DAngle ang if (P_TestMobjLocation (mobj)) { rtn++; - mobj->Angles.Yaw = (angle != 1000000. ? angle : spot->Angles.Yaw); + mobj->Angles.Yaw = (angle != DAngle::fromDeg(1000000.) ? angle : spot->Angles.Yaw); if (fog) { 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) caller->SetPitch(reference->Angles.Pitch, false); - if (pitch != 0) + if (pitch != nullAngle) caller->SetPitch(caller->Angles.Pitch + pitch, false); if (flags & WARPF_COPYVELOCITY) diff --git a/src/rendering/hwrenderer/scene/hw_portal.cpp b/src/rendering/hwrenderer/scene/hw_portal.cpp index 8573bede17..b06d51c587 100644 --- a/src/rendering/hwrenderer/scene/hw_portal.cpp +++ b/src/rendering/hwrenderer/scene/hw_portal.cpp @@ -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 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()); } diff --git a/src/rendering/hwrenderer/scene/hw_weapon.cpp b/src/rendering/hwrenderer/scene/hw_weapon.cpp index 17a99a3a3b..d0e96947bd 100644 --- a/src/rendering/hwrenderer/scene/hw_weapon.cpp +++ b/src/rendering/hwrenderer/scene/hw_weapon.cpp @@ -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; 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. float anchorx, anchory; diff --git a/src/rendering/r_utility.cpp b/src/rendering/r_utility.cpp index 95306c64b0..10f6b6dc6e 100644 --- a/src/rendering/r_utility.cpp +++ b/src/rendering/r_utility.cpp @@ -180,8 +180,8 @@ DEFINE_GLOBAL(LocalViewPitch); void R_SetFOV (FRenderViewpoint &viewpoint, DAngle fov) { - if (fov < 5.) fov = DAngle::fromDeg(5.); - else if (fov > 170.) fov = DAngle::fromDeg(170.); + if (fov < DAngle::fromDeg(5.)) fov = DAngle::fromDeg(5.); + else if (fov > DAngle::fromDeg(170.)) fov = DAngle::fromDeg(170.); if (fov != viewpoint.FieldOfView) { viewpoint.FieldOfView = fov; @@ -263,7 +263,7 @@ void R_SetWindow (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, int wind if (viewwindow.centerxwide != viewwindow.centerx) { // 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))); - if (fov > 170.) fov = DAngle::fromDeg(170.); + if (fov > DAngle::fromDeg(170.)) fov = DAngle::fromDeg(170.); } viewwindow.FocalTangent = tan(fov.Radians() / 2); }