- Remove all uses of fixedhoriz::asq16().

This commit is contained in:
Mitchell Richters 2022-09-27 14:12:16 +10:00 committed by Christoph Oelckers
parent 06a9a7b1a7
commit 22a9f89b64
12 changed files with 22 additions and 23 deletions

View file

@ -81,7 +81,6 @@ public:
// This class intentionally makes no allowances for implicit type conversions because those would render it ineffective.
constexpr short asbuild() const { return FixedToInt(value); }
constexpr fixed_t asq16() const { return value; }
constexpr double Tan() const { return FixedToFloat<23>(value); }
double Degrees() const { return HorizToPitch(value); }

View file

@ -36,7 +36,7 @@ struct PlayerHorizon
// Ticrate playsim adjustment helpers.
void resetadjustment() { adjustment = 0; }
bool targetset() { return target.asq16(); }
bool targetset() { return target.Sgn(); }
// Input locking helpers.
void lockinput() { inputdisabled = true; }
@ -66,7 +66,7 @@ struct PlayerHorizon
if (!SyncInput() && !backup)
{
target = value.asq16() ? value : q16horiz(1);
target = value.Sgn() ? value : q16horiz(1);
}
else
{

View file

@ -1556,7 +1556,7 @@ void ProcessInput(PLAYER* pPlayer)
}
pPlayer->deathTime += 4;
if (!bSeqStat)
pPlayer->horizon.addadjustment(q16horiz(MulScale(0x8000 - (Cos(ClipHigh(pPlayer->deathTime << 3, 1024)) >> 15), pitchhoriz(gi->playerPitchMax()).asq16(), 16) - pPlayer->horizon.horiz.asq16()));
pPlayer->horizon.addadjustment(pitchhoriz(((1. - BobVal(ClipHigh(pPlayer->deathTime << 3, 1024) + 512)) * gi->playerPitchMax()) - pPlayer->horizon.horiz.Degrees()));
if (pPlayer->curWeapon)
pInput->setNewWeapon(pPlayer->curWeapon);
if (pInput->actions & SB_OPEN)
@ -1731,7 +1731,7 @@ void ProcessInput(PLAYER* pPlayer)
pPlayer->angle.unlockinput();
pPlayer->horizon.unlockinput();
pPlayer->slope = -pPlayer->horizon.horiz.asq16() >> 9;
pPlayer->slope = -pPlayer->horizon.horiz.Tan() * 16384.;
if (pInput->actions & SB_INVPREV)
{
pInput->actions &= ~SB_INVPREV;

View file

@ -247,10 +247,10 @@ static void fakeProcessInput(PLAYER* pPlayer, InputPacket* pInput)
else
{
predict.horizoff = interpolatedvalue(predict.horizoff, q16horiz(0), 0x4000);
if (abs(predict.horizoff.asq16()) < 4)
if (abs(predict.horizoff.Degrees()) < 1.79)
predict.horizoff = q16horiz(0);
}
predict.slope = -predict.horiz.asq16() >> 9;
predict.slope = -predict.horiz.Tan() * 16384.;
#endif
}

View file

@ -525,7 +525,7 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, fixedhoriz& c
{
cPos.Z += bobHeight;
}
cPos.Z += FixedToFloat<24>(cH.asq16() * 10);
cPos.Z += cH.Tan() * 5.;
}
else
{
@ -767,7 +767,7 @@ void viewDrawScreen(bool sceneonly)
int v8 = byte_1CE5C2 > 0 && (sector[tmpSect].ceilingstat & CSTAT_SECTOR_SKY);
if (gWeather.at12d8 > 0 || v8)
{
gWeather.Draw(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitch, gWeather.at12d8);
gWeather.Draw(cX, cY, cZ, cA.Tan() * (1 << 23), cH.Tan() * (1 << 23) + deliriumPitch, gWeather.at12d8);
if (v8)
{
gWeather.at12d8 = ClipRange(delta * 8 + gWeather.at12d8, 0, 4095);

View file

@ -2170,7 +2170,7 @@ static void greenslime(DDukeActor *actor)
return;
}
actor->spr.pos.Z = ps[p].pos.Z + 8 + ps[p].pyoff - (actor->temp_data[2] - (ps[p].horizon.horiz.asq16() >> 12)) * zinttoworld;
actor->spr.pos.Z = ps[p].pos.Z + 8 + ps[p].pyoff - (actor->temp_data[2] - (ps[p].horizon.horiz.Tan() * 2048.)) * zinttoworld;
if (actor->temp_data[2] > 512)
actor->temp_data[2] -= 128;

View file

@ -925,7 +925,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
case PLAYER_RETURN_TO_CENTER:
if (bSet) ps[iPlayer].sync.actions |= SB_CENTERVIEW;
else SetGameVarID(lVar2, ps[iPlayer].sync.actions & SB_CENTERVIEW ? abs(int(ps[iPlayer].horizon.horiz.asq16() * (9. / pitchhoriz(GetMaxPitch()).asq16()))) : 0, sActor, sPlayer);
else SetGameVarID(lVar2, ps[iPlayer].sync.actions & SB_CENTERVIEW ? abs(int(ps[iPlayer].horizon.horiz.Tan() * (9. / pitchhoriz(GetMaxPitch()).Tan()))) : 0, sActor, sPlayer);
break;
default:

View file

@ -92,7 +92,7 @@ void FuncFishLimb(int a, int b, int c);
enum { kMaxGrenades = 50 };
void BuildGrenade(int nPlayer);
void ThrowGrenade(int nPlayer, double ecx, int push1);
void ThrowGrenade(int nPlayer, double ecx, double push1);
void FuncGrenade(int, int, int, int);
// gun

View file

@ -63,7 +63,7 @@ void BounceGrenade(DExhumedActor* pActor, DAngle nAngle)
//
//---------------------------------------------------------------------------
void ThrowGrenade(int nPlayer, double dz, int push1)
void ThrowGrenade(int nPlayer, double dz, double push1)
{
if (PlayerList[nPlayer].pPlayerGrenade == nullptr)
return;
@ -84,12 +84,12 @@ void ThrowGrenade(int nPlayer, double dz, int push1)
pActor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
pActor->spr.angle = nAngle;
if (push1 >= -3000)
if (push1 >= -23.4375)
{
int nVel = PlayerList[nPlayer].totalvel << 5;
pActor->nTurn = ((90 - pActor->nIndex2) * (90 - pActor->nIndex2)) + nVel;
pActor->vel.Z = ((-0.25 * push1) - 17);
pActor->vel.Z = ((-32. * push1) - 17);
DVector2 vec = nAngle.ToVector() * pPlayerActor->fClipdist() *2; // == << 14 + 3 + 2 - 18

View file

@ -876,7 +876,7 @@ loc_flag:
case kWeaponGrenade:
{
ThrowGrenade(nPlayer, nHeight - 10, FixedToInt(PlayerList[nLocalPlayer].horizon.horiz.asq16()));
ThrowGrenade(nPlayer, nHeight - 10, PlayerList[nLocalPlayer].horizon.horiz.Tan());
break;
}
case kWeaponStaff:

View file

@ -1118,7 +1118,7 @@ void AIPlayer::Tick(RunListEvent* ev)
zVelB = -zVelB;
}
if (zVelB > 2 && !PlayerList[nPlayer].horizon.horiz.asq16() && cl_slopetilting) {
if (zVelB > 2 && !PlayerList[nPlayer].horizon.horiz.Sgn() && cl_slopetilting) {
PlayerList[nPlayer].nDestVertPan = q16horiz(0);
}
}
@ -2621,7 +2621,7 @@ sectdone:
}
else
{
if (PlayerList[nPlayer].horizon.horiz.asq16() < 0)
if (PlayerList[nPlayer].horizon.horiz.Sgn() < 0)
{
PlayerList[nPlayer].horizon.settarget(buildhoriz(0));
PlayerList[nPlayer].eyelevel -= dVertPan[nPlayer];
@ -2630,11 +2630,11 @@ sectdone:
{
PlayerList[nPlayer].horizon.addadjustment(buildhoriz(dVertPan[nPlayer]));
if (PlayerList[nPlayer].horizon.horiz.asq16() >= IntToFixed(100))
if (PlayerList[nPlayer].horizon.horiz.Degrees() >= 38)
{
PlayerList[nPlayer].horizon.settarget(buildhoriz(99));
}
else if (PlayerList[nPlayer].horizon.horiz.asq16() <= 0)
else if (PlayerList[nPlayer].horizon.horiz.Sgn() <= 0)
{
if (!(pPlayerActor->sector()->Flag & kSectUnderwater))
{

View file

@ -11610,7 +11610,7 @@ int DoRing(DSWActor* actor)
// put it out there
actor->spr.pos += actor->spr.angle.ToVector() * actor->user.Dist;
if (pp) actor->spr.pos.Z += (actor->user.Dist * (-pp->horizon.horiz.asq16() >> 9)) * (1/ (512.*16.)); // horizon math sucks...
if (pp) actor->spr.pos.Z += actor->user.Dist * -pp->horizon.horiz.Tan() * 2.; // horizon math sucks...
SetActor(actor, actor->spr.pos);
@ -11689,7 +11689,7 @@ void InitSpellRing(PLAYER* pp)
// put it out there
actorNew->spr.pos += actorNew->spr.angle.ToVector() * actorNew->user.Dist;
actorNew->spr.pos.Z += pp->pos.Z + 20 + (actorNew->user.Dist * (-pp->horizon.horiz.asq16() >> 9)) * (1 / (512. * 16.)); // horizon math sucks...
actorNew->spr.pos.Z += pp->pos.Z + 20 + (actorNew->user.Dist * -pp->horizon.horiz.Tan() * 2.); // horizon math sucks...
actorNew->spr.angle += DAngle90;
@ -15321,7 +15321,7 @@ int InitTracerUzi(PLAYER* pp)
static const short lat_dist[] = {800,-800};
double nz = 8 - MulScaleF(pp->horizon.horiz.asq16(), 72, 24);
double nz = 8 - (pp->horizon.horiz.Tan() * 36.);
// Spawn a shot
// Inserting and setting up variables