diff --git a/source/core/gameinput.h b/source/core/gameinput.h index f366d415d..a858b01bf 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -155,8 +155,8 @@ struct PlayerAngle bool movementlocked() { return targetset() || inputdisabled; } // Draw code helpers. The logic where these are used rely heavily on Build's angle period. - double look_anghalf(double const interpfrac) { return renderlookang(interpfrac).Normalized180().Buildfang() * 0.5; } - double looking_arc(double const interpfrac) { return fabs(renderlookang(interpfrac).Normalized180().Buildfang() * (1. / 9.)); } + double look_anghalf(double const interpfrac) { return renderlookang(interpfrac).Normalized180().Degrees() * (128. / 45.); } + double looking_arc(double const interpfrac) { return fabs(renderlookang(interpfrac).Normalized180().Degrees() * (1024. / 1620.)); } // Ticrate playsim adjustment setters and processor. void addadjustment(const DAngle value) diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index b96a553c8..6b2405271 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -129,7 +129,6 @@ void DrawFrame(double x, double y, double z, double a, double alpha, int picnum, { auto tex = tileGetTexture(picnum); double scale = z * (1. / 65536.); - double angle = a * BAngToDegree; int renderstyle = (stat & RS_NOMASK) ? STYLE_Normal : STYLE_Translucent; int pin = (stat & kQavOrientationLeft) ? -1 : (stat & RS_ALIGN_R) ? 1 : 0; auto translation = TRANSLATION(Translation_Remap, palnum); @@ -139,7 +138,7 @@ void DrawFrame(double x, double y, double z, double a, double alpha, int picnum, bool yflip = !!(stat & RS_YFLIP); auto color = shadeToLight(shade); - DrawTexture(twod, tex, x, y, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Rotate, angle, DTA_LegacyRenderStyle, renderstyle, DTA_Alpha, alpha, DTA_Pin, pin, DTA_TranslationIndex, translation, + DrawTexture(twod, tex, x, y, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Rotate, a, DTA_LegacyRenderStyle, renderstyle, DTA_Alpha, alpha, DTA_Pin, pin, DTA_TranslationIndex, translation, DTA_TopLeft, topleft, DTA_CenterOffsetRel, topleft ? 0 : 2, DTA_FullscreenScale, FSMode_Fit320x200, DTA_FlipOffsets, true, DTA_Color, color, DTA_FlipX, xflip, DTA_FlipY, yflip, TAG_DONE); } @@ -188,7 +187,7 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b double tileX; double tileY; double tileZ; - double tileA; + DAngle tileA; double tileAlpha; int tileShade; auto const tileStat = stat | thisTile->stat; @@ -198,7 +197,7 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b tileX = interpolatedvalue(prevTile->x, thisTile->x, interpfrac); tileY = interpolatedvalue(prevTile->y, thisTile->y, interpfrac); tileZ = interpolatedvalue(prevTile->z, thisTile->z, interpfrac); - tileA = interpolatedvalue(DAngle::fromBuild(prevTile->angle), DAngle::fromBuild(thisTile->angle), interpfrac).Buildfang(); + tileA = interpolatedvalue(prevTile->angle, thisTile->angle, interpfrac); tileShade = interpolatedvalue(prevTile->shade, thisTile->shade, interpfrac) + shade; auto prevAlpha = ((stat | prevTile->stat) & RS_TRANS1) ? glblend[0].def[!!((stat | prevTile->stat) & RS_TRANS2)].alpha : 1.f; auto thisAlpha = (tileStat & RS_TRANS1) ? glblend[0].def[!!(tileStat & RS_TRANS2)].alpha : 1.f; @@ -214,7 +213,7 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b tileAlpha = (tileStat & RS_TRANS1) ? glblend[0].def[!!(tileStat & RS_TRANS2)].alpha : 1.f; } - DrawFrame(tileX + x, tileY + y, tileZ, tileA, tileAlpha, thisTile->picnum, tileStat, tileShade, (palnum <= 0 ? thisTile->palnum : palnum), to3dview); + DrawFrame(tileX + x, tileY + y, tileZ, tileA.Degrees(), tileAlpha, thisTile->picnum, tileStat, tileShade, (palnum <= 0 ? thisTile->palnum : palnum), to3dview); } } } @@ -418,7 +417,7 @@ QAV* getQAV(int res_id) qavdata->frames[i].tiles[j].stat = fr.ReadInt32(); qavdata->frames[i].tiles[j].shade = fr.ReadInt8(); qavdata->frames[i].tiles[j].palnum = fr.ReadUInt8(); - qavdata->frames[i].tiles[j].angle = fr.ReadUInt16(); + qavdata->frames[i].tiles[j].angle = DAngle::fromBuild(fr.ReadUInt16()); } } diff --git a/source/games/blood/src/qav.h b/source/games/blood/src/qav.h index adf6715d3..166b0e945 100644 --- a/source/games/blood/src/qav.h +++ b/source/games/blood/src/qav.h @@ -200,7 +200,7 @@ struct TILE_FRAME int stat; int8_t shade; int8_t palnum; - uint16_t angle; + DAngle angle; }; struct SOUNDINFO diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index 36dfeb395..e1f8f3569 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -309,7 +309,6 @@ void GameMove(void) else { bobangle += 56; - bobangle &= kAngleMask; } UpdateCreepySounds(); diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index 801df51e2..e932bfab1 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -910,8 +910,8 @@ void DrawWeapons(double interpfrac) if (cl_hudinterpolation) { - nBobAngle = interpolatedvalue(DAngle::fromBuild(obobangle), DAngle::fromBuild(bobangle), interpfrac).Buildfang(); - nVal = interpolatedvalue(PlayerList[nLocalPlayer].ototalvel, PlayerList[nLocalPlayer].totalvel, interpfrac) * 0.5; + nBobAngle = interpolatedvalue(obobangle, bobangle, interpfrac) * BAngToDegree; + nVal = interpolatedvalue(PlayerList[nLocalPlayer].ototalvel, PlayerList[nLocalPlayer].totalvel, interpfrac); } else { @@ -919,11 +919,11 @@ void DrawWeapons(double interpfrac) nVal = PlayerList[nLocalPlayer].totalvel; } - yOffset = MulScaleF(nVal, bsinf(fmod(nBobAngle, 1024.), -8), 9); + yOffset = nVal * fabs(g_sindeg(nBobAngle)) * (1. / 16.); if (var_34 == 1) { - xOffset = MulScaleF(bcosf(nBobAngle, -8), nVal, 8); + xOffset = nVal * g_cosdeg(nBobAngle) * (1. / 8.); } } else