From 5df4caa82f44cf458f405e8f27b8d2064aa81978 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 3 Feb 2022 21:58:28 +0100 Subject: [PATCH] - renamed interpolate functions as preparation for floatifying opos. --- source/core/coreactor.h | 21 +++++++++++---------- source/games/blood/src/animatesprite.cpp | 2 +- source/games/duke/src/actors.cpp | 4 +--- source/games/duke/src/animatesprites_d.cpp | 2 +- source/games/duke/src/animatesprites_r.cpp | 2 +- source/games/duke/src/game_misc.cpp | 2 +- source/games/duke/src/gameexec.cpp | 12 ------------ source/games/exhumed/src/map.cpp | 4 ++-- source/games/exhumed/src/osdcmds.cpp | 2 +- source/games/exhumed/src/view.cpp | 8 ++++---- source/games/sw/src/draw.cpp | 8 ++++---- 11 files changed, 27 insertions(+), 40 deletions(-) diff --git a/source/core/coreactor.h b/source/core/coreactor.h index 18dc49f75..594c0c443 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -129,40 +129,41 @@ public: return { spr.pos.X, -spr.pos.Y, -spr.pos.Z }; } - int32_t interpolatedx(double const smoothratio, int const scale = 16) + int32_t __interpolatedx(double const smoothratio, int const scale = 16) { return interpolatedvalue(opos.X, spr.int_pos().X, smoothratio, scale); } - int32_t interpolatedy(double const smoothratio, int const scale = 16) + int32_t __interpolatedy(double const smoothratio, int const scale = 16) { return interpolatedvalue(opos.Y, spr.int_pos().Y, smoothratio, scale); } - int32_t interpolatedz(double const smoothratio, int const scale = 16) + int32_t __interpolatedz(double const smoothratio, int const scale = 16) { return interpolatedvalue(opos.Z, spr.int_pos().Z, smoothratio, scale); } - vec2_t interpolatedvec2(double const smoothratio, int const scale = 16) + vec2_t __interpolatedvec2(double const smoothratio, int const scale = 16) { return { - interpolatedx(smoothratio, scale), - interpolatedy(smoothratio, scale) + __interpolatedx(smoothratio, scale), + __interpolatedy(smoothratio, scale) }; } - vec3_t interpolatedvec3(double const smoothratio, int const scale = 16) + vec3_t __interpolatedvec3(double const smoothratio, int const scale = 16) { return { - interpolatedx(smoothratio, scale), - interpolatedy(smoothratio, scale), - interpolatedz(smoothratio, scale) + __interpolatedx(smoothratio, scale), + __interpolatedy(smoothratio, scale), + __interpolatedz(smoothratio, scale) }; } + int16_t interpolatedang(double const smoothratio) { return interpolatedangle(oang, spr.ang, smoothratio, 16); diff --git a/source/games/blood/src/animatesprite.cpp b/source/games/blood/src/animatesprite.cpp index d454bde66..06bbbea22 100644 --- a/source/games/blood/src/animatesprite.cpp +++ b/source/games/blood/src/animatesprite.cpp @@ -578,7 +578,7 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t if (cl_interpolate && owneractor->interpolated && !(pTSprite->flags & 512)) { - pTSprite->set_int_pos(owneractor->interpolatedvec3(gInterpolate)); + pTSprite->set_int_pos(owneractor->__interpolatedvec3(gInterpolate)); pTSprite->ang = owneractor->interpolatedang(gInterpolate); } int nAnim = 0; diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index a41f16408..0aefa4c32 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -792,9 +792,7 @@ void movecrane(DDukeActor *actor, int crane) else if (actor->IsActiveCrane()) { auto ang = ps[p].angle.ang.asbuild(); - ps[p].opos.X = ps[p].pos.X; - ps[p].opos.Y = ps[p].pos.Y; - ps[p].opos.Z = ps[p].pos.Z; + ps[p].opos = ps[p].pos; ps[p].pos.X = actor->int_pos().X - bcos(ang, -6); ps[p].pos.Y = actor->int_pos().Y - bsin(ang, -6); ps[p].pos.Z = actor->int_pos().Z + (2 << 8); diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 86bd7ead6..54857f3e1 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -172,7 +172,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat } else if (!actorflag(h, SFLAG_NOINTERPOLATE)) { - t->set_int_pos(h->interpolatedvec3(smoothratio)); + t->set_int_pos(h->__interpolatedvec3(smoothratio)); } auto sectp = h->sector(); diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 4d5c0d380..4d142a799 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -154,7 +154,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat } else if (!actorflag(h, SFLAG_NOINTERPOLATE)) { - t->set_int_pos(h->interpolatedvec3(smoothratio)); + t->set_int_pos(h->__interpolatedvec3(smoothratio)); } auto sectp = h->sector(); diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index a5f0e9fa9..0310a6403 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -558,7 +558,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int for (p = connecthead; p >= 0; p = connectpoint2[p]) { auto act = ps[p].GetActor(); - auto spos = act->interpolatedvec2(smoothratio); + auto spos = act->__interpolatedvec2(smoothratio); ox = mx - cposx; oy = my - cposy; diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 052303c9c..f42b4e324 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1321,18 +1321,6 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, if (bSet) act->ovel.Y = lValue; else SetGameVarID(lVar2, act->ovel.Y, sActor, sPlayer); break; - case ACTOR_HTBPOSX: - if (bSet) act->opos.X = lValue; - else SetGameVarID(lVar2, act->opos.X, sActor, sPlayer); - break; - case ACTOR_HTBPOSY: - if (bSet) act->opos.Y = lValue; - else SetGameVarID(lVar2, act->opos.Y, sActor, sPlayer); - break; - case ACTOR_HTBPOSZ: - if (bSet) act->opos.Z = lValue; - else SetGameVarID(lVar2, act->opos.Z, sActor, sPlayer); - break; case ACTOR_HTG_T0: if (bSet) act->temp_data[0] = lValue; else SetGameVarID(lVar2, act->temp_data[0], sActor, sPlayer); diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index 8acfaf14b..e9054cb25 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -50,8 +50,8 @@ void DrawMap(double const smoothratio) { auto pPlayerActor = PlayerList[nLocalPlayer].pActor; - int x = pPlayerActor->interpolatedx(smoothratio); - int y = pPlayerActor->interpolatedy(smoothratio); + int x = pPlayerActor->__interpolatedx(smoothratio); + int y = pPlayerActor->__interpolatedy(smoothratio); int ang = (!SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(smoothratio)).asbuild(); DrawOverheadMap(x, y, ang, smoothratio); } diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 0a6b113e4..8b6cf3cb7 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -38,7 +38,7 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) Player *nPlayer = &PlayerList[nLocalPlayer]; nPlayer->pActor->set_int_pos({ x, y, z }); - nPlayer->pActor->opos = nPlayer->pActor->int_pos(); + nPlayer->pActor->backuppos(); if (ang != INT_MIN) { diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 54e862e69..d3f19d50c 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -73,7 +73,7 @@ static void analyzesprites(tspriteArray& tsprites, int x, int y, int z, double c if (pTSprite->ownerActor) { // interpolate sprite position - pTSprite->set_int_pos(pTSprite->ownerActor->interpolatedvec3(smoothratio)); + pTSprite->set_int_pos(pTSprite->ownerActor->__interpolatedvec3(smoothratio)); pTSprite->ang = pTSprite->ownerActor->interpolatedang(smoothratio); } } @@ -230,9 +230,9 @@ void DrawView(double smoothRatio, bool sceneonly) } else { - playerX = pPlayerActor->interpolatedx(smoothRatio); - playerY = pPlayerActor->interpolatedy(smoothRatio); - playerZ = pPlayerActor->interpolatedz(smoothRatio) + interpolatedvalue(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, smoothRatio); + playerX = pPlayerActor->__interpolatedx(smoothRatio); + playerY = pPlayerActor->__interpolatedy(smoothRatio); + playerZ = pPlayerActor->__interpolatedz(smoothRatio) + interpolatedvalue(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, smoothRatio); pSector = PlayerList[nLocalPlayer].pPlayerViewSect; updatesector(playerX, playerY, &pSector); diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index cba5b2e0d..e437572b9 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -625,7 +625,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int { if (tsp->statnum <= STAT_SKIP4_INTERP_END) { - tsp->set_int_pos(tActor->interpolatedvec3(smr4, 18)); + tsp->set_int_pos(tActor->__interpolatedvec3(smr4, 18)); } } @@ -633,7 +633,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int { if (tsp->statnum <= STAT_SKIP2_INTERP_END) { - tsp->set_int_pos(tActor->interpolatedvec3(smr2, 17)); + tsp->set_int_pos(tActor->__interpolatedvec3(smr2, 17)); } } } @@ -1636,8 +1636,8 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int k = actor->spr.statnum; if ((k >= 1) && (k <= 8) && (k != 2)) // Interpolate moving { - sprx = actor->interpolatedx(smoothratio); - spry = actor->interpolatedy(smoothratio); + sprx = actor->__interpolatedx(smoothratio); + spry = actor->__interpolatedy(smoothratio); } switch (actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK)