mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 04:50:42 +00:00
- All Games: Remove remaining use of totalclock
and associated timing code.
This commit is contained in:
parent
c207437a57
commit
b883204f6a
11 changed files with 5 additions and 41 deletions
|
@ -737,7 +737,6 @@ void GameInterface::app_init()
|
||||||
WeaponInit();
|
WeaponInit();
|
||||||
LoadSaveSetup();
|
LoadSaveSetup();
|
||||||
LoadSavedInfo();
|
LoadSavedInfo();
|
||||||
timerInit(120);
|
|
||||||
|
|
||||||
Printf(PRINT_NONOTIFY, "Initializing network users\n");
|
Printf(PRINT_NONOTIFY, "Initializing network users\n");
|
||||||
netInitialize(true);
|
netInitialize(true);
|
||||||
|
|
|
@ -364,8 +364,6 @@ EXTERN struct validmode_t validmode[MAXVALIDMODES];
|
||||||
EXTERN int32_t Numsprites;
|
EXTERN int32_t Numsprites;
|
||||||
EXTERN int16_t numsectors, numwalls;
|
EXTERN int16_t numsectors, numwalls;
|
||||||
EXTERN int32_t display_mirror;
|
EXTERN int32_t display_mirror;
|
||||||
EXTERN ClockTicks totalclock;
|
|
||||||
static inline int32_t BGetTime(void) { return (int32_t) totalclock; }
|
|
||||||
|
|
||||||
EXTERN int32_t randomseed;
|
EXTERN int32_t randomseed;
|
||||||
EXTERN int16_t sintable[2048];
|
EXTERN int16_t sintable[2048];
|
||||||
|
@ -596,12 +594,9 @@ TILE VARIABLES:
|
||||||
NUMTILES - the number of tiles found TILES.DAT.
|
NUMTILES - the number of tiles found TILES.DAT.
|
||||||
|
|
||||||
TIMING VARIABLES:
|
TIMING VARIABLES:
|
||||||
TOTALCLOCK - When the engine is initialized, TOTALCLOCK is set to zero.
|
|
||||||
From then on, it is incremented 120 times a second by 1. That
|
|
||||||
means that the number of seconds elapsed is totalclock / 120.
|
|
||||||
NUMFRAMES - The number of times the draw3dscreen function was called
|
NUMFRAMES - The number of times the draw3dscreen function was called
|
||||||
since the engine was initialized. This helps to determine frame
|
since the engine was initialized. This helps to determine frame
|
||||||
rate. (Frame rate = numframes * 120 / totalclock.)
|
rate. (Frame rate = numframes * 120 / I_GetBuildTime().)
|
||||||
|
|
||||||
OTHER VARIABLES:
|
OTHER VARIABLES:
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// for compatibility
|
// for compatibility
|
||||||
#define timerUninit()
|
#define timerUninit()
|
||||||
|
|
||||||
int timerInit(int const tickspersecond);
|
|
||||||
void timerUpdateClock(void);
|
|
||||||
double timerGetHiTicks(void);
|
double timerGetHiTicks(void);
|
||||||
uint32_t timerGetTicks(void);
|
uint32_t timerGetTicks(void);
|
||||||
|
|
||||||
|
|
|
@ -1127,7 +1127,6 @@ int32_t engineInit(void)
|
||||||
|
|
||||||
searchit = 0; searchstat = -1;
|
searchit = 0; searchstat = -1;
|
||||||
|
|
||||||
totalclock = 0;
|
|
||||||
g_visibility = 512;
|
g_visibility = 512;
|
||||||
parallaxvisibility = 512;
|
parallaxvisibility = 512;
|
||||||
|
|
||||||
|
|
|
@ -20,25 +20,3 @@ uint32_t timerGetTicks(void) { return duration_cast<milliseconds>(steady_cloc
|
||||||
// Returns the time since an unspecified starting time in milliseconds.
|
// Returns the time since an unspecified starting time in milliseconds.
|
||||||
// (May be not monotonic for certain configurations.)
|
// (May be not monotonic for certain configurations.)
|
||||||
double timerGetHiTicks(void) { return duration<double, nano>(steady_clock::now().time_since_epoch()).count() / 1000000.0; }
|
double timerGetHiTicks(void) { return duration<double, nano>(steady_clock::now().time_since_epoch()).count() / 1000000.0; }
|
||||||
|
|
||||||
int timerInit(int const tickspersecond)
|
|
||||||
{
|
|
||||||
timerticspersec = tickspersecond;
|
|
||||||
timerlastsample = steady_clock::now();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void timerUpdateClock(void)
|
|
||||||
{
|
|
||||||
auto time = steady_clock::now();
|
|
||||||
auto elapsedTime = time - timerlastsample;
|
|
||||||
|
|
||||||
uint64_t numerator = (elapsedTime.count() * (uint64_t) timerticspersec * steady_clock::period::num);
|
|
||||||
uint64_t freq = steady_clock::period::den;
|
|
||||||
int n = numerator / freq;
|
|
||||||
|
|
||||||
if (n <= 0) return;
|
|
||||||
|
|
||||||
totalclock += n;
|
|
||||||
timerlastsample += n*nanoseconds(1000000000/timerticspersec);
|
|
||||||
}
|
|
||||||
|
|
|
@ -914,8 +914,6 @@ void app_loop()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
timerUpdateClock();
|
|
||||||
|
|
||||||
TickSubsystems();
|
TickSubsystems();
|
||||||
twod->SetSize(screen->GetWidth(), screen->GetHeight());
|
twod->SetSize(screen->GetWidth(), screen->GetHeight());
|
||||||
twodpsp.SetSize(screen->GetWidth(), screen->GetHeight());
|
twodpsp.SetSize(screen->GetWidth(), screen->GetHeight());
|
||||||
|
|
|
@ -242,8 +242,8 @@ void S_SerializeSounds(FSerializer& arc)
|
||||||
}
|
}
|
||||||
arc.EndArray();
|
arc.EndArray();
|
||||||
}
|
}
|
||||||
// totalclock runs on 120 fps, we need to allow a small delay here.
|
// Build runs at 120 fps, we need to allow a small delay here.
|
||||||
soundEngine->SetRestartTime((int)totalclock + 6);
|
soundEngine->SetRestartTime(I_GetBuildTime() + 6);
|
||||||
}
|
}
|
||||||
GSnd->Sync(false);
|
GSnd->Sync(false);
|
||||||
GSnd->UpdateSounds();
|
GSnd->UpdateSounds();
|
||||||
|
|
|
@ -548,8 +548,6 @@ void ExitGame()
|
||||||
void InitTimer()
|
void InitTimer()
|
||||||
{
|
{
|
||||||
htimer = 1;
|
htimer = 1;
|
||||||
|
|
||||||
timerInit(kTimerTicks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* actions[] =
|
static const char* actions[] =
|
||||||
|
|
|
@ -353,7 +353,7 @@ void S_Update(void)
|
||||||
}
|
}
|
||||||
listener.ListenerObject = ud.camerasprite == -1 ? nullptr : &sprite[ud.camerasprite];
|
listener.ListenerObject = ud.camerasprite == -1 ? nullptr : &sprite[ud.camerasprite];
|
||||||
soundEngine->SetListener(listener);
|
soundEngine->SetListener(listener);
|
||||||
soundEngine->UpdateSounds(totalclock);
|
soundEngine->UpdateSounds(gameclock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,6 @@ void GameInterface::app_init()
|
||||||
|
|
||||||
paletteSetColorTable(DREALMSPAL, pal.Data(), true, true);
|
paletteSetColorTable(DREALMSPAL, pal.Data(), true, true);
|
||||||
}
|
}
|
||||||
timerInit(120);
|
|
||||||
InitPalette();
|
InitPalette();
|
||||||
// sets numplayers, connecthead, connectpoint2, myconnectindex
|
// sets numplayers, connecthead, connectpoint2, myconnectindex
|
||||||
|
|
||||||
|
|
|
@ -604,7 +604,7 @@ void DoUpdateSounds(void)
|
||||||
soundEngine->SetListener(listener);
|
soundEngine->SetListener(listener);
|
||||||
|
|
||||||
UpdateAmbients();
|
UpdateAmbients();
|
||||||
soundEngine->UpdateSounds(totalclock);
|
soundEngine->UpdateSounds(I_GetBuildTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue