- binaryangle.h: Add asbuildf() method to all classes and use where appropriate.

This commit is contained in:
Mitchell Richters 2020-11-23 00:17:07 +11:00 committed by Christoph Oelckers
parent e57d6f8785
commit 5ba2e7863d
7 changed files with 15 additions and 12 deletions

View file

@ -740,7 +740,7 @@ void viewDrawScreen(bool sceneonly)
//int tiltcs, tiltdim; //int tiltcs, tiltdim;
uint8_t v4 = powerupCheck(gView, kPwUpCrystalBall) > 0; uint8_t v4 = powerupCheck(gView, kPwUpCrystalBall) > 0;
#ifdef USE_OPENGL #ifdef USE_OPENGL
renderSetRollAngle(rotscrnang.asbam() / (double)(BAMUNIT)); renderSetRollAngle(rotscrnang.asbuildf());
#endif #endif
if (v78 || bDelirium) if (v78 || bDelirium)
{ {

View file

@ -132,6 +132,7 @@ public:
lookangle(const lookangle &other) = default; lookangle(const lookangle &other) = default;
// This class intentionally makes no allowances for implicit type conversions because those would render it ineffective. // This class intentionally makes no allowances for implicit type conversions because those would render it ineffective.
constexpr short asbuild() const { return value >> 21; } constexpr short asbuild() const { return value >> 21; }
constexpr double asbuildf() const { return value * (1. / BAMUNIT); }
constexpr fixed_t asq16() const { return value >> 5; } constexpr fixed_t asq16() const { return value >> 5; }
constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); } constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); }
constexpr double asdeg() const { return AngleToFloat(value); } constexpr double asdeg() const { return AngleToFloat(value); }
@ -255,6 +256,7 @@ public:
binangle(const binangle &other) = default; binangle(const binangle &other) = default;
// This class intentionally makes no allowances for implicit type conversions because those would render it ineffective. // This class intentionally makes no allowances for implicit type conversions because those would render it ineffective.
constexpr short asbuild() const { return value >> 21; } constexpr short asbuild() const { return value >> 21; }
constexpr double asbuildf() const { return value * (1. / BAMUNIT); }
constexpr fixed_t asq16() const { return value >> 5; } constexpr fixed_t asq16() const { return value >> 5; }
constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); } constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); }
constexpr double asdeg() const { return AngleToFloat(value); } 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. // This class intentionally makes no allowances for implicit type conversions because those would render it ineffective.
constexpr short asbuild() const { return FixedToInt(value); } constexpr short asbuild() const { return FixedToInt(value); }
constexpr double asbuildf() const { return FixedToFloat(value); }
constexpr fixed_t asq16() const { return value; } constexpr fixed_t asq16() const { return value; }
double aspitch() const { return HorizToPitch(value); } double aspitch() const { return HorizToPitch(value); }
int32_t asbam() const { return PitchToBAM(aspitch()); } int32_t asbam() const { return PitchToBAM(aspitch()); }

View file

@ -229,12 +229,12 @@ struct PlayerAngle
binangle osum() binangle osum()
{ {
return bamang(oang.asbam() + olook_ang.asbam()); return oang + olook_ang;
} }
binangle sum() binangle sum()
{ {
return bamang(ang.asbam() + look_ang.asbam()); return ang + look_ang;
} }
binangle interpolatedsum(double const smoothratio) binangle interpolatedsum(double const smoothratio)
@ -248,8 +248,8 @@ struct PlayerAngle
lookangle interpolatedrotscrn(double const smoothratio) lookangle interpolatedrotscrn(double const smoothratio)
{ {
double const ratio = smoothratio / FRACUNIT; double const ratio = smoothratio * (1. / FRACUNIT);
return bamlook(orotscrnang.asbam() + xs_CRoundToInt(ratio * (rotscrnang.asbam() - orotscrnang.asbam()))); return bamlook(orotscrnang.asbam() + xs_CRoundToInt(ratio * (rotscrnang - orotscrnang).asbam()));
} }
}; };

View file

@ -379,7 +379,7 @@ void seq_DrawPilotLightSeq(double xOffset, double yOffset)
double x = ChunkXpos[nFrameBase] + (160 + xOffset); double x = ChunkXpos[nFrameBase] + (160 + xOffset);
double y = ChunkYpos[nFrameBase] + (100 + yOffset); 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++; nFrameBase++;
} }
} }

View file

@ -298,7 +298,7 @@ void DrawView(double smoothRatio, bool sceneonly)
sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE; sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE;
} }
renderSetRollAngle(rotscrnang.asbam() / (double)BAMUNIT); renderSetRollAngle(rotscrnang.asbuildf());
} }
nCameraa = nAngle; nCameraa = nAngle;

View file

@ -546,10 +546,10 @@ void displayrooms(int snum, double smoothratio)
cposz = omyz + xs_CRoundToInt(fmulscale16(myz - omyz, smoothratio)); cposz = omyz + xs_CRoundToInt(fmulscale16(myz - omyz, smoothratio));
if (cl_syncinput) if (cl_syncinput)
{ {
fixed_t ohorz = (omyhoriz.asq16() + omyhorizoff.asq16()); fixed_t ohorz = (omyhoriz + omyhorizoff).asq16();
fixed_t horz = (myhoriz.asq16() + myhorizoff.asq16()); fixed_t horz = (myhoriz + myhorizoff).asq16();
choriz = q16horiz(ohorz + xs_CRoundToInt(fmulscale16(horz - ohorz, smoothratio))); 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 else
{ {
@ -605,7 +605,7 @@ void displayrooms(int snum, double smoothratio)
} }
// do screen rotation. // do screen rotation.
renderSetRollAngle(rotscrnang.asbam() / (double)(BAMUNIT)); renderSetRollAngle(rotscrnang.asbuildf());
cz = p->GetActor()->ceilingz; cz = p->GetActor()->ceilingz;
fz = p->GetActor()->floorz; fz = p->GetActor()->floorz;

View file

@ -1667,7 +1667,7 @@ drawscreen(PLAYERp pp, double smoothratio)
} }
tsectnum = camerapp->cursectnum; tsectnum = camerapp->cursectnum;
renderSetRollAngle(trotscrnang.asbam() / (double)BAMUNIT); renderSetRollAngle(trotscrnang.asbuildf());
COVERupdatesector(tx, ty, &tsectnum); COVERupdatesector(tx, ty, &tsectnum);