From 8fd6452bafc33b0f71a8f59499c2efd0929e937c Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 7 Sep 2022 13:51:20 +1000 Subject: [PATCH] - Rename `interpolatedvaluef()` in preparation for replacement. --- source/core/coreactor.h | 6 +++--- source/core/interphelpers.h | 2 +- source/games/blood/src/qav.cpp | 8 ++++---- source/games/blood/src/view.cpp | 12 ++++++------ source/games/duke/src/animatesprites_d.cpp | 2 +- source/games/duke/src/animatesprites_r.cpp | 2 +- source/games/duke/src/hudweapon_d.cpp | 20 ++++++++++---------- source/games/duke/src/hudweapon_r.cpp | 8 ++++---- source/games/duke/src/inlines.h | 2 +- source/games/duke/src/render.cpp | 2 +- source/games/exhumed/src/gun.cpp | 2 +- source/games/exhumed/src/view.cpp | 2 +- source/games/sw/src/draw.cpp | 6 +++--- source/games/sw/src/panel.cpp | 4 ++-- 14 files changed, 39 insertions(+), 39 deletions(-) diff --git a/source/core/coreactor.h b/source/core/coreactor.h index 8fbf87c9e..80ab3345f 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -211,17 +211,17 @@ public: double interpolatedx(double const smoothratio, int const scale = 16) { - return interpolatedvaluef(opos.X, spr.pos.X, smoothratio, scale); + return __interpvaluef(opos.X, spr.pos.X, smoothratio, scale); } double interpolatedy(double const smoothratio, int const scale = 16) { - return interpolatedvaluef(opos.Y, spr.pos.Y, smoothratio, scale); + return __interpvaluef(opos.Y, spr.pos.Y, smoothratio, scale); } double interpolatedz(double const smoothratio, int const scale = 16) { - return interpolatedvaluef(opos.Z, spr.pos.Z, smoothratio, scale); + return __interpvaluef(opos.Z, spr.pos.Z, smoothratio, scale); } DVector3 interpolatedvec3(double const smoothratio) diff --git a/source/core/interphelpers.h b/source/core/interphelpers.h index 6c72ba259..c24c11aa6 100644 --- a/source/core/interphelpers.h +++ b/source/core/interphelpers.h @@ -47,7 +47,7 @@ inline constexpr int32_t interpolatedvalue(int32_t oval, int32_t val, int const return oval + MulScale(val - oval, smoothratio, scale); } -inline constexpr double interpolatedvaluef(double oval, double val, double const smoothratio, int const scale = 16) +inline constexpr double __interpvaluef(double oval, double val, double const smoothratio, int const scale = 16) { return oval + MulScaleF(val - oval, smoothratio, scale); } diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index 9f778c2f7..2c58cf99f 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -195,14 +195,14 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b if (prevTile) { - tileX += interpolatedvaluef(prevTile->x, thisTile->x, smoothratio); - tileY += interpolatedvaluef(prevTile->y, thisTile->y, smoothratio); - tileZ = interpolatedvaluef(prevTile->z, thisTile->z, smoothratio); + tileX += __interpvaluef(prevTile->x, thisTile->x, smoothratio); + tileY += __interpvaluef(prevTile->y, thisTile->y, smoothratio); + tileZ = __interpvaluef(prevTile->z, thisTile->z, smoothratio); 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.; - tileAlpha = interpolatedvaluef(prevAlpha, thisAlpha, smoothratio); + tileAlpha = __interpvaluef(prevAlpha, thisAlpha, smoothratio); } else { diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index 1b1a5bb7f..a0db9080d 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -497,11 +497,11 @@ void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sectortype cX = interpolatedvalue(predictOld.x, predict.x, gInterpolate); cY = interpolatedvalue(predictOld.y, predict.y, gInterpolate); cZ = interpolatedvalue(predictOld.viewz, predict.viewz, gInterpolate); - zDelta = interpolatedvaluef(predictOld.weaponZ, predict.weaponZ, gInterpolate); + zDelta = __interpvaluef(predictOld.weaponZ, predict.weaponZ, gInterpolate); bobWidth = interpolatedvalue(predictOld.bobWidth, predict.bobWidth, gInterpolate); bobHeight = interpolatedvalue(predictOld.bobHeight, predict.bobHeight, gInterpolate); - shakeX = interpolatedvaluef(predictOld.shakeBobX, predict.shakeBobX, gInterpolate); - shakeY = interpolatedvaluef(predictOld.shakeBobY, predict.shakeBobY, gInterpolate); + shakeX = __interpvaluef(predictOld.shakeBobX, predict.shakeBobX, gInterpolate); + shakeY = __interpvaluef(predictOld.shakeBobY, predict.shakeBobY, gInterpolate); if (!SyncInput()) { @@ -523,11 +523,11 @@ void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sectortype cX = interpolatedvalue(pView->x, gView->actor->int_pos().X, gInterpolate); cY = interpolatedvalue(pView->y, gView->actor->int_pos().Y, gInterpolate); cZ = interpolatedvalue(pView->viewz, gView->zView, gInterpolate); - zDelta = interpolatedvaluef(pView->weaponZ, gView->zWeapon - gView->zView - (12 << 8), gInterpolate); + zDelta = __interpvaluef(pView->weaponZ, gView->zWeapon - gView->zView - (12 << 8), gInterpolate); bobWidth = interpolatedvalue(pView->bobWidth, gView->bobWidth, gInterpolate); bobHeight = interpolatedvalue(pView->bobHeight, gView->bobHeight, gInterpolate); - shakeX = interpolatedvaluef(pView->shakeBobX, gView->swayWidth, gInterpolate); - shakeY = interpolatedvaluef(pView->shakeBobY, gView->swayHeight, gInterpolate); + shakeX = __interpvaluef(pView->shakeBobX, gView->swayWidth, gInterpolate); + shakeY = __interpvaluef(pView->shakeBobY, gView->swayHeight, gInterpolate); if (!SyncInput()) { diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index ed1fb696e..141b9ce59 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -169,7 +169,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat { t->pos.X -= MulScaleF(MaxSmoothRatio - smoothratio, pp->pos.X - pp->opos.X, 16); t->pos.Y -= MulScaleF(MaxSmoothRatio - smoothratio, pp->pos.Y - pp->opos.Y, 16); - t->pos.Z = interpolatedvaluef(pp->opos.Z, pp->pos.Z, smoothratio) + gs.playerheight; + t->pos.Z = __interpvaluef(pp->opos.Z, pp->pos.Z, smoothratio) + gs.playerheight; } else if (!actorflag(h, SFLAG_NOINTERPOLATE)) { diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index e057208c5..f7c2edef7 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -149,7 +149,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat { t->pos.X -= MulScaleF(MaxSmoothRatio - smoothratio, pp->pos.X - pp->opos.X, 16); t->pos.Y -= MulScaleF(MaxSmoothRatio - smoothratio, pp->pos.Y - pp->opos.Y, 16); - t->pos.Z = interpolatedvaluef(pp->opos.Z, pp->pos.Z, smoothratio) + gs.playerheight; + t->pos.Z = __interpvaluef(pp->opos.Z, pp->pos.Z, smoothratio) + gs.playerheight; h->spr.xrepeat = 24; h->spr.yrepeat = 17; } diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index 588fde59e..5e472e742 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -65,7 +65,7 @@ static void displayloogie(player_struct* p, double const smoothratio) { if (p->loogcnt == 0) return; - const double loogi = interpolatedvaluef(p->oloogcnt, p->loogcnt, smoothratio); + const double loogi = __interpvaluef(p->oloogcnt, p->loogcnt, smoothratio); const double y = loogi * 4.; for (int i = 0; i < p->numloogs; i++) @@ -86,7 +86,7 @@ static void displayloogie(player_struct* p, double const smoothratio) static bool animatefist(int gs, player_struct* p, double look_anghalf, double looking_arc, double plravel, int fistpal, double const smoothratio) { - const double fisti = min(interpolatedvaluef(p->ofist_incs, p->fist_incs, smoothratio), 32.); + const double fisti = min(__interpvaluef(p->ofist_incs, p->fist_incs, smoothratio), 32.); if (fisti <= 0) return false; hud_drawsprite( @@ -108,7 +108,7 @@ static bool animateknee(int gs, player_struct* p, double look_anghalf, double lo if (p->knee_incs > 11 || p->knee_incs == 0 || p->GetActor()->spr.extra <= 0) return false; static const int8_t knee_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8 }; - const double kneei = interpolatedvaluef(knee_y[p->oknee_incs], knee_y[p->knee_incs], smoothratio); + const double kneei = __interpvaluef(knee_y[p->oknee_incs], knee_y[p->knee_incs], smoothratio); looking_arc += kneei; hud_drawpal(105 + plravel - look_anghalf + (kneei * 0.25), looking_arc + 280 - horiz16th, KNEE, gs, 4, pal); @@ -161,7 +161,7 @@ static bool animatetip(int gs, player_struct* p, double look_anghalf, double loo if (p->tipincs == 0) return false; static const int8_t tip_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16 }; - const double tipi = interpolatedvaluef(tip_y[p->otipincs], tip_y[p->tipincs], smoothratio) * 0.5; + const double tipi = __interpvaluef(tip_y[p->otipincs], tip_y[p->tipincs], smoothratio) * 0.5; hud_drawpal(170 + plravel - look_anghalf, tipi + looking_arc + 240 - horiz16th, TIP + ((26 - p->tipincs) >> 4), gs, 0, pal); @@ -179,7 +179,7 @@ static bool animateaccess(int gs, player_struct* p, double look_anghalf, double if (p->access_incs == 0 || p->GetActor()->spr.extra <= 0) return false; static const int8_t access_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16}; - const double accessi = interpolatedvaluef(access_y[p->oaccess_incs], access_y[p->access_incs], smoothratio); + const double accessi = __interpvaluef(access_y[p->oaccess_incs], access_y[p->access_incs], smoothratio); looking_arc += accessi; const int pal = p->access_spritenum != nullptr ? p->access_spritenum->spr.pal : 0; @@ -215,11 +215,11 @@ void displayweapon_d(int snum, double smoothratio) if (cl_hudinterpolation) { - weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio); - kickback_pic = interpolatedvaluef(p->okickback_pic, p->kickback_pic, smoothratio); - random_club_frame = interpolatedvaluef(p->orandom_club_frame, p->random_club_frame, smoothratio); - hard_landing = interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio); - gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio); + weapon_sway = __interpvaluef(p->oweapon_sway, p->weapon_sway, smoothratio); + kickback_pic = __interpvaluef(p->okickback_pic, p->kickback_pic, smoothratio); + random_club_frame = __interpvaluef(p->orandom_club_frame, p->random_club_frame, smoothratio); + hard_landing = __interpvaluef(p->ohard_landing, p->hard_landing, smoothratio); + gun_pos = 80 - __interpvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio); } else { diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index 813cd38a8..55f9ada46 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -120,10 +120,10 @@ void displayweapon_r(int snum, double smoothratio) if (cl_hudinterpolation) { - weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio); - hard_landing = interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio); - gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio); - TiltStatus = !SyncInput() ? p->TiltStatus : interpolatedvaluef(p->oTiltStatus, p->TiltStatus, smoothratio); + weapon_sway = __interpvaluef(p->oweapon_sway, p->weapon_sway, smoothratio); + hard_landing = __interpvaluef(p->ohard_landing, p->hard_landing, smoothratio); + gun_pos = 80 - __interpvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio); + TiltStatus = !SyncInput() ? p->TiltStatus : __interpvaluef(p->oTiltStatus, p->TiltStatus, smoothratio); } else { diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index fad2e0d42..877854b9a 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -225,7 +225,7 @@ inline void hud_draw(double x, double y, int tilenum, int shade, int orientation inline void animateshrunken(player_struct* p, double weapon_xoffset, double looking_arc, double look_anghalf, int tilenum, int8_t shade, int o, double smoothratio) { - const double fistsign = bsinf(interpolatedvaluef(p->ofistsign, p->fistsign, smoothratio), -10); + const double fistsign = bsinf(__interpvaluef(p->ofistsign, p->fistsign, smoothratio), -10); if (p->jetpack_on == 0) looking_arc += 32 - (p->GetActor()->int_xvel() >> 1); hud_draw(weapon_xoffset + fistsign + 250 - look_anghalf, looking_arc + 258 - fabs(fistsign * 4), tilenum, shade, o); hud_draw(weapon_xoffset - fistsign + 40 - look_anghalf, looking_arc + 200 + fabs(fistsign * 4), tilenum, shade, o | 4); diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index d939665cf..d1f1eed06 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -339,7 +339,7 @@ void displayrooms(int snum, double smoothratio, bool sceneonly) } else if (p->over_shoulder_on == 0) { - if (cl_viewbob) cposz += interpolatedvaluef(p->opyoff, p->pyoff, smoothratio) * zworldtoint; + if (cl_viewbob) cposz += __interpvaluef(p->opyoff, p->pyoff, smoothratio) * zworldtoint; viewer = p->GetActor(); } else diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index 7ff210f3c..aa6af97af 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -911,7 +911,7 @@ void DrawWeapons(double smooth) if (cl_hudinterpolation) { nBobAngle = interpolatedangle(DAngle::fromBuild(obobangle), DAngle::fromBuild(bobangle), smooth * (1. / MaxSmoothRatio)).Buildfang(); - nVal = interpolatedvaluef(PlayerList[nLocalPlayer].ototalvel, PlayerList[nLocalPlayer].totalvel, smooth, 16) * 0.5; + nVal = __interpvaluef(PlayerList[nLocalPlayer].ototalvel, PlayerList[nLocalPlayer].totalvel, smooth, 16) * 0.5; } else { diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index a6b889116..ca34b00d1 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -214,7 +214,7 @@ void DrawView(double interpfrac, bool sceneonly) } else { - nCamerapos = pPlayerActor->interpolatedvec3(interpfrac).plusZ(interpolatedvaluef(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, interpfrac * MaxSmoothRatio) * zinttoworld); + nCamerapos = pPlayerActor->interpolatedvec3(interpfrac).plusZ(__interpvaluef(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, interpfrac * MaxSmoothRatio) * zinttoworld); pSector = PlayerList[nLocalPlayer].pPlayerViewSect; updatesector(nCamerapos, &pSector); diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 96743137a..27afad19b 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -1380,9 +1380,9 @@ void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly) else camerapp = pp; - tx = int(interpolatedvaluef(camerapp->opos.X, camerapp->pos.X, smoothratio) * worldtoint); - ty = int(interpolatedvaluef(camerapp->opos.Y, camerapp->pos.Y, smoothratio) * worldtoint); - tz = int(interpolatedvaluef(camerapp->opos.Z, camerapp->pos.Z, smoothratio) * zworldtoint); + tx = int(__interpvaluef(camerapp->opos.X, camerapp->pos.X, smoothratio) * worldtoint); + ty = int(__interpvaluef(camerapp->opos.Y, camerapp->pos.Y, smoothratio) * worldtoint); + tz = int(__interpvaluef(camerapp->opos.Z, camerapp->pos.Z, smoothratio) * zworldtoint); // Interpolate the player's angle while on a sector object, just like VoidSW. // This isn't needed for the turret as it was fixable, but moving sector objects are problematic. diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index 6aaea5e34..f0db03665 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -6387,8 +6387,8 @@ void pDisplaySprites(PLAYER* pp, double smoothratio) flags = 0; if (cl_hudinterpolation) { - x = interpolatedvaluef(psp->opos.X, psp->pos.X, smoothratio); - y = interpolatedvaluef(psp->opos.Y, psp->pos.Y, smoothratio); + x = __interpvaluef(psp->opos.X, psp->pos.X, smoothratio); + y = __interpvaluef(psp->opos.Y, psp->pos.Y, smoothratio); } else