- Duke: Do not reset the global ticker.

The new main loop code cannot handle that. Instead set a start value for gameclock so that gameclock can be based on an arbitrary time value instead of directly representing global time.
This commit is contained in:
Christoph Oelckers 2020-08-30 08:04:33 +02:00
parent 34510ae9b3
commit 49106c5b5e
3 changed files with 5 additions and 4 deletions

View file

@ -95,7 +95,7 @@ GameInterface* gi;
int myconnectindex, numplayers; int myconnectindex, numplayers;
int connecthead, connectpoint2[MAXMULTIPLAYERS]; int connecthead, connectpoint2[MAXMULTIPLAYERS];
auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries. auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries.
int gameclock; int gameclock, gameclockstart;
int lastTic; int lastTic;
int automapMode; int automapMode;

View file

@ -219,4 +219,5 @@ extern int automapMode;
extern bool automapFollow; extern bool automapFollow;
extern bool sendPause; extern bool sendPause;
extern int gameclock; extern int gameclock;
extern int gameclockstart;
extern int lastTic; extern int lastTic;

View file

@ -294,7 +294,7 @@ void GameTicker()
gameupdatetime.Clock(); gameupdatetime.Clock();
int const currentTic = I_GetTime(); int const currentTic = I_GetTime();
gameclock = I_GetBuildTime(); gameclock = I_GetBuildTime() - gameclockstart;
while (playrunning() && currentTic - lastTic >= 1) while (playrunning() && currentTic - lastTic >= 1)
{ {
@ -361,8 +361,8 @@ void startmainmenu()
void resetGameClock() void resetGameClock()
{ {
I_ResetTime(); I_SetFrameTime();
lastTic = -1; gameclockstart = I_GetTime();
gameclock = 0; gameclock = 0;
cloudclock = 0; cloudclock = 0;
} }