- 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

@ -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<DAngle>(0., bottompitch));
if (floorportalstate) EnterSectorPortal(sector_t::floor, 0, lastsector, max<DAngle>(0., toppitch), bottompitch);
if (ceilingportalstate) EnterSectorPortal(sector_t::ceiling, 0, lastsector, toppitch, min<DAngle>(nullAngle, bottompitch));
if (floorportalstate) EnterSectorPortal(sector_t::floor, 0, lastsector, max<DAngle>(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<DAngle>(0., bottompitch));
EnterSectorPortal(sector_t::ceiling, in->frac, entersec, toppitch, min<DAngle>(nullAngle, bottompitch));
}
if ((planestocheck & aim_down) && bottompitch > 0 && open.bottom != LINEOPEN_MIN && !entersec->PortalBlocksMovement(sector_t::floor))
{
EnterSectorPortal(sector_t::floor, in->frac, entersec, max<DAngle>(0., toppitch), bottompitch);
EnterSectorPortal(sector_t::floor, in->frac, entersec, max<DAngle>(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<double>(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);