From 49106c5b5e7a375ed79fea9af58810f6cf4f183b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 30 Aug 2020 08:04:33 +0200 Subject: [PATCH] - 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. --- source/core/gamecontrol.cpp | 2 +- source/core/gamecontrol.h | 1 + source/games/duke/src/gameloop.cpp | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 9bd27b29e..7fae461f3 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -95,7 +95,7 @@ GameInterface* gi; int myconnectindex, numplayers; 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. -int gameclock; +int gameclock, gameclockstart; int lastTic; int automapMode; diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index 9f1a173b0..8c10e090d 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -219,4 +219,5 @@ extern int automapMode; extern bool automapFollow; extern bool sendPause; extern int gameclock; +extern int gameclockstart; extern int lastTic; diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp index 0178cefc2..14c1c70ca 100644 --- a/source/games/duke/src/gameloop.cpp +++ b/source/games/duke/src/gameloop.cpp @@ -294,7 +294,7 @@ void GameTicker() gameupdatetime.Clock(); int const currentTic = I_GetTime(); - gameclock = I_GetBuildTime(); + gameclock = I_GetBuildTime() - gameclockstart; while (playrunning() && currentTic - lastTic >= 1) { @@ -361,8 +361,8 @@ void startmainmenu() void resetGameClock() { - I_ResetTime(); - lastTic = -1; + I_SetFrameTime(); + gameclockstart = I_GetTime(); gameclock = 0; cloudclock = 0; }