diff --git a/src/am_map.cpp b/src/am_map.cpp index 7c67a7c37..02fcefcbc 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -1284,7 +1284,7 @@ void DAutomap::changeWindowLoc () oincy = incy = m_paninc.y * twod->GetHeight() / 200; if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { - rotate(&incx, &incy, players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw - 90.); + rotate(&incx, &incy, players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw - DAngle::fromDeg(90.)); } m_x += incx; @@ -1525,7 +1525,7 @@ void DAutomap::doFollowPlayer () sy = (f_oldloc.y - ampos.Y); if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { - rotate(&sx, &sy, cam->InterpolatedAngles(r_viewpoint.TicFrac).Yaw - 90); + rotate(&sx, &sy, cam->InterpolatedAngles(r_viewpoint.TicFrac).Yaw - DAngle::fromDeg(90)); } ScrollParchment(sx, sy); @@ -2082,7 +2082,7 @@ void DAutomap::drawSubsectors() // Apply the automap's rotation to the texture origin. if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { - rotation = rotation + 90. - players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw; + rotation = rotation + DAngle::fromDeg(90.) - players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw; rotatePoint(&originpt.x, &originpt.y); } originx = f_x + ((originpt.x - m_x) * scale); @@ -2646,7 +2646,7 @@ void DAutomap::drawWalls (bool allmap) void DAutomap::rotate(double *xp, double *yp, DAngle a) { - static DAngle angle_saved = 0.; + static DAngle angle_saved = nullAngle; static double sinrot = 0; static double cosrot = 1; @@ -2678,7 +2678,7 @@ void DAutomap::rotatePoint (double *x, double *y) double pivoty = m_y + m_h/2; *x -= pivotx; *y -= pivoty; - rotate (x, y, -players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw + 90.); + rotate (x, y, -players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw + DAngle::fromDeg(90.)); *x += pivotx; *y += pivoty; } @@ -2758,7 +2758,7 @@ void DAutomap::drawPlayers () pt.y = pos.Y; if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { - angle = 90.; + angle = DAngle::fromDeg(90.); rotatePoint (&pt.x, &pt.y); } else @@ -2826,7 +2826,7 @@ void DAutomap::drawPlayers () if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { rotatePoint (&pt.x, &pt.y); - angle -= players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw - 90.; + angle -= players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw - DAngle::fromDeg(90.); } drawLineCharacter(&MapArrow[0], MapArrow.Size(), 0, angle, color, pt.x, pt.y); @@ -2860,7 +2860,7 @@ void DAutomap::drawKeys () if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { rotatePoint (&p.x, &p.y); - angle += -players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw + 90.; + angle += -players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw + DAngle::fromDeg(90.); } if (key->flags & MF_SPECIAL) @@ -2872,7 +2872,7 @@ void DAutomap::drawKeys () if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c)); else color = AMColors[AMColors.ThingColor_CountItem]; - drawLineCharacter(&EasyKey[0], EasyKey.Size(), 0, 0., color, p.x, p.y); + drawLineCharacter(&EasyKey[0], EasyKey.Size(), 0, nullAngle, color, p.x, p.y); } } } @@ -2914,11 +2914,11 @@ void DAutomap::drawThings () const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0); frame = &SpriteFrames[spriteIndex]; - DAngle angle = 270. + 22.5 - t->InterpolatedAngles(r_viewpoint.TicFrac).Yaw; - if (frame->Texture[0] != frame->Texture[1]) angle += 180. / 16; + DAngle angle = DAngle::fromDeg(270. + 22.5) - t->InterpolatedAngles(r_viewpoint.TicFrac).Yaw; + if (frame->Texture[0] != frame->Texture[1]) angle += DAngle::fromDeg(180. / 16); if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { - angle += players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw - 90.; + angle += players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw - DAngle::fromDeg(90.); } rotation = int((angle.Normalized360() * (16. / 360.)).Degrees); @@ -2944,7 +2944,7 @@ void DAutomap::drawThings () if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { rotatePoint (&p.x, &p.y); - angle += -players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw + 90.; + angle += -players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw + DAngle::fromDeg(90.); } color = AMColors[AMColors.ThingColor]; @@ -2974,7 +2974,7 @@ void DAutomap::drawThings () if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c)); else color = AMColors[AMColors.ThingColor_CountItem]; - drawLineCharacter(&CheatKey[0], CheatKey.Size(), 0, 0., color, p.x, p.y); + drawLineCharacter(&CheatKey[0], CheatKey.Size(), 0, nullAngle, color, p.x, p.y); color.RGB = 0; } else diff --git a/src/common/engine/palettecontainer.h b/src/common/engine/palettecontainer.h index 615ae92c4..e1d0befd3 100644 --- a/src/common/engine/palettecontainer.h +++ b/src/common/engine/palettecontainer.h @@ -15,7 +15,9 @@ enum struct FRemapTable { FRemapTable(int count = 256) { NumEntries = count; } + FRemapTable(const FRemapTable& o) = default; + FRemapTable& operator=(const FRemapTable& o) = default; bool operator==(const FRemapTable& o); void MakeIdentity(); diff --git a/src/common/models/voxels.cpp b/src/common/models/voxels.cpp index 12c070b0d..b85f2f851 100644 --- a/src/common/models/voxels.cpp +++ b/src/common/models/voxels.cpp @@ -317,7 +317,7 @@ FVoxelDef *R_LoadVoxelDef(int lumpnum, int spin) voxdef->Voxel = vox; voxdef->Scale = 1.; voxdef->DroppedSpin = voxdef->PlacedSpin = spin; - voxdef->AngleOffset = 90.; + voxdef->AngleOffset = DAngle::fromDeg(90.); Voxels.Push(vox); VoxelDefs.Push(voxdef); diff --git a/src/common/rendering/hwrenderer/data/hw_skydome.cpp b/src/common/rendering/hwrenderer/data/hw_skydome.cpp index 837f4023e..d351d79f4 100644 --- a/src/common/rendering/hwrenderer/data/hw_skydome.cpp +++ b/src/common/rendering/hwrenderer/data/hw_skydome.cpp @@ -147,10 +147,10 @@ FSkyVertexBuffer::~FSkyVertexBuffer() void FSkyVertexBuffer::SkyVertexDoom(int r, int c, bool zflip) { - static const FAngle maxSideAngle = 60.f; + static const FAngle maxSideAngle = FAngle::fromDeg(60.f); static const float scale = 10000.; - FAngle topAngle = (c / (float)mColumns * 360.f); + FAngle topAngle = FAngle::fromDeg((c / (float)mColumns * 360.f)); FAngle sideAngle = maxSideAngle * float(mRows - r) / float(mRows); float height = sideAngle.Sin(); float realRadius = scale * sideAngle.Cos(); @@ -190,10 +190,10 @@ void FSkyVertexBuffer::SkyVertexDoom(int r, int c, bool zflip) void FSkyVertexBuffer::SkyVertexBuild(int r, int c, bool zflip) { - static const FAngle maxSideAngle = 60.f; + static const FAngle maxSideAngle = FAngle::fromDeg(60.f); static const float scale = 10000.; - FAngle topAngle = (c / (float)mColumns * 360.f); + FAngle topAngle = FAngle::fromDeg((c / (float)mColumns * 360.f)); FVector2 pos = topAngle.ToVector(scale); float z = (!zflip) ? (mRows - r) * 4000.f : -(mRows - r) * 4000.f; diff --git a/src/common/scripting/vm/vm.h b/src/common/scripting/vm/vm.h index 4bd342a49..420307e4d 100644 --- a/src/common/scripting/vm/vm.h +++ b/src/common/scripting/vm/vm.h @@ -511,7 +511,8 @@ bool AssertObject(void * ob); #define PARAM_SOUND_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); FSoundID x = param[p].i; #define PARAM_COLOR_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); PalEntry x; x.d = param[p].i; #define PARAM_FLOAT_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_FLOAT); double x = param[p].f; -#define PARAM_ANGLE_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_FLOAT); DAngle x = param[p].f; +#define PARAM_ANGLE_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_FLOAT); DAngle x = DAngle::fromDeg(param[p].f); +#define PARAM_FANGLE_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_FLOAT); FAngle x = FAngle::fromDeg(param[p].f); #define PARAM_STRING_VAL_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_STRING); FString x = param[p].s(); #define PARAM_STRING_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_STRING); const FString &x = param[p].s(); #define PARAM_STATELABEL_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); int x = param[p].i; @@ -538,6 +539,7 @@ bool AssertObject(void * ob); #define PARAM_COLOR(x) ++paramnum; PARAM_COLOR_AT(paramnum,x) #define PARAM_FLOAT(x) ++paramnum; PARAM_FLOAT_AT(paramnum,x) #define PARAM_ANGLE(x) ++paramnum; PARAM_ANGLE_AT(paramnum,x) +#define PARAM_FANGLE(x) ++paramnum; PARAM_FANGLE_AT(paramnum,x) #define PARAM_STRING(x) ++paramnum; PARAM_STRING_AT(paramnum,x) #define PARAM_STRING_VAL(x) ++paramnum; PARAM_STRING_VAL_AT(paramnum,x) #define PARAM_STATELABEL(x) ++paramnum; PARAM_STATELABEL_AT(paramnum,x) diff --git a/src/common/utility/m_fixed.h b/src/common/utility/m_fixed.h index 30209d635..da1852e3b 100644 --- a/src/common/utility/m_fixed.h +++ b/src/common/utility/m_fixed.h @@ -40,20 +40,9 @@ inline unsigned FloatToAngle(double f) return xs_CRoundToInt((f)* (0x40000000 / 90.)); } -inline constexpr double AngleToFloat(unsigned f) -{ - return f * (90. / 0x40000000); -} - -inline constexpr double AngleToFloat(int f) -{ - return f * (90. / 0x40000000); -} - #define FLOAT2FIXED(f) FloatToFixed(f) #define FIXED2FLOAT(f) float(FixedToFloat(f)) #define FIXED2DBL(f) FixedToFloat(f) -#define ANGLE2DBL(f) AngleToFloat(f) #endif diff --git a/src/common/utility/vectors.h b/src/common/utility/vectors.h index 126f3f51c..30f37114b 100644 --- a/src/common/utility/vectors.h +++ b/src/common/utility/vectors.h @@ -1158,40 +1158,85 @@ struct TAngle TAngle() = default; - TAngle (vec_t amt) - : Degrees(amt) +private: + // Both constructors are needed to avoid unnecessary conversions when assigning to FAngle. + constexpr TAngle (float amt) + : Degrees((vec_t)amt) { } + constexpr TAngle (double amt) + : Degrees((vec_t)amt) + { + } +public: + + static constexpr TAngle fromDeg(float deg) + { + return TAngle(deg); + } + static constexpr TAngle fromDeg(double deg) + { + return TAngle(deg); + } + static constexpr TAngle fromDeg(int deg) + { + return TAngle((vec_t)deg); + } + static constexpr TAngle fromDeg(unsigned deg) + { + return TAngle((vec_t)deg); + } + + static constexpr TAngle fromRad(float rad) + { + return TAngle(float(rad * (180.0f / pi::pif()))); + } + static constexpr TAngle fromRad(double rad) + { + return TAngle(double(rad * (180.0 / pi::pi()))); + } + + static constexpr TAngle fromBam(int f) + { + return TAngle(f * (90. / 0x40000000)); + } + static constexpr TAngle fromBam(unsigned f) + { + return TAngle(f * (90. / 0x40000000)); + } TAngle(const TAngle &other) = default; TAngle &operator= (const TAngle &other) = default; + /* TAngle &operator= (double other) { Degrees = (decltype(Degrees))other; return *this; } + */ // intentionally disabled so that common math functions cannot be accidentally called with a TAngle. //operator vec_t() const { return Degrees; } - TAngle operator- () const + constexpr TAngle operator- () const { return TAngle(-Degrees); } - TAngle &operator+= (TAngle other) + constexpr TAngle &operator+= (TAngle other) { Degrees += other.Degrees; return *this; } - TAngle &operator-= (TAngle other) + constexpr TAngle &operator-= (TAngle other) { Degrees -= other.Degrees; return *this; } + /* TAngle &operator*= (TAngle other) { Degrees *= other.Degrees; @@ -1203,27 +1248,29 @@ struct TAngle Degrees /= other.Degrees; return *this; } + */ - TAngle operator+ (TAngle other) const + constexpr TAngle operator+ (TAngle other) const { return Degrees + other.Degrees; } - TAngle operator- (TAngle other) const + constexpr TAngle operator- (TAngle other) const { return Degrees - other.Degrees; } - TAngle operator* (TAngle other) const + constexpr TAngle operator* (TAngle other) const { return Degrees * other.Degrees; } - TAngle operator/ (TAngle other) const + constexpr TAngle operator/ (TAngle other) const { return Degrees / other.Degrees; } + /* TAngle &operator+= (vec_t other) { Degrees = Degrees + other; @@ -1235,19 +1282,21 @@ struct TAngle Degrees = Degrees - other; return *this; } + */ - TAngle &operator*= (vec_t other) + constexpr TAngle &operator*= (vec_t other) { Degrees = Degrees * other; return *this; } - TAngle &operator/= (vec_t other) + constexpr TAngle &operator/= (vec_t other) { Degrees = Degrees / other; return *this; } + /* TAngle operator+ (vec_t other) const { return Degrees + other; @@ -1257,79 +1306,82 @@ struct TAngle { return Degrees - other; } + */ + /* friend TAngle operator- (vec_t o1, TAngle o2) { return TAngle(o1 - o2.Degrees); } + */ - TAngle operator* (vec_t other) const + constexpr TAngle operator* (vec_t other) const { return Degrees * other; } - TAngle operator/ (vec_t other) const + constexpr TAngle operator/ (vec_t other) const { return Degrees / other; } // Should the comparisons consider an epsilon value? - bool operator< (TAngle other) const + constexpr bool operator< (TAngle other) const { return Degrees < other.Degrees; } - bool operator> (TAngle other) const + constexpr bool operator> (TAngle other) const { return Degrees > other.Degrees; } - bool operator<= (TAngle other) const + constexpr bool operator<= (TAngle other) const { return Degrees <= other.Degrees; } - bool operator>= (TAngle other) const + constexpr bool operator>= (TAngle other) const { return Degrees >= other.Degrees; } - bool operator== (TAngle other) const + constexpr bool operator== (TAngle other) const { return Degrees == other.Degrees; } - bool operator!= (TAngle other) const + constexpr bool operator!= (TAngle other) const { return Degrees != other.Degrees; } - bool operator< (vec_t other) const + constexpr bool operator< (vec_t other) const { return Degrees < other; } - bool operator> (vec_t other) const + constexpr bool operator> (vec_t other) const { return Degrees > other; } - bool operator<= (vec_t other) const + constexpr bool operator<= (vec_t other) const { return Degrees <= other; } - bool operator>= (vec_t other) const + constexpr bool operator>= (vec_t other) const { return Degrees >= other; } - bool operator== (vec_t other) const + constexpr bool operator== (vec_t other) const { return Degrees == other; } - bool operator!= (vec_t other) const + constexpr bool operator!= (vec_t other) const { return Degrees != other; } @@ -1348,7 +1400,7 @@ struct TAngle return (vec_t)(BAM_FACTOR * (signed int)BAMs()); } - vec_t Radians() const + constexpr vec_t Radians() const { return vec_t(Degrees * (pi::pi() / 180.0)); } @@ -1394,13 +1446,13 @@ struct TAngle // Emulates the old floatbob offset table with direct calls to trig functions. inline double BobSin(double fb) { - return TAngle(double(fb * (180.0 / 32))).Sin() * 8; + return g_sindeg(double(fb * (180.0 / 32))) * 8; } template inline TAngle fabs (const TAngle °) { - return TAngle(fabs(deg.Degrees)); + return TAngle::fromDeg(fabs(deg.Degrees)); } template @@ -1409,6 +1461,7 @@ inline TAngle deltaangle(const TAngle &a1, const TAngle &a2) return (a2 - a1).Normalized180(); } +/* template inline TAngle deltaangle(const TAngle &a1, double a2) { @@ -1420,6 +1473,7 @@ inline TAngle deltaangle(double a1, const TAngle &a2) { return (a2 - a1).Normalized180(); } + */ template inline TAngle absangle(const TAngle &a1, const TAngle &a2) @@ -1427,27 +1481,29 @@ inline TAngle absangle(const TAngle &a1, const TAngle &a2) return fabs((a1 - a2).Normalized180()); } +/* template inline TAngle absangle(const TAngle &a1, double a2) { return fabs((a1 - a2).Normalized180()); } + */ inline TAngle VecToAngle(double x, double y) { - return g_atan2(y, x) * (180.0 / pi::pi()); + return TAngle::fromDeg(g_atan2(y, x) * (180.0 / pi::pi())); } template inline TAngle VecToAngle (const TVector2 &vec) { - return (T)g_atan2(vec.Y, vec.X) * (180.0 / pi::pi()); + return TAngle::fromDeg(g_atan2(vec.Y, vec.X) * (180.0 / pi::pi())); } template inline TAngle VecToAngle (const TVector3 &vec) { - return (T)g_atan2(vec.Y, vec.X) * (180.0 / pi::pi()); + return TAngle::fromDeg(g_atan2(vec.Y, vec.X) * (180.0 / pi::pi())); } template @@ -1651,6 +1707,8 @@ typedef TRotator DRotator; typedef TMatrix3x3 DMatrix3x3; typedef TAngle DAngle; +constexpr DAngle nullAngle = DAngle::fromDeg(0.); +constexpr FAngle nullFAngle = FAngle::fromDeg(0.); class Plane { diff --git a/src/console/c_cmds.cpp b/src/console/c_cmds.cpp index 4037f8189..68b41fc0f 100644 --- a/src/console/c_cmds.cpp +++ b/src/console/c_cmds.cpp @@ -1073,7 +1073,7 @@ CCMD(angleconvtest) Printf("Testing degrees to angle conversion:\n"); for (double ang = -5 * 180.; ang < 5 * 180.; ang += 45.) { - unsigned ang1 = DAngle(ang).BAMs(); + unsigned ang1 = DAngle::fromDeg(ang).BAMs(); unsigned ang2 = (unsigned)(ang * (0x40000000 / 90.)); unsigned ang3 = (unsigned)(int)(ang * (0x40000000 / 90.)); Printf("Angle = %.5f: xs_RoundToInt = %08x, unsigned cast = %08x, signed cast = %08x\n", diff --git a/src/console/c_functions.cpp b/src/console/c_functions.cpp index 4b9344e6c..b99c9a5d0 100644 --- a/src/console/c_functions.cpp +++ b/src/console/c_functions.cpp @@ -52,7 +52,7 @@ void C_PrintInfo(AActor *target, bool verbose) void C_AimLine(FTranslatedLineTarget *t, bool nonshootable) { - P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->Angles.Yaw, MISSILERANGE, t, 0., + P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->Angles.Yaw, MISSILERANGE, t, nullAngle, (nonshootable) ? ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART|ALF_IGNORENOAUTOAIM : ALF_IGNORENOAUTOAIM); } diff --git a/src/d_main.cpp b/src/d_main.cpp index df1051af5..f7602d2af 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -895,13 +895,13 @@ void D_Display () auto &vp = r_viewpoint; if (viewactive) { - DAngle fov = 90.f; + DAngle fov = DAngle::fromDeg(90.); AActor *cam = players[consoleplayer].camera; if (cam) { if (cam->player) - fov = cam->player->FOV; - else fov = cam->CameraFOV; + fov = DAngle::fromDeg(cam->player->FOV); + else fov = DAngle::fromDeg(cam->CameraFOV); } R_SetFOV(vp, fov); } diff --git a/src/d_net.cpp b/src/d_net.cpp index cff637c78..58f65d91a 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2403,7 +2403,7 @@ void Net_DoCommand (int type, uint8_t **stream, int player) if (type >= DEM_SUMMON2 && type <= DEM_SUMMONFOE2) { - spawned->Angles.Yaw = source->Angles.Yaw - angle; + spawned->Angles.Yaw = source->Angles.Yaw - DAngle::fromDeg(angle); spawned->special = special; for(i = 0; i < 5; i++) { spawned->args[i] = args[i]; @@ -2693,8 +2693,8 @@ void Net_DoCommand (int type, uint8_t **stream, int player) break; case DEM_SETPITCHLIMIT: - players[player].MinPitch = -(double)ReadByte(stream); // up - players[player].MaxPitch = (double)ReadByte(stream); // down + players[player].MinPitch = DAngle::fromDeg(-ReadByte(stream)); // up + players[player].MaxPitch = DAngle::fromDeg(ReadByte(stream)); // down break; case DEM_REVERTCAMERA: diff --git a/src/events.cpp b/src/events.cpp index d3a739495..5be54044f 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -754,7 +754,7 @@ FWorldEvent EventManager::SetupWorldEvent() FWorldEvent e; e.IsSaveGame = savegamerestore; e.IsReopen = Level->FromSnapshot && !savegamerestore; // each one by itself isnt helpful, but with hub load we have savegamerestore==0 and level.FromSnapshot==1. - e.DamageAngle = 0.0; + e.DamageAngle = nullAngle; return e; } diff --git a/src/g_dumpinfo.cpp b/src/g_dumpinfo.cpp index a026863de..72c928906 100644 --- a/src/g_dumpinfo.cpp +++ b/src/g_dumpinfo.cpp @@ -74,7 +74,7 @@ CCMD(listlights) if (dl->target) { - FTextureID spr = sprites[dl->target->sprite].GetSpriteFrame(dl->target->frame, 0, 0., nullptr); + FTextureID spr = sprites[dl->target->sprite].GetSpriteFrame(dl->target->frame, 0, nullAngle, nullptr); Printf(", frame = %s ", TexMan.GetGameTexture(spr)->GetName().GetChars()); } diff --git a/src/maploader/edata.cpp b/src/maploader/edata.cpp index 9d50b26b4..3bc4928f0 100644 --- a/src/maploader/edata.cpp +++ b/src/maploader/edata.cpp @@ -296,7 +296,7 @@ static void parseSector(FScanner &sc, TMap &EDSectors) { sc.CheckString("="); sc.MustGetFloat(); - sec.angle[sector_t::floor] = sc.Float; + sec.angle[sector_t::floor] = DAngle::fromDeg(sc.Float); } else if (sc.Compare("flooroffsetx")) { @@ -320,7 +320,7 @@ static void parseSector(FScanner &sc, TMap &EDSectors) { sc.CheckString("="); sc.MustGetFloat(); - sec.angle[sector_t::ceiling] = sc.Float; + sec.angle[sector_t::ceiling] = DAngle::fromDeg(sc.Float); } else if (sc.Compare("ceilingoffsetx")) { diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 9e4126196..1f28e13ed 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -911,7 +911,7 @@ bool MapLoader::LoadSegs (MapData * map) // errors _can_ cause firelines. DAngle ptp_angle = (li->v2->fPos() - li->v1->fPos()).Angle(); - DAngle seg_angle = AngleToFloat(segangle << 16); + DAngle seg_angle = DAngle::fromBam(segangle << 16); DAngle delta_angle = absangle(ptp_angle, seg_angle); if (delta_angle >= 1.) @@ -1996,7 +1996,7 @@ void MapLoader::LoopSidedefs (bool firstloop) if (sidetemp[right].b.next != NO_SIDE) { int bestright = right; // Shut up, GCC - DAngle bestang = 360.; + DAngle bestang = DAngle::fromDeg(360.); line_t *leftline, *rightline; DAngle ang1, ang2, ang; @@ -2004,7 +2004,7 @@ void MapLoader::LoopSidedefs (bool firstloop) ang1 = leftline->Delta().Angle(); if (!sidetemp[i].b.lineside) { - ang1 += 180; + ang1 += DAngle::fromDeg(180); } while (right != NO_SIDE) @@ -2017,7 +2017,7 @@ void MapLoader::LoopSidedefs (bool firstloop) ang2 = rightline->Delta().Angle(); if (sidetemp[right].b.lineside) { - ang2 += 180; + ang2 += DAngle::fromDeg(180); } ang = (ang2 - ang1).Normalized360(); diff --git a/src/maploader/slopes.cpp b/src/maploader/slopes.cpp index b5ef8d761..9567c6ef4 100644 --- a/src/maploader/slopes.cpp +++ b/src/maploader/slopes.cpp @@ -160,22 +160,22 @@ void MapLoader::SetSlope (secplane_t *plane, bool setCeil, int xyangi, int zangi if (zangi >= 180) { - zang = 179.; + zang = DAngle::fromDeg(179.); } else if (zangi <= 0) { - zang = 1.; + zang = DAngle::fromDeg(1.); } else { - zang = (double)zangi; + zang = DAngle::fromDeg(zangi); } if (setCeil) { - zang += 180.; + zang += DAngle::fromDeg(180.); } - xyang = (double)xyangi; + xyang = DAngle::fromDeg(xyangi); DVector3 norm; diff --git a/src/maploader/udmf.cpp b/src/maploader/udmf.cpp index 089663398..fb8fd8379 100644 --- a/src/maploader/udmf.cpp +++ b/src/maploader/udmf.cpp @@ -262,7 +262,7 @@ double UDMFParserBase::CheckCoordinate(FName key) DAngle UDMFParserBase::CheckAngle(FName key) { - return DAngle(CheckFloat(key)).Normalized360(); + return DAngle::fromDeg(CheckFloat(key)).Normalized360(); } bool UDMFParserBase::CheckBool(FName key) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 21705fc79..607731ada 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -166,7 +166,7 @@ static void ClearConversationStuff(player_t* player) player->ConversationFaceTalker = false; player->ConversationNPC = nullptr; player->ConversationPC = nullptr; - player->ConversationNPCAngle = 0.; + player->ConversationNPCAngle = nullAngle; } //============================================================================ diff --git a/src/playsim/a_decals.cpp b/src/playsim/a_decals.cpp index cba5de2f3..fdb63a0a6 100644 --- a/src/playsim/a_decals.cpp +++ b/src/playsim/a_decals.cpp @@ -929,7 +929,7 @@ static void SpawnDecal(AActor *self) // Look for a wall within 64 units behind the actor. If none can be // found, then no decal is created, and this actor is destroyed // without effectively doing anything. - if (!ShootDecal(self->Level, tpl, self->Sector, self->X(), self->Y(), self->Z(), self->Angles.Yaw + 180, 64., true)) + if (!ShootDecal(self->Level, tpl, self->Sector, self->X(), self->Y(), self->Z(), self->Angles.Yaw + DAngle::fromDeg(180), 64., true)) { DPrintf (DMSG_WARNING, "Could not find a wall to stick decal to at (%f,%f)\n", self->X(), self->Y()); } diff --git a/src/playsim/a_dynlight.cpp b/src/playsim/a_dynlight.cpp index 6c1e72fd3..8f58cf31c 100644 --- a/src/playsim/a_dynlight.cpp +++ b/src/playsim/a_dynlight.cpp @@ -115,7 +115,7 @@ void AttachLight(AActor *self) light->pPitch = &self->Angles.Pitch; light->pLightFlags = (LightFlags*)&self->IntVar(NAME_lightflags); light->pArgs = self->args; - light->specialf1 = DAngle(double(self->SpawnAngle)).Normalized360().Degrees; + light->specialf1 = DAngle::fromDeg(double(self->SpawnAngle)).Normalized360().Degrees; light->Sector = self->Sector; light->target = self; light->mShadowmapIndex = 1024; diff --git a/src/playsim/a_dynlight.h b/src/playsim/a_dynlight.h index 586c9c799..0aee31790 100644 --- a/src/playsim/a_dynlight.h +++ b/src/playsim/a_dynlight.h @@ -78,16 +78,16 @@ public: void SetDontLightMap(bool on) { if (on) m_lightFlags |= LF_DONTLIGHTMAP; else m_lightFlags &= ~LF_DONTLIGHTMAP; } void SetNoShadowmap(bool on) { if (on) m_lightFlags |= LF_NOSHADOWMAP; else m_lightFlags &= ~LF_NOSHADOWMAP; } void SetSpot(bool spot) { if (spot) m_lightFlags |= LF_SPOT; else m_lightFlags &= ~LF_SPOT; } - void SetSpotInnerAngle(double angle) { m_spotInnerAngle = angle; } - void SetSpotOuterAngle(double angle) { m_spotOuterAngle = angle; } + void SetSpotInnerAngle(double angle) { m_spotInnerAngle = DAngle::fromDeg(angle); } + void SetSpotOuterAngle(double angle) { m_spotOuterAngle = DAngle::fromDeg(angle); } void SetSpotPitch(double pitch) { - m_pitch = pitch; + m_pitch = DAngle::fromDeg(pitch); m_explicitPitch = true; } void UnsetSpotPitch() { - m_pitch = 0.; + m_pitch = nullAngle; m_explicitPitch = false; } @@ -125,9 +125,9 @@ protected: bool m_swapped = false; bool m_spot = false; bool m_explicitPitch = false; - DAngle m_spotInnerAngle = 10.0; - DAngle m_spotOuterAngle = 25.0; - DAngle m_pitch = 0.0; + DAngle m_spotInnerAngle = DAngle::fromDeg(10.0); + DAngle m_spotOuterAngle = DAngle::fromDeg(25.0); + DAngle m_pitch = nullAngle; friend FSerializer &Serialize(FSerializer &arc, const char *key, FLightDefaults &value, FLightDefaults *def); }; diff --git a/src/playsim/bots/b_bot.cpp b/src/playsim/bots/b_bot.cpp index d733457cb..d9abf4a9f 100644 --- a/src/playsim/bots/b_bot.cpp +++ b/src/playsim/bots/b_bot.cpp @@ -73,7 +73,7 @@ void DBot::Construct() void DBot::Clear () { player = nullptr; - Angle = 0.; + Angle = nullAngle; dest = nullptr; prev = nullptr; enemy = nullptr; diff --git a/src/playsim/bots/b_func.cpp b/src/playsim/bots/b_func.cpp index b38fd1723..85a64bec0 100644 --- a/src/playsim/bots/b_func.cpp +++ b/src/playsim/bots/b_func.cpp @@ -212,7 +212,7 @@ void DBot::Dofire (ticcmd_t *cmd) { //MAKEME: This should be smarter. if ((pr_botdofire()%200)<=skill.reaction) - if(Check_LOS(enemy, SHOOTFOV)) + if(Check_LOS(enemy, DAngle::fromDeg(SHOOTFOV))) no_fire = false; } else if (GetBotInfo(player->ReadyWeapon).projectileType != NULL) @@ -237,7 +237,7 @@ void DBot::Dofire (ticcmd_t *cmd) fm = Dist / GetDefaultByType (GetBotInfo(player->ReadyWeapon).projectileType)->Speed; Level->BotInfo.SetBodyAt(Level, enemy->Pos() + enemy->Vel.XY() * fm * 2, 1); Angle = player->mo->AngleTo(Level->BotInfo.body1); - if (Check_LOS (enemy, SHOOTFOV)) + if (Check_LOS (enemy, DAngle::fromDeg(SHOOTFOV))) no_fire = false; } else @@ -254,9 +254,9 @@ void DBot::Dofire (ticcmd_t *cmd) aiming_value = skill.aiming - aiming_penalty; if (aiming_value <= 0) aiming_value = 1; - m = ((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) - m = 1.; //Prevents lock. + m = DAngle::fromDeg(1.); //Prevents lock. if (m != 0) { @@ -271,7 +271,7 @@ void DBot::Dofire (ticcmd_t *cmd) increase = !increase; } - if (Check_LOS (enemy, (SHOOTFOV/2))) + if (Check_LOS (enemy, DAngle::fromDeg(SHOOTFOV/2))) no_fire = false; } if (!no_fire) //If going to fire weapon @@ -328,7 +328,7 @@ void FCajunMaster::BotTick(AActor *mo) { if (!players[i].Bot->missile && (mo->flags3 & MF3_WARNBOT)) { //warn for incoming missiles. - if (mo->target != players[i].mo && players[i].Bot->Check_LOS(mo, 90.)) + if (mo->target != players[i].mo && players[i].Bot->Check_LOS(mo, DAngle::fromDeg(90.))) players[i].Bot->missile = mo; } } @@ -425,9 +425,9 @@ AActor *DBot::Find_enemy () //Note: It's hard to ambush a bot who is not alone if (allround || mate) - vangle = 360.; + vangle = DAngle::fromDeg(360.); else - vangle = ENEMY_SCAN_FOV; + vangle = DAngle::fromDeg(ENEMY_SCAN_FOV); allround = false; target = NULL; @@ -537,7 +537,7 @@ DAngle DBot::FireRox (AActor *enemy, ticcmd_t *cmd) dist = actor->Distance2D (enemy); if (dist < SAFE_SELF_MISDIST) - return 0.; + return nullAngle; //Predict. m = ((dist+1) / GetDefaultByName("Rocket")->Speed); @@ -563,7 +563,7 @@ DAngle DBot::FireRox (AActor *enemy, ticcmd_t *cmd) return player->mo->AngleTo(enemy); } } - return 0.; + return nullAngle; } // [RH] We absolutely do not want to pick things up here. The bot code is diff --git a/src/playsim/bots/b_move.cpp b/src/playsim/bots/b_move.cpp index a22867af1..805d12870 100644 --- a/src/playsim/bots/b_move.cpp +++ b/src/playsim/bots/b_move.cpp @@ -77,9 +77,9 @@ void DBot::Roam (ticcmd_t *cmd) int delta = angle - (player->mo->movedir << 29); if (delta > 0) - Angle -= 45; + Angle -= DAngle::fromDeg(45); else if (delta < 0) - Angle += 45; + Angle += DAngle::fromDeg(45); } // chase towards destination. @@ -357,7 +357,7 @@ void DBot::TurnToAng () if(enemy) if(!dest) //happens when running after item in combat situations, or normal, prevents weak turns if(GetBotInfo(player->ReadyWeapon).projectileType == NULL && GetBotInfo(player->ReadyWeapon).MoveCombatDist > 0) - if(Check_LOS(enemy, SHOOTFOV+5)) + if(Check_LOS(enemy, DAngle::fromDeg(SHOOTFOV+5))) maxturn = 3; } @@ -368,7 +368,7 @@ void DBot::TurnToAng () distance /= TURNSENS; if (fabs (distance) > maxturn) - distance = distance < 0 ? -maxturn : maxturn; + distance = DAngle::fromDeg(distance < 0 ? -maxturn : maxturn); player->mo->Angles.Yaw += distance; } diff --git a/src/playsim/bots/b_think.cpp b/src/playsim/bots/b_think.cpp index 0d9f26647..48cce212b 100644 --- a/src/playsim/bots/b_think.cpp +++ b/src/playsim/bots/b_think.cpp @@ -83,8 +83,8 @@ void DBot::Think () if (cmd->ucmd.pitch == -32768) cmd->ucmd.pitch = -32767; cmd->ucmd.pitch /= ticdup; - actor->Angles.Yaw = oldyaw + DAngle(cmd->ucmd.yaw * ticdup * (360 / 65536.f)); - actor->Angles.Pitch = oldpitch - DAngle(cmd->ucmd.pitch * ticdup * (360 / 65536.f)); + actor->Angles.Yaw = oldyaw + DAngle::fromDeg(cmd->ucmd.yaw * ticdup * (360 / 65536.f)); + actor->Angles.Pitch = oldpitch - DAngle::fromDeg(cmd->ucmd.pitch * ticdup * (360 / 65536.f)); } if (t_active) t_active--; @@ -118,7 +118,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd) dist = dest ? player->mo->Distance2D(dest) : 0; if (missile && - (!missile->Vel.X || !missile->Vel.Y || !Check_LOS(missile, SHOOTFOV*3/2))) + (!missile->Vel.X || !missile->Vel.Y || !Check_LOS(missile, DAngle::fromDeg(SHOOTFOV*3/2)))) { sleft = !sleft; missile = nullptr; //Probably ended its travel. @@ -147,7 +147,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd) } //If able to see enemy while avoiding missile, still fire at enemy. - if (enemy && Check_LOS (enemy, SHOOTFOV)) + if (enemy && Check_LOS (enemy, DAngle::fromDeg(SHOOTFOV))) Dofire (cmd); //Order bot to fire current weapon } else if (enemy && P_CheckSight (player->mo, enemy, 0)) //Fight! @@ -259,7 +259,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd) ///// roam: ///// - if (enemy && Check_LOS (enemy, SHOOTFOV*3/2)) //If able to see enemy while avoiding missile , still fire at it. + if (enemy && Check_LOS (enemy, DAngle::fromDeg(SHOOTFOV*3/2))) //If able to see enemy while avoiding missile , still fire at it. Dofire (cmd); //Order bot to fire current weapon if (dest && !(dest->flags&MF_SPECIAL) && dest->health < 0) diff --git a/src/playsim/d_player.h b/src/playsim/d_player.h index bbc440ac4..9d1cc5485 100644 --- a/src/playsim/d_player.h +++ b/src/playsim/d_player.h @@ -396,8 +396,8 @@ public: FString SubtitleText; int SubtitleCounter; - DAngle MinPitch = 0.; // Viewpitch limits (negative is up, positive is down) - DAngle MaxPitch = 0.; + DAngle MinPitch = nullAngle; // Viewpitch limits (negative is up, positive is down) + DAngle MaxPitch = nullAngle; double crouchfactor = 0; double crouchoffset = 0; @@ -407,7 +407,7 @@ public: // [CW] I moved these here for multiplayer conversation support. TObjPtr ConversationNPC = MakeObjPtr(nullptr), ConversationPC = MakeObjPtr(nullptr); - DAngle ConversationNPCAngle = 0.; + DAngle ConversationNPCAngle = nullAngle; bool ConversationFaceTalker = false; double GetDeltaViewHeight() const diff --git a/src/playsim/fragglescript/t_func.cpp b/src/playsim/fragglescript/t_func.cpp index ee1a94cc6..cbb76a0ec 100644 --- a/src/playsim/fragglescript/t_func.cpp +++ b/src/playsim/fragglescript/t_func.cpp @@ -827,7 +827,7 @@ void FParser::SF_Spawn(void) { DVector3 pos; PClassActor *pclass; - DAngle angle = 0.; + DAngle angle = nullAngle; if (CheckArgs(3)) { @@ -853,7 +853,7 @@ void FParser::SF_Spawn(void) if(t_argc >= 4) { - angle = floatvalue(t_argv[3]); + angle = DAngle::fromDeg(floatvalue(t_argv[3])); } t_return.type = svt_mobj; @@ -1217,7 +1217,7 @@ void FParser::SF_PushThing(void) AActor * mo = actorvalue(t_argv[0]); if(!mo) return; - DAngle angle = floatvalue(t_argv[1]); + DAngle angle = DAngle::fromDeg(floatvalue(t_argv[1])); double force = floatvalue(t_argv[2]); mo->Thrust(angle, force); } @@ -1415,15 +1415,15 @@ void FParser::SF_SetCamera(void) return; // nullptr check } - angle = t_argc < 2 ? newcamera->Angles.Yaw : floatvalue(t_argv[1]); + angle = t_argc < 2 ? newcamera->Angles.Yaw : DAngle::fromDeg(floatvalue(t_argv[1])); newcamera->specialf1 = newcamera->Angles.Yaw.Degrees; newcamera->specialf2 = newcamera->Z(); double z = t_argc < 3 ? newcamera->Sector->floorplane.ZatPoint(newcamera) + 41 : floatvalue(t_argv[2]); newcamera->SetOrigin(newcamera->PosAtZ(z), false); newcamera->Angles.Yaw = angle; - if (t_argc < 4) newcamera->Angles.Pitch = 0.; - else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.); + if (t_argc < 4) newcamera->Angles.Pitch = nullAngle; + else newcamera->Angles.Pitch = DAngle::fromDeg(clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.)); player->camera=newcamera; newcamera->renderflags |= RF_NOINTERPOLATEVIEW; } @@ -1445,7 +1445,7 @@ void FParser::SF_ClearCamera(void) if (cam) { player->camera=player->mo; - cam->Angles.Yaw = cam->specialf1; + cam->Angles.Yaw = DAngle::fromDeg(cam->specialf1); cam->SetZ(cam->specialf2); } @@ -2732,10 +2732,10 @@ void FParser::SF_MoveCamera(void) } else finishedmove = true; - DAngle targetangle = DAngle(floatvalue(t_argv[4])).Normalized360(); + DAngle targetangle = DAngle::fromDeg(floatvalue(t_argv[4])).Normalized360(); if (cam->Angles.Yaw != targetangle) { - DAngle anglespeed = floatvalue(t_argv[5]); + DAngle anglespeed = DAngle::fromDeg(floatvalue(t_argv[5])); DAngle anglenow = targetangle; const DAngle diffangle = deltaangle(cam->Angles.Yaw, targetangle); @@ -3307,7 +3307,7 @@ void FParser::SF_LineAttack() mo = actorvalue(t_argv[0]); damage = intvalue(t_argv[2]); - angle = floatvalue(t_argv[1]); + angle = DAngle::fromDeg(floatvalue(t_argv[1])); slope = P_AimLineAttack(mo, angle, MISSILERANGE); P_LineAttack(mo, angle, MISSILERANGE, slope, damage, NAME_Hitscan, NAME_BulletPuff); diff --git a/src/playsim/mapthinkers/a_pusher.cpp b/src/playsim/mapthinkers/a_pusher.cpp index 6cf9b0c7b..eefb427a1 100644 --- a/src/playsim/mapthinkers/a_pusher.cpp +++ b/src/playsim/mapthinkers/a_pusher.cpp @@ -232,7 +232,7 @@ void DPusher::Tick () if ((speed > 0) && (P_CheckSight (thing, m_Source, SF_IGNOREVISIBILITY))) { DAngle pushangle = pos.Angle(); - if (m_Source->IsKindOf(NAME_PointPuller)) pushangle += 180; + if (m_Source->IsKindOf(NAME_PointPuller)) pushangle += DAngle::fromDeg(180); thing->Thrust(pushangle, speed); } } diff --git a/src/playsim/mapthinkers/a_pusher.h b/src/playsim/mapthinkers/a_pusher.h index c3cf30efa..36c9cfab6 100644 --- a/src/playsim/mapthinkers/a_pusher.h +++ b/src/playsim/mapthinkers/a_pusher.h @@ -26,7 +26,7 @@ public: int CheckForSectorMatch (EPusher type, int tag); void ChangeValues (int magnitude, int angle) { - DAngle ang = angle * (360. / 256.); + DAngle ang = DAngle::fromDeg(angle * (360. / 256.)); m_PushVec = ang.ToVector(magnitude); m_Magnitude = magnitude; } diff --git a/src/playsim/mapthinkers/a_quake.cpp b/src/playsim/mapthinkers/a_quake.cpp index 69e17513d..f207a523d 100644 --- a/src/playsim/mapthinkers/a_quake.cpp +++ b/src/playsim/mapthinkers/a_quake.cpp @@ -137,7 +137,7 @@ void DEarthquake::Tick () P_DamageMobj (victim, NULL, NULL, pr_quake.HitDice (1), NAME_Quake); } // Thrust player around - DAngle an = victim->Angles.Yaw + pr_quake(); + DAngle an = victim->Angles.Yaw + DAngle::fromDeg(pr_quake()); victim->Vel.X += m_Intensity.X * an.Cos() * 0.5; victim->Vel.Y += m_Intensity.Y * an.Sin() * 0.5; } diff --git a/src/playsim/p_acs.cpp b/src/playsim/p_acs.cpp index efe687c4b..c021c6b43 100644 --- a/src/playsim/p_acs.cpp +++ b/src/playsim/p_acs.cpp @@ -615,7 +615,7 @@ inline int DoubleToACS(double val) inline DAngle ACSToAngle(int acsval) { - return acsval * (360. / 65536.); + return DAngle::fromDeg(acsval * (360. / 65536.)); } inline int AngleToACS(DAngle ang) @@ -3791,7 +3791,7 @@ int DLevelScript::DoSpawn (int type, const DVector3 &pos, int tid, DAngle angle, int DLevelScript::DoSpawn(int type, int x, int y, int z, int tid, int angle, bool force) { - return DoSpawn(type, DVector3(ACSToDouble(x), ACSToDouble(y), ACSToDouble(z)), tid, angle * (360. / 256), force); + return DoSpawn(type, DVector3(ACSToDouble(x), ACSToDouble(y), ACSToDouble(z)), tid, DAngle::fromDeg(angle * (360. / 256)), force); } @@ -3806,12 +3806,12 @@ int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle, bool forc while ( (aspot = iterator.Next ()) ) { - spawned += DoSpawn (type, aspot->Pos(), tid, angle * (360. / 256), force); + spawned += DoSpawn (type, aspot->Pos(), tid, DAngle::fromDeg(angle * (360. / 256)), force); } } else if (activator != NULL) { - spawned += DoSpawn (type, activator->Pos(), tid, angle * (360. / 256), force); + spawned += DoSpawn (type, activator->Pos(), tid, DAngle::fromDeg(angle * (360. / 256)), force); } return spawned; } @@ -9652,7 +9652,7 @@ scriptwait: break; case PCD_VECTORANGLE: - STACK(2) = AngleToACS(VecToAngle(STACK(2), STACK(1)).Degrees); + STACK(2) = AngleToACS(VecToAngle(STACK(2), STACK(1))); sp--; break; @@ -9753,14 +9753,14 @@ scriptwait: // Like Thing_Projectile(Gravity) specials, but you can give the // projectile a TID. // Thing_Projectile2 (tid, type, angle, speed, vspeed, gravity, newtid); - Level->EV_Thing_Projectile(STACK(7), activator, STACK(6), NULL, STACK(5) * (360. / 256.), + Level->EV_Thing_Projectile(STACK(7), activator, STACK(6), NULL, DAngle::fromDeg(STACK(5) * (360. / 256.)), STACK(4) / 8., STACK(3) / 8., 0, NULL, STACK(2), STACK(1), false); sp -= 7; break; case PCD_SPAWNPROJECTILE: // Same, but takes an actor name instead of a spawn ID. - Level->EV_Thing_Projectile(STACK(7), activator, 0, Level->Behaviors.LookupString(STACK(6)), STACK(5) * (360. / 256.), + Level->EV_Thing_Projectile(STACK(7), activator, 0, Level->Behaviors.LookupString(STACK(6)), DAngle::fromDeg(STACK(5) * (360. / 256.)), STACK(4) / 8., STACK(3) / 8., 0, NULL, STACK(2), STACK(1), false); sp -= 7; break; diff --git a/src/playsim/p_actionfunctions.cpp b/src/playsim/p_actionfunctions.cpp index 2a898c6dd..3132b91ff 100644 --- a/src/playsim/p_actionfunctions.cpp +++ b/src/playsim/p_actionfunctions.cpp @@ -765,7 +765,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SeekerMissile) { self->tracer = P_RoughMonsterSearch (self, distance, true); } - if (!P_SeekerMissile(self, clamp(ang1, 0, 90), clamp(ang2, 0, 90), !!(flags & SMF_PRECISE), !!(flags & SMF_CURSPEED))) + if (!P_SeekerMissile(self, DAngle::fromDeg(clamp(ang1, 0, 90)), DAngle::fromDeg(clamp(ang2, 0, 90)), !!(flags & SMF_PRECISE), !!(flags & SMF_CURSPEED))) { if (flags & SMF_LOOK) { // This monster is no longer seekable, so let us look for another one next time. @@ -795,7 +795,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BulletAttack) S_Sound (self, CHAN_WEAPON, 0, self->AttackSound, 1, ATTN_NORM); for (i = self->GetMissileDamage (0, 1); i > 0; --i) { - DAngle angle = self->Angles.Yaw + pr_cabullet.Random2() * (5.625 / 256.); + DAngle angle = self->Angles.Yaw + DAngle::fromDeg(pr_cabullet.Random2() * (5.625 / 256.)); int damage = ((pr_cabullet()%5)+1)*3; P_LineAttack(self, angle, MISSILERANGE, slope, damage, NAME_Hitscan, NAME_BulletPuff); @@ -931,7 +931,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnProjectile) { if (ti) { - DAngle angle = self->Angles.Yaw - 90; + DAngle angle = self->Angles.Yaw - DAngle::fromDeg(90.); double x = Spawnofs_xy * angle.Cos(); double y = Spawnofs_xy * angle.Sin(); double z = Spawnheight + self->GetBobOffset() - 32 + (self->player? self->player->crouchoffset : 0.); @@ -1202,7 +1202,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CustomRailgun) { self->Angles.Yaw = self->AngleTo(self->target); } - self->Angles.Pitch = P_AimLineAttack (self, self->Angles.Yaw, MISSILERANGE, &t, 60., 0, aim ? self->target.Get() : nullptr); + self->Angles.Pitch = P_AimLineAttack (self, self->Angles.Yaw, MISSILERANGE, &t, DAngle::fromDeg(60.), 0, aim ? self->target.Get() : nullptr); if (t.linetarget == NULL && aim) { // We probably won't hit the target, but aim at it anyway so we don't look stupid. @@ -1228,7 +1228,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CustomRailgun) if (self->target->flags & MF_SHADOW) { - DAngle rnd = pr_crailgun.Random2() * (45. / 256.); + DAngle rnd = DAngle::fromDeg(pr_crailgun.Random2() * (45. / 256.)); self->Angles.Yaw += rnd; } } @@ -1276,7 +1276,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Recoil) PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(xyvel); - self->Thrust(self->Angles.Yaw + 180., xyvel); + self->Thrust(self->Angles.Yaw + DAngle::fromDeg(180.), xyvel); return 0; } @@ -2423,7 +2423,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckIfTargetInLOS) else { // Does the player aim at something that can be shot? - P_AimLineAttack(self, self->Angles.Yaw, MISSILERANGE, &t, (flags & JLOSF_NOAUTOAIM) ? 0.5 : 0., ALF_PORTALRESTRICT); + P_AimLineAttack(self, self->Angles.Yaw, MISSILERANGE, &t, DAngle::fromDeg((flags & JLOSF_NOAUTOAIM) ? 0.5 : 0.), ALF_PORTALRESTRICT); if (!t.linetarget) { @@ -2435,14 +2435,14 @@ DEFINE_ACTION_FUNCTION(AActor, CheckIfTargetInLOS) { case JLOSF_TARGETLOS|JLOSF_FLIPFOV: // target makes sight check, player makes fov check; player has verified fov - fov = 0.; + fov = nullAngle; // fall-through case JLOSF_TARGETLOS: doCheckSight = !(flags & JLOSF_NOSIGHT); // The target is responsible for sight check and fov break; default: // player has verified sight and fov - fov = 0.; + fov = nullAngle; // fall-through case JLOSF_FLIPFOV: // Player has verified sight, but target must verify fov doCheckSight = false; @@ -2473,7 +2473,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckIfTargetInLOS) ACTION_RETURN_BOOL(false); } if (flags & JLOSF_CLOSENOFOV) - fov = 0.; + fov = nullAngle; if (flags & JLOSF_CLOSENOSIGHT) doCheckSight = false; @@ -2493,7 +2493,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckIfTargetInLOS) else { target = viewport; viewport = self; } } - fov = min(fov, 360.); + fov = min(fov, DAngle::fromDeg(360.)); if (fov > 0) { @@ -2567,7 +2567,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckIfInTargetLOS) ACTION_RETURN_BOOL(false); } if (flags & JLOSF_CLOSENOFOV) - fov = 0.; + fov = nullAngle; if (flags & JLOSF_CLOSENOSIGHT) doCheckSight = false; @@ -2798,7 +2798,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRefire) DEFINE_ACTION_FUNCTION(AActor, A_SetAngle) { PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT(angle); + PARAM_ANGLE(angle); PARAM_INT(flags); PARAM_INT(ptr); @@ -2821,7 +2821,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetAngle) DEFINE_ACTION_FUNCTION(AActor, A_SetPitch) { PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT(pitch); + PARAM_ANGLE(pitch); PARAM_INT(flags); PARAM_INT(ptr); @@ -2845,7 +2845,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetPitch) DEFINE_ACTION_FUNCTION(AActor, A_SetRoll) { PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT (roll); + PARAM_ANGLE (roll); PARAM_INT (flags); PARAM_INT (ptr) ; AActor *ref = COPY_AAPTR(self, ptr); @@ -2870,7 +2870,7 @@ static void SetViewAngleNative(AActor* self, double angle, int flags, int ptr) AActor *ref = COPY_AAPTR(self, ptr); if (ref != nullptr) { - ref->SetViewAngle(angle, flags); + ref->SetViewAngle(DAngle::fromDeg(angle), flags); } } @@ -2899,7 +2899,7 @@ static void SetViewPitchNative(AActor* self, double pitch, int flags, int ptr) AActor *ref = COPY_AAPTR(self, ptr); if (ref != nullptr) { - ref->SetViewPitch(pitch, flags); + ref->SetViewPitch(DAngle::fromDeg(pitch), flags); } } @@ -2928,7 +2928,7 @@ static void SetViewRollNative(AActor* self, double roll, int flags, int ptr) AActor *ref = COPY_AAPTR(self, ptr); if (ref != nullptr) { - ref->SetViewRoll(roll, flags); + ref->SetViewRoll(DAngle::fromDeg(roll), flags); } } @@ -3317,7 +3317,7 @@ void A_Weave(AActor *self, int xyspeed, int zspeed, double xydist, double zdist) weaveXY = self->WeaveIndexXY & 63; weaveZ = self->WeaveIndexZ & 63; - angle = self->Angles.Yaw + 90; + angle = self->Angles.Yaw + DAngle::fromDeg(90); if (xydist != 0 && xyspeed != 0) { @@ -4858,10 +4858,10 @@ enum VRFFlags DEFINE_ACTION_FUNCTION(AActor, A_SetVisibleRotation) { PARAM_SELF_PROLOGUE(AActor); - PARAM_ANGLE(anglestart) - PARAM_ANGLE(angleend) - PARAM_ANGLE(pitchstart) - PARAM_ANGLE(pitchend) + PARAM_FANGLE(anglestart) + PARAM_FANGLE(angleend) + PARAM_FANGLE(pitchstart) + PARAM_FANGLE(pitchend) PARAM_INT(flags) PARAM_INT(ptr) @@ -4874,19 +4874,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetVisibleRotation) if (!(flags & VRF_NOANGLESTART)) { - mobj->VisibleStartAngle = anglestart.Degrees; + mobj->VisibleStartAngle = anglestart; } if (!(flags & VRF_NOANGLEEND)) { - mobj->VisibleEndAngle = angleend.Degrees; + mobj->VisibleEndAngle = angleend; } if (!(flags & VRF_NOPITCHSTART)) { - mobj->VisibleStartPitch = pitchstart.Degrees; + mobj->VisibleStartPitch = pitchstart; } if (!(flags & VRF_NOPITCHEND)) { - mobj->VisibleEndPitch = pitchend.Degrees; + mobj->VisibleEndPitch = pitchend; } ACTION_RETURN_BOOL(true); @@ -4929,7 +4929,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain) { int anglespeed = self->Level->GetFirstSectorTag(sec) - 100; double speed = (anglespeed % 10) / 16.; - DAngle an = (anglespeed / 10) * (360 / 8.); + DAngle an = DAngle::fromDeg((anglespeed / 10) * (360 / 8.)); self->Thrust(an, speed); } } diff --git a/src/playsim/p_effect.cpp b/src/playsim/p_effect.cpp index 23a541ba6..26c6f2ef9 100644 --- a/src/playsim/p_effect.cpp +++ b/src/playsim/p_effect.cpp @@ -341,7 +341,7 @@ static void MakeFountain (AActor *actor, int color1, int color2) if (particle) { - DAngle an = M_Random() * (360. / 256); + DAngle an = DAngle::fromDeg(M_Random() * (360. / 256)); double out = actor->radius * M_Random() / 256.; particle->Pos = actor->Vec3Angle(out, an, actor->Height + 1); @@ -374,7 +374,7 @@ void P_RunEffect (AActor *actor, int effects) double backy = -actor->radius * 2 * moveangle.Sin(); double backz = actor->Height * ((2. / 3) - actor->Vel.Z / 8); - DAngle an = moveangle + 90.; + DAngle an = moveangle + DAngle::fromDeg(90.); double speed; particle = JitterParticle (actor->Level, 3 + (M_Random() & 31)); @@ -423,7 +423,7 @@ void P_RunEffect (AActor *actor, int effects) DVector3 pos = actor->Vec3Angle(-actor->radius * 2, moveangle, -actor->Height * actor->Vel.Z / 8 + actor->Height * (2. / 3)); - P_DrawSplash2 (actor->Level, 6, pos, moveangle + 180, 2, 2); + P_DrawSplash2 (actor->Level, 6, pos, moveangle + DAngle::fromDeg(180), 2, 2); } if (actor->fountaincolor) { @@ -454,7 +454,7 @@ void P_RunEffect (AActor *actor, int effects) particle = JitterParticle (actor->Level, 16); if (particle != NULL) { - DAngle ang = M_Random() * (360 / 256.); + DAngle ang = DAngle::fromDeg(M_Random() * (360 / 256.)); DVector3 pos = actor->Vec3Angle(actor->radius, ang, 0); particle->Pos = pos; particle->color = *protectColors[M_Random() & 1]; @@ -500,7 +500,7 @@ void P_DrawSplash (FLevelLocals *Level, int count, const DVector3 &pos, DAngle a p->Acc.X += (M_Random () - 128) / 8192.; p->Acc.Y += (M_Random () - 128) / 8192.; p->Pos.Z = pos.Z - M_Random () / 64.; - angle += M_Random() * (45./256); + angle += DAngle::fromDeg(M_Random() * (45./256)); p->Pos.X = pos.X + (M_Random() & 15)*angle.Cos(); p->Pos.Y = pos.Y + (M_Random() & 15)*angle.Sin(); } @@ -552,13 +552,13 @@ void P_DrawSplash2 (FLevelLocals *Level, int count, const DVector3 &pos, DAngle p->Acc.Z = -1 / 22.; if (kind) { - an = angle + ((M_Random() - 128) * (180 / 256.)); + an = angle + DAngle::fromDeg((M_Random() - 128) * (180 / 256.)); p->Vel.X = M_Random() * an.Cos() / 2048.; p->Vel.Y = M_Random() * an.Sin() / 2048.; p->Acc.X = p->Vel.X / 16.; p->Acc.Y = p->Vel.Y / 16.; } - an = angle + ((M_Random() - 128) * (90 / 256.)); + an = angle + DAngle::fromDeg((M_Random() - 128) * (90 / 256.)); p->Pos.X = pos.X + ((M_Random() & 31) - 15) * an.Cos(); p->Pos.Y = pos.Y + ((M_Random() & 31) - 15) * an.Sin(); p->Pos.Z = pos.Z + (M_Random() + zadd - 128) * zspread; @@ -687,7 +687,7 @@ void P_DrawRailTrail(AActor *source, TArray &portalhits, int color1, color1 = color1 == 0 ? -1 : ParticleColor(color1); pos = trail[0].start; - deg = (double)SpiralOffset; + deg = DAngle::fromDeg(SpiralOffset); for (i = spiral_steps; i; i--) { particle_t *p = NewParticle (source->Level); @@ -708,7 +708,7 @@ void P_DrawRailTrail(AActor *source, TArray &portalhits, int color1, p->Vel = tempvec * drift / 16.; p->Pos = tempvec + pos; pos += trail[segment].dir * stepsize; - deg += double(r_rail_spiralsparsity * 14); + deg += DAngle::fromDeg(r_rail_spiralsparsity * 14); lencount -= stepsize; if (color1 == -1) { diff --git a/src/playsim/p_effect.h b/src/playsim/p_effect.h index 970c86c6a..9d2d16ef0 100644 --- a/src/playsim/p_effect.h +++ b/src/playsim/p_effect.h @@ -92,7 +92,7 @@ struct SPortalHit DVector3 OutDir; }; -void P_DrawRailTrail(AActor *source, TArray &portalhits, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, DAngle angle = 0., int duration = TICRATE, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270, DAngle pitch = 0.); +void P_DrawRailTrail(AActor *source, TArray &portalhits, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, DAngle angle = nullAngle, int duration = TICRATE, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270, DAngle pitch = nullAngle); void P_DrawSplash (FLevelLocals *Level, int count, const DVector3 &pos, DAngle angle, int kind); void P_DrawSplash2 (FLevelLocals *Level, int count, const DVector3 &pos, DAngle angle, int updown, int kind); void P_DisconnectEffect (AActor *actor); diff --git a/src/playsim/p_enemy.cpp b/src/playsim/p_enemy.cpp index 8a4a33f03..ea9079531 100644 --- a/src/playsim/p_enemy.cpp +++ b/src/playsim/p_enemy.cpp @@ -401,7 +401,7 @@ int P_HitFriend(AActor * self) { DAngle angle = self->AngleTo(self->target); double dist = self->Distance2D(self->target); - P_AimLineAttack (self, angle, dist, &t, 0., true); + P_AimLineAttack (self, angle, dist, &t, nullAngle, true); if (t.linetarget != NULL && t.linetarget != self->target) { return self->IsFriend (t.linetarget); @@ -994,7 +994,7 @@ void P_NewChaseDir(AActor * actor) } else if (front == actor->Z() && back < actor->Z() - actor->MaxDropOffHeight) { - angle = line->Delta().Angle() + 180.; // back side dropoff + angle = line->Delta().Angle() + DAngle::fromDeg(180.); // back side dropoff } else continue; @@ -1263,7 +1263,7 @@ int P_IsVisible(AActor *lookee, AActor *other, INTBOOL allaround, FLookExParams else { mindist = maxdist = 0; - fov = allaround ? 0. : 180.; + fov = DAngle::fromDeg(allaround ? 0. : 180.); } double dist = lookee->Distance2D (other); @@ -1999,7 +1999,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LookEx) AActor *targ = NULL; // Shuts up gcc double dist; - if (fov == 0) fov = 180.; + if (fov == nullAngle) fov = DAngle::fromDeg(180.); FLookExParams params = { fov, minseedist, maxseedist, maxheardist, flags, seestate }; if (self->flags5 & MF5_INCONVERSATION) @@ -2226,15 +2226,15 @@ void A_Wander(AActor *self, int flags) // turn towards movement direction if not there yet if (!(flags & CHF_NODIRECTIONTURN) && (self->movedir < DI_NODIR)) { - self->Angles.Yaw = floor(self->Angles.Yaw.Degrees / 45) * 45.; - DAngle delta = deltaangle(self->Angles.Yaw, (self->movedir * 45)); + 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) { - self->Angles.Yaw -= 45; + self->Angles.Yaw -= DAngle::fromDeg(45); } else if (delta > 0) { - self->Angles.Yaw += 45; + self->Angles.Yaw += DAngle::fromDeg(45); } } @@ -2379,15 +2379,15 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi } else if (!(flags & CHF_NODIRECTIONTURN) && actor->movedir < 8) { - actor->Angles.Yaw = floor(actor->Angles.Yaw.Degrees / 45) * 45.; - DAngle delta = deltaangle(actor->Angles.Yaw, (actor->movedir * 45)); + 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) { - actor->Angles.Yaw -= 45; + actor->Angles.Yaw -= DAngle::fromDeg(45); } else if (delta > 0) { - actor->Angles.Yaw += 45; + actor->Angles.Yaw += DAngle::fromDeg(45); } } @@ -2552,8 +2552,8 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi if (pr_chase() < 100) { DAngle ang = actor->AngleTo(actor->target); - if (pr_chase() < 128) ang += 90.; - else ang -= 90.; + if (pr_chase() < 128) ang += DAngle::fromDeg(90.); + else ang -= DAngle::fromDeg(90.); actor->VelFromAngle(13., ang); actor->FastChaseStrafeCount = 3; // strafe time } @@ -3022,7 +3022,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) ) { - self->Angles.Yaw += pr_facetarget.Random2() * (45 / 256.); + self->Angles.Yaw += DAngle::fromDeg(pr_facetarget.Random2() * (45 / 256.)); } } @@ -3058,7 +3058,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail) self->Angles.Yaw = self->AngleTo(self->target); - self->Angles.Pitch = P_AimLineAttack (self, self->Angles.Yaw, MISSILERANGE, &t, 60., 0, self->target); + self->Angles.Pitch = P_AimLineAttack (self, self->Angles.Yaw, MISSILERANGE, &t, DAngle::fromDeg(60.), 0, self->target); if (t.linetarget == NULL) { // We probably won't hit the target, but aim at it anyway so we don't look stupid. @@ -3072,7 +3072,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail) if (self->target->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE)) { - self->Angles.Yaw += pr_railface.Random2() * 45./256; + self->Angles.Yaw += DAngle::fromDeg(pr_railface.Random2() * 45./256); } FRailParams p; diff --git a/src/playsim/p_enemy.h b/src/playsim/p_enemy.h index dd38c3bf0..9f13128ff 100644 --- a/src/playsim/p_enemy.h +++ b/src/playsim/p_enemy.h @@ -72,7 +72,7 @@ void A_Wander(AActor *self, int flags = 0); void A_DoChase(AActor *actor, bool fastchase, FState *meleestate, FState *missilestate, bool playactive, bool nightmarefast, bool dontmove, int flags); void A_Chase(AActor *self); void A_FaceTarget(AActor *actor); -void A_Face(AActor *self, AActor *other, DAngle max_turn = 0., DAngle max_pitch = 270., DAngle ang_offset = 0., DAngle pitch_offset = 0., int flags = 0, double z_add = 0); +void A_Face(AActor *self, AActor *other, DAngle max_turn = nullAngle, DAngle max_pitch = DAngle::fromDeg(270.), DAngle ang_offset = nullAngle, DAngle pitch_offset = nullAngle, int flags = 0, double z_add = 0); class FSoundID; int CheckBossDeath (AActor *); diff --git a/src/playsim/p_interaction.cpp b/src/playsim/p_interaction.cpp index 68a11c2e6..c3fb82edb 100644 --- a/src/playsim/p_interaction.cpp +++ b/src/playsim/p_interaction.cpp @@ -1514,7 +1514,7 @@ DEFINE_ACTION_FUNCTION(AActor, DamageMobj) PARAM_INT(damage); PARAM_NAME(mod); PARAM_INT(flags); - PARAM_FLOAT(angle); + PARAM_ANGLE(angle); ACTION_RETURN_INT(DoDamageMobj(self, inflictor, source, damage, mod, flags, angle)); } diff --git a/src/playsim/p_lnspec.cpp b/src/playsim/p_lnspec.cpp index 2dd6d9493..787a5bded 100644 --- a/src/playsim/p_lnspec.cpp +++ b/src/playsim/p_lnspec.cpp @@ -78,7 +78,7 @@ static const uint8_t ChangeMap[8] = { 0, 1, 5, 3, 7, 2, 6, 0 }; #define SPEED(a) ((a) / 8.) #define TICS(a) (((a)*TICRATE)/35) #define OCTICS(a) (((a)*TICRATE)/8) -#define BYTEANGLE(a) ((a) * (360./256.)) +#define BYTEANGLE(a) DAngle::fromDeg((a) * (360./256.)) #define CRUSH(a) ((a) > 0? (a) : -1) #define CHANGE(a) (((a) >= 0 && (a)<=7)? ChangeMap[a]:0) @@ -1736,13 +1736,13 @@ FUNC(LS_Thing_Hate) FUNC(LS_Thing_ProjectileAimed) // Thing_ProjectileAimed (tid, type, speed, target, newtid) { - return Level->EV_Thing_Projectile (arg0, it, arg1, NULL, 0., SPEED(arg2), 0, arg3, it, 0, arg4, false); + return Level->EV_Thing_Projectile (arg0, it, arg1, NULL, nullAngle, SPEED(arg2), 0, arg3, it, 0, arg4, false); } FUNC(LS_Thing_ProjectileIntercept) // Thing_ProjectileIntercept (tid, type, speed, target, newtid) { - return Level->EV_Thing_Projectile (arg0, it, arg1, NULL, 0., SPEED(arg2), 0, arg3, it, 0, arg4, true); + return Level->EV_Thing_Projectile (arg0, it, arg1, NULL, nullAngle, SPEED(arg2), 0, arg3, it, 0, arg4, true); } // [BC] added newtid for next two @@ -1761,7 +1761,7 @@ FUNC(LS_Thing_SpawnNoFog) FUNC(LS_Thing_SpawnFacing) // Thing_SpawnFacing (tid, type, nofog, newtid) { - return Level->EV_Thing_Spawn (arg0, it, arg1, 1000000., arg2 ? false : true, arg3); + return Level->EV_Thing_Spawn (arg0, it, arg1, DAngle::fromDeg(1000000.), arg2 ? false : true, arg3); } FUNC(LS_Thing_Raise) @@ -2583,8 +2583,8 @@ FUNC(LS_Sector_SetCeilingScale2) FUNC(LS_Sector_SetRotation) // Sector_SetRotation (tag, floor-angle, ceiling-angle) { - DAngle ceiling = (double)arg2; - DAngle floor = (double)arg1; + DAngle ceiling = DAngle::fromDeg(arg2); + DAngle floor = DAngle::fromDeg(arg1); auto itr = Level->GetSectorTagIterator(arg0); int secnum; @@ -3234,7 +3234,7 @@ FUNC(LS_ForceField) if (it != NULL) { P_DamageMobj (it, NULL, NULL, 16, NAME_None); - it->Thrust(it->Angles.Yaw + 180, 7.8125); + it->Thrust(it->Angles.Yaw + DAngle::fromDeg(180), 7.8125); } return true; } @@ -3308,7 +3308,7 @@ FUNC(LS_GlassBreak) } if (glass != nullptr) { - glass->Angles.Yaw = pr_glass() * (360 / 256.); + glass->Angles.Yaw = DAngle::fromDeg(pr_glass() * (360 / 256.)); glass->VelFromAngle(pr_glass() & 3); glass->Vel.Z = (pr_glass() & 7); // [RH] Let the shards stick around longer than they did in Strife. diff --git a/src/playsim/p_local.h b/src/playsim/p_local.h index ade5b9765..cc48c4259 100644 --- a/src/playsim/p_local.h +++ b/src/playsim/p_local.h @@ -93,7 +93,7 @@ void P_PredictionLerpReset(); #define SPF_WEAPONFULLYUP 2 // spawn with weapon already raised int P_FaceMobj (AActor *source, AActor *target, DAngle *delta); -bool P_SeekerMissile (AActor *actor, double thresh, double turnMax, bool precise = false, bool usecurspeed=false); +bool P_SeekerMissile (AActor *actor, DAngle thresh, DAngle turnMax, bool precise = false, bool usecurspeed=false); enum EPuffFlags { @@ -299,7 +299,7 @@ void P_FindFloorCeiling (AActor *actor, int flags=0); bool P_ChangeSector (sector_t* sector, int crunch, double amt, int floorOrCeil, bool isreset, bool instant = false); -DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLineTarget *pLineTarget = NULL, DAngle vrange = 0., int flags = 0, AActor *target = NULL, AActor *friender = NULL); +DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLineTarget *pLineTarget = NULL, DAngle vrange = nullAngle, int flags = 0, AActor *target = NULL, AActor *friender = NULL); enum // P_AimLineAttack flags { @@ -363,8 +363,8 @@ struct FRailParams double maxdiff = 0; int flags = 0; PClassActor *puff = nullptr; - DAngle angleoffset = 0.; - DAngle pitchoffset = 0.; + DAngle angleoffset = nullAngle; + DAngle pitchoffset = nullAngle; double distance = 8192; int duration = 0; double sparsity = 1.0; @@ -432,7 +432,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move); // P_INTER // void P_TouchSpecialThing (AActor *special, AActor *toucher); -int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags=0, DAngle angle = 0.); +int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags=0, DAngle angle = nullAngle); void P_PoisonMobj (AActor *target, AActor *inflictor, AActor *source, int damage, int duration, int period, FName type); bool P_GiveBody (AActor *actor, int num, int max=0); bool P_PoisonPlayer (player_t *player, AActor *poisoner, AActor *source, int poison); diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index 796c0a61c..8dcd22d52 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -2141,7 +2141,7 @@ void P_FakeZMovement(AActor *mo) } if (mo->player && mo->flags&MF_NOGRAVITY && (mo->Z() > mo->floorz) && !mo->IsNoClip2()) { - mo->AddZ(DAngle(4.5 * mo->Level->maptime).Sin()); + mo->AddZ(DAngle::fromDeg(4.5 * mo->Level->maptime).Sin()); } // @@ -2555,7 +2555,7 @@ bool P_TryMove(AActor *thing, const DVector2 &pos, if (thing->Level->isCamera(thing)) { divline_t dl1 = { besthit.Oldrefpos.X,besthit.Oldrefpos.Y, besthit.Refpos.X - besthit.Oldrefpos.X, besthit.Refpos.Y - besthit.Oldrefpos.Y }; - DVector3a hit = { {dl1.x + dl1.dx * bestfrac, dl1.y + dl1.dy * bestfrac, 0.},0. }; + DVector3a hit = { {dl1.x + dl1.dx * bestfrac, dl1.y + dl1.dy * bestfrac, 0.},nullAngle }; R_AddInterpolationPoint(hit); if (port->mType == PORTT_LINKED) @@ -2961,12 +2961,12 @@ void FSlide::HitSlideLine(line_t* ld) lineangle = ld->Delta().Angle(); if (side == 1) - lineangle += 180.; + lineangle += DAngle::fromDeg(180.); moveangle = tmmove.Angle(); // prevents sudden path reversal due to rounding error | // phares - moveangle += 3600/65536.*65536.; // Boom added 10 to the angle here. + moveangle += DAngle::fromDeg(3600/65536.*65536.); // Boom added 10 to the angle here. deltaangle = ::deltaangle(lineangle, moveangle); // V movelen = tmmove.Length(); @@ -3519,7 +3519,7 @@ bool FSlide::BounceWall(AActor *mo) lineangle = line->Delta().Angle(); if (side == 1) { - lineangle += 180; + lineangle += DAngle::fromDeg(180); } moveangle = mo->Vel.Angle(); deltaangle = (lineangle * 2) - moveangle; @@ -3611,7 +3611,7 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop) if (!ontop) { - DAngle angle = BlockingMobj->AngleTo(mo) + ((pr_bounce() % 16) - 8); + DAngle angle = BlockingMobj->AngleTo(mo) + DAngle::fromDeg((pr_bounce() % 16) - 8); double speed = mo->VelXYToSpeed() * GetWallBounceFactor(mo); // [GZ] was 0.75, using wallbouncefactor seems more consistent if (fabs(speed) < EQUAL_EPSILON) speed = 0; mo->Angles.Yaw = angle; @@ -4074,8 +4074,8 @@ struct aim_t floorportalstate = false; } } - if (ceilingportalstate) EnterSectorPortal(sector_t::ceiling, 0, lastsector, toppitch, min(0., bottompitch)); - if (floorportalstate) EnterSectorPortal(sector_t::floor, 0, lastsector, max(0., toppitch), bottompitch); + if (ceilingportalstate) EnterSectorPortal(sector_t::ceiling, 0, lastsector, toppitch, min(nullAngle, bottompitch)); + if (floorportalstate) EnterSectorPortal(sector_t::floor, 0, lastsector, max(nullAngle, toppitch), bottompitch); FPathTraverse it(lastsector->Level, startpos.X, startpos.Y, aimtrace.X, aimtrace.Y, PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE | PT_DELTA, startfrac); intercept_t *in; @@ -4153,11 +4153,11 @@ struct aim_t // 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)) { - EnterSectorPortal(sector_t::ceiling, in->frac, entersec, toppitch, min(0., bottompitch)); + 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)) { - EnterSectorPortal(sector_t::floor, in->frac, entersec, max(0., toppitch), bottompitch); + EnterSectorPortal(sector_t::floor, in->frac, entersec, max(nullAngle, toppitch), bottompitch); } continue; // shot continues } @@ -4371,7 +4371,7 @@ DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLin { if (t1->player == NULL || !t1->Level->IsFreelookAllowed()) { - vrange = 35.; + vrange = DAngle::fromDeg(35.); } else { @@ -4379,7 +4379,7 @@ DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLin auto weapon = t1->player->ReadyWeapon; if ((weapon && (weapon->IntVar(NAME_WeaponFlags) & WIF_NOAUTOAIM)) && !(flags & ALF_NOWEAPONCHECK)) { - vrange = 0.5; + vrange = DAngle::fromDeg(0.5); } else { @@ -4387,7 +4387,7 @@ DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLin // vrange of 0 degrees, because then toppitch and bottompitch will // be equal, and PTR_AimTraverse will never find anything to shoot at // if it crosses a line. - vrange = clamp(t1->player->userinfo.GetAimDist(), 0.5, 35.); + vrange = DAngle::fromDeg(clamp(t1->player->userinfo.GetAimDist(), 0.5, 35.)); } } } @@ -4653,7 +4653,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, { DVector2 pos = t1->Level->GetPortalOffsetPosition(trace.HitPos.X, trace.HitPos.Y, -trace.HitVector.X * 4, -trace.HitVector.Y * 4); puff = P_SpawnPuff(t1, pufftype, DVector3(pos, trace.HitPos.Z - trace.HitVector.Z * 4), trace.SrcAngleFromTarget, - trace.SrcAngleFromTarget - 90, 0, puffFlags); + trace.SrcAngleFromTarget - DAngle::fromDeg(90), 0, puffFlags); puff->radius = 1/65536.; if (nointeract) @@ -4717,7 +4717,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, puffFlags |= PF_HITTHINGBLEED; // We must pass the unreplaced puff type here - puff = P_SpawnPuff(t1, pufftype, bleedpos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - 90, 2, puffFlags | PF_HITTHING, trace.Actor); + puff = P_SpawnPuff(t1, pufftype, bleedpos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - DAngle::fromDeg(90), 2, puffFlags | PF_HITTHING, trace.Actor); } if (victim != NULL) { @@ -4755,7 +4755,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, { // Since the puff is the damage inflictor we need it here // regardless of whether it is displayed or not. - puff = P_SpawnPuff(t1, pufftype, bleedpos, 0., 0., 2, puffFlags | PF_HITTHING | PF_TEMPORARY); + puff = P_SpawnPuff(t1, pufftype, bleedpos, nullAngle, nullAngle, 2, puffFlags | PF_HITTHING | PF_TEMPORARY); killPuff = true; } auto src = t1; @@ -4785,7 +4785,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, { if (puff == NULL) { // Spawn puff just to get a mass for the splash - puff = P_SpawnPuff(t1, pufftype, trace.HitPos, 0., 0., 2, puffFlags | PF_HITTHING | PF_TEMPORARY); + puff = P_SpawnPuff(t1, pufftype, trace.HitPos, nullAngle, nullAngle, 2, puffFlags | PF_HITTHING | PF_TEMPORARY); killPuff = true; } SpawnDeepSplash(t1, trace, puff); @@ -5045,8 +5045,8 @@ void P_TraceBleed(int damage, const DVector3 &pos, AActor *actor, DAngle angle, { FTraceResults bleedtrace; - DAngle bleedang = angle + (pr_tracebleed() - 128) * noise; - DAngle bleedpitch = pitch + (pr_tracebleed() - 128) * noise; + DAngle bleedang = angle + DAngle::fromDeg((pr_tracebleed() - 128) * noise); + DAngle bleedpitch = pitch + DAngle::fromDeg((pr_tracebleed() - 128) * noise); double cosp = bleedpitch.Cos(); DVector3 vdir = DVector3(cosp * bleedang.Cos(), cosp * bleedang.Sin(), -bleedpitch.Sin()); @@ -5102,7 +5102,7 @@ void P_TraceBleed(int damage, AActor *target, AActor *missile) } else { - pitch = 0.; + pitch = nullAngle; } P_TraceBleed(damage, target->PosPlusZ(target->Height/2), target, missile->AngleTo(target), pitch); } @@ -5120,7 +5120,7 @@ void P_TraceBleed(int damage, FTranslatedLineTarget *t, AActor *puff) return; } - DAngle pitch = (pr_tracebleed() - 128) * (360 / 65536.); + DAngle pitch = DAngle::fromDeg((pr_tracebleed() - 128) * (360 / 65536.)); P_TraceBleed(damage, t->linetarget->PosPlusZ(t->linetarget->Height/2), t->linetarget, t->angleFromSource, pitch); } @@ -5135,8 +5135,8 @@ void P_TraceBleed(int damage, AActor *target) { if (target != NULL) { - DAngle angle = pr_tracebleed() * (360 / 256.); - DAngle pitch = (pr_tracebleed() - 128) * (360 / 65536.); + DAngle angle = DAngle::fromDeg(pr_tracebleed() * (360 / 256.)); + DAngle pitch = DAngle::fromDeg((pr_tracebleed() - 128) * (360 / 65536.)); P_TraceBleed(damage, target->PosPlusZ(target->Height / 2), target, angle, pitch); } } @@ -5266,7 +5266,7 @@ void P_RailAttack(FRailParams *p) puffflags |= PF_NORANDOMZ; } - DVector2 xy = source->Vec2Angle(p->offset_xy, angle - 90.); + DVector2 xy = source->Vec2Angle(p->offset_xy, angle - DAngle::fromDeg(90.)); RailData rail_data; rail_data.Caller = source; @@ -5349,7 +5349,7 @@ void P_RailAttack(FRailParams *p) } if (spawnpuff) { - hitpuff = P_SpawnPuff(source, puffclass, hitpos, hitangle, hitangle - 90, 1, actorpuffflags, hitactor); + hitpuff = P_SpawnPuff(source, puffclass, hitpos, hitangle, hitangle - DAngle::fromDeg(90), 1, actorpuffflags, hitactor); } // https://github.com/coelckers/gzdoom/pull/1668#pullrequestreview-1039431156 if (!hitpuff) { @@ -5385,7 +5385,7 @@ void P_RailAttack(FRailParams *p) if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF) { - puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - 90, 1, puffflags); + puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - DAngle::fromDeg(90), 1, puffflags); if (puff && (trace.Line != NULL) && (trace.Line->special == Line_Horizon) && !(puff->flags3 & MF3_SKYEXPLODE)) puff->Destroy(); } @@ -5400,7 +5400,7 @@ void P_RailAttack(FRailParams *p) AActor* puff = NULL; if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF) { - puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - 90, 1, puffflags); + puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - DAngle::fromDeg(90), 1, puffflags); if (puff && !(puff->flags3 & MF3_SKYEXPLODE) && (((trace.HitType == TRACE_HitFloor) && (puff->floorpic == skyflatnum)) || ((trace.HitType == TRACE_HitCeiling) && (puff->ceilingpic == skyflatnum)))) @@ -5438,7 +5438,7 @@ CVAR(Float, chase_dist, 90.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) void P_AimCamera(AActor *t1, DVector3 &campos, DAngle &camangle, sector_t *&CameraSector, bool &unlinked) { double distance = clamp(chase_dist, 0, 30000); - DAngle angle = t1->Angles.Yaw - 180; + DAngle angle = t1->Angles.Yaw - DAngle::fromDeg(180); DAngle pitch = t1->Angles.Pitch; FTraceResults trace; DVector3 vvec; @@ -5461,7 +5461,7 @@ void P_AimCamera(AActor *t1, DVector3 &campos, DAngle &camangle, sector_t *&Came } CameraSector = trace.Sector; unlinked = trace.unlinked; - camangle = trace.SrcAngleFromTarget - 180.; + camangle = trace.SrcAngleFromTarget - DAngle::fromDeg(180.); } // [MC] Used for ViewPos. Uses code borrowed from P_AimCamera. @@ -5502,7 +5502,7 @@ bool P_TalkFacing(AActor *player) for (double angle : angleofs) { - P_AimLineAttack(player, player->Angles.Yaw + angle, TALKRANGE, &t, 35., ALF_FORCENOSMART | ALF_CHECKCONVERSATION | ALF_PORTALRESTRICT); + P_AimLineAttack(player, player->Angles.Yaw + DAngle::fromDeg(angle), TALKRANGE, &t, DAngle::fromDeg(35.), ALF_FORCENOSMART | ALF_CHECKCONVERSATION | ALF_PORTALRESTRICT); if (t.linetarget != NULL) { if (t.linetarget->health > 0 && // Dead things can't talk. @@ -6372,7 +6372,7 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos) if (!(cl_bloodtype <= 1)) mo->renderflags |= RF_INVISIBLE; } - DAngle an = (M_Random() - 128) * (360./256); + DAngle an = DAngle::fromDeg((M_Random() - 128) * (360./256)); if (cl_bloodtype >= 1) { P_DrawSplash2(thing->Level, 32, thing->PosPlusZ(thing->Height/2), an, 2, thing->BloodColor); diff --git a/src/playsim/p_maputl.cpp b/src/playsim/p_maputl.cpp index f99f2a6bb..ecc4e1ce2 100644 --- a/src/playsim/p_maputl.cpp +++ b/src/playsim/p_maputl.cpp @@ -415,11 +415,11 @@ bool AActor::FixMapthingPos() DAngle ang = ldef->Delta().Angle(); if (ldef->backsector != NULL && ldef->backsector == secstart) { - ang += 90.; + ang += DAngle::fromDeg(90.); } else { - ang -= 90.; + ang -= DAngle::fromDeg(90.); } // Get the distance we have to move the object away from the wall diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 75aeae6cd..2070edc38 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -1015,10 +1015,10 @@ bool AActor::IsInsideVisibleAngles() const if (p == nullptr || p->camera == nullptr) return true; - DAngle anglestart = VisibleStartAngle.Degrees; - DAngle angleend = VisibleEndAngle.Degrees; - DAngle pitchstart = VisibleStartPitch.Degrees; - DAngle pitchend = VisibleEndPitch.Degrees; + DAngle anglestart = DAngle::fromDeg(VisibleStartAngle.Degrees); + DAngle angleend = DAngle::fromDeg(VisibleEndAngle.Degrees); + DAngle pitchstart = DAngle::fromDeg(VisibleStartPitch.Degrees); + DAngle pitchend = DAngle::fromDeg(VisibleEndPitch.Degrees); if (anglestart > angleend) { @@ -1740,7 +1740,7 @@ DEFINE_ACTION_FUNCTION(AActor, CanSeek) // //---------------------------------------------------------------------------- -bool P_SeekerMissile (AActor *actor, double thresh, double turnMax, bool precise, bool usecurspeed) +bool P_SeekerMissile (AActor *actor, DAngle thresh, DAngle turnMax, bool precise, bool usecurspeed) { int dir; DAngle delta; @@ -1795,7 +1795,7 @@ bool P_SeekerMissile (AActor *actor, double thresh, double turnMax, bool precise } else { - DAngle pitch = 0.; + DAngle pitch = nullAngle; if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) { // Need to seek vertically double dist = max(1., actor->Distance2D(target)); @@ -1845,16 +1845,16 @@ double P_XYMovement (AActor *mo, DVector2 scroll) switch (special) { case 40: case 41: case 42: // Wind_East - mo->Thrust(0., windTab[special-40]); + mo->Thrust(DAngle::fromDeg(0.), windTab[special-40]); break; case 43: case 44: case 45: // Wind_North - mo->Thrust(90., windTab[special-43]); + mo->Thrust(DAngle::fromDeg(90.), windTab[special-43]); break; case 46: case 47: case 48: // Wind_South - mo->Thrust(270., windTab[special-46]); + mo->Thrust(DAngle::fromDeg(270.), windTab[special-46]); break; case 49: case 50: case 51: // Wind_West - mo->Thrust(180., windTab[special-49]); + mo->Thrust(DAngle::fromDeg(180.), windTab[special-49]); break; } } @@ -2155,7 +2155,7 @@ double P_XYMovement (AActor *mo, DVector2 scroll) { if ((BlockingMobj->flags7 & MF7_MIRRORREFLECT) && (tg | blockingtg)) { - mo->Angles.Yaw += 180.; + mo->Angles.Yaw += DAngle::fromDeg(180.); mo->Vel *= -.5; } else @@ -2450,7 +2450,7 @@ void P_ZMovement (AActor *mo, double oldfloorz) { if (!mo->IsNoClip2()) { - mo->AddZ(DAngle(360 / 80.f * mo->Level->maptime).Sin() / 8); + mo->AddZ(DAngle::fromDeg(360 / 80.f * mo->Level->maptime).Sin() / 8); } if (!(mo->flags8 & MF8_NOFRICTION)) @@ -2936,7 +2936,7 @@ void P_NightmareRespawn (AActor *mobj) mo->SpawnPoint = mobj->SpawnPoint; mo->SpawnAngle = mobj->SpawnAngle; mo->SpawnFlags = mobj->SpawnFlags & ~MTF_DORMANT; // It wasn't dormant when it died, so it's not dormant now, either. - mo->Angles.Yaw = (double)mobj->SpawnAngle; + mo->Angles.Yaw = DAngle::fromDeg(mobj->SpawnAngle); mo->HandleSpawnFlags (); mo->reactiontime = 18; @@ -3256,22 +3256,22 @@ bool AActor::AdjustReflectionAngle (AActor *thing, DAngle &angle) if (thing->flags7 & MF7_NOSHIELDREFLECT) return true; if (pr_reflect () < 128) - angle += 45; + angle += DAngle::fromDeg(45); else - angle -= 45; + angle -= DAngle::fromDeg(45); } else if (thing->flags4&MF4_DEFLECT) { // deflect (like the Heresiarch) if(pr_reflect() < 128) - angle += 45; + angle += DAngle::fromDeg(45); else - angle -= 45; + angle -= DAngle::fromDeg(45); } else { - angle += ((pr_reflect() % 16) - 8); + angle += DAngle::fromDeg((pr_reflect() % 16) - 8); } //Always check for AIMREFLECT, no matter what else is checked above. if (thing->flags7 & MF7_AIMREFLECT) @@ -3422,8 +3422,8 @@ DAngle AActor::ClampPitch(DAngle p) } else { - min = -89.; - max = 89.; + min = DAngle::fromDeg(-89.); + max = DAngle::fromDeg(89.); } p = clamp(p, min, max); return p; @@ -3902,7 +3902,7 @@ void AActor::Tick () { // Strife scroll special int anglespeed = Level->GetFirstSectorTag(sec) - 100; double carryspeed = (anglespeed % 10) / (16 * CARRYFACTOR); - DAngle angle = ((anglespeed / 10) * 45.); + DAngle angle = DAngle::fromDeg(((anglespeed / 10) * 45.)); scrollv += angle.ToVector(carryspeed); } } @@ -5172,10 +5172,10 @@ AActor *FLevelLocals::SpawnPlayer (FPlayerStart *mthing, int playernum, int flag spawn.Y = mthing->pos.Y; // Allow full angular precision - SpawnAngle = (double)mthing->angle; + SpawnAngle = DAngle::fromDeg(mthing->angle); if (i_compatflags2 & COMPATF2_BADANGLES) { - SpawnAngle += 0.01; + SpawnAngle += DAngle::fromDeg(0.01); } if (GetDefaultByType(p->cls)->flags & MF_SPAWNCEILING) @@ -5230,7 +5230,7 @@ AActor *FLevelLocals::SpawnPlayer (FPlayerStart *mthing, int playernum, int flag } mobj->Angles.Yaw = SpawnAngle; - mobj->Angles.Pitch = mobj->Angles.Roll = 0.; + mobj->Angles.Pitch = mobj->Angles.Roll = nullAngle; mobj->health = p->health; // [RH] Set player sprite based on skin @@ -5260,7 +5260,7 @@ AActor *FLevelLocals::SpawnPlayer (FPlayerStart *mthing, int playernum, int flag p->lastkilltime = 0; p->BlendR = p->BlendG = p->BlendB = p->BlendA = 0.f; p->Uncrouch(); - p->MinPitch = p->MaxPitch = 0.; // will be filled in by PostBeginPlay()/netcode + p->MinPitch = p->MaxPitch = nullAngle; // will be filled in by PostBeginPlay()/netcode p->MUSINFOactor = nullptr; p->MUSINFOtics = -1; p->Vel.Zero(); // killough 10/98: initialize bobbing to 0. @@ -5696,7 +5696,7 @@ AActor *FLevelLocals::SpawnMapThing (FMapThing *mthing, int position) // [RH] Add ThingID to mobj and link it in with the others mobj->SetTID(mthing->thingid); - mobj->PrevAngles.Yaw = mobj->Angles.Yaw = (double)mthing->angle; + mobj->PrevAngles.Yaw = mobj->Angles.Yaw = DAngle::fromDeg(mthing->angle); // Check if this actor's mapthing has a conversation defined if (mthing->Conversation > 0) @@ -5720,9 +5720,9 @@ AActor *FLevelLocals::SpawnMapThing (FMapThing *mthing, int position) if (mthing->Scale.Y != 0) mobj->Scale.Y = mthing->Scale.Y * mobj->Scale.Y; if (mthing->pitch) - mobj->Angles.Pitch = (double)mthing->pitch; + mobj->Angles.Pitch = DAngle::fromDeg(mthing->pitch); if (mthing->roll) - mobj->Angles.Roll = (double)mthing->roll; + mobj->Angles.Roll = DAngle::fromDeg(mthing->roll); if (mthing->score) mobj->Score = mthing->score; if (mthing->fillcolor) @@ -5748,8 +5748,8 @@ AActor *FLevelLocals::SpawnMapThing (FMapThing *mthing, int position) if (mobj->IntVar(NAME_lightflags) & LF_SPOT) { - mobj->AngleVar(NAME_SpotInnerAngle) = double(mthing->args[1]); - mobj->AngleVar(NAME_SpotOuterAngle) = double(mthing->args[2]); + mobj->AngleVar(NAME_SpotInnerAngle) = DAngle::fromDeg(mthing->args[1]); + mobj->AngleVar(NAME_SpotOuterAngle) = DAngle::fromDeg(mthing->args[2]); } } @@ -5832,7 +5832,7 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, const DVector3 &pos1 puff->target = source; // Angle is the opposite of the hit direction (i.e. the puff faces the source.) - puff->Angles.Yaw = hitdir + 180; + puff->Angles.Yaw = hitdir + DAngle::fromDeg(180); // If a puff has a crash state and an actor was not hit, // it will enter the crash state. This is used by the StrifeSpark @@ -6036,7 +6036,7 @@ void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle) } if (bloodtype >= 1) { - P_DrawSplash2 (originator->Level, 40, pos, hitangle-180., 2, originator->BloodColor); + P_DrawSplash2 (originator->Level, 40, pos, hitangle - DAngle::fromDeg(180.), 2, originator->BloodColor); } } @@ -6077,7 +6077,7 @@ void P_BloodSplatter2 (const DVector3 &pos, AActor *originator, DAngle hitangle) } if (bloodtype >= 1) { - P_DrawSplash2(originator->Level, 40, pos + add, hitangle - 180., 2, originator->BloodColor); + P_DrawSplash2(originator->Level, 40, pos + add, hitangle - DAngle::fromDeg(180.), 2, originator->BloodColor); } } @@ -6137,7 +6137,7 @@ void P_RipperBlood (AActor *mo, AActor *bleeder) } if (bloodtype >= 1) { - P_DrawSplash2(bleeder->Level, 28, pos, bleeder->AngleTo(mo) + 180., 0, bleeder->BloodColor); + P_DrawSplash2(bleeder->Level, 28, pos, bleeder->AngleTo(mo) + DAngle::fromDeg(180.), 0, bleeder->BloodColor); } } @@ -6604,7 +6604,7 @@ AActor *P_SpawnMissileXYZ (DVector3 pos, AActor *source, AActor *dest, PClassAct // [RC] Now monsters can aim at invisible player as if they were fully visible. if (dest->flags & MF_SHADOW && !(source->flags6 & MF6_SEEINVISIBLE)) { - DAngle an = pr_spawnmissile.Random2() * (22.5 / 256); + DAngle an = DAngle::fromDeg(pr_spawnmissile.Random2() * (22.5 / 256)); double c = an.Cos(); double s = an.Sin(); @@ -6737,7 +6737,7 @@ AActor *P_SpawnMissileZAimed (AActor *source, double z, AActor *dest, PClassActo if (dest->flags & MF_SHADOW) { - an += pr_spawnmissile.Random2() * (16. / 360.); + an += DAngle::fromDeg(pr_spawnmissile.Random2() * (16. / 360.)); } dist = source->Distance2D (dest); speed = GetDefaultSpeed (type); @@ -6874,7 +6874,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, double x, double y, double z, DAngle pitch; FTranslatedLineTarget scratch; AActor *defaultobject = GetDefaultByType(type); - DAngle vrange = nofreeaim ? 35. : 0.; + DAngle vrange = DAngle::fromDeg(nofreeaim ? 35. : 0.); if (!pLineTarget) pLineTarget = &scratch; if (!(aimflags & ALF_NOWEAPONCHECK) && source->player && source->player->ReadyWeapon && ((source->player->ReadyWeapon->IntVar(NAME_WeaponFlags) & WIF_NOAUTOAIM) || noautoaim)) @@ -6894,7 +6894,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, double x, double y, double z, int i = 2; do { - an = angle + angdiff[i]; + an = angle + DAngle::fromDeg(angdiff[i]); pitch = P_AimLineAttack (source, an, linetargetrange, pLineTarget, vrange, aimflags); if (source->player != NULL && @@ -6911,7 +6911,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, double x, double y, double z, an = angle; if (nofreeaim || !source->Level->IsFreelookAllowed()) { - pitch = 0.; + pitch = nullAngle; } } } diff --git a/src/playsim/p_pspr.cpp b/src/playsim/p_pspr.cpp index b9e8655a0..e812be344 100644 --- a/src/playsim/p_pspr.cpp +++ b/src/playsim/p_pspr.cpp @@ -182,7 +182,7 @@ DPSprite::DPSprite(player_t *owner, AActor *caller, int id) { Caller = caller; baseScale = {1.0, 1.2}; - rotation = 0.; + rotation = nullAngle; scale = {1.0, 1.0}; pivot = {0.0, 0.0}; for (int i = 0; i < 4; i++) @@ -1204,8 +1204,8 @@ DAngle P_BulletSlope (AActor *mo, FTranslatedLineTarget *pLineTarget, int aimfla i = 2; do { - an = mo->Angles.Yaw + angdiff[i]; - pitch = P_AimLineAttack (mo, an, 16.*64, pLineTarget, 0., aimflags); + an = mo->Angles.Yaw + DAngle::fromDeg(angdiff[i]); + pitch = P_AimLineAttack (mo, an, 16.*64, pLineTarget, nullAngle, aimflags); if (mo->player != nullptr && mo->Level->IsFreelookAllowed() && diff --git a/src/playsim/p_sectors.cpp b/src/playsim/p_sectors.cpp index b0aba23c1..2fe1130b5 100644 --- a/src/playsim/p_sectors.cpp +++ b/src/playsim/p_sectors.cpp @@ -1401,12 +1401,12 @@ bool FLevelLocals::AlignFlat (int linenum, int side, int fc) return false; DAngle angle = line->Delta().Angle(); - DAngle norm = angle - 90; + DAngle norm = angle - DAngle::fromDeg(90.); double dist = -(norm.Cos() * line->v1->fX() + norm.Sin() * line->v1->fY()); if (side) { - angle += 180.; + angle += DAngle::fromDeg(180.); dist = -dist; } diff --git a/src/playsim/p_teleport.cpp b/src/playsim/p_teleport.cpp index 356576c35..19c430e2b 100644 --- a/src/playsim/p_teleport.cpp +++ b/src/playsim/p_teleport.cpp @@ -170,7 +170,7 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags) player->viewz = thing->Z() + player->viewheight; if (resetpitch) { - player->mo->Angles.Pitch = 0.; + player->mo->Angles.Pitch = nullAngle; } } if (!(flags & TELF_KEEPORIENTATION)) @@ -359,10 +359,10 @@ bool FLevelLocals::EV_Teleport (int tid, int tag, line_t *line, int side, AActor { AActor *searcher; double z; - DAngle angle = 0.; + DAngle angle = nullAngle; double s = 0, c = 0; double vx = 0, vy = 0; - DAngle badangle = 0.; + DAngle badangle = nullAngle; if (thing == NULL) { // Teleport function called with an invalid actor @@ -389,7 +389,7 @@ bool FLevelLocals::EV_Teleport (int tid, int tag, line_t *line, int side, AActor // Rotate 90 degrees, so that walking perpendicularly across // teleporter linedef causes thing to exit in the direction // indicated by the exit thing. - angle = line->Delta().Angle() - searcher->Angles.Yaw + 90.; + angle = line->Delta().Angle() - searcher->Angles.Yaw + DAngle::fromDeg(90.); if (flags & TELF_ROTATEBOOMINVERSE) angle = -angle; // Sine, cosine of angle adjustment @@ -412,7 +412,7 @@ bool FLevelLocals::EV_Teleport (int tid, int tag, line_t *line, int side, AActor } if ((i_compatflags2 & COMPATF2_BADANGLES) && (thing->player != NULL)) { - badangle = 0.01; + badangle = DAngle::fromDeg(0.01); } if (P_Teleport (thing, DVector3(searcher->Pos(), z), searcher->Angles.Yaw + badangle, flags)) { @@ -502,7 +502,7 @@ bool FLevelLocals::EV_SilentLineTeleport (line_t *line, int side, AActor *thing, if (!reverse) { - angle += 180.; + angle += DAngle::fromDeg(180.); pos = 1 - pos; } @@ -666,7 +666,7 @@ bool DoGroupForOne (AActor *victim, AActor *source, AActor *dest, bool floorz, b bool res = P_Teleport (victim, DVector3(dest->Pos().XY() + newp, z), - 0., flags); + nullAngle, flags); // P_Teleport only changes angle if fog is true victim->Angles.Yaw = (dest->Angles.Yaw + victim->Angles.Yaw - source->Angles.Yaw).Normalized360(); @@ -725,7 +725,7 @@ bool FLevelLocals::EV_TeleportGroup (int group_tid, AActor *victim, int source_t if (moveSource && didSomething) { didSomething |= - P_Teleport (sourceOrigin, destOrigin->PosAtZ(floorz ? ONFLOORZ : destOrigin->Z()), 0., TELF_KEEPORIENTATION); + P_Teleport (sourceOrigin, destOrigin->PosAtZ(floorz ? ONFLOORZ : destOrigin->Z()), nullAngle, TELF_KEEPORIENTATION); sourceOrigin->Angles.Yaw = destOrigin->Angles.Yaw; } diff --git a/src/playsim/po_man.cpp b/src/playsim/po_man.cpp index 8d100bb71..3c8583a81 100644 --- a/src/playsim/po_man.cpp +++ b/src/playsim/po_man.cpp @@ -226,7 +226,7 @@ void DMovePoly::Serialize(FSerializer &arc) void DMovePoly::Construct(FPolyObj *polyNum) { Super::Construct(polyNum); - m_Angle = 0.; + m_Angle = nullAngle; m_Speedv = { 0,0 }; } @@ -275,7 +275,7 @@ void DPolyDoor::Construct (FPolyObj * polyNum, podoortype_t type) { Super::Construct(polyNum); m_Type = type; - m_Direction = 0.; + m_Direction = nullAngle; m_TotalDist = 0; m_Tics = 0; m_WaitTics = 0; @@ -300,7 +300,7 @@ void DRotatePoly::Tick () m_Speed = m_Speed < 0 ? -m_Dist : m_Dist; } - if (m_PolyObj->RotatePolyobj (m_Speed)) + if (m_PolyObj->RotatePolyobj (DAngle::fromDeg(m_Speed))) { if (m_Dist == -1) { // perpetual polyobj @@ -442,7 +442,7 @@ bool EV_MovePoly (FLevelLocals *Level, line_t *line, int polyNum, double speed, pe->StopInterpolation (); } - angle += 180.; // Reverse the angle. + angle += DAngle::fromDeg(180.); // Reverse the angle. } return pe != nullptr; // Return true if something started moving. } @@ -585,7 +585,7 @@ void DPolyDoor::Tick () break; case PODOOR_SWING: - if (m_Dist <= 0 || m_PolyObj->RotatePolyobj (m_Speed)) + if (m_Dist <= 0 || m_PolyObj->RotatePolyobj(DAngle::fromDeg(m_Speed))) { double absSpeed = fabs (m_Speed); m_Dist -= absSpeed; @@ -668,7 +668,7 @@ bool EV_OpenPolyDoor(FLevelLocals *Level, line_t *line, int polyNum, double spee pd->m_Direction = angle; pd->m_Speedv = angle.ToVector(speed); SN_StartSequence (poly, poly->seqType, SEQ_DOOR, 0); - angle += 180.; // reverse the angle + angle += DAngle::fromDeg(180.); // reverse the angle } else if (type == PODOOR_SWING) { @@ -718,7 +718,7 @@ bool EV_StopPoly(FLevelLocals *Level, int polynum) FPolyObj::FPolyObj() { StartSpot.pos = { 0,0 }; - Angle = 0.; + Angle = nullAngle; tag = 0; memset(bbox, 0, sizeof(bbox)); validcount = 0; @@ -762,7 +762,7 @@ void FPolyObj::ThrustMobj (AActor *actor, side_t *side) } vertex_t *v1 = side->V1(); vertex_t *v2 = side->V2(); - thrustAngle = (v2->fPos() - v1->fPos()).Angle() - 90.; + thrustAngle = (v2->fPos() - v1->fPos()).Angle() - DAngle::fromDeg(90.); pe = static_cast(specialdata); if (pe) diff --git a/src/playsim/portal.cpp b/src/playsim/portal.cpp index 1086315ed..b2c423afb 100644 --- a/src/playsim/portal.cpp +++ b/src/playsim/portal.cpp @@ -208,7 +208,7 @@ static void SetPortalRotation(FLinePortal *port) { line_t *dst = port->mDestination; line_t *line = port->mOrigin; - DAngle angle = dst->Delta().Angle() - line->Delta().Angle() + 180.; + DAngle angle = dst->Delta().Angle() - line->Delta().Angle() + DAngle::fromDeg(180.); port->mSinRot = sindeg(angle.Degrees); // Here precision matters so use the slower but more precise versions. port->mCosRot = cosdeg(angle.Degrees); port->mAngleDiff = angle; @@ -226,7 +226,7 @@ static void SetPortalRotation(FLinePortal *port) // Linked portals have no angular difference. port->mSinRot = 0.; port->mCosRot = 1.; - port->mAngleDiff = 0.; + port->mAngleDiff = nullAngle; } } } diff --git a/src/r_data/sprites.cpp b/src/r_data/sprites.cpp index 28ebff2e2..960317646 100644 --- a/src/r_data/sprites.cpp +++ b/src/r_data/sprites.cpp @@ -77,19 +77,19 @@ FTextureID spritedef_t::GetSpriteFrame(int frame, int rot, DAngle ang, bool *mir { if ((sprframe->Texture[0] == sprframe->Texture[1]) && flipagain) { - rot = (360.0 - ang + 45.0 / 2 * 9).BAMs() >> 28; + rot = (- ang + DAngle::fromDeg(360.0 + 45.0 / 2 * 9)).BAMs() >> 28; } else if (sprframe->Texture[0] == sprframe->Texture[1]) { - rot = (ang + 45.0 / 2 * 9).BAMs() >> 28; + rot = (ang + DAngle::fromDeg(45.0 / 2 * 9)).BAMs() >> 28; } else if (flipagain) { - rot = (360.0 - ang + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; + rot = (- ang + DAngle::fromDeg(360.0 + (45.0 / 2 * 9 - 180.0 / 16))).BAMs() >> 28; } else { - rot = (ang + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; + rot = (ang + DAngle::fromDeg(45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; } } if (mirror) *mirror = !!(sprframe->Flip&(1 << rot)); diff --git a/src/r_data/voxeldef.cpp b/src/r_data/voxeldef.cpp index 237a77c58..89c114658 100644 --- a/src/r_data/voxeldef.cpp +++ b/src/r_data/voxeldef.cpp @@ -53,7 +53,7 @@ struct VoxelOptions { VoxelOptions() - : DroppedSpin(0), PlacedSpin(0), Scale(1.), AngleOffset(90.), OverridePalette(false), + : DroppedSpin(0), PlacedSpin(0), Scale(1.), AngleOffset(DAngle::fromDeg(90.)), OverridePalette(false), PitchFromMomentum(false), UseActorPitch(false), UseActorRoll(false) {} @@ -178,7 +178,7 @@ static void VOX_ReadOptions(FScanner &sc, VoxelOptions &opts) { sc.TokenMustBe(TK_FloatConst); } - opts.AngleOffset = mul * sc.Float + 90.; + opts.AngleOffset = DAngle::fromDeg(mul * sc.Float + 90.); } else if (sc.Compare("overridepalette")) { diff --git a/src/rendering/hwrenderer/hw_entrypoint.cpp b/src/rendering/hwrenderer/hw_entrypoint.cpp index a2851c8f6..e14e41f68 100644 --- a/src/rendering/hwrenderer/hw_entrypoint.cpp +++ b/src/rendering/hwrenderer/hw_entrypoint.cpp @@ -159,7 +159,7 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou // Only used by the GLES2 renderer RenderState.SetSpecialColormap(cm, flash); - di->Viewpoint.FieldOfView = fov; // Set the real FOV for the current scene (it's not necessarily the same as the global setting in r_viewpoint) + di->Viewpoint.FieldOfView = DAngle::fromDeg(fov); // Set the real FOV for the current scene (it's not necessarily the same as the global setting in r_viewpoint) // Stereo mode specific perspective projection di->VPUniforms.mProjectionMatrix = eye.GetProjection(fov, ratio, fovratio); diff --git a/src/rendering/hwrenderer/scene/hw_drawinfo.cpp b/src/rendering/hwrenderer/scene/hw_drawinfo.cpp index 14eb54c83..61be1b159 100644 --- a/src/rendering/hwrenderer/scene/hw_drawinfo.cpp +++ b/src/rendering/hwrenderer/scene/hw_drawinfo.cpp @@ -354,7 +354,7 @@ angle_t HWDrawInfo::FrustumAngle() // ok, this is a gross hack that barely works... // but at least it doesn't overestimate too much... double floatangle = 2.0 + (45.0 + ((tilt / 1.9)))*Viewpoint.FieldOfView.Degrees*48.0 / AspectMultiplier(r_viewwindow.WidescreenRatio) / 90.0; - angle_t a1 = DAngle(floatangle).BAMs(); + angle_t a1 = DAngle::fromDeg(floatangle).BAMs(); if (a1 >= ANGLE_180) return 0xffffffff; return a1; } diff --git a/src/rendering/hwrenderer/scene/hw_sprites.cpp b/src/rendering/hwrenderer/scene/hw_sprites.cpp index 3e44171db..a27b65e1a 100644 --- a/src/rendering/hwrenderer/scene/hw_sprites.cpp +++ b/src/rendering/hwrenderer/scene/hw_sprites.cpp @@ -352,7 +352,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp) // Tilt the actor up or down based on pitch (increase 'somersaults' forward). // Then counteract the roll and DO A BARREL ROLL. - FAngle pitch = (float)-Angles.Pitch.Degrees; + FAngle pitch = FAngle::fromDeg(-Angles.Pitch.Degrees); pitch.Normalized180(); mat.Translate(x, z, y); @@ -429,7 +429,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp) // [fgsfds] calculate yaw vectors float yawvecX = 0, yawvecY = 0, rollDegrees = 0; - float angleRad = (270. - HWAngles.Yaw).Radians(); + float angleRad = (FAngle::fromDeg(270.) - HWAngles.Yaw).Radians(); if (actor) rollDegrees = Angles.Roll.Degrees; if (isFlatSprite) { @@ -870,16 +870,16 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t if (sprframe->Texture[0] == sprframe->Texture[1]) { if (thing->flags7 & MF7_SPRITEANGLE) - rot = (thing->SpriteAngle + 45.0 / 2 * 9).BAMs() >> 28; + rot = (thing->SpriteAngle + DAngle::fromDeg(45.0 / 2 * 9)).BAMs() >> 28; else - rot = (sprang - (thing->Angles.Yaw + thing->SpriteRotation) + 45.0 / 2 * 9).BAMs() >> 28; + rot = (sprang - (thing->Angles.Yaw + thing->SpriteRotation) + DAngle::fromDeg(45.0 / 2 * 9)).BAMs() >> 28; } else { if (thing->flags7 & MF7_SPRITEANGLE) - rot = (thing->SpriteAngle + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; + rot = (thing->SpriteAngle + DAngle::fromDeg(45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; else - rot = (sprang - (thing->Angles.Yaw + thing->SpriteRotation) + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; + rot = (sprang - (thing->Angles.Yaw + thing->SpriteRotation) + DAngle::fromDeg(45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; } auto picnum = sprframe->Texture[rot]; if (sprframe->Flip & (1 << rot)) @@ -902,7 +902,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t else { // Flat sprites cannot rotate in a predictable manner. - sprangle = 0.; + sprangle = nullAngle; rot = 0; } patch = sprites[spritenum].GetSpriteFrame(thing->frame, rot, sprangle, &mirror, !!(thing->renderflags & RF_SPRITEFLIP)); diff --git a/src/rendering/hwrenderer/scene/hw_weapon.cpp b/src/rendering/hwrenderer/scene/hw_weapon.cpp index 5125b41b9..17a99a3a3 100644 --- a/src/rendering/hwrenderer/scene/hw_weapon.cpp +++ b/src/rendering/hwrenderer/scene/hw_weapon.cpp @@ -140,7 +140,7 @@ static bool isBright(DPSprite *psp) if (psp != nullptr && psp->GetState() != nullptr) { bool disablefullbright = false; - FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., nullptr); + FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, nullAngle, nullptr); if (lump.isValid()) { auto tex = TexMan.GetGameTexture(lump, true); @@ -416,7 +416,7 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy, // decide which patch to use bool mirror; - FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., &mirror); + FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, nullAngle, &mirror); if (!lump.isValid()) return false; auto tex = TexMan.GetGameTexture(lump, false); @@ -508,7 +508,7 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy, // Handle PSPF_FLIP. if (flip) anchorx = 1.0 - anchorx; - FAngle rot = float((flip) ? -psp->rotation.Degrees : psp->rotation.Degrees); + FAngle rot = FAngle::fromDeg(float((flip) ? -psp->rotation.Degrees : psp->rotation.Degrees)); const float cosang = rot.Cos(); const float sinang = rot.Sin(); diff --git a/src/rendering/r_utility.cpp b/src/rendering/r_utility.cpp index aa85d6e99..95306c64b 100644 --- a/src/rendering/r_utility.cpp +++ b/src/rendering/r_utility.cpp @@ -130,7 +130,7 @@ FRenderViewpoint::FRenderViewpoint() player = nullptr; Pos = { 0.0, 0.0, 0.0 }; ActorPos = { 0.0, 0.0, 0.0 }; - Angles = { 0.0, 0.0, 0.0 }; + Angles = { nullAngle, nullAngle, nullAngle }; Path[0] = { 0.0, 0.0, 0.0 }; Path[1] = { 0.0, 0.0, 0.0 }; Cos = 0.0; @@ -139,7 +139,7 @@ FRenderViewpoint::FRenderViewpoint() TanSin = 0.0; camera = nullptr; sector = nullptr; - FieldOfView = 90.; // Angles in the SCREENWIDTH wide window + FieldOfView = DAngle::fromDeg(90.); // Angles in the SCREENWIDTH wide window TicFrac = 0.0; FrameTime = 0; extralight = 0; @@ -180,8 +180,8 @@ DEFINE_GLOBAL(LocalViewPitch); void R_SetFOV (FRenderViewpoint &viewpoint, DAngle fov) { - if (fov < 5.) fov = 5.; - else if (fov > 170.) fov = 170.; + if (fov < 5.) fov = DAngle::fromDeg(5.); + else if (fov > 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 = 170.; + if (fov > 170.) fov = DAngle::fromDeg(170.); } viewwindow.FocalTangent = tan(fov.Radians() / 2); } @@ -454,12 +454,12 @@ void R_InterpolateView (FRenderViewpoint &viewpoint, player_t *player, double Fr double pathlen = 0; double zdiff = 0; double totalzdiff = 0; - DAngle adiff = 0.; - DAngle totaladiff = 0.; + DAngle adiff = nullAngle; + DAngle totaladiff = nullAngle; double oviewz = iview->Old.Pos.Z; double nviewz = iview->New.Pos.Z; - DVector3a oldpos = { { iview->Old.Pos.X, iview->Old.Pos.Y, 0 }, 0. }; - DVector3a newpos = { { iview->New.Pos.X, iview->New.Pos.Y, 0 }, 0. }; + DVector3a oldpos = { { iview->Old.Pos.X, iview->Old.Pos.Y, 0 }, nullAngle }; + DVector3a newpos = { { iview->New.Pos.X, iview->New.Pos.Y, 0 }, nullAngle }; InterpolationPath.Push(newpos); // add this to the array to simplify the loops below for (unsigned i = 0; i < InterpolationPath.Size(); i += 2) @@ -527,8 +527,8 @@ void R_InterpolateView (FRenderViewpoint &viewpoint, player_t *player, double Fr (!netgame || !cl_noprediction) && !LocalKeyboardTurner) { - viewpoint.Angles.Yaw = (nviewangle + AngleToFloat(LocalViewAngle & 0xFFFF0000)).Normalized180(); - DAngle delta = player->centering ? DAngle(0.) : AngleToFloat(int(LocalViewPitch & 0xFFFF0000)); + viewpoint.Angles.Yaw = (nviewangle + DAngle::fromBam(LocalViewAngle & 0xFFFF0000)).Normalized180(); + DAngle delta = player->centering ? nullAngle : DAngle::fromBam(int(LocalViewPitch & 0xFFFF0000)); viewpoint.Angles.Pitch = clamp((iview->New.Angles.Pitch - delta).Normalized180(), player->MinPitch, player->MaxPitch); viewpoint.Angles.Roll = iview->New.Angles.Roll.Normalized180(); } @@ -599,7 +599,7 @@ void FRenderViewpoint::SetViewAngle (const FViewWindow &viewwindow) DVector2 v = Angles.Yaw.ToVector(); ViewVector.X = v.X; ViewVector.Y = v.Y; - HWAngles.Yaw = float(270.0 - Angles.Yaw.Degrees); + HWAngles.Yaw = FAngle::fromDeg(270.0 - Angles.Yaw.Degrees); } @@ -958,7 +958,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor DVector3 pos; pos.Zero(); if (jiggers.RollIntensity != 0 || jiggers.RollWave != 0) { - viewpoint.Angles.Roll += QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave); + viewpoint.Angles.Roll += DAngle::fromDeg(QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave)); } if (jiggers.RelIntensity.X != 0 || jiggers.RelOffset.X != 0) { @@ -1115,7 +1115,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor double angx = cos(radPitch); double angy = sin(radPitch) * actor->Level->info->pixelstretch; double alen = sqrt(angx*angx + angy*angy); - viewpoint.HWAngles.Pitch = RAD2DEG((float)asin(angy / alen)); + viewpoint.HWAngles.Pitch = FAngle::fromRad((float)asin(angy / alen)); viewpoint.HWAngles.Roll.Degrees = (float)viewpoint.Angles.Roll.Degrees; // copied for convenience. diff --git a/src/rendering/swrenderer/plane/r_flatplane.cpp b/src/rendering/swrenderer/plane/r_flatplane.cpp index fd0a1dd4a..639e28d51 100644 --- a/src/rendering/swrenderer/plane/r_flatplane.cpp +++ b/src/rendering/swrenderer/plane/r_flatplane.cpp @@ -92,7 +92,7 @@ namespace swrenderer pviewy = _yscale * pviewy; // left to right mapping - planeang += (Thread->Viewport->viewpoint.Angles.Yaw - 90).Radians(); + planeang += (Thread->Viewport->viewpoint.Angles.Yaw - DAngle::fromDeg(90)).Radians(); auto viewport = Thread->Viewport.get(); diff --git a/src/rendering/swrenderer/plane/r_visibleplane.h b/src/rendering/swrenderer/plane/r_visibleplane.h index 101be05bc..fcb5c6786 100644 --- a/src/rendering/swrenderer/plane/r_visibleplane.h +++ b/src/rendering/swrenderer/plane/r_visibleplane.h @@ -70,7 +70,7 @@ namespace swrenderer int extralight = 0; double visibility = 0.0; DVector3 viewpos = { 0.0, 0.0, 0.0 }; - DAngle viewangle = { 0.0 }; + DAngle viewangle = nullAngle; fixed_t Alpha = 0; bool Additive = false; diff --git a/src/rendering/swrenderer/plane/r_visibleplanelist.cpp b/src/rendering/swrenderer/plane/r_visibleplanelist.cpp index 791ae8587..bddc4f232 100644 --- a/src/rendering/swrenderer/plane/r_visibleplanelist.cpp +++ b/src/rendering/swrenderer/plane/r_visibleplanelist.cpp @@ -121,7 +121,7 @@ namespace swrenderer xform = &nulltransform; nulltransform.xOffs = nulltransform.yOffs = nulltransform.baseyOffs = 0; nulltransform.xScale = nulltransform.yScale = 1; - nulltransform.Angle = nulltransform.baseAngle = 0.0; + nulltransform.Angle = nulltransform.baseAngle = nullAngle; additive = false; // [RH] Map floor skies and ceiling skies to separate visplanes. This isn't // always necessary, but it is needed if a floor and ceiling sky are in the diff --git a/src/rendering/swrenderer/r_swrenderer.cpp b/src/rendering/swrenderer/r_swrenderer.cpp index 66ebb7484..4c2414db5 100644 --- a/src/rendering/swrenderer/r_swrenderer.cpp +++ b/src/rendering/swrenderer/r_swrenderer.cpp @@ -250,7 +250,7 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *camtex, AActor *viewp CameraLight savedCameraLight = *CameraLight::Instance(); DAngle savedfov = cameraViewpoint.FieldOfView; - R_SetFOV (cameraViewpoint, fov); + R_SetFOV (cameraViewpoint, DAngle::fromDeg(fov)); mScene.RenderViewToCanvas(viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), camtex->bFirstUpdate); diff --git a/src/rendering/swrenderer/scene/r_opaque_pass.cpp b/src/rendering/swrenderer/scene/r_opaque_pass.cpp index 09c4344ba..6b5592f1f 100644 --- a/src/rendering/swrenderer/scene/r_opaque_pass.cpp +++ b/src/rendering/swrenderer/scene/r_opaque_pass.cpp @@ -1072,16 +1072,16 @@ namespace swrenderer if (sprframe->Texture[0] == sprframe->Texture[1]) { if (thing->flags7 & MF7_SPRITEANGLE) - rot = (thing->SpriteAngle + 45.0 / 2 * 9).BAMs() >> 28; + rot = (thing->SpriteAngle + DAngle::fromDeg(45.0 / 2 * 9)).BAMs() >> 28; else - rot = (ang - (thing->Angles.Yaw + thing->SpriteRotation) + 45.0 / 2 * 9).BAMs() >> 28; + rot = (ang - (thing->Angles.Yaw + thing->SpriteRotation) + DAngle::fromDeg(45.0 / 2 * 9)).BAMs() >> 28; } else { if (thing->flags7 & MF7_SPRITEANGLE) - rot = (thing->SpriteAngle + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; + rot = (thing->SpriteAngle + DAngle::fromDeg(45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; else - rot = (ang - (thing->Angles.Yaw + thing->SpriteRotation) + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; + rot = (ang - (thing->Angles.Yaw + thing->SpriteRotation) + DAngle::fromDeg(45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; } sprite.picnum = sprframe->Texture[rot]; if (sprframe->Flip & (1 << rot)) diff --git a/src/rendering/swrenderer/things/r_voxel.cpp b/src/rendering/swrenderer/things/r_voxel.cpp index fa5a38c68..01cc5174c 100644 --- a/src/rendering/swrenderer/things/r_voxel.cpp +++ b/src/rendering/swrenderer/things/r_voxel.cpp @@ -135,12 +135,12 @@ namespace swrenderer int voxelspin = (thing->flags & MF_DROPPED) ? voxel->DroppedSpin : voxel->PlacedSpin; if (voxelspin != 0) { - DAngle ang = double(screen->FrameTime) * voxelspin / 1000; + DAngle ang = DAngle::fromDeg((screen->FrameTime) * voxelspin / 1000.); vis->Angle -= ang; } vis->pa.vpos = { (float)thread->Viewport->viewpoint.Pos.X, (float)thread->Viewport->viewpoint.Pos.Y, (float)thread->Viewport->viewpoint.Pos.Z }; - vis->pa.vang = FAngle((float)thread->Viewport->viewpoint.Angles.Yaw.Degrees); + vis->pa.vang = FAngle::fromDeg(((float)thread->Viewport->viewpoint.Angles.Yaw.Degrees)); // killough 3/27/98: save sector for special clipping later vis->heightsec = heightsec; diff --git a/src/rendering/swrenderer/things/r_voxel.h b/src/rendering/swrenderer/things/r_voxel.h index d9164899b..94405ef97 100644 --- a/src/rendering/swrenderer/things/r_voxel.h +++ b/src/rendering/swrenderer/things/r_voxel.h @@ -70,7 +70,7 @@ namespace swrenderer struct posang { FVector3 vpos = { 0.0f, 0.0f, 0.0f }; // view origin - FAngle vang = { 0.0f }; // view angle + FAngle vang = nullFAngle; // view angle }; struct VoxelBlockEntry @@ -80,7 +80,7 @@ namespace swrenderer }; posang pa; - DAngle Angle = { 0.0 }; + DAngle Angle = nullAngle; fixed_t xscale = 0; FVoxel *voxel = nullptr; bool bInMirror = false; diff --git a/src/rendering/swrenderer/things/r_wallsprite.cpp b/src/rendering/swrenderer/things/r_wallsprite.cpp index e00b38148..b4dcc9bf2 100644 --- a/src/rendering/swrenderer/things/r_wallsprite.cpp +++ b/src/rendering/swrenderer/things/r_wallsprite.cpp @@ -75,7 +75,7 @@ namespace swrenderer double x1, x2; DVector2 left, right; double gzb, gzt, tz; - DAngle ang = thing->Angles.Yaw + 90; + DAngle ang = thing->Angles.Yaw + DAngle::fromDeg(90); double angcos = ang.Cos(); double angsin = ang.Sin(); diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index a10d6e449..7eaebda6c 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -805,7 +805,7 @@ void SynthesizeFlagFields() DEFINE_ACTION_FUNCTION(DObject, BAM) { PARAM_PROLOGUE; - PARAM_FLOAT(ang); - ACTION_RETURN_INT(DAngle(ang).BAMs()); + PARAM_ANGLE(ang); + ACTION_RETURN_INT(ang.BAMs()); } diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index 061820ca7..78c643786 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -959,7 +959,7 @@ DEFINE_PROPERTY(gravity, F, Actor) DEFINE_PROPERTY(spriteangle, F, Actor) { PROP_DOUBLE_PARM(i, 0); - defaults->SpriteAngle = i; + defaults->SpriteAngle = DAngle::fromDeg(i); } //========================================================================== diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index ea78ed58e..4d6502d1f 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -647,7 +647,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset) static void SetAngle(sector_t *self, int pos, double o) { - self->SetAngle(pos, o); + self->SetAngle(pos, DAngle::fromDeg(o)); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetAngle, SetAngle) @@ -674,7 +674,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset) static void SetBase(sector_t *self, int pos, double o, double a) { - self->SetBase(pos, o, a); + self->SetBase(pos, o, DAngle::fromDeg(a)); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetBase, SetBase) @@ -2427,8 +2427,8 @@ void SphericalCoords(FLevelLocals *self, double vpX, double vpY, double vpZ, dou auto vecTo = absolute ? target - viewpoint : VecDiff(self, viewpoint, target); *result = (DVector3( - deltaangle(vecTo.Angle(), viewYaw).Degrees, - deltaangle(vecTo.Pitch(), viewPitch).Degrees, + deltaangle(vecTo.Angle(), DAngle::fromDeg(viewYaw)).Degrees, + deltaangle(vecTo.Pitch(), DAngle::fromDeg(viewPitch)).Degrees, vecTo.Length() )); diff --git a/src/scripting/vmthunks_actors.cpp b/src/scripting/vmthunks_actors.cpp index a630c6cd8..60cc9f7f1 100644 --- a/src/scripting/vmthunks_actors.cpp +++ b/src/scripting/vmthunks_actors.cpp @@ -239,7 +239,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckKeys, P_CheckKeys) static double deltaangleDbl(double a1, double a2) { - return deltaangle(DAngle(a1), DAngle(a2)).Degrees; + return deltaangle(DAngle::fromDeg(a1), DAngle::fromDeg(a2)).Degrees; } DEFINE_ACTION_FUNCTION_NATIVE(AActor, deltaangle, deltaangleDbl) // should this be global? @@ -247,12 +247,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, deltaangle, deltaangleDbl) // should this PARAM_PROLOGUE; PARAM_FLOAT(a1); PARAM_FLOAT(a2); - ACTION_RETURN_FLOAT(deltaangle(DAngle(a1), DAngle(a2)).Degrees); + ACTION_RETURN_FLOAT(deltaangle(DAngle::fromDeg(a1), DAngle::fromDeg(a2)).Degrees); } static double absangleDbl(double a1, double a2) { - return absangle(DAngle(a1), DAngle(a2)).Degrees; + return absangle(DAngle::fromDeg(a1), DAngle::fromDeg(a2)).Degrees; } DEFINE_ACTION_FUNCTION_NATIVE(AActor, absangle, absangleDbl) // should this be global? @@ -260,7 +260,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, absangle, absangleDbl) // should this be g PARAM_PROLOGUE; PARAM_FLOAT(a1); PARAM_FLOAT(a2); - ACTION_RETURN_FLOAT(absangle(DAngle(a1), DAngle(a2)).Degrees); + ACTION_RETURN_FLOAT(absangle(DAngle::fromDeg(a1), DAngle::fromDeg(a2)).Degrees); } static double Distance2DSquared(AActor *self, AActor *other) @@ -379,7 +379,7 @@ static void VelFromAngle(AActor *self, double speed, double angle) } else { - self->VelFromAngle(speed, angle); + self->VelFromAngle(speed, DAngle::fromDeg(angle)); } } } @@ -395,7 +395,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, VelFromAngle, VelFromAngle) static void Vel3DFromAngle(AActor *self, double speed, double angle, double pitch) { - self->Vel3DFromAngle(angle, pitch, speed); + self->Vel3DFromAngle(DAngle::fromDeg(angle), DAngle::fromDeg(pitch), speed); } // This combines all 3 variations of the internal function @@ -424,7 +424,7 @@ static void Thrust(AActor *self, double speed, double angle) } else { - self->Thrust(angle, speed); + self->Thrust(DAngle::fromDeg(angle), speed); } } } @@ -453,7 +453,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, AngleTo, AngleTo) static void AngleToVector(double angle, double length, DVector2 *result) { - *result = DAngle(angle).ToVector(length); + *result = DAngle::fromDeg(angle).ToVector(length); } DEFINE_ACTION_FUNCTION_NATIVE(AActor, AngleToVector, AngleToVector) @@ -480,7 +480,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, RotateVector, RotateVector) static double Normalize180(double angle) { - return DAngle(angle).Normalized180().Degrees; + return DAngle::fromDeg(angle).Normalized180().Degrees; } DEFINE_ACTION_FUNCTION_NATIVE(AActor, Normalize180, Normalize180) @@ -520,7 +520,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, SetXYZ, SetXYZ) static void Vec2Angle(AActor *self, double length, double angle, bool absolute, DVector2 *result) { - *result = self->Vec2Angle(length, angle, absolute); + *result = self->Vec2Angle(length, DAngle::fromDeg(angle), absolute); } DEFINE_ACTION_FUNCTION_NATIVE(AActor, Vec2Angle, Vec2Angle) @@ -558,7 +558,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, Vec2To, Vec2To) static void Vec3Angle(AActor *self, double length, double angle, double z, bool absolute, DVector3 *result) { - *result = self->Vec3Angle(length, angle, z, absolute); + *result = self->Vec3Angle(length, DAngle::fromDeg(angle), z, absolute); } DEFINE_ACTION_FUNCTION_NATIVE(AActor, Vec3Angle, Vec3Angle) @@ -1151,7 +1151,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckMove, CheckMove) static double AimLineAttack(AActor *self, double angle, double distance, FTranslatedLineTarget *pLineTarget, double vrange, int flags, AActor *target, AActor *friender) { flags &= ~ALF_IGNORENOAUTOAIM; // just to be safe. This flag is not supposed to be accesible to scripting. - return P_AimLineAttack(self, angle, distance, pLineTarget, vrange, flags, target, friender).Degrees; + return P_AimLineAttack(self, DAngle::fromDeg(angle), distance, pLineTarget, DAngle::fromDeg(vrange), flags, target, friender).Degrees; } DEFINE_ACTION_FUNCTION_NATIVE(AActor, AimLineAttack, AimLineAttack) @@ -1170,7 +1170,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, AimLineAttack, AimLineAttack) static AActor *ZS_LineAttack(AActor *self, double angle, double distance, double pitch, int damage, int damageType, PClassActor *puffType, int flags, FTranslatedLineTarget *victim, double offsetz, double offsetforward, double offsetside, int *actualdamage) { if (puffType == nullptr) puffType = PClass::FindActor(NAME_BulletPuff); // P_LineAttack does not work without a puff to take info from. - return P_LineAttack(self, angle, distance, pitch, damage, ENamedName(damageType), puffType, flags, victim, actualdamage, offsetz, offsetforward, offsetside); + return P_LineAttack(self, DAngle::fromDeg(angle), distance, DAngle::fromDeg(pitch), damage, ENamedName(damageType), puffType, flags, victim, actualdamage, offsetz, offsetforward, offsetside); } DEFINE_ACTION_FUNCTION_NATIVE(AActor, LineAttack, ZS_LineAttack) @@ -1197,7 +1197,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, LineAttack, ZS_LineAttack) static int LineTrace(AActor *self, double angle, double distance, double pitch, int flags, double offsetz, double offsetforward, double offsetside, FLineTraceData *data) { - return P_LineTrace(self,angle,distance,pitch,flags,offsetz,offsetforward,offsetside,data); + return P_LineTrace(self,DAngle::fromDeg(angle),distance,DAngle::fromDeg(pitch),flags,offsetz,offsetforward,offsetside,data); } DEFINE_ACTION_FUNCTION_NATIVE(AActor, LineTrace, LineTrace) @@ -1211,12 +1211,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, LineTrace, LineTrace) PARAM_FLOAT(offsetforward); PARAM_FLOAT(offsetside); PARAM_OUTPOINTER(data, FLineTraceData); - ACTION_RETURN_BOOL(P_LineTrace(self,angle,distance,pitch,flags,offsetz,offsetforward,offsetside,data)); + ACTION_RETURN_BOOL(P_LineTrace(self,DAngle::fromDeg(angle),distance,DAngle::fromDeg(pitch),flags,offsetz,offsetforward,offsetside,data)); } static void TraceBleedAngle(AActor *self, int damage, double angle, double pitch) { - P_TraceBleed(damage, self, angle, pitch); + P_TraceBleed(damage, self, DAngle::fromDeg(angle), DAngle::fromDeg(pitch)); } DEFINE_ACTION_FUNCTION_NATIVE(AActor, TraceBleedAngle, TraceBleedAngle) @@ -1226,7 +1226,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, TraceBleedAngle, TraceBleedAngle) PARAM_FLOAT(angle); PARAM_FLOAT(pitch); - P_TraceBleed(damage, self, angle, pitch); + P_TraceBleed(damage, self, DAngle::fromDeg(angle), DAngle::fromDeg(pitch)); return 0; } @@ -1348,7 +1348,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetReplacee, ZS_GetReplacee) static void DrawSplash(AActor *self, int count, double angle, int kind) { - P_DrawSplash(self->Level, count, self->Pos(), angle, kind); + P_DrawSplash(self->Level, count, self->Pos(), DAngle::fromDeg(angle), kind); } DEFINE_ACTION_FUNCTION_NATIVE(AActor, DrawSplash, DrawSplash) @@ -1357,7 +1357,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, DrawSplash, DrawSplash) PARAM_INT(count); PARAM_FLOAT(angle); PARAM_INT(kind); - P_DrawSplash(self->Level, count, self->Pos(), angle, kind); + P_DrawSplash(self->Level, count, self->Pos(), DAngle::fromDeg(angle), kind); return 0; } @@ -1628,7 +1628,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_CheckForResurrection, CheckForResurrecti static void ZS_Face(AActor *self, AActor *faceto, double max_turn, double max_pitch, double ang_offset, double pitch_offset, int flags, double z_add) { - A_Face(self, faceto, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_add); + A_Face(self, faceto, DAngle::fromDeg(max_turn), DAngle::fromDeg(max_pitch), DAngle::fromDeg(ang_offset), DAngle::fromDeg(pitch_offset), flags, z_add); } DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_Face, ZS_Face)