diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 536b58f90..3e5375169 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -740,7 +740,7 @@ void viewDrawScreen(bool sceneonly) //int tiltcs, tiltdim; uint8_t v4 = powerupCheck(gView, kPwUpCrystalBall) > 0; #ifdef USE_OPENGL - renderSetRollAngle(rotscrnang.asbam() / (double)(BAMUNIT)); + renderSetRollAngle(rotscrnang.asbuildf()); #endif if (v78 || bDelirium) { diff --git a/source/core/binaryangle.h b/source/core/binaryangle.h index 0a464725c..3e0dd989f 100644 --- a/source/core/binaryangle.h +++ b/source/core/binaryangle.h @@ -132,6 +132,7 @@ public: lookangle(const lookangle &other) = default; // This class intentionally makes no allowances for implicit type conversions because those would render it ineffective. constexpr short asbuild() const { return value >> 21; } + constexpr double asbuildf() const { return value * (1. / BAMUNIT); } constexpr fixed_t asq16() const { return value >> 5; } constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); } constexpr double asdeg() const { return AngleToFloat(value); } @@ -255,6 +256,7 @@ public: binangle(const binangle &other) = default; // This class intentionally makes no allowances for implicit type conversions because those would render it ineffective. constexpr short asbuild() const { return value >> 21; } + constexpr double asbuildf() const { return value * (1. / BAMUNIT); } constexpr fixed_t asq16() const { return value >> 5; } constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); } constexpr double asdeg() const { return AngleToFloat(value); } @@ -423,6 +425,7 @@ 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 double asbuildf() const { return FixedToFloat(value); } constexpr fixed_t asq16() const { return value; } double aspitch() const { return HorizToPitch(value); } int32_t asbam() const { return PitchToBAM(aspitch()); } diff --git a/source/core/gameinput.h b/source/core/gameinput.h index e3b65524b..4326b4c71 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -229,12 +229,12 @@ struct PlayerAngle binangle osum() { - return bamang(oang.asbam() + olook_ang.asbam()); + return oang + olook_ang; } binangle sum() { - return bamang(ang.asbam() + look_ang.asbam()); + return ang + look_ang; } binangle interpolatedsum(double const smoothratio) @@ -248,8 +248,8 @@ struct PlayerAngle lookangle interpolatedrotscrn(double const smoothratio) { - double const ratio = smoothratio / FRACUNIT; - return bamlook(orotscrnang.asbam() + xs_CRoundToInt(ratio * (rotscrnang.asbam() - orotscrnang.asbam()))); + double const ratio = smoothratio * (1. / FRACUNIT); + return bamlook(orotscrnang.asbam() + xs_CRoundToInt(ratio * (rotscrnang - orotscrnang).asbam())); } }; diff --git a/source/exhumed/src/sequence.cpp b/source/exhumed/src/sequence.cpp index 4899bb10a..4e3d7a44b 100644 --- a/source/exhumed/src/sequence.cpp +++ b/source/exhumed/src/sequence.cpp @@ -379,7 +379,7 @@ void seq_DrawPilotLightSeq(double xOffset, double yOffset) double x = ChunkXpos[nFrameBase] + (160 + xOffset); double y = ChunkYpos[nFrameBase] + (100 + yOffset); - hud_drawsprite(x, y, 65536, fmod(-2 * (PlayerList[nLocalPlayer].angle.ang.asbam() / (double)BAMUNIT), kAngleMask + 1), nTile, 0, 0, 1); + hud_drawsprite(x, y, 65536, fmod(-2 * PlayerList[nLocalPlayer].angle.ang.asbuildf(), kAngleMask + 1), nTile, 0, 0, 1); nFrameBase++; } } diff --git a/source/exhumed/src/view.cpp b/source/exhumed/src/view.cpp index c92ab7acb..b6eb814fd 100644 --- a/source/exhumed/src/view.cpp +++ b/source/exhumed/src/view.cpp @@ -298,7 +298,7 @@ void DrawView(double smoothRatio, bool sceneonly) sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE; } - renderSetRollAngle(rotscrnang.asbam() / (double)BAMUNIT); + renderSetRollAngle(rotscrnang.asbuildf()); } nCameraa = nAngle; diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index cfb4d1432..f7b80de4b 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -546,10 +546,10 @@ void displayrooms(int snum, double smoothratio) cposz = omyz + xs_CRoundToInt(fmulscale16(myz - omyz, smoothratio)); if (cl_syncinput) { - fixed_t ohorz = (omyhoriz.asq16() + omyhorizoff.asq16()); - fixed_t horz = (myhoriz.asq16() + myhorizoff.asq16()); + fixed_t ohorz = (omyhoriz + omyhorizoff).asq16(); + fixed_t horz = (myhoriz + myhorizoff).asq16(); choriz = q16horiz(ohorz + xs_CRoundToInt(fmulscale16(horz - ohorz, smoothratio))); - cang = bamang(xs_CRoundToUInt(omyang.asbam() + fmulscale16(myang.asbam() - omyang.asbam(), smoothratio))); + cang = bamang(xs_CRoundToUInt(omyang.asbam() + fmulscale16((myang - omyang).asbam(), smoothratio))); } else { @@ -605,7 +605,7 @@ void displayrooms(int snum, double smoothratio) } // do screen rotation. - renderSetRollAngle(rotscrnang.asbam() / (double)(BAMUNIT)); + renderSetRollAngle(rotscrnang.asbuildf()); cz = p->GetActor()->ceilingz; fz = p->GetActor()->floorz; diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 598ba3ff1..73b95f046 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1667,7 +1667,7 @@ drawscreen(PLAYERp pp, double smoothratio) } tsectnum = camerapp->cursectnum; - renderSetRollAngle(trotscrnang.asbam() / (double)BAMUNIT); + renderSetRollAngle(trotscrnang.asbuildf()); COVERupdatesector(tx, ty, &tsectnum);