- disable implicit conversions from float to TAngle

This commit is contained in:
Christoph Oelckers 2022-08-26 00:56:53 +02:00
commit f0fbdba593
66 changed files with 425 additions and 374 deletions

View file

@ -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;
}
}
}