mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-03-10 03:02:21 +00:00
- blocked off direct access to TAngle’s internal storage.
This commit is contained in:
parent
3d2578820b
commit
4032576519
31 changed files with 126 additions and 238 deletions
|
@ -2920,7 +2920,7 @@ void DAutomap::drawThings ()
|
|||
{
|
||||
angle += players[consoleplayer].camera->InterpolatedAngles(r_viewpoint.TicFrac).Yaw - DAngle::fromDeg(90.);
|
||||
}
|
||||
rotation = int((angle.Normalized360() * (16. / 360.)).Degrees);
|
||||
rotation = int((angle.Normalized360() * (16. / 360.)).Degrees());
|
||||
|
||||
const FTextureID textureID = frame->Texture[show > 2 ? rotation : 0];
|
||||
texture = TexMan.GetGameTexture(textureID, true);
|
||||
|
|
|
@ -339,7 +339,7 @@ inline FSerializer& Serialize(FSerializer& arc, const char* key, FVector2& p, FV
|
|||
template<class T>
|
||||
inline FSerializer &Serialize(FSerializer &arc, const char *key, TAngle<T> &p, TAngle<T> *def)
|
||||
{
|
||||
return Serialize(arc, key, p.Degrees, def? &def->Degrees : nullptr);
|
||||
return Serialize(arc, key, p.Degrees__(), def ? &def->Degrees__() : nullptr);
|
||||
}
|
||||
|
||||
inline FSerializer &Serialize(FSerializer &arc, const char *key, PalEntry &pe, PalEntry *def)
|
||||
|
|
|
@ -315,6 +315,10 @@ struct VMValue
|
|||
{
|
||||
i = v;
|
||||
}
|
||||
VMValue(unsigned int v)
|
||||
{
|
||||
i = v;
|
||||
}
|
||||
VMValue(double v)
|
||||
{
|
||||
f = v;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "xs_Float.h"
|
||||
#include "math/cmath.h"
|
||||
|
||||
class FSerializer;
|
||||
|
||||
#define EQUAL_EPSILON (1/65536.)
|
||||
|
||||
|
@ -1144,7 +1145,7 @@ Outside comments: A faster version with only 10 (not 24) multiplies.
|
|||
template<class vec_t>
|
||||
struct TAngle
|
||||
{
|
||||
vec_t Degrees;
|
||||
vec_t Degrees_;
|
||||
|
||||
// This is to catch any accidental attempt to assign an angle_t to this type. Any explicit exception will require a type cast.
|
||||
TAngle(int) = delete;
|
||||
|
@ -1161,14 +1162,16 @@ struct TAngle
|
|||
private:
|
||||
// Both constructors are needed to avoid unnecessary conversions when assigning to FAngle.
|
||||
constexpr TAngle (float amt)
|
||||
: Degrees((vec_t)amt)
|
||||
: Degrees_((vec_t)amt)
|
||||
{
|
||||
}
|
||||
constexpr TAngle (double amt)
|
||||
: Degrees((vec_t)amt)
|
||||
: Degrees_((vec_t)amt)
|
||||
{
|
||||
}
|
||||
public:
|
||||
|
||||
vec_t& Degrees__() { return Degrees_; }
|
||||
|
||||
static constexpr TAngle fromDeg(float deg)
|
||||
{
|
||||
|
@ -1208,188 +1211,86 @@ public:
|
|||
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; }
|
||||
|
||||
constexpr TAngle operator- () const
|
||||
{
|
||||
return TAngle(-Degrees);
|
||||
return TAngle(-Degrees_);
|
||||
}
|
||||
|
||||
constexpr TAngle &operator+= (TAngle other)
|
||||
{
|
||||
Degrees += other.Degrees;
|
||||
Degrees_ += other.Degrees_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr TAngle &operator-= (TAngle other)
|
||||
{
|
||||
Degrees -= other.Degrees;
|
||||
Degrees_ -= other.Degrees_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
TAngle &operator*= (TAngle other)
|
||||
{
|
||||
Degrees *= other.Degrees;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TAngle &operator/= (TAngle other)
|
||||
{
|
||||
Degrees /= other.Degrees;
|
||||
return *this;
|
||||
}
|
||||
*/
|
||||
|
||||
constexpr TAngle operator+ (TAngle other) const
|
||||
{
|
||||
return Degrees + other.Degrees;
|
||||
return Degrees_ + other.Degrees_;
|
||||
}
|
||||
|
||||
constexpr TAngle operator- (TAngle other) const
|
||||
{
|
||||
return Degrees - other.Degrees;
|
||||
return Degrees_ - other.Degrees_;
|
||||
}
|
||||
|
||||
/*
|
||||
constexpr TAngle operator* (TAngle other) const
|
||||
{
|
||||
return Degrees * other.Degrees;
|
||||
}
|
||||
|
||||
constexpr TAngle operator/ (TAngle other) const
|
||||
{
|
||||
return Degrees / other.Degrees;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
TAngle &operator+= (vec_t other)
|
||||
{
|
||||
Degrees = Degrees + other;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TAngle &operator-= (vec_t other)
|
||||
{
|
||||
Degrees = Degrees - other;
|
||||
return *this;
|
||||
}
|
||||
*/
|
||||
|
||||
constexpr TAngle &operator*= (vec_t other)
|
||||
{
|
||||
Degrees = Degrees * other;
|
||||
Degrees_ = Degrees_ * other;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr TAngle &operator/= (vec_t other)
|
||||
{
|
||||
Degrees = Degrees / other;
|
||||
Degrees_ = Degrees_ / other;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
TAngle operator+ (vec_t other) const
|
||||
{
|
||||
return Degrees + other;
|
||||
}
|
||||
|
||||
TAngle operator- (vec_t other) const
|
||||
{
|
||||
return Degrees - other;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
friend TAngle operator- (vec_t o1, TAngle o2)
|
||||
{
|
||||
return TAngle(o1 - o2.Degrees);
|
||||
}
|
||||
*/
|
||||
|
||||
constexpr TAngle operator* (vec_t other) const
|
||||
{
|
||||
return Degrees * other;
|
||||
return Degrees_ * other;
|
||||
}
|
||||
|
||||
constexpr TAngle operator/ (vec_t other) const
|
||||
{
|
||||
return Degrees / other;
|
||||
return Degrees_ / other;
|
||||
}
|
||||
|
||||
// Should the comparisons consider an epsilon value?
|
||||
constexpr bool operator< (TAngle other) const
|
||||
{
|
||||
return Degrees < other.Degrees;
|
||||
return Degrees_ < other.Degrees_;
|
||||
}
|
||||
|
||||
constexpr bool operator> (TAngle other) const
|
||||
{
|
||||
return Degrees > other.Degrees;
|
||||
return Degrees_ > other.Degrees_;
|
||||
}
|
||||
|
||||
constexpr bool operator<= (TAngle other) const
|
||||
{
|
||||
return Degrees <= other.Degrees;
|
||||
return Degrees_ <= other.Degrees_;
|
||||
}
|
||||
|
||||
constexpr bool operator>= (TAngle other) const
|
||||
{
|
||||
return Degrees >= other.Degrees;
|
||||
return Degrees_ >= other.Degrees_;
|
||||
}
|
||||
|
||||
constexpr bool operator== (TAngle other) const
|
||||
{
|
||||
return Degrees == other.Degrees;
|
||||
return Degrees_ == other.Degrees_;
|
||||
}
|
||||
|
||||
constexpr bool operator!= (TAngle other) const
|
||||
{
|
||||
return Degrees != other.Degrees;
|
||||
return Degrees_ != other.Degrees_;
|
||||
}
|
||||
|
||||
/*
|
||||
constexpr bool operator< (vec_t other) const
|
||||
{
|
||||
return Degrees < other;
|
||||
}
|
||||
|
||||
constexpr bool operator> (vec_t other) const
|
||||
{
|
||||
return Degrees > other;
|
||||
}
|
||||
|
||||
constexpr bool operator<= (vec_t other) const
|
||||
{
|
||||
return Degrees <= other;
|
||||
}
|
||||
|
||||
constexpr bool operator>= (vec_t other) const
|
||||
{
|
||||
return Degrees >= other;
|
||||
}
|
||||
|
||||
constexpr bool operator== (vec_t other) const
|
||||
{
|
||||
return Degrees == other;
|
||||
}
|
||||
|
||||
constexpr bool operator!= (vec_t other) const
|
||||
{
|
||||
return Degrees != other;
|
||||
}
|
||||
*/
|
||||
|
||||
// Ensure the angle is between [0.0,360.0) degrees
|
||||
TAngle Normalized360() const
|
||||
{
|
||||
|
@ -1406,12 +1307,17 @@ public:
|
|||
|
||||
constexpr vec_t Radians() const
|
||||
{
|
||||
return vec_t(Degrees * (pi::pi() / 180.0));
|
||||
return vec_t(Degrees_ * (pi::pi() / 180.0));
|
||||
}
|
||||
|
||||
unsigned BAMs() const
|
||||
{
|
||||
return xs_CRoundToInt(Degrees * (0x40000000 / 90.));
|
||||
return xs_CRoundToInt(Degrees_ * (0x40000000 / 90.));
|
||||
}
|
||||
|
||||
vec_t Degrees() const
|
||||
{
|
||||
return Degrees_;
|
||||
}
|
||||
|
||||
TVector2<vec_t> ToVector(vec_t length = 1) const
|
||||
|
@ -1421,12 +1327,12 @@ public:
|
|||
|
||||
vec_t Cos() const
|
||||
{
|
||||
return vec_t(g_cosdeg(Degrees));
|
||||
return vec_t(g_cosdeg(Degrees_));
|
||||
}
|
||||
|
||||
vec_t Sin() const
|
||||
{
|
||||
return vec_t(g_sindeg(Degrees));
|
||||
return vec_t(g_sindeg(Degrees_));
|
||||
}
|
||||
|
||||
double Tan() const
|
||||
|
@ -1439,12 +1345,6 @@ public:
|
|||
{
|
||||
return clamp(Tan(), -max, max);
|
||||
}
|
||||
|
||||
static inline TAngle ToDegrees(double rad)
|
||||
{
|
||||
return TAngle(double(rad * (180.0 / pi::pi())));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Emulates the old floatbob offset table with direct calls to trig functions.
|
||||
|
@ -1456,7 +1356,13 @@ inline double BobSin(double fb)
|
|||
template<class T>
|
||||
inline TAngle<T> fabs (const TAngle<T> °)
|
||||
{
|
||||
return TAngle<T>::fromDeg(fabs(deg.Degrees));
|
||||
return TAngle<T>::fromDeg(fabs(deg.Degrees()));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline TAngle<T> abs (const TAngle<T> °)
|
||||
{
|
||||
return TAngle<T>::fromDeg(fabs(deg.Degrees()));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
@ -1465,49 +1371,27 @@ inline TAngle<T> deltaangle(const TAngle<T> &a1, const TAngle<T> &a2)
|
|||
return (a2 - a1).Normalized180();
|
||||
}
|
||||
|
||||
/*
|
||||
template<class T>
|
||||
inline TAngle<T> deltaangle(const TAngle<T> &a1, double a2)
|
||||
{
|
||||
return (a2 - a1).Normalized180();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline TAngle<T> deltaangle(double a1, const TAngle<T> &a2)
|
||||
{
|
||||
return (a2 - a1).Normalized180();
|
||||
}
|
||||
*/
|
||||
|
||||
template<class T>
|
||||
inline TAngle<T> absangle(const TAngle<T> &a1, const TAngle<T> &a2)
|
||||
{
|
||||
return fabs((a1 - a2).Normalized180());
|
||||
}
|
||||
|
||||
/*
|
||||
template<class T>
|
||||
inline TAngle<T> absangle(const TAngle<T> &a1, double a2)
|
||||
{
|
||||
return fabs((a1 - a2).Normalized180());
|
||||
}
|
||||
*/
|
||||
|
||||
inline TAngle<double> VecToAngle(double x, double y)
|
||||
{
|
||||
return TAngle<double>::fromDeg(g_atan2(y, x) * (180.0 / pi::pi()));
|
||||
return TAngle<double>::fromRad(g_atan2(y, x));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline TAngle<T> VecToAngle (const TVector2<T> &vec)
|
||||
{
|
||||
return TAngle<T>::fromDeg(g_atan2(vec.Y, vec.X) * (180.0 / pi::pi()));
|
||||
return TAngle<T>::fromRad(g_atan2(vec.Y, vec.X));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline TAngle<T> VecToAngle (const TVector3<T> &vec)
|
||||
{
|
||||
return TAngle<T>::fromDeg(g_atan2(vec.Y, vec.X) * (180.0 / pi::pi()));
|
||||
return TAngle<T>::fromRad(g_atan2(vec.Y, vec.X));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
@ -1627,14 +1511,14 @@ struct TRotator
|
|||
// Scalar division
|
||||
TRotator &operator/= (const Angle &scalar)
|
||||
{
|
||||
Angle mul(1 / scalar.Degrees);
|
||||
Angle mul(1 / scalar.Degrees_);
|
||||
Pitch *= scalar, Yaw *= scalar, Roll *= scalar;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TRotator operator/ (const Angle &scalar) const
|
||||
{
|
||||
Angle mul(1 / scalar.Degrees);
|
||||
Angle mul(1 / scalar.Degrees_);
|
||||
return TRotator(Pitch * mul, Yaw * mul, Roll * mul);
|
||||
}
|
||||
|
||||
|
|
|
@ -942,7 +942,7 @@ CCMD(currentpos)
|
|||
if(mo)
|
||||
{
|
||||
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, sector lightlevel: %d, actor lightlevel: %d\n",
|
||||
mo->X(), mo->Y(), mo->Z(), mo->Angles.Yaw.Normalized360().Degrees, mo->floorz, mo->Sector->sectornum, mo->Sector->lightlevel, mo->LightLevel);
|
||||
mo->X(), mo->Y(), mo->Z(), mo->Angles.Yaw.Normalized360().Degrees(), mo->floorz, mo->Sector->sectornum, mo->Sector->lightlevel, mo->LightLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2752,7 +2752,7 @@ FString System_GetLocationDescription()
|
|||
auto& vp = r_viewpoint;
|
||||
auto Level = vp.ViewLevel;
|
||||
return Level == nullptr ? FString() : FStringf("Map %s: \"%s\",\nx = %1.4f, y = %1.4f, z = %1.4f, angle = %1.4f, pitch = %1.4f\n%llu fps\n\n",
|
||||
Level->MapName.GetChars(), Level->LevelName.GetChars(), vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw.Degrees, vp.Angles.Pitch.Degrees, (unsigned long long)LastFPS);
|
||||
Level->MapName.GetChars(), Level->LevelName.GetChars(), vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw.Degrees(), vp.Angles.Pitch.Degrees(), (unsigned long long)LastFPS);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2812,7 +2812,7 @@ void System_CrashInfo(char* buffer, size_t bufflen, const char *lfstr)
|
|||
buffer += mysnprintf(buffer, buffend - buffer, "%s%sviewx = %f", lfstr, lfstr, vp.Pos.X);
|
||||
buffer += mysnprintf(buffer, buffend - buffer, "%sviewy = %f", lfstr, vp.Pos.Y);
|
||||
buffer += mysnprintf(buffer, buffend - buffer, "%sviewz = %f", lfstr, vp.Pos.Z);
|
||||
buffer += mysnprintf(buffer, buffend - buffer, "%sviewangle = %f", lfstr, vp.Angles.Yaw.Degrees);
|
||||
buffer += mysnprintf(buffer, buffend - buffer, "%sviewangle = %f", lfstr, vp.Angles.Yaw.Degrees());
|
||||
}
|
||||
}
|
||||
buffer += mysnprintf(buffer, buffend - buffer, "%s", lfstr);
|
||||
|
|
|
@ -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::fromDeg(double(self->SpawnAngle)).Normalized360().Degrees;
|
||||
light->specialf1 = DAngle::fromDeg(double(self->SpawnAngle)).Normalized360().Degrees();
|
||||
light->Sector = self->Sector;
|
||||
light->target = self;
|
||||
light->mShadowmapIndex = 1024;
|
||||
|
|
|
@ -380,7 +380,7 @@ void DBot::Pitch (AActor *target)
|
|||
|
||||
diff = target->Z() - player->mo->Z();
|
||||
aim = g_atan(diff / player->mo->Distance2D(target));
|
||||
player->mo->Angles.Pitch = DAngle::ToDegrees(aim);
|
||||
player->mo->Angles.Pitch = DAngle::fromRad(aim);
|
||||
}
|
||||
|
||||
//Checks if a sector is dangerous.
|
||||
|
|
|
@ -78,8 +78,8 @@ void DBot::Think ()
|
|||
ThinkForMove (cmd);
|
||||
TurnToAng ();
|
||||
|
||||
cmd->ucmd.yaw = (short)((actor->Angles.Yaw - oldyaw).Degrees * (65536 / 360.f)) / ticdup;
|
||||
cmd->ucmd.pitch = (short)((oldpitch - actor->Angles.Pitch).Degrees * (65536 / 360.f));
|
||||
cmd->ucmd.yaw = (short)((actor->Angles.Yaw - oldyaw).Degrees() * (65536 / 360.f)) / ticdup;
|
||||
cmd->ucmd.pitch = (short)((oldpitch - actor->Angles.Pitch).Degrees() * (65536 / 360.f));
|
||||
if (cmd->ucmd.pitch == -32768)
|
||||
cmd->ucmd.pitch = -32767;
|
||||
cmd->ucmd.pitch /= ticdup;
|
||||
|
|
|
@ -1013,7 +1013,7 @@ void FParser::SF_ObjAngle(void)
|
|||
mo = Script->trigger;
|
||||
}
|
||||
|
||||
t_return.setDouble(mo ? mo->Angles.Yaw.Degrees : 0.);
|
||||
t_return.setDouble(mo ? mo->Angles.Yaw.Degrees() : 0.);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1364,7 +1364,7 @@ void FParser::SF_PointToAngle(void)
|
|||
double x2 = floatvalue(t_argv[2]);
|
||||
double y2 = floatvalue(t_argv[3]);
|
||||
|
||||
t_return.setDouble(DVector2(x2 - x1, y2 - y1).Angle().Normalized360().Degrees);
|
||||
t_return.setDouble(DVector2(x2 - x1, y2 - y1).Angle().Normalized360().Degrees());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1417,7 +1417,7 @@ void FParser::SF_SetCamera(void)
|
|||
|
||||
angle = t_argc < 2 ? newcamera->Angles.Yaw : DAngle::fromDeg(floatvalue(t_argv[1]));
|
||||
|
||||
newcamera->specialf1 = newcamera->Angles.Yaw.Degrees;
|
||||
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);
|
||||
|
@ -2758,7 +2758,7 @@ void FParser::SF_MoveCamera(void)
|
|||
anglenow = (cam->Angles.Yaw - anglespeed).Normalized360();
|
||||
}
|
||||
const DAngle diffangle2 = deltaangle(anglenow, targetangle);
|
||||
if (diffangle.Degrees * diffangle2.Degrees <= 0)
|
||||
if (diffangle.Degrees() * diffangle2.Degrees() <= 0)
|
||||
{
|
||||
anglenow = targetangle;
|
||||
finishedangle = true;
|
||||
|
|
|
@ -625,7 +625,7 @@ inline int AngleToACS(DAngle ang)
|
|||
|
||||
inline int PitchToACS(DAngle ang)
|
||||
{
|
||||
return int(ang.Normalized180().Degrees * (65536. / 360));
|
||||
return int(ang.Normalized180().Degrees() * (65536. / 360));
|
||||
}
|
||||
|
||||
struct CallReturn
|
||||
|
|
|
@ -2226,7 +2226,7 @@ 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 = DAngle::fromDeg(floor(self->Angles.Yaw.Degrees / 45) * 45.);
|
||||
self->Angles.Yaw = DAngle::fromDeg(floor(self->Angles.Yaw.Degrees() / 45) * 45.);
|
||||
DAngle delta = deltaangle(self->Angles.Yaw, DAngle::fromDeg(self->movedir * 45));
|
||||
if (delta < nullAngle)
|
||||
{
|
||||
|
@ -2379,7 +2379,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
|
|||
}
|
||||
else if (!(flags & CHF_NODIRECTIONTURN) && actor->movedir < 8)
|
||||
{
|
||||
actor->Angles.Yaw = DAngle::fromDeg(floor(actor->Angles.Yaw.Degrees / 45) * 45.);
|
||||
actor->Angles.Yaw = DAngle::fromDeg(floor(actor->Angles.Yaw.Degrees() / 45) * 45.);
|
||||
DAngle delta = deltaangle(actor->Angles.Yaw, DAngle::fromDeg(actor->movedir * 45));
|
||||
if (delta < nullAngle)
|
||||
{
|
||||
|
@ -2995,7 +2995,7 @@ void A_Face(AActor *self, AActor *other, DAngle max_turn, DAngle max_pitch, DAng
|
|||
double dist_z = target_z - source_z;
|
||||
double ddist = g_sqrt(dist.X*dist.X + dist.Y*dist.Y + dist_z*dist_z);
|
||||
|
||||
DAngle other_pitch = -DAngle::ToDegrees(g_asin(dist_z / ddist)).Normalized180();
|
||||
DAngle other_pitch = -DAngle::fromRad(g_asin(dist_z / ddist)).Normalized180();
|
||||
|
||||
if (max_pitch != nullAngle)
|
||||
{
|
||||
|
|
|
@ -1253,7 +1253,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
|
|||
{
|
||||
IFVIRTUALPTR(target, AActor, ApplyKickback)
|
||||
{
|
||||
VMValue params[] = { target, inflictor, source, damage, angle.Degrees, mod.GetIndex(), flags };
|
||||
VMValue params[] = { target, inflictor, source, damage, angle.Degrees(), mod.GetIndex(), flags };
|
||||
VMCall(func, params, countof(params), nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1522,7 +1522,7 @@ int P_DamageMobj(AActor *target, AActor *inflictor, AActor *source, int damage,
|
|||
{
|
||||
IFVIRTUALPTR(target, AActor, DamageMobj)
|
||||
{
|
||||
VMValue params[7] = { target, inflictor, source, damage, mod.GetIndex(), flags, angle.Degrees };
|
||||
VMValue params[7] = { target, inflictor, source, damage, mod.GetIndex(), flags, angle.Degrees() };
|
||||
VMReturn ret;
|
||||
int retval;
|
||||
ret.IntAt(&retval);
|
||||
|
|
|
@ -4101,7 +4101,7 @@ struct aim_t
|
|||
int frontflag = P_PointOnLineSidePrecise(startpos, li);
|
||||
|
||||
if (aimdebug)
|
||||
Printf("Found line %d: toppitch = %f, bottompitch = %f\n", li->Index(), toppitch.Degrees, bottompitch.Degrees);
|
||||
Printf("Found line %d: toppitch = %f, bottompitch = %f\n", li->Index(), toppitch.Degrees(), bottompitch.Degrees());
|
||||
|
||||
if (li->isLinePortal() && frontflag == 0)
|
||||
{
|
||||
|
@ -4145,7 +4145,7 @@ struct aim_t
|
|||
return;
|
||||
|
||||
if (aimdebug)
|
||||
Printf("After line %d: toppitch = %f, bottompitch = %f, planestocheck = %d\n", li->Index(), toppitch.Degrees, bottompitch.Degrees, planestocheck);
|
||||
Printf("After line %d: toppitch = %f, bottompitch = %f, planestocheck = %d\n", li->Index(), toppitch.Degrees(), bottompitch.Degrees(), planestocheck);
|
||||
|
||||
sector_t *entersec = frontflag ? li->frontsector : li->backsector;
|
||||
sector_t *exitsec = frontflag ? li->backsector : li->frontsector;
|
||||
|
@ -4770,7 +4770,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
|
|||
{
|
||||
IFVIRTUALPTR(trace.Actor, AActor, SpawnLineAttackBlood)
|
||||
{
|
||||
VMValue params[] = { trace.Actor, t1, bleedpos.X, bleedpos.Y, bleedpos.Z, trace.SrcAngleFromTarget.Degrees, damage, newdam };
|
||||
VMValue params[] = { trace.Actor, t1, bleedpos.X, bleedpos.Y, bleedpos.Z, trace.SrcAngleFromTarget.Degrees(), damage, newdam };
|
||||
VMCall(func, params, countof(params), nullptr, 0);
|
||||
}
|
||||
if (damage)
|
||||
|
@ -5098,7 +5098,7 @@ void P_TraceBleed(int damage, AActor *target, AActor *missile)
|
|||
double aim;
|
||||
|
||||
aim = g_atan(missile->Vel.Z / target->Distance2D(missile));
|
||||
pitch = -DAngle::ToDegrees(aim);
|
||||
pitch = -DAngle::fromRad(aim);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1015,10 +1015,10 @@ bool AActor::IsInsideVisibleAngles() const
|
|||
if (p == nullptr || p->camera == nullptr)
|
||||
return true;
|
||||
|
||||
DAngle anglestart = DAngle::fromDeg(VisibleStartAngle.Degrees);
|
||||
DAngle angleend = DAngle::fromDeg(VisibleEndAngle.Degrees);
|
||||
DAngle pitchstart = DAngle::fromDeg(VisibleStartPitch.Degrees);
|
||||
DAngle pitchend = DAngle::fromDeg(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)
|
||||
{
|
||||
|
|
|
@ -1223,7 +1223,7 @@ DEFINE_ACTION_FUNCTION(AActor, BulletSlope)
|
|||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_POINTER(t, FTranslatedLineTarget);
|
||||
PARAM_INT(aimflags);
|
||||
ACTION_RETURN_FLOAT(P_BulletSlope(self, t, aimflags).Degrees);
|
||||
ACTION_RETURN_FLOAT(P_BulletSlope(self, t, aimflags).Degrees());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
|
|
@ -154,7 +154,7 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
|
|||
int nocancel = 1;
|
||||
IFVIRTUALPTR(thing, AActor, PreTeleport)
|
||||
{
|
||||
VMValue params[] = { thing, pos.X, pos.Y, pos.Z, angle.Degrees, flags };
|
||||
VMValue params[] = { thing, pos.X, pos.Y, pos.Z, angle.Degrees(), flags };
|
||||
VMReturn ret;
|
||||
ret.IntAt(&nocancel);
|
||||
VMCall(func, params, countof(params), &ret, 1);
|
||||
|
@ -230,7 +230,7 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
|
|||
{
|
||||
IFVIRTUALPTR(thing, AActor, PostTeleport)
|
||||
{
|
||||
VMValue params[] = { thing, pos.X, pos.Y, pos.Z, angle.Degrees, flags };
|
||||
VMValue params[] = { thing, pos.X, pos.Y, pos.Z, angle.Degrees(), flags };
|
||||
VMCall(func, params, countof(params), nullptr, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,7 +1248,7 @@ void P_PlayerThink (player_t *player)
|
|||
{
|
||||
fprintf (debugfile, "tic %d for pl %d: (%f, %f, %f, %f) b:%02x p:%d y:%d f:%d s:%d u:%d\n",
|
||||
gametic, (int)(player-players), player->mo->X(), player->mo->Y(), player->mo->Z(),
|
||||
player->mo->Angles.Yaw.Degrees, player->cmd.ucmd.buttons,
|
||||
player->mo->Angles.Yaw.Degrees(), player->cmd.ucmd.buttons,
|
||||
player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove,
|
||||
player->cmd.ucmd.sidemove, player->cmd.ucmd.upmove);
|
||||
}
|
||||
|
|
|
@ -673,9 +673,9 @@ bool EV_OpenPolyDoor(FLevelLocals *Level, line_t *line, int polyNum, double spee
|
|||
else if (type == PODOOR_SWING)
|
||||
{
|
||||
pd->m_WaitTics = delay;
|
||||
pd->m_Direction.Degrees = swingdir;
|
||||
pd->m_Direction = DAngle::fromDeg(swingdir);
|
||||
pd->m_Speed = (speed*swingdir*(90. / 64)) / 8;
|
||||
pd->m_Dist = pd->m_TotalDist = angle.Degrees;
|
||||
pd->m_Dist = pd->m_TotalDist = angle.Degrees();
|
||||
SN_StartSequence (poly, poly->seqType, SEQ_DOOR, 0);
|
||||
swingdir = -swingdir; // reverse the direction
|
||||
}
|
||||
|
|
|
@ -209,8 +209,8 @@ static void SetPortalRotation(FLinePortal *port)
|
|||
line_t *dst = port->mDestination;
|
||||
line_t *line = port->mOrigin;
|
||||
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->mSinRot = sindeg(angle.Degrees()); // Here precision matters so use the slower but more precise versions.
|
||||
port->mCosRot = cosdeg(angle.Degrees());
|
||||
port->mAngleDiff = angle;
|
||||
if ((line->sidedef[0]->Flags & WALLF_POLYOBJ) || (dst->sidedef[0]->Flags & WALLF_POLYOBJ))
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ void RenderModel(FModelRenderer *renderer, float x, float y, float z, FSpriteMod
|
|||
angles = actor->InterpolatedAngles(ticFrac);
|
||||
else
|
||||
angles = actor->Angles;
|
||||
float angle = angles.Yaw.Degrees;
|
||||
float angle = angles.Yaw.Degrees();
|
||||
|
||||
// [BB] Workaround for the missing pitch information.
|
||||
if ((smf->flags & MDL_PITCHFROMMOMENTUM))
|
||||
|
@ -119,11 +119,11 @@ void RenderModel(FModelRenderer *renderer, float x, float y, float z, FSpriteMod
|
|||
// If both flags MDL_USEACTORPITCH and MDL_PITCHFROMMOMENTUM are set, the pitch sums up the actor pitch and the velocity vector pitch.
|
||||
if (smf->flags & MDL_USEACTORPITCH)
|
||||
{
|
||||
double d = angles.Pitch.Degrees;
|
||||
double d = angles.Pitch.Degrees();
|
||||
if (smf->flags & MDL_BADROTATION) pitch += d;
|
||||
else pitch -= d;
|
||||
}
|
||||
if (smf->flags & MDL_USEACTORROLL) roll += angles.Roll.Degrees;
|
||||
if (smf->flags & MDL_USEACTORROLL) roll += angles.Roll.Degrees();
|
||||
|
||||
VSMatrix objectToWorldMatrix;
|
||||
objectToWorldMatrix.loadIdentity();
|
||||
|
@ -132,7 +132,7 @@ void RenderModel(FModelRenderer *renderer, float x, float y, float z, FSpriteMod
|
|||
objectToWorldMatrix.translate(x, z, y);
|
||||
|
||||
// [Nash] take SpriteRotation into account
|
||||
angle += actor->SpriteRotation.Degrees;
|
||||
angle += actor->SpriteRotation.Degrees();
|
||||
|
||||
// Applying model transformations:
|
||||
// 1) Applying actor angle, pitch and roll to the model
|
||||
|
@ -390,7 +390,7 @@ void InitModels()
|
|||
smf.skinIDs.Alloc(1);
|
||||
smf.skinIDs[0] = md->GetPaletteTexture();
|
||||
smf.xscale = smf.yscale = smf.zscale = VoxelDefs[i]->Scale;
|
||||
smf.angleoffset = VoxelDefs[i]->AngleOffset.Degrees;
|
||||
smf.angleoffset = VoxelDefs[i]->AngleOffset.Degrees();
|
||||
if (VoxelDefs[i]->PitchFromMomentum) smf.flags |= MDL_PITCHFROMMOMENTUM;
|
||||
if (VoxelDefs[i]->UseActorPitch) smf.flags |= MDL_USEACTORPITCH;
|
||||
if (VoxelDefs[i]->UseActorRoll) smf.flags |= MDL_USEACTORROLL;
|
||||
|
|
|
@ -164,7 +164,7 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
|
|||
// Stereo mode specific perspective projection
|
||||
di->VPUniforms.mProjectionMatrix = eye.GetProjection(fov, ratio, fovratio);
|
||||
// Stereo mode specific viewpoint adjustment
|
||||
vp.Pos += eye.GetViewShift(vp.HWAngles.Yaw.Degrees);
|
||||
vp.Pos += eye.GetViewShift(vp.HWAngles.Yaw.Degrees());
|
||||
di->SetupView(RenderState, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, false, false);
|
||||
|
||||
di->ProcessScene(toscreen);
|
||||
|
@ -280,7 +280,7 @@ void WriteSavePic(player_t* player, FileWriter* file, int width, int height)
|
|||
|
||||
// This shouldn't overwrite the global viewpoint even for a short time.
|
||||
FRenderViewpoint savevp;
|
||||
sector_t* viewsector = RenderViewpoint(savevp, players[consoleplayer].camera, &bounds, r_viewpoint.FieldOfView.Degrees, 1.6f, 1.6f, true, false);
|
||||
sector_t* viewsector = RenderViewpoint(savevp, players[consoleplayer].camera, &bounds, r_viewpoint.FieldOfView.Degrees(), 1.6f, 1.6f, true, false);
|
||||
RenderState.EnableStencil(false);
|
||||
RenderState.SetNoSoftLightLevel();
|
||||
|
||||
|
@ -394,7 +394,7 @@ sector_t* RenderView(player_t* player)
|
|||
|
||||
screen->ImageTransitionScene(true); // Only relevant for Vulkan.
|
||||
|
||||
retsec = RenderViewpoint(r_viewpoint, player->camera, NULL, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, true, true);
|
||||
retsec = RenderViewpoint(r_viewpoint, player->camera, NULL, r_viewpoint.FieldOfView.Degrees(), ratio, fovratio, true, true);
|
||||
}
|
||||
All.Unclock();
|
||||
return retsec;
|
||||
|
|
|
@ -346,14 +346,14 @@ int HWDrawInfo::SetFullbrightFlags(player_t *player)
|
|||
|
||||
angle_t HWDrawInfo::FrustumAngle()
|
||||
{
|
||||
float tilt = fabs(Viewpoint.HWAngles.Pitch.Degrees);
|
||||
float tilt = fabs(Viewpoint.HWAngles.Pitch.Degrees());
|
||||
|
||||
// If the pitch is larger than this you can look all around at a FOV of 90°
|
||||
if (tilt > 46.0f) return 0xffffffff;
|
||||
|
||||
// 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;
|
||||
double floatangle = 2.0 + (45.0 + ((tilt / 1.9)))*Viewpoint.FieldOfView.Degrees() * 48.0 / AspectMultiplier(r_viewwindow.WidescreenRatio) / 90.0;
|
||||
angle_t a1 = DAngle::fromDeg(floatangle).BAMs();
|
||||
if (a1 >= ANGLE_180) return 0xffffffff;
|
||||
return a1;
|
||||
|
@ -371,9 +371,9 @@ void HWDrawInfo::SetViewMatrix(const FRotator &angles, float vx, float vy, float
|
|||
float planemult = planemirror ? -Level->info->pixelstretch : Level->info->pixelstretch;
|
||||
|
||||
VPUniforms.mViewMatrix.loadIdentity();
|
||||
VPUniforms.mViewMatrix.rotate(angles.Roll.Degrees, 0.0f, 0.0f, 1.0f);
|
||||
VPUniforms.mViewMatrix.rotate(angles.Pitch.Degrees, 1.0f, 0.0f, 0.0f);
|
||||
VPUniforms.mViewMatrix.rotate(angles.Yaw.Degrees, 0.0f, mult, 0.0f);
|
||||
VPUniforms.mViewMatrix.rotate(angles.Roll.Degrees(), 0.0f, 0.0f, 1.0f);
|
||||
VPUniforms.mViewMatrix.rotate(angles.Pitch.Degrees(), 1.0f, 0.0f, 0.0f);
|
||||
VPUniforms.mViewMatrix.rotate(angles.Yaw.Degrees(), 0.0f, mult, 0.0f);
|
||||
VPUniforms.mViewMatrix.translate(vx * mult, -vz * planemult, -vy);
|
||||
VPUniforms.mViewMatrix.scale(-mult, planemult, 1);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ struct HWSectorPlane
|
|||
Offs.Y = (float)sec->GetYOffset(ceiling);
|
||||
Scale.X = (float)sec->GetXScale(ceiling);
|
||||
Scale.Y = (float)sec->GetYScale(ceiling);
|
||||
Angle = (float)sec->GetAngle(ceiling).Degrees;
|
||||
Angle = (float)sec->GetAngle(ceiling).Degrees();
|
||||
texture = sec->GetTexture(ceiling);
|
||||
plane = sec->GetSecPlane(ceiling);
|
||||
Texheight = (float)((ceiling == sector_t::ceiling)? plane.fD() : -plane.fD());
|
||||
|
|
|
@ -352,12 +352,12 @@ 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 = FAngle::fromDeg(-Angles.Pitch.Degrees);
|
||||
FAngle pitch = FAngle::fromDeg(-Angles.Pitch.Degrees());
|
||||
pitch.Normalized180();
|
||||
|
||||
mat.Translate(x, z, y);
|
||||
mat.Rotate(0, 1, 0, 270. - Angles.Yaw.Degrees);
|
||||
mat.Rotate(1, 0, 0, pitch.Degrees);
|
||||
mat.Rotate(0, 1, 0, 270. - Angles.Yaw.Degrees());
|
||||
mat.Rotate(1, 0, 0, pitch.Degrees());
|
||||
|
||||
if (actor->renderflags & RF_ROLLCENTER)
|
||||
{
|
||||
|
@ -365,12 +365,12 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
float cy = (y1 + y2) * 0.5;
|
||||
|
||||
mat.Translate(cx - x, 0, cy - y);
|
||||
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees);
|
||||
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees());
|
||||
mat.Translate(-cx, -z, -cy);
|
||||
}
|
||||
else
|
||||
{
|
||||
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees);
|
||||
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees());
|
||||
mat.Translate(-x, -z, -y);
|
||||
}
|
||||
v[0] = mat * FVector3(x2, z, y2);
|
||||
|
@ -421,7 +421,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
float xrel = xcenter - vp->X;
|
||||
float yrel = ycenter - vp->Y;
|
||||
float absAngleDeg = RAD2DEG(atan2(-yrel, xrel));
|
||||
float counterRotationDeg = 270. - HWAngles.Yaw.Degrees; // counteracts existing sprite rotation
|
||||
float counterRotationDeg = 270. - HWAngles.Yaw.Degrees(); // counteracts existing sprite rotation
|
||||
float relAngleDeg = counterRotationDeg + absAngleDeg;
|
||||
|
||||
mat.Rotate(0, 1, 0, relAngleDeg);
|
||||
|
@ -430,7 +430,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
// [fgsfds] calculate yaw vectors
|
||||
float yawvecX = 0, yawvecY = 0, rollDegrees = 0;
|
||||
float angleRad = (FAngle::fromDeg(270.) - HWAngles.Yaw).Radians();
|
||||
if (actor) rollDegrees = Angles.Roll.Degrees;
|
||||
if (actor) rollDegrees = Angles.Roll.Degrees();
|
||||
if (isFlatSprite)
|
||||
{
|
||||
yawvecX = Angles.Yaw.Cos();
|
||||
|
@ -453,7 +453,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
if (useOffsets) mat.Translate(xx, zz, yy);
|
||||
if (drawWithXYBillboard)
|
||||
{
|
||||
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees);
|
||||
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees());
|
||||
}
|
||||
mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
|
||||
if (useOffsets) mat.Translate(-xx, -zz, -yy);
|
||||
|
@ -463,7 +463,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
// Rotate the sprite about the vector starting at the center of the sprite
|
||||
// triangle strip and with direction orthogonal to where the player is looking
|
||||
// in the x/y plane.
|
||||
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees);
|
||||
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees());
|
||||
}
|
||||
|
||||
mat.Translate(-xcenter, -zcenter, -ycenter); // retreat from sprite center
|
||||
|
|
|
@ -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 = FAngle::fromDeg(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();
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ void R_SetWindow (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, int wind
|
|||
// screen that would be visible on a 4:3 display has the requested FOV.
|
||||
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)));
|
||||
fov = DAngle::fromRad(2 * atan(viewwindow.centerx * tan(fov.Radians()/2) / double(viewwindow.centerxwide)));
|
||||
if (fov > DAngle::fromDeg(170.)) fov = DAngle::fromDeg(170.);
|
||||
}
|
||||
viewwindow.FocalTangent = tan(fov.Radians() / 2);
|
||||
|
@ -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 = FAngle::fromDeg(270.0 - Angles.Yaw.Degrees);
|
||||
HWAngles.Yaw = FAngle::fromDeg(270.0 - Angles.Yaw.Degrees());
|
||||
|
||||
}
|
||||
|
||||
|
@ -1117,7 +1117,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
|||
double alen = sqrt(angx*angx + angy*angy);
|
||||
viewpoint.HWAngles.Pitch = FAngle::fromRad((float)asin(angy / alen));
|
||||
|
||||
viewpoint.HWAngles.Roll.Degrees = (float)viewpoint.Angles.Roll.Degrees; // copied for convenience.
|
||||
viewpoint.HWAngles.Roll = FAngle::fromDeg(viewpoint.Angles.Roll.Degrees()); // copied for convenience.
|
||||
|
||||
// ViewActor only gets set, if the camera actor should not be rendered
|
||||
if (actor->player && actor->player - players == consoleplayer &&
|
||||
|
|
|
@ -94,8 +94,8 @@ namespace swrenderer
|
|||
skyiscale = float(r_Yaspect / freelookviewheight);
|
||||
skyscale = freelookviewheight / r_Yaspect;
|
||||
|
||||
skyiscale *= float(thread->Viewport->viewpoint.FieldOfView.Degrees / 90.);
|
||||
skyscale *= float(90. / thread->Viewport->viewpoint.FieldOfView.Degrees);
|
||||
skyiscale *= float(thread->Viewport->viewpoint.FieldOfView.Degrees() / 90.);
|
||||
skyscale *= float(90. / thread->Viewport->viewpoint.FieldOfView.Degrees());
|
||||
}
|
||||
|
||||
if (Level->skystretch)
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace swrenderer
|
|||
}
|
||||
|
||||
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::fromDeg(((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;
|
||||
|
|
|
@ -661,7 +661,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset)
|
|||
|
||||
static double GetAngle(sector_t *self, int pos, bool addbase)
|
||||
{
|
||||
return self->GetAngle(pos, addbase).Degrees;
|
||||
return self->GetAngle(pos, addbase).Degrees();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetAngle, GetAngle)
|
||||
|
@ -669,7 +669,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset)
|
|||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(pos);
|
||||
PARAM_BOOL(addbase);
|
||||
ACTION_RETURN_FLOAT(self->GetAngle(pos, addbase).Degrees);
|
||||
ACTION_RETURN_FLOAT(self->GetAngle(pos, addbase).Degrees());
|
||||
}
|
||||
|
||||
static void SetBase(sector_t *self, int pos, double o, double a)
|
||||
|
@ -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(), DAngle::fromDeg(viewYaw)).Degrees,
|
||||
deltaangle(vecTo.Pitch(), DAngle::fromDeg(viewPitch)).Degrees,
|
||||
deltaangle(vecTo.Angle(), DAngle::fromDeg(viewYaw)).Degrees(),
|
||||
deltaangle(vecTo.Pitch(), DAngle::fromDeg(viewPitch)).Degrees(),
|
||||
vecTo.Length()
|
||||
));
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckKeys, P_CheckKeys)
|
|||
|
||||
static double deltaangleDbl(double a1, double a2)
|
||||
{
|
||||
return deltaangle(DAngle::fromDeg(a1), DAngle::fromDeg(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::fromDeg(a1), DAngle::fromDeg(a2)).Degrees);
|
||||
ACTION_RETURN_FLOAT(deltaangle(DAngle::fromDeg(a1), DAngle::fromDeg(a2)).Degrees());
|
||||
}
|
||||
|
||||
static double absangleDbl(double a1, double a2)
|
||||
{
|
||||
return absangle(DAngle::fromDeg(a1), DAngle::fromDeg(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::fromDeg(a1), DAngle::fromDeg(a2)).Degrees);
|
||||
ACTION_RETURN_FLOAT(absangle(DAngle::fromDeg(a1), DAngle::fromDeg(a2)).Degrees());
|
||||
}
|
||||
|
||||
static double Distance2DSquared(AActor *self, AActor *other)
|
||||
|
@ -353,7 +353,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, SetDamage, SetDamage)
|
|||
|
||||
static double PitchFromVel(AActor* self)
|
||||
{
|
||||
return self->Vel.Pitch().Degrees;
|
||||
return self->Vel.Pitch().Degrees();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, PitchFromVel, PitchFromVel)
|
||||
|
@ -440,7 +440,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, Thrust, Thrust)
|
|||
|
||||
static double AngleTo(AActor *self, AActor *targ, bool absolute)
|
||||
{
|
||||
return self->AngleTo(PARAM_NULLCHECK(targ, targ), absolute).Degrees;
|
||||
return self->AngleTo(PARAM_NULLCHECK(targ, targ), absolute).Degrees();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, AngleTo, AngleTo)
|
||||
|
@ -448,7 +448,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, AngleTo, AngleTo)
|
|||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_OBJECT_NOT_NULL(targ, AActor);
|
||||
PARAM_BOOL(absolute);
|
||||
ACTION_RETURN_FLOAT(self->AngleTo(targ, absolute).Degrees);
|
||||
ACTION_RETURN_FLOAT(self->AngleTo(targ, absolute).Degrees());
|
||||
}
|
||||
|
||||
static void AngleToVector(double angle, double length, DVector2 *result)
|
||||
|
@ -480,14 +480,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, RotateVector, RotateVector)
|
|||
|
||||
static double Normalize180(double angle)
|
||||
{
|
||||
return DAngle::fromDeg(angle).Normalized180().Degrees;
|
||||
return DAngle::fromDeg(angle).Normalized180().Degrees();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, Normalize180, Normalize180)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_ANGLE(angle);
|
||||
ACTION_RETURN_FLOAT(angle.Normalized180().Degrees);
|
||||
ACTION_RETURN_FLOAT(angle.Normalized180().Degrees());
|
||||
}
|
||||
|
||||
static double DistanceBySpeed(AActor *self, AActor *targ, double speed)
|
||||
|
@ -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, DAngle::fromDeg(angle), distance, pLineTarget, DAngle::fromDeg(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)
|
||||
|
@ -1164,7 +1164,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, AimLineAttack, AimLineAttack)
|
|||
PARAM_INT(flags);
|
||||
PARAM_OBJECT(target, AActor);
|
||||
PARAM_OBJECT(friender, AActor);
|
||||
ACTION_RETURN_FLOAT(P_AimLineAttack(self, angle, distance, pLineTarget, vrange, flags, target, friender).Degrees);
|
||||
ACTION_RETURN_FLOAT(P_AimLineAttack(self, angle, distance, pLineTarget, vrange, flags, target, friender).Degrees());
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue