From 7d5040f5600f786c52ecde016f213a5dfacc7a6f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 6 Sep 2022 22:22:51 +1000 Subject: [PATCH] - Fix all calls to `interpolatedangle()` that didn't revert smoothratio back to a float. --- source/games/blood/src/qav.cpp | 2 +- source/games/blood/src/view.cpp | 14 +++++++------- source/games/duke/src/animatesprites_d.cpp | 2 +- source/games/duke/src/animatesprites_r.cpp | 2 +- source/games/duke/src/game_misc.cpp | 4 ++-- source/games/duke/src/render.cpp | 8 ++++---- source/games/exhumed/src/gun.cpp | 2 +- source/games/exhumed/src/map.cpp | 2 +- source/games/exhumed/src/view.cpp | 4 ++-- source/games/sw/src/draw.cpp | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index 95d6ef3f6..9f778c2f7 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -198,7 +198,7 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b tileX += interpolatedvaluef(prevTile->x, thisTile->x, smoothratio); tileY += interpolatedvaluef(prevTile->y, thisTile->y, smoothratio); tileZ = interpolatedvaluef(prevTile->z, thisTile->z, smoothratio); - tileA = interpolatedangle(DAngle::fromBuild(prevTile->angle), DAngle::fromBuild(thisTile->angle), smoothratio).Buildfang(); + tileA = interpolatedangle(DAngle::fromBuild(prevTile->angle), DAngle::fromBuild(thisTile->angle), smoothratio * (1. / MaxSmoothRatio)).Buildfang(); tileShade = interpolatedvalue(prevTile->shade, thisTile->shade, smoothratio) + shade; auto prevAlpha = ((stat | prevTile->stat) & RS_TRANS1) ? glblend[0].def[!!((stat | prevTile->stat) & RS_TRANS2)].alpha : 1.; auto thisAlpha = (tileStat & RS_TRANS1) ? glblend[0].def[!!(tileStat & RS_TRANS2)].alpha : 1.; diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index d801d0443..1b1a5bb7f 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -473,7 +473,7 @@ static void DrawMap(DBloodActor* view) } VIEW* pView = &gPrevView[gViewIndex]; auto xy = DVector2(interpolatedvalue(pView->x, view->int_pos().X, gInterpolate), interpolatedvalue(pView->y, view->int_pos().Y, gInterpolate)) * inttoworld; - auto ang = !SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(gInterpolate); + auto ang = !SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(gInterpolate * (1. / MaxSmoothRatio)); DrawOverheadMap(xy, ang, gInterpolate); if (tm) setViewport(hud_size); @@ -511,9 +511,9 @@ void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sectortype } else { - cA = interpolatedangle(predictOld.angle + predictOld.look_ang, predict.angle + predict.look_ang, gInterpolate); + cA = interpolatedangle(predictOld.angle + predictOld.look_ang, predict.angle + predict.look_ang, gInterpolate * (1. / MaxSmoothRatio)); cH = interpolatedhorizon(predictOld.horiz + predictOld.horizoff, predict.horiz + predict.horizoff, gInterpolate); - rotscrnang = interpolatedangle(predictOld.rotscrnang, predict.rotscrnang, gInterpolate); + rotscrnang = interpolatedangle(predictOld.rotscrnang, predict.rotscrnang, gInterpolate * (1. / MaxSmoothRatio)); } } else @@ -537,9 +537,9 @@ void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sectortype } else { - cA = gView->angle.interpolatedsum(gInterpolate); + cA = gView->angle.interpolatedsum(gInterpolate * (1. / MaxSmoothRatio)); cH = gView->horizon.interpolatedsum(gInterpolate); - rotscrnang = gView->angle.interpolatedrotscrn(gInterpolate); + rotscrnang = gView->angle.interpolatedrotscrn(gInterpolate * (1. / MaxSmoothRatio)); } } @@ -686,7 +686,7 @@ void viewDrawScreen(bool sceneonly) double shakeX, shakeY; SetupView(cX, cY, cZ, cA, cH, pSector, zDelta, shakeX, shakeY, rotscrnang); - DAngle tilt = interpolatedangle(gScreenTiltO, gScreenTilt, gInterpolate); + DAngle tilt = interpolatedangle(gScreenTiltO, gScreenTilt, gInterpolate * (1. / MaxSmoothRatio)); bool bDelirium = powerupCheck(gView, kPwUpDeliriumShroom) > 0; static bool bDeliriumOld = false; //int tiltcs, tiltdim; @@ -735,7 +735,7 @@ void viewDrawScreen(bool sceneonly) } } g_relvisibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - brightness, 0)) - g_visibility; - cA += interpolatedangle(deliriumTurnO, deliriumTurn, gInterpolate); + cA += interpolatedangle(deliriumTurnO, deliriumTurn, gInterpolate * (1. / MaxSmoothRatio)); if (pSector != nullptr) { diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index fe830d7c2..6d0c0e36e 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -310,7 +310,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat t->x = interpolatedvalue(omyx, myx, smoothratio); t->y = interpolatedvalue(omyy, myy, smoothratio); t->z = interpolatedvalue(omyz, myz, smoothratio) + gs_playerheight; - t->ang = interpolatedangle(omyang, myang, smoothratio).asbuild(); + t->ang = interpolatedangle(omyang, myang, smoothratio * (1. / MaxSmoothRatio)).asbuild(); t->sector = mycursectnum; } #endif diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 8b42c9518..e2339ebf7 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -352,7 +352,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat t->x = interpolatedvalue(omyx, myx, smoothratio); t->y = interpolatedvalue(omyy, myy, smoothratio); t->z = interpolatedvalue(omyz, myz, smoothratio) + gs.playerheight; - t->ang = interpolatedangle(omyang, myang, smoothratio).asbuild(); + t->ang = interpolatedangle(omyang, myang, smoothratio * (1. / MaxSmoothRatio)).asbuild(); t->sector = mycursectnum; } #endif diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index b8cf953ca..a7d3b6ac2 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -267,12 +267,12 @@ void drawoverlays(double smoothratio) if (screenpeek == myconnectindex && numplayers > 1) { cposxy = DVector2(interpolatedvalue(omyx, myx, smoothratio), interpolatedvalue(omyy, myy, smoothratio)) * inttoworld; - cang = !SyncInput() ? myang : interpolatedangle(omyang, myang, smoothratio); + cang = !SyncInput() ? myang : interpolatedangle(omyang, myang, smoothratio * (1. / MaxSmoothRatio)); } else { cposxy = interpolatedvec3(pp->opos, pp->pos, smoothratio * (1. / MaxSmoothRatio)).XY(); - cang = !SyncInput() ? pp->angle.ang : interpolatedangle(pp->angle.oang, pp->angle.ang, smoothratio); + cang = !SyncInput() ? pp->angle.ang : interpolatedangle(pp->angle.oang, pp->angle.ang, smoothratio * (1. / MaxSmoothRatio)); } } else diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index d68faea75..d939665cf 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -258,7 +258,7 @@ void displayrooms(int snum, double smoothratio, bool sceneonly) if (act->spr.yint < 0) act->spr.yint = -100; else if (act->spr.yint > 199) act->spr.yint = 300; - cang = interpolatedangle(DAngle::fromBuild(ud.cameraactor->tempang), act->spr.angle, smoothratio); + cang = interpolatedangle(DAngle::fromBuild(ud.cameraactor->tempang), act->spr.angle, smoothratio * (1. / MaxSmoothRatio)); auto bh = buildhoriz(act->spr.yint); auto cstat = act->spr.cstat; @@ -281,7 +281,7 @@ void displayrooms(int snum, double smoothratio, bool sceneonly) setgamepalette(setpal(p)); // set screen rotation. - rotscrnang = !SyncInput() ? p->angle.rotscrnang : p->angle.interpolatedrotscrn(smoothratio); + rotscrnang = !SyncInput() ? p->angle.rotscrnang : p->angle.interpolatedrotscrn(smoothratio * (1. / MaxSmoothRatio)); #if 0 if ((snum == myconnectindex) && (numplayers > 1)) @@ -292,7 +292,7 @@ void displayrooms(int snum, double smoothratio, bool sceneonly) if (SyncInput()) { choriz = interpolatedhorizon(omyhoriz + omyhorizoff, myhoriz + myhorizoff, smoothratio); - cang = interpolatedangle(omyang, myang, smoothratio); + cang = interpolatedangle(omyang, myang, smoothratio * (1. / MaxSmoothRatio)); } else { @@ -310,7 +310,7 @@ void displayrooms(int snum, double smoothratio, bool sceneonly) if (SyncInput()) { // Original code for when the values are passed through the sync struct - cang = p->angle.interpolatedsum(smoothratio); + cang = p->angle.interpolatedsum(smoothratio * (1. / MaxSmoothRatio)); choriz = p->horizon.interpolatedsum(smoothratio); } else diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index f8ab4a1f5..7ff210f3c 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -910,7 +910,7 @@ void DrawWeapons(double smooth) if (cl_hudinterpolation) { - nBobAngle = interpolatedangle(DAngle::fromBuild(obobangle), DAngle::fromBuild(bobangle), smooth).Buildfang(); + nBobAngle = interpolatedangle(DAngle::fromBuild(obobangle), DAngle::fromBuild(bobangle), smooth * (1. / MaxSmoothRatio)).Buildfang(); nVal = interpolatedvaluef(PlayerList[nLocalPlayer].ototalvel, PlayerList[nLocalPlayer].totalvel, smooth, 16) * 0.5; } else diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index 0e5d0a5b0..1f893611f 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -49,7 +49,7 @@ void DrawMap(double const smoothratio) if (!nFreeze && automapMode != am_off) { auto pPlayerActor = PlayerList[nLocalPlayer].pActor; - auto ang = !SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(smoothratio); + auto ang = !SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(smoothratio * (1. / MaxSmoothRatio)); DrawOverheadMap(pPlayerActor->interpolatedvec3(smoothratio * (1. / MaxSmoothRatio)).XY(), ang, smoothratio); } } diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 9601b772f..095c93057 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -239,8 +239,8 @@ void DrawView(double smoothRatio, bool sceneonly) else { pan = PlayerList[nLocalPlayer].horizon.interpolatedsum(smoothRatio); - nAngle = PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio); - rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(smoothRatio); + nAngle = PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio * (1. / MaxSmoothRatio)); + rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(smoothRatio * (1. / MaxSmoothRatio)); } if (!bCamera) diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index eeb3f9636..332aa3ae0 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -784,7 +784,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int pp = tActor->user.PlayerP; double sr = 1. - smoothratio * (1. / MaxSmoothRatio); tsp->pos -= (pp->pos - pp->opos) * sr; - tsp->angle = pp->angle.interpolatedang(sr); + tsp->angle = pp->angle.interpolatedang(sr * (1. / MaxSmoothRatio)); } } @@ -1388,9 +1388,9 @@ void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly) // This isn't needed for the turret as it was fixable, but moving sector objects are problematic. if (SyncInput() || pp != Player+myconnectindex) { - tang = camerapp->angle.interpolatedsum(smoothratio); + tang = camerapp->angle.interpolatedsum(smoothratio * (1. / MaxSmoothRatio)); thoriz = camerapp->horizon.interpolatedsum(smoothratio); - trotscrnang = camerapp->angle.interpolatedrotscrn(smoothratio); + trotscrnang = camerapp->angle.interpolatedrotscrn(smoothratio * (1. / MaxSmoothRatio)); } else {