diff --git a/source/core/rendering/hw_entrypoint.cpp b/source/core/rendering/hw_entrypoint.cpp index ba4ccb069..ce35269a4 100644 --- a/source/core/rendering/hw_entrypoint.cpp +++ b/source/core/rendering/hw_entrypoint.cpp @@ -321,7 +321,7 @@ void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sect // Get this before everything else FRenderViewpoint r_viewpoint = SetupViewpoint(playersprite, position, sectnum, angle, horizon, rollang, fov); if (cl_capfps) r_viewpoint.TicFrac = 1.; - else r_viewpoint.TicFrac = smoothratio * (1/65536.); + else r_viewpoint.TicFrac = smoothratio * (1./MaxSmoothRatio); screen->mLights->Clear(); screen->mViewpoints->Clear(); diff --git a/source/games/blood/src/qav.h b/source/games/blood/src/qav.h index 1071dee9d..494a92c03 100644 --- a/source/games/blood/src/qav.h +++ b/source/games/blood/src/qav.h @@ -229,8 +229,8 @@ struct QAV int y; // 18 uint16_t res_id; FRAMEINFO frames[1]; // 24 - void Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio = 65536); - void Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio = 65536) { Draw(x, y, ticks, stat, shade, palnum, to3dview, smoothratio); } + void Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio = MaxSmoothRatio); + void Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio = MaxSmoothRatio) { Draw(x, y, ticks, stat, shade, palnum, to3dview, smoothratio); } void Play(int, int, int, PLAYER*); void Precache(int palette = 0); }; diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index a14184ed3..723d327bc 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -173,7 +173,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat } else if (!actorflag(h, SFLAG_NOINTERPOLATE)) { - t->pos = h->interpolatedvec3(smoothratio / 65536.); + t->pos = h->interpolatedvec3(smoothratio * (1. / MaxSmoothRatio)); } auto sectp = h->sector(); diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index cfa62cac4..527b98408 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -155,7 +155,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat } else if (!actorflag(h, SFLAG_NOINTERPOLATE)) { - t->pos = h->interpolatedvec3(smoothratio / 65536.); + t->pos = h->interpolatedvec3(smoothratio * (1. / MaxSmoothRatio)); } auto sectp = h->sector(); diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index d383d790a..b17d0b645 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -260,7 +260,7 @@ void drawoverlays(double smoothratio) { if (automapMode != am_off) { - DoInterpolations(smoothratio / 65536.); + DoInterpolations(smoothratio * (1. / MaxSmoothRatio)); if (pp->newOwner == nullptr && playrunning()) { @@ -271,7 +271,7 @@ void drawoverlays(double smoothratio) } else { - cposxy = interpolatedvec3(pp->opos, pp->pos, smoothratio / 65536.).XY(); + cposxy = interpolatedvec3(pp->opos, pp->pos, smoothratio * (1. / MaxSmoothRatio)).XY(); cang = !SyncInput() ? pp->angle.ang : interpolatedangle(pp->angle.oang, pp->angle.ang, smoothratio); } } @@ -493,7 +493,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, double j = clamp(czoom * act->spr.yrepeat + abs(pp.truefz - pp.pos.Z), 21.5, 128.) * REPEAT_SCALE; auto const vec = OutAutomapVector(mxy - cpos, cangsin, cangcos, czoom, xydim); - auto const daang = -((!SyncInput() ? act->spr.angle : act->interpolatedangle(smoothratio / 65536.)) + cang).Normalized360().Degrees(); + auto const daang = -((!SyncInput() ? act->spr.angle : act->interpolatedangle(smoothratio * (1. / MaxSmoothRatio))) + cang).Normalized360().Degrees(); DrawTexture(twod, tileGetTexture(i), vec.X, vec.Y, DTA_TranslationIndex, TRANSLATION(Translation_Remap + setpal(&pp), act->spr.pal), DTA_CenterOffset, true, DTA_Rotate, daang, DTA_Color, shadeToLight(act->spr.shade), DTA_ScaleX, j, DTA_ScaleY, j, TAG_DONE); diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 56d299ef1..f6728281f 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -95,7 +95,7 @@ void GameInterface::UpdateCameras(double smoothratio) display_mirror = 1; // should really be 'display external view'. auto cstat = camera->spr.cstat; camera->spr.cstat = CSTAT_SPRITE_INVISIBLE; - render_camtex(camera, camera->int_pos(), camera->sector(), camera->interpolatedangle(smoothratio / 65536.), buildhoriz(camera->spr.shade), nullAngle, tex, rect, smoothratio); + render_camtex(camera, camera->int_pos(), camera->sector(), camera->interpolatedangle(smoothratio * (1. / MaxSmoothRatio)), buildhoriz(camera->spr.shade), nullAngle, tex, rect, smoothratio); camera->spr.cstat = cstat; display_mirror = 0; }); @@ -245,7 +245,7 @@ void displayrooms(int snum, double smoothratio, bool sceneonly) GlobalMapFog = fogactive ? 0x999999 : 0; GlobalFogDensity = fogactive ? 350.f : 0.f; - DoInterpolations(smoothratio / 65536.); + DoInterpolations(smoothratio * (1. / MaxSmoothRatio)); setgamepalette(BASEPAL); @@ -326,7 +326,7 @@ void displayrooms(int snum, double smoothratio, bool sceneonly) if (p->newOwner != nullptr) { auto act = p->newOwner; - cang = act->interpolatedangle(smoothratio / 65536.); + cang = act->interpolatedangle(smoothratio * (1. / MaxSmoothRatio)); choriz = buildhoriz(act->spr.shade); cposx = act->int_pos().X; cposy = act->int_pos().Y; diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index 9698f9b70..4252a3219 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -50,7 +50,7 @@ void DrawMap(double const smoothratio) { auto pPlayerActor = PlayerList[nLocalPlayer].pActor; auto ang = !SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(smoothratio); - DrawOverheadMap(pPlayerActor->interpolatedvec3(smoothratio / 65536.).XY(), ang, smoothratio); + DrawOverheadMap(pPlayerActor->interpolatedvec3(smoothratio * (1. / MaxSmoothRatio)).XY(), ang, smoothratio); } } diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 4f6d2099d..4496f4a67 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -69,8 +69,8 @@ static void analyzesprites(tspriteArray& tsprites, int x, int y, int z, double c if (pTSprite->ownerActor) { // interpolate sprite position - pTSprite->pos = pTSprite->ownerActor->interpolatedvec3(smoothratio / 65536.); - pTSprite->angle = pTSprite->ownerActor->interpolatedangle(smoothratio / 65536.); + pTSprite->pos = pTSprite->ownerActor->interpolatedvec3(smoothratio * (1. / MaxSmoothRatio)); + pTSprite->angle = pTSprite->ownerActor->interpolatedangle(smoothratio * (1. / MaxSmoothRatio)); } } @@ -192,7 +192,7 @@ void DrawView(double smoothRatio, bool sceneonly) zbob = bsin(2 * bobangle, -3); - DoInterpolations(smoothRatio / 65536.); + DoInterpolations(smoothRatio * (1. / MaxSmoothRatio)); auto pPlayerActor = PlayerList[nLocalPlayer].pActor; auto nPlayerOldCstat = pPlayerActor->spr.cstat; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 93e7f46ac..0ffbd8800 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -618,7 +618,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int { if (tsp->statnum <= STAT_SKIP4_INTERP_END) { - tsp->pos = tActor->interpolatedvec3(smr4 / 262144.); + tsp->pos = tActor->interpolatedvec3(smr4 * (0.25 / MaxSmoothRatio)); } } @@ -626,7 +626,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int { if (tsp->statnum <= STAT_SKIP2_INTERP_END) { - tsp->pos = tActor->interpolatedvec3(smr2 / 131072.); + tsp->pos = tActor->interpolatedvec3(smr2 * (0.5 / MaxSmoothRatio)); } } } @@ -781,7 +781,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int else // Otherwise just interpolate the player sprite { pp = tActor->user.PlayerP; - double sr = 1. - smoothratio * (1. / 65536.); + double sr = 1. - smoothratio * (1. / MaxSmoothRatio); tsp->pos -= (pp->pos - pp->opos) * sr; tsp->angle = pp->angle.interpolatedang(sr); } @@ -1367,7 +1367,7 @@ void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly) if (!sceneonly) { - DoInterpolations(smoothratio / 65536.); // Stick at beginning of drawscreen + DoInterpolations(smoothratio * (1. / MaxSmoothRatio)); // Stick at beginning of drawscreen if (cl_sointerpolation) so_dointerpolations(sr); // Stick at beginning of drawscreen } @@ -1606,7 +1606,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, PalEntry col = (actor->spr.cstat & CSTAT_SPRITE_BLOCK) > 0 ? GPalette.BaseColors[248] : actor == peekActor ? GPalette.BaseColors[31] : GPalette.BaseColors[56]; auto statnum = actor->spr.statnum; - auto sprxy = ((statnum >= 1) && (statnum <= 8) && (statnum != 2) ? actor->interpolatedvec3(smoothratio / 65536.) : actor->spr.pos).XY(); + auto sprxy = ((statnum >= 1) && (statnum <= 8) && (statnum != 2) ? actor->interpolatedvec3(smoothratio * (1. / MaxSmoothRatio)) : actor->spr.pos).XY(); switch (actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) { @@ -1615,7 +1615,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, { if (czoom > 0.1875) { - const auto daang = -((!SyncInput() ? actor->spr.angle : actor->interpolatedangle(smoothratio / 65536.)) + cang).Normalized360().Degrees(); + const auto daang = -((!SyncInput() ? actor->spr.angle : actor->interpolatedangle(smoothratio * (1. / MaxSmoothRatio))) + cang).Normalized360().Degrees(); auto vect = OutAutomapVector(mxy - cpos, cangsin, cangcos, czoom, xydim); // Special case tiles diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index 9b841ef07..16cbe9e25 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -418,9 +418,9 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b !Player[screenpeek].sop_remote))) continue; - int32_t ratio = smoothratio * synctics + 65536 * interp->tic; + int32_t ratio = smoothratio * synctics + MaxSmoothRatio * interp->tic; ratio /= interp->lasttic; - ratio = (interp->tic == interp->lasttic) ? 65536 : ratio; + ratio = (interp->tic == interp->lasttic) ? MaxSmoothRatio : ratio; for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++) {