diff --git a/source/common/utility/i_time.cpp b/source/common/utility/i_time.cpp index ce14e52d4..f54c80d78 100644 --- a/source/common/utility/i_time.cpp +++ b/source/common/utility/i_time.cpp @@ -175,11 +175,6 @@ int I_GetBuildTime() return NSToBuildTic(CurrentFrameStartTime - FirstFrameStartTime); } -void I_ResetTime() -{ - FirstFrameStartTime = CurrentFrameStartTime = 0; -} - double I_GetTimeFrac() { int currentTic = NSToTic(CurrentFrameStartTime - FirstFrameStartTime); diff --git a/source/common/utility/i_time.h b/source/common/utility/i_time.h index 1f28df893..78a399939 100644 --- a/source/common/utility/i_time.h +++ b/source/common/utility/i_time.h @@ -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. int I_GetBuildTime(); -// Reset timer variables to zero when called. -void I_ResetTime(); - double I_GetTimeFrac(); double I_GetBuildTimeFrac(); diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp index 14c1c70ca..0920d59a6 100644 --- a/source/games/duke/src/gameloop.cpp +++ b/source/games/duke/src/gameloop.cpp @@ -362,7 +362,7 @@ void startmainmenu() void resetGameClock() { I_SetFrameTime(); - gameclockstart = I_GetTime(); + gameclockstart = I_GetBuildTime(); gameclock = 0; cloudclock = 0; } diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index c12201525..083bfd86f 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -730,7 +730,7 @@ void GameTicker(void) ready2send = 1; int const currentTic = I_GetTime(); - gameclock = I_GetBuildTime(); + gameclock = I_GetBuildTime() - gameclockstart; if (paused) { @@ -765,6 +765,13 @@ void GameTicker(void) } +void resetGameClock() +{ + I_SetFrameTime(); + gameclockstart = I_GetBuildTime(); + ogameclock = gameclock = 0; +} + void GameInterface::RunGameFrame() { // if the menu initiazed a new game or loaded a savegame, switch to play mode. @@ -774,9 +781,7 @@ void GameInterface::RunGameFrame() { default: case GS_STARTUP: - I_ResetTime(); - lastTic = -1; - ogameclock = gameclock = 0; + resetGameClock(); if (userConfig.CommandMap.IsNotEmpty()) { diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index 63afbcc87..83eabcd97 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -43,6 +43,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS void getinput(InputPacket *, SWBOOL); +void resetGameClock(); static uint8_t tempbuf[576], packbuf[576]; int PlayClock; @@ -163,9 +164,7 @@ InitTimingVars(void) // resettiming(); totalsynctics = 0; - I_ResetTime(); - lastTic = -1; - ogameclock = gameclock = 0; + resetGameClock(); randomseed = 17L; MoveSkip8 = 2;