- 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)
{
lastTic = currentTic;
ogameclock = gameclock;
UpdateInputs();
MoveTicker();
}
@ -825,7 +826,7 @@ void GameInterface::RunGameFrame()
case GS_STARTUP:
I_ResetTime();
lastTic = -1;
gameclock = 0;
ogameclock = gameclock = 0;
if (userConfig.CommandMap.IsNotEmpty())
{

View File

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

View File

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

View File

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