diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index 99751eedd..d64d69c7a 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -658,6 +658,11 @@ inline int interpolate(int a, int b, int c) return a+mulscale16(b-a,c); } +inline double finterpolate(double a, double b, double c) +{ + return a+fmulscale16(b-a,c); +} + inline int interpolateang(int a, int b, int c) { return a+mulscale16(((b-a+1024)&2047)-1024, c); diff --git a/source/blood/src/hudsprites.cpp b/source/blood/src/hudsprites.cpp index bb4e063a4..20e21906d 100644 --- a/source/blood/src/hudsprites.cpp +++ b/source/blood/src/hudsprites.cpp @@ -95,7 +95,7 @@ static void viewBurnTime(int gScale) } -void hudDraw(PLAYER *gView, int nSectnum, int defaultHoriz, int bobx, int boby, int zDelta, int basepal) +void hudDraw(PLAYER *gView, int nSectnum, int defaultHoriz, double bobx, double boby, int zDelta, int basepal) { if (gViewPos == 0) { diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 6a1d60caf..12dd88191 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -64,7 +64,7 @@ struct INTERPOLATE { int gViewMode = 3; int gViewSize = 2; -int gInterpolate; +double gInterpolate; int nInterpolations; char gInterpolateSprite[(kMaxSprites+7)>>3]; char gInterpolateWall[(kMaxWalls+7)>>3]; @@ -779,8 +779,8 @@ void viewDrawScreen(bool sceneonly) fix16_t q16slopehoriz = gView->q16slopehoriz; int v74 = gView->bobWidth; int v8c = gView->bobHeight; - int v4c = gView->swayWidth; - int v48 = gView->swayHeight; + double v4c = gView->swayWidth; + double v48 = gView->swayHeight; int nSectnum = gView->pSprite->sectnum; if (cl_interpolate) { @@ -796,8 +796,8 @@ void viewDrawScreen(bool sceneonly) q16slopehoriz = interpolate(predictOld.at28, predict.at28, gInterpolate); v74 = interpolate(predictOld.atc, predict.atc, gInterpolate); v8c = interpolate(predictOld.at8, predict.at8, gInterpolate); - v4c = interpolate(predictOld.at1c, predict.at1c, gInterpolate); - v48 = interpolate(predictOld.at18, predict.at18, gInterpolate); + v4c = finterpolate(predictOld.at1c, predict.at1c, gInterpolate); + v48 = finterpolate(predictOld.at18, predict.at18, gInterpolate); } else { @@ -811,8 +811,8 @@ void viewDrawScreen(bool sceneonly) q16slopehoriz = interpolate(pView->at28, q16slopehoriz, gInterpolate); v74 = interpolate(pView->atc, v74, gInterpolate); v8c = interpolate(pView->at8, v8c, gInterpolate); - v4c = interpolate(pView->at1c, v4c, gInterpolate); - v48 = interpolate(pView->at18, v48, gInterpolate); + v4c = finterpolate(pView->at1c, v4c, gInterpolate); + v48 = finterpolate(pView->at18, v48, gInterpolate); } } if (gView == gMe && (numplayers <= 1 || gPrediction) && gView->pXSprite->health != 0 && !VanillaMode()) diff --git a/source/blood/src/view.h b/source/blood/src/view.h index 78e2f0eb0..2fc07cdaa 100644 --- a/source/blood/src/view.h +++ b/source/blood/src/view.h @@ -145,9 +145,9 @@ extern int gViewXCenter, gViewYCenter; extern int gViewX0, gViewY0, gViewX1, gViewY1; extern int gViewX0S, gViewY0S, gViewX1S, gViewY1S; extern int gLastPal; -extern int gInterpolate; +extern double gInterpolate; -void hudDraw(PLAYER* gView, int nSectnum, int defaultHoriz, int bobx, int boby, int zDelta, int basepal); +void hudDraw(PLAYER* gView, int nSectnum, int defaultHoriz, double bobx, double boby, int zDelta, int basepal); void viewToggle(int viewMode); void viewInitializePrediction(void); void viewUpdatePrediction(GINPUT *pInput);