- Remove all remaining uses of fixedhoriz::asbuild().

This commit is contained in:
Mitchell Richters 2022-09-27 13:28:03 +10:00 committed by Christoph Oelckers
parent a952c35669
commit 41bbbd9df5
7 changed files with 16 additions and 17 deletions

View file

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

View file

@ -108,8 +108,8 @@ static void fakeProcessInput(PLAYER* pPlayer, InputPacket* pInput)
predict.jump = !!(gMe->input.actions & SB_JUMP);
if (predict.posture == 1)
{
int x = Cos(predict.angle.asbuild());
int y = Sin(predict.angle.asbuild());
int x = predict.angle.Cos();
int y = predict.angle.Sin();
if (pInput->fvel)
{
int forward = pInput->fvel;
@ -133,8 +133,8 @@ static void fakeProcessInput(PLAYER* pPlayer, InputPacket* pInput)
int speed = 0x10000;
if (predict.floordist > 0)
speed -= DivScale(predict.floordist, 0x100, 16);
int x = Cos(predict.angle.asbuild());
int y = Sin(predict.angle.asbuild());
int x = predict.angle.Cos();
int y = predict.angle.Sin();
if (pInput->fvel)
{
int forward = pInput->fvel;
@ -234,8 +234,8 @@ static void fakeProcessInput(PLAYER* pPlayer, InputPacket* pInput)
if (va && (sector[nSector].floorstat & 2) != 0)
{
int z1 = getflorzofslope(nSector, predict.x, predict.y);
int x2 = predict.x + MulScale(64, Cos(predict.angle.asbuild()), 30);
int y2 = predict.y + MulScale(64, Sin(predict.angle.asbuild()), 30);
int x2 = predict.x + MulScale(64, predict.angle.Cos(), 30);
int y2 = predict.y + MulScale(64, predict.angle.Sin(), 30);
int nSector2 = nSector;
updatesector(x2, y2, &nSector2);
if (nSector2 == nSector)

View file

@ -308,7 +308,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
if (screenpeek == myconnectindex && numplayers >= 2)
{
t->pos = interpolatedvalue(omypos, mypos, interpfrac).plusZ(gs_playerheight);
t->ang = interpolatedvalue(omyang, myang, interpfrac).asbuild();
t->angle = interpolatedvalue(omyang, myang, interpfrac);
t->sector = mycursectnum;
}
#endif

View file

@ -350,7 +350,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
if (screenpeek == myconnectindex && numplayers >= 2)
{
t->pos = interpolatedvalue(omypos, mypos, interpfrac).plusZ(gs_playerheight);
t->ang = interpolatedvalue(omyang, myang, interpfrac).asbuild();
t->angle = interpolatedvalue(omyang, myang, interpfrac);
t->sector = mycursectnum;
}
#endif

View file

@ -346,20 +346,20 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
}
ps[iPlayer].horizon.settarget(maphoriz(lValue));
}
else SetGameVarID(lVar2, ps[iPlayer].horizon.horiz.asbuild(), sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].horizon.horiz.Tan() * 128.), sActor, sPlayer);
break;
case PLAYER_OHORIZ:
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].horizon.ohoriz.asbuild(), sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].horizon.ohoriz.Tan() * 128.), sActor, sPlayer);
break;
case PLAYER_HORIZOFF:
if (bSet) ps[iPlayer].horizon.horizoff = maphoriz(lValue);
else SetGameVarID(lVar2, ps[iPlayer].horizon.horizoff.asbuild(), sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].horizon.horizoff.Tan() * 128.), sActor, sPlayer);
break;
case PLAYER_OHORIZOFF:
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].horizon.ohorizoff.asbuild(), sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].horizon.ohorizoff.Tan() * 128.), sActor, sPlayer);
break;
case PLAYER_INVDISPTIME:

View file

@ -792,7 +792,7 @@ static void FinalizeInput(player_struct *p, InputPacket& input)
loc.avel = input.avel = 0;
}
if (p->newOwner != nullptr || (p->sync.actions & SB_CENTERVIEW && abs(p->horizon.horiz.asbuild()) > 5))
if (p->newOwner != nullptr || (p->sync.actions & SB_CENTERVIEW && abs(p->horizon.horiz.Degrees()) > 2.2370))
{
loc.horz = input.horz = 0;
}

View file

@ -338,9 +338,9 @@ DDukeActor* aim(DDukeActor* actor, int abase)
int check;
if (actor->isPlayer())
{
double checkval = (act->spr.pos.Z - actor->spr.pos.Z) * 160 / sdist;
double horiz = ps[actor->PlayerIndex()].horizon.sum().asbuild();
check = abs(checkval - horiz) < 100;
double checkval = (act->spr.pos.Z - actor->spr.pos.Z) * 1.25 / sdist;
double horiz = ps[actor->PlayerIndex()].horizon.sum().Tan();
check = abs(checkval - horiz) < 0.78125;
}
else check = 1;