Refactor: replace references to cv_timescale with I_GetTimeScale

This commit is contained in:
James R 2024-03-18 01:39:05 -07:00
parent 6efa35549b
commit 7abe285f84
10 changed files with 18 additions and 12 deletions

View file

@ -2200,7 +2200,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
else
{
I_Sleep(cv_sleep.value);
I_UpdateTime(cv_timescale.value);
I_UpdateTime();
}
return true;

View file

@ -829,7 +829,7 @@ void D_SRB2Loop(void)
// Pushing of + parameters is now done back in D_SRB2Main, not here.
I_UpdateTime(cv_timescale.value);
I_UpdateTime();
oldentertics = I_GetTime();
// end of loading screen: CONS_Printf() will no more call FinishUpdate()
@ -877,7 +877,7 @@ void D_SRB2Loop(void)
bool ranwipe = false;
I_UpdateTime(cv_timescale.value);
I_UpdateTime();
if (lastwipetic)
{

View file

@ -600,7 +600,7 @@ void Net_WaitAllAckReceived(UINT32 timeout)
while (tictac == I_GetTime())
{
I_Sleep(cv_sleep.value);
I_UpdateTime(cv_timescale.value);
I_UpdateTime();
}
tictac = I_GetTime();
HGetPacket();

View file

@ -507,7 +507,7 @@ void F_RunWipe(UINT8 wipemode, UINT8 wipetype, boolean drawMenu, const char *col
while (!((nowtime = I_GetTime()) - lastwipetic))
{
I_Sleep(cv_sleep.value);
I_UpdateTime(cv_timescale.value);
I_UpdateTime();
}
lastwipetic = nowtime;

View file

@ -1285,7 +1285,7 @@ void G_PreLevelTitleCard(void)
while (!((nowtime = I_GetTime()) - lasttime))
{
I_Sleep(cv_sleep.value);
I_UpdateTime(cv_timescale.value);
I_UpdateTime();
}
lasttime = nowtime;
}

View file

@ -57,14 +57,19 @@ void I_InitializeTime(void)
I_StartupTimer();
}
void I_UpdateTime(fixed_t timescale)
fixed_t I_GetTimeScale(void)
{
return cv_timescale.value;
}
void I_UpdateTime(void)
{
double ticratescaled;
double elapsedseconds;
tic_t realtics;
// get real tics
ticratescaled = (double)TICRATE * FIXED_TO_FLOAT(timescale);
ticratescaled = (double)TICRATE * FIXED_TO_FLOAT(I_GetTimeScale());
enterprecise = I_GetPreciseTime();
elapsedseconds = (double)(enterprecise - oldenterprecise) / I_GetPrecisePrecision();

View file

@ -38,7 +38,8 @@ tic_t I_GetTime(void);
*/
void I_InitializeTime(void);
void I_UpdateTime(fixed_t timescale);
void I_UpdateTime(void);
fixed_t I_GetTimeScale(void);
/** \brief Block for at minimum the duration specified. This function makes a
best effort not to oversleep, and will spinloop if sleeping would

View file

@ -134,7 +134,7 @@ void M_QuitResponse(INT32 ch)
V_DrawSmallScaledPatch(0, 0, 0, W_CachePatchName("GAMEQUIT", PU_CACHE)); // Demo 3 Quit Screen Tails 06-16-2001
I_FinishUpdate(); // Update the screen with the image Tails 06-19-2001
I_Sleep(cv_sleep.value);
I_UpdateTime(cv_timescale.value);
I_UpdateTime();
}
}
I_Quit();

View file

@ -8393,7 +8393,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
while (!((nowtime = I_GetTime()) - lastwipetic)) \
{ \
I_Sleep(cv_sleep.value); \
I_UpdateTime(cv_timescale.value); \
I_UpdateTime(); \
} \
lastwipetic = nowtime; \
if (moviemode && rendermode == render_opengl) \

View file

@ -50,7 +50,7 @@ UINT32 R_GetFramerateCap(void)
boolean R_UsingFrameInterpolation(void)
{
return (R_GetFramerateCap() != TICRATE || cv_timescale.value < FRACUNIT);
return (R_GetFramerateCap() != TICRATE || I_GetTimeScale() < FRACUNIT);
}
static viewvars_t pview_old[MAXSPLITSCREENPLAYERS];