- Exhumed: Flatten smoothratio back to float and rename to interpfrac.

This commit is contained in:
Mitchell Richters 2022-09-06 23:16:13 +10:00 committed by Christoph Oelckers
parent 8a4601ef8d
commit f378c481b3
6 changed files with 24 additions and 27 deletions

View file

@ -103,7 +103,7 @@ extern bool bShowTowers;
void GrabMap();
void UpdateMap();
void DrawMap(double const smoothratio);
void DrawMap(double const interpfrac);
// random

View file

@ -245,12 +245,9 @@ void DrawClock()
DoEnergyTile();
}
double calc_smoothratio()
double calc_interpfrac()
{
if (bRecord || bPlayback || nFreeze != 0 || paused || cl_capfps || !cl_interpolate || EndLevel)
return MaxSmoothRatio;
return I_GetTimeFrac() * MaxSmoothRatio;
return bRecord || bPlayback || nFreeze != 0 || paused || cl_capfps || !cl_interpolate || EndLevel ? 1. : I_GetTimeFrac();
}
void DoGameOverScene(bool finallevel)

View file

@ -57,7 +57,7 @@ int nBestLevel;
void RunCinemaScene(int num);
void GameMove(void);
void DrawClock();
double calc_smoothratio();
double calc_interpfrac();
void DoTitle(CompletionFunc completion);
@ -73,15 +73,15 @@ void GameInterface::Render()
DrawClock();
}
double const smoothratio = calc_smoothratio();
double const interpfrac = calc_interpfrac();
DrawView(smoothratio);
DrawView(interpfrac);
if (nFreeze != 2) // Hide when Ramses is talking.
{
DrawStatusBar();
DrawCrosshair(kCrosshairTile, PlayerList[nLocalPlayer].nHealth >> 3, -PlayerList[nLocalPlayer].angle.look_anghalf(smoothratio), 0, 1);
DrawCrosshair(kCrosshairTile, PlayerList[nLocalPlayer].nHealth >> 3, -PlayerList[nLocalPlayer].angle.look_anghalf(interpfrac), 0, 1);
if (paused && !M_Active())
{

View file

@ -44,13 +44,13 @@ void UpdateMap()
}
}
void DrawMap(double const smoothratio)
void DrawMap(double const interpfrac)
{
if (!nFreeze && automapMode != am_off)
{
auto pPlayerActor = PlayerList[nLocalPlayer].pActor;
auto ang = !SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(smoothratio * (1. / MaxSmoothRatio));
DrawOverheadMap(pPlayerActor->interpolatedvec3(smoothratio * (1. / MaxSmoothRatio)).XY(), ang, smoothratio);
auto ang = !SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(interpfrac);
DrawOverheadMap(pPlayerActor->interpolatedvec3(interpfrac).XY(), ang, interpfrac * MaxSmoothRatio);
}
}

View file

@ -174,15 +174,15 @@ void ResetView()
static TextOverlay subtitleOverlay;
void DrawView(double smoothRatio, bool sceneonly)
void DrawView(double interpfrac, bool sceneonly)
{
DExhumedActor* pEnemy = nullptr;
int nEnemyPal = -1;
sectortype* pSector = nullptr;
DAngle nCameraa, rotscrnang;
fixedhoriz nCamerapan;
fixedhoriz nCamerapan = q16horiz(0);
DoInterpolations(smoothRatio * (1. / MaxSmoothRatio));
DoInterpolations(interpfrac);
auto pPlayerActor = PlayerList[nLocalPlayer].pActor;
auto nPlayerOldCstat = pPlayerActor->spr.cstat;
@ -214,7 +214,7 @@ void DrawView(double smoothRatio, bool sceneonly)
}
else
{
nCamera = pPlayerActor->interpolatedvec3(smoothRatio * (1. / MaxSmoothRatio)).plusZ(interpolatedvaluef(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, smoothRatio) * zinttoworld);
nCamera = pPlayerActor->interpolatedvec3(interpfrac).plusZ(interpolatedvaluef(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, interpfrac * MaxSmoothRatio) * zinttoworld);
pSector = PlayerList[nLocalPlayer].pPlayerViewSect;
updatesector(nCamera, &pSector);
@ -228,9 +228,9 @@ void DrawView(double smoothRatio, bool sceneonly)
}
else
{
nCamerapan = PlayerList[nLocalPlayer].horizon.interpolatedsum(smoothRatio);
nCameraa = PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio * (1. / MaxSmoothRatio));
rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(smoothRatio * (1. / MaxSmoothRatio));
nCamerapan = PlayerList[nLocalPlayer].horizon.interpolatedsum(interpfrac * MaxSmoothRatio);
nCameraa = PlayerList[nLocalPlayer].angle.interpolatedsum(interpfrac);
rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(interpfrac);
}
if (!bCamera)
@ -258,10 +258,10 @@ void DrawView(double smoothRatio, bool sceneonly)
if (bCamera)
{
nCamera.Z -= 10;
if (!calcChaseCamPos(nCamera, pPlayerActor, &pSector, nCameraa, nCamerapan, smoothRatio))
if (!calcChaseCamPos(nCamera, pPlayerActor, &pSector, nCameraa, nCamerapan, interpfrac * MaxSmoothRatio))
{
nCamera.Z += 10;
calcChaseCamPos(nCamera, pPlayerActor, &pSector, nCameraa, nCamerapan, smoothRatio);
calcChaseCamPos(nCamera, pPlayerActor, &pSector, nCameraa, nCamerapan, interpfrac * MaxSmoothRatio);
}
}
}
@ -303,8 +303,8 @@ void DrawView(double smoothRatio, bool sceneonly)
}
if (!nFreeze && !sceneonly)
DrawWeapons(smoothRatio);
render_drawrooms(nullptr, nCamera, sectnum(pSector), nCameraa, nCamerapan, rotscrnang, smoothRatio);
DrawWeapons(interpfrac * MaxSmoothRatio);
render_drawrooms(nullptr, nCamera, sectnum(pSector), nCameraa, nCamerapan, rotscrnang, interpfrac * MaxSmoothRatio);
if (HavePLURemap())
{
@ -369,7 +369,7 @@ void DrawView(double smoothRatio, bool sceneonly)
{
if (nSnakeCam < 0)
{
DrawMap(smoothRatio);
DrawMap(interpfrac);
}
else
{
@ -378,7 +378,7 @@ void DrawView(double smoothRatio, bool sceneonly)
pEnemy->spr.pal = (uint8_t)nEnemyPal;
}
DrawMap(smoothRatio);
DrawMap(interpfrac);
}
}
}

View file

@ -26,7 +26,7 @@ extern TObjPtr<DExhumedActor*> bestTarget;
extern bool bCamera;
void DrawStatusBar();
void DrawView(double smoothRatio, bool sceneonly = false);
void DrawView(double interpfrac, bool sceneonly = false);
void ResetView();
void NoClip();
void Clip();