- interpolate bobx and boby with higher precision from updated `CalcSmoothRatio()` function that returns a double instead of an int.

This commit is contained in:
Mitchell Richters 2020-08-03 08:50:48 +10:00
parent 8a31e96602
commit 61820ddef5
4 changed files with 15 additions and 10 deletions

View File

@ -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);

View File

@ -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)
{

View File

@ -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())

View File

@ -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);