- removed I_ResetTime entirely and refactored SW's use of it.

This commit is contained in:
Christoph Oelckers 2020-08-30 08:13:34 +02:00
parent 49106c5b5e
commit 1e0b8038e5
5 changed files with 12 additions and 16 deletions

View file

@ -175,11 +175,6 @@ int I_GetBuildTime()
return NSToBuildTic(CurrentFrameStartTime - FirstFrameStartTime); return NSToBuildTic(CurrentFrameStartTime - FirstFrameStartTime);
} }
void I_ResetTime()
{
FirstFrameStartTime = CurrentFrameStartTime = 0;
}
double I_GetTimeFrac() double I_GetTimeFrac()
{ {
int currentTic = NSToTic(CurrentFrameStartTime - FirstFrameStartTime); int currentTic = NSToTic(CurrentFrameStartTime - FirstFrameStartTime);

View file

@ -15,9 +15,6 @@ uint64_t I_GetTimeNS();
// Called by Build games in lieu of totalclock, returns current time in tics at ticrate of 120. // Called by Build games in lieu of totalclock, returns current time in tics at ticrate of 120.
int I_GetBuildTime(); int I_GetBuildTime();
// Reset timer variables to zero when called.
void I_ResetTime();
double I_GetTimeFrac(); double I_GetTimeFrac();
double I_GetBuildTimeFrac(); double I_GetBuildTimeFrac();

View file

@ -362,7 +362,7 @@ void startmainmenu()
void resetGameClock() void resetGameClock()
{ {
I_SetFrameTime(); I_SetFrameTime();
gameclockstart = I_GetTime(); gameclockstart = I_GetBuildTime();
gameclock = 0; gameclock = 0;
cloudclock = 0; cloudclock = 0;
} }

View file

@ -730,7 +730,7 @@ void GameTicker(void)
ready2send = 1; ready2send = 1;
int const currentTic = I_GetTime(); int const currentTic = I_GetTime();
gameclock = I_GetBuildTime(); gameclock = I_GetBuildTime() - gameclockstart;
if (paused) if (paused)
{ {
@ -765,6 +765,13 @@ void GameTicker(void)
} }
void resetGameClock()
{
I_SetFrameTime();
gameclockstart = I_GetBuildTime();
ogameclock = gameclock = 0;
}
void GameInterface::RunGameFrame() void GameInterface::RunGameFrame()
{ {
// if the menu initiazed a new game or loaded a savegame, switch to play mode. // if the menu initiazed a new game or loaded a savegame, switch to play mode.
@ -774,9 +781,7 @@ void GameInterface::RunGameFrame()
{ {
default: default:
case GS_STARTUP: case GS_STARTUP:
I_ResetTime(); resetGameClock();
lastTic = -1;
ogameclock = gameclock = 0;
if (userConfig.CommandMap.IsNotEmpty()) if (userConfig.CommandMap.IsNotEmpty())
{ {

View file

@ -43,6 +43,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
void getinput(InputPacket *, SWBOOL); void getinput(InputPacket *, SWBOOL);
void resetGameClock();
static uint8_t tempbuf[576], packbuf[576]; static uint8_t tempbuf[576], packbuf[576];
int PlayClock; int PlayClock;
@ -163,9 +164,7 @@ InitTimingVars(void)
// resettiming(); // resettiming();
totalsynctics = 0; totalsynctics = 0;
I_ResetTime(); resetGameClock();
lastTic = -1;
ogameclock = gameclock = 0;
randomseed = 17L; randomseed = 17L;
MoveSkip8 = 2; MoveSkip8 = 2;