- SW: Add ogameclock and use in places where ototalclock was used.

* Duke used `ototalclock` only to keep track of when the game ticked. SW uses it in the rendering code for differentials between tics so we should preserve that to prevent issues down the track.
This commit is contained in:
Mitchell Richters 2020-08-26 07:45:14 +10:00
parent d38a3a1fb1
commit 40739d9176
4 changed files with 8 additions and 7 deletions

View file

@ -786,6 +786,7 @@ void GameTicker(void)
while (ready2send && currentTic - lastTic >= 1) while (ready2send && currentTic - lastTic >= 1)
{ {
lastTic = currentTic; lastTic = currentTic;
ogameclock = gameclock;
UpdateInputs(); UpdateInputs();
MoveTicker(); MoveTicker();
} }
@ -825,7 +826,7 @@ void GameInterface::RunGameFrame()
case GS_STARTUP: case GS_STARTUP:
I_ResetTime(); I_ResetTime();
lastTic = -1; lastTic = -1;
gameclock = 0; ogameclock = gameclock = 0;
if (userConfig.CommandMap.IsNotEmpty()) if (userConfig.CommandMap.IsNotEmpty())
{ {

View file

@ -2188,7 +2188,7 @@ extern USER puser[MAX_SW_PLAYERS_REG];
/////////////////////////// ///////////////////////////
extern int gotlastpacketclock; extern int gotlastpacketclock;
extern int gameclock; extern int ogameclock, gameclock;
extern int lastTic; extern int lastTic;
extern SWBOOL ready2send; extern SWBOOL ready2send;
extern double smoothratio; extern double smoothratio;

View file

@ -300,7 +300,7 @@ void JS_InitMirrors(void)
// Scan wall tags for mirrors // Scan wall tags for mirrors
mirrorcnt = 0; mirrorcnt = 0;
tileDelete(MIRROR); tileDelete(MIRROR);
oscilationclock = gameclock; oscilationclock = ogameclock;
for (i = 0; i < MAXMIRRORS; i++) for (i = 0; i < MAXMIRRORS; i++)
{ {
@ -532,7 +532,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz)
SWBOOL bIsWallMirror = FALSE; SWBOOL bIsWallMirror = FALSE;
camloopcnt += gameclock - gameclock; camloopcnt += gameclock - ogameclock;
if (camloopcnt > (60 * 5)) // 5 seconds per player view if (camloopcnt > (60 * 5)) // 5 seconds per player view
{ {
camloopcnt = 0; camloopcnt = 0;
@ -545,7 +545,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz)
longptr = (int*)&gotpic[MIRRORLABEL >> 3]; longptr = (int*)&gotpic[MIRRORLABEL >> 3];
if (longptr && (longptr[0] || longptr[1])) if (longptr && (longptr[0] || longptr[1]))
{ {
uint32_t oscilation_delta = gameclock - oscilationclock; uint32_t oscilation_delta = ogameclock - oscilationclock;
oscilation_delta -= oscilation_delta % 4; oscilation_delta -= oscilation_delta % 4;
oscilationclock += oscilation_delta; oscilationclock += oscilation_delta;
oscilation_delta *= 2; oscilation_delta *= 2;

View file

@ -95,7 +95,7 @@ uint8_t syncstat[MAXSYNCBYTES];
int syncvaltail, syncvaltottail; int syncvaltail, syncvaltottail;
void GetSyncInfoFromPacket(uint8_t *packbuf, int packbufleng, int *j, int otherconnectindex); void GetSyncInfoFromPacket(uint8_t *packbuf, int packbufleng, int *j, int otherconnectindex);
int gameclock; int ogameclock, gameclock;
int lastTic; int lastTic;
double smoothratio; double smoothratio;
@ -167,7 +167,7 @@ InitTimingVars(void)
totalsynctics = 0; totalsynctics = 0;
I_ResetTime(); I_ResetTime();
lastTic = -1; lastTic = -1;
gameclock = 0; ogameclock = gameclock = 0;
randomseed = 17L; randomseed = 17L;
MoveSkip8 = 2; MoveSkip8 = 2;