diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index e1e4cc7a9..c720e3486 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -1128,7 +1128,7 @@ void RestorePortalState() } } -void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly) +void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly) { DAngle tang, trotscrnang; fixedhoriz thoriz; @@ -1137,9 +1137,6 @@ void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly) // prediction player if prediction is on, else regular player PLAYER* camerapp = (PredictionOn && CommEnabled && pp == Player+myconnectindex) ? ppp : pp; - // temporary interpolation scaler. - double interpfrac = smoothratio * (1. / MaxSmoothRatio); - DrawScreen = true; PreDraw(); @@ -1149,7 +1146,7 @@ void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly) { // Stick at beginning of drawscreen DoInterpolations(interpfrac); - if (cl_sointerpolation) so_dointerpolations((int)smoothratio); + if (cl_sointerpolation) so_dointerpolations(interpfrac); } // Get initial player position, interpolating if required. diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index b8bece965..e02349ac9 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -709,7 +709,7 @@ void GameInterface::Render() { drawtime.Reset(); drawtime.Clock(); - drawscreen(Player + screenpeek, (paused || !cl_interpolate || cl_capfps ? 1. : I_GetTimeFrac()) * MaxSmoothRatio, false); + drawscreen(Player + screenpeek, paused || !cl_interpolate || cl_capfps ? 1. : I_GetTimeFrac(), false); drawtime.Unclock(); } diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index f42689547..d7ae472b1 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -352,7 +352,7 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings // must call restore for every do interpolations // make sure you don't exit -void so_dointerpolations(int32_t smoothratio) // Stick at beginning of drawscreen +void so_dointerpolations(double interpfrac) // Stick at beginning of drawscreen { int32_t i; SECTOR_OBJECT* sop; @@ -418,9 +418,9 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b !Player[screenpeek].sop_remote))) continue; - int32_t ratio = smoothratio * synctics + MaxSmoothRatio * interp->tic; + double ratio = interpfrac * synctics + interp->tic; ratio /= interp->lasttic; - ratio = (interp->tic == interp->lasttic) ? MaxSmoothRatio : ratio; + ratio = (interp->tic == interp->lasttic) ? 1. : ratio; for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++) { @@ -443,12 +443,12 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b { DSWActor* actor = data->actorofang; if (!actor) continue; - actor->set_int_ang(NORM_ANGLE(data->lastoldipos + MulScale(data->lastangdiff.Buildang(), ratio, 16))); + actor->spr.angle = (DAngle::fromBuildf(data->lastoldipos) + data->lastangdiff * ratio).Normalized360(); } else { double delta = data->lastipos - data->lastoldipos; - setvalue(*data, data->lastoldipos + MulScaleF(delta, ratio, 16)); + setvalue(*data, data->lastoldipos + delta * ratio); } } } diff --git a/source/games/sw/src/interpso.h b/source/games/sw/src/interpso.h index 8cff087f2..b70d1cf67 100644 --- a/source/games/sw/src/interpso.h +++ b/source/games/sw/src/interpso.h @@ -37,7 +37,7 @@ void so_stopspriteinterpolation(SECTOR_OBJECT* sop, DSWActor *sp); void so_setinterpolationangdiff(SECTOR_OBJECT* sop, int16_t angdiff); void so_setinterpolationtics(SECTOR_OBJECT* sop, int16_t locktics); void so_updateinterpolations(void); -void so_dointerpolations(int32_t smoothratio); +void so_dointerpolations(double interpfrac); void so_restoreinterpolations(void); void so_serializeinterpolations(FSerializer& arc); diff --git a/source/games/sw/src/network.cpp b/source/games/sw/src/network.cpp index 31c04d7a7..e0ab416ff 100644 --- a/source/games/sw/src/network.cpp +++ b/source/games/sw/src/network.cpp @@ -55,8 +55,6 @@ gNET gNet; bool CommEnabled = false; uint8_t CommPlayers = 0; -double smoothratio; - // must start out as 0 void InitNetPlayerOptions(void) diff --git a/source/games/sw/src/panel.h b/source/games/sw/src/panel.h index bff890974..46aa93688 100644 --- a/source/games/sw/src/panel.h +++ b/source/games/sw/src/panel.h @@ -193,7 +193,7 @@ enum PANEL_SPRITE* pSpawnSprite(PLAYER* pp, PANEL_STATE* state, uint8_t priority, double x, double y); void pSetSuicide(PANEL_SPRITE* psp); bool pKillScreenSpiteIDs(PLAYER* pp, short id); -void PreUpdatePanel(double smoothratio); +void PreUpdatePanel(double interpfrac); void UpdatePanel(double interpfrac); void PlayerUpdateArmor(PLAYER* pp,short value); void pToggleCrosshair(void);