From e2691d41844766cc5cdf47a24a17ecbd690cf697 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 7 Oct 2020 18:34:52 +1100 Subject: [PATCH] - Duke: Clean up a few missed things during f39939d11438c57b2c113a11bed90f0a165d7ef7. --- source/games/duke/src/inlines.h | 7 ++----- source/games/duke/src/prediction.cpp | 7 ++++--- source/games/duke/src/prediction.h | 3 ++- source/games/duke/src/render.cpp | 6 +++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 6ad1b90aa..086fa798b 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -195,12 +195,9 @@ inline void backupplayer(player_struct* p) } // the weapon display code uses this. -inline double get16thOfHoriz(int snum, bool interpolate, double smoothratio) +inline double get16thOfHoriz(int const snum, bool const interpolate, double const smoothratio) { - struct player_struct *p = &ps[snum]; - fixed_t ohorz = p->horizon.ohoriz.asq16() - p->horizon.ohorizoff.asq16(); - fixed_t horz = p->horizon.horiz.asq16() - p->horizon.horizoff.asq16(); - return (!interpolate ? horz : ohorz + fmulscale16(horz - ohorz, smoothratio)) * (0.0625 / FRACUNIT); + return (!interpolate ? ps[snum].horizon.sum() : ps[snum].horizon.interpolatedsum(smoothratio)).asq16() * (0.0625 / FRACUNIT); } diff --git a/source/games/duke/src/prediction.cpp b/source/games/duke/src/prediction.cpp index e68cdbacd..8d778f08b 100644 --- a/source/games/duke/src/prediction.cpp +++ b/source/games/duke/src/prediction.cpp @@ -39,7 +39,8 @@ BEGIN_DUKE_NS int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel; short globalskillsound; -fixed_t q16myang, oq16myang, q16myhoriz, oq16myhoriz, q16myhorizoff, oq16myhorizoff; +fixed_t q16myang, oq16myang; +fixedhoriz myhoriz, omyhoriz, myhorizoff, omyhorizoff; short mycursectnum, myjumpingcounter; char myjumpingtoggle, myonground, myhardlanding,myreturntocenter; int fakemovefifoplc; @@ -55,8 +56,8 @@ void resetmys() myz = omyz = ps[myconnectindex].posz; myxvel = myyvel = myzvel = 0; q16myang = oq16myang = ps[myconnectindex].q16ang; - q16myhoriz = oq16myhoriz = ps[myconnectindex].horizon.horiz.asq16(); - q16myhorizoff = oq16myhorizoff = ps[myconnectindex].horizon.horizoff.asq16(); + myhoriz = omyhoriz = ps[myconnectindex].horizon.horiz; + myhorizoff = omyhorizoff = ps[myconnectindex].horizon.horizoff; mycursectnum = ps[myconnectindex].cursectnum; myjumpingcounter = ps[myconnectindex].jumping_counter; myjumpingtoggle = ps[myconnectindex].jumping_toggle; diff --git a/source/games/duke/src/prediction.h b/source/games/duke/src/prediction.h index 6f9be8992..8d1396fd8 100644 --- a/source/games/duke/src/prediction.h +++ b/source/games/duke/src/prediction.h @@ -5,7 +5,8 @@ BEGIN_DUKE_NS extern int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel; extern short globalskillsound; extern short mycursectnum, myjumpingcounter; -extern fixed_t q16myang, oq16myang, q16myhoriz, oq16myhoriz, q16myhorizoff, oq16myhorizoff; +extern fixed_t q16myang, oq16myang; +extern fixedhoriz myhoriz, omyhoriz, myhorizoff, omyhorizoff; extern char myjumpingtoggle, myonground, myhardlanding,myreturntocenter; extern int fakemovefifoplc; extern int myxbak[MOVEFIFOSIZ], myybak[MOVEFIFOSIZ], myzbak[MOVEFIFOSIZ]; diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 234269039..417feb933 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -554,15 +554,15 @@ void displayrooms(int snum, double smoothratio) cposz = omyz + xs_CRoundToInt(fmulscale16(myz - omyz, smoothratio)); if (cl_syncinput) { - fixed_t ohorz = (oq16myhoriz + oq16myhorizoff); - fixed_t horz = (q16myhoriz + q16myhorizoff); + fixed_t ohorz = (omyhoriz.asq16() + omyhorizoff.asq16()); + fixed_t horz = (myhoriz.asq16() + myhorizoff.asq16()); choriz = q16horiz(ohorz + xs_CRoundToInt(fmulscale16(horz - ohorz, smoothratio))); cang = q16ang(oq16myang + xs_CRoundToInt(fmulscale16(((q16myang + dang - oq16myang) & 0x7FFFFFF) - dang, smoothratio))); } else { cang = q16ang(q16myang); - choriz = q16horiz(q16myhoriz + q16myhorizoff); + choriz = q16horiz(myhoriz.asq16() + myhorizoff.asq16()); } sect = mycursectnum; }