- 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 GrabMap();
void UpdateMap(); void UpdateMap();
void DrawMap(double const smoothratio); void DrawMap(double const interpfrac);
// random // random

View file

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

View file

@ -57,7 +57,7 @@ int nBestLevel;
void RunCinemaScene(int num); void RunCinemaScene(int num);
void GameMove(void); void GameMove(void);
void DrawClock(); void DrawClock();
double calc_smoothratio(); double calc_interpfrac();
void DoTitle(CompletionFunc completion); void DoTitle(CompletionFunc completion);
@ -73,15 +73,15 @@ void GameInterface::Render()
DrawClock(); DrawClock();
} }
double const smoothratio = calc_smoothratio(); double const interpfrac = calc_interpfrac();
DrawView(smoothratio); DrawView(interpfrac);
if (nFreeze != 2) // Hide when Ramses is talking. if (nFreeze != 2) // Hide when Ramses is talking.
{ {
DrawStatusBar(); 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()) 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) if (!nFreeze && automapMode != am_off)
{ {
auto pPlayerActor = PlayerList[nLocalPlayer].pActor; auto pPlayerActor = PlayerList[nLocalPlayer].pActor;
auto ang = !SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(smoothratio * (1. / MaxSmoothRatio)); auto ang = !SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(interpfrac);
DrawOverheadMap(pPlayerActor->interpolatedvec3(smoothratio * (1. / MaxSmoothRatio)).XY(), ang, smoothratio); DrawOverheadMap(pPlayerActor->interpolatedvec3(interpfrac).XY(), ang, interpfrac * MaxSmoothRatio);
} }
} }

View file

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

View file

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