diff --git a/source/core/fixedhorizon.h b/source/core/fixedhorizon.h index cb7e60854..5bba16ee4 100644 --- a/source/core/fixedhorizon.h +++ b/source/core/fixedhorizon.h @@ -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); } diff --git a/source/games/blood/src/prediction.cpp b/source/games/blood/src/prediction.cpp index 92bad724f..2656e2b8d 100644 --- a/source/games/blood/src/prediction.cpp +++ b/source/games/blood/src/prediction.cpp @@ -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) diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index e4db6c4fb..f5c7d6b45 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -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 diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 09d7c3847..91b6d6c34 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -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 diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 4cb5c5852..86c37c67a 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -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: diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 297db5fce..79dbcc6fc 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -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; } diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 92edf861c..8424d37b1 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -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;