Rename timerUpdate() and timerGetRate() to timerUpdateClock() and timerGetClockRate(), because they both only apply to totalclock

git-svn-id: https://svn.eduke32.com/eduke32@8169 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/build/src/timer.cpp
#	source/build/src/winlayer.cpp
This commit is contained in:
terminx 2019-10-19 23:43:35 +00:00 committed by Christoph Oelckers
parent 91fde580ce
commit 8b43ed5777
4 changed files with 8 additions and 7 deletions

View file

@ -9,8 +9,8 @@
#define timerUninit()
int timerInit(int const tickspersecond);
void timerUpdate(void);
int timerGetRate(void);
void timerUpdateClock(void);
int timerGetClockRate(void);
uint64_t timerGetTicksU64(void);
uint64_t timerGetFreqU64(void);
double timerGetHiTicks(void);

View file

@ -614,7 +614,7 @@ void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal)
fps = smooth->mdsmooth ? Blrintf((1.0f / ((float)tile2model[tile].smoothduration * (1.f / (float)UINT16_MAX))) * 66.f)
: anim ? anim->fpssc : 1;
i = (mdtims - sprext->mdanimtims) * ((fps * timerGetRate()) / 120);
i = (mdtims - sprext->mdanimtims) * ((fps * timerGetClockRate()) / 120);
j = (smooth->mdsmooth || !anim) ? 65536 : ((anim->endframe + 1 - anim->startframe) << 16);
@ -622,7 +622,7 @@ void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal)
if (i < 0) { i = 0; sprext->mdanimtims = mdtims; }
//compare with j*2 instead of j to ensure i stays > j-65536 for MDANIM_ONESHOT
if (anim && (i >= j+j) && (fps) && !mdpause) //Keep mdanimtims close to mdtims to avoid the use of MOD
sprext->mdanimtims += j/((fps*timerGetRate())/120);
sprext->mdanimtims += j/((fps*timerGetClockRate())/120);
k = i;

View file

@ -2212,7 +2212,7 @@ int32_t handleevents(void)
rv = handleevents_pollsdl();
inputchecked = 0;
timerUpdate();
timerUpdateClock();
#ifndef _WIN32
startwin_idle(NULL);

View file

@ -1,3 +1,4 @@
// Build engine timer stuff
#include "timer.h"
@ -15,7 +16,7 @@ static time_point<steady_clock> timerlastsample;
static int timerticspersec;
static void(*usertimercallback)(void) = NULL;
int timerGetRate(void) { return timerticspersec; }
int timerGetClockRate(void) { return timerticspersec; }
uint32_t timerGetTicks(void) { return duration_cast<milliseconds>(steady_clock::now().time_since_epoch()).count(); }
uint64_t timerGetTicksU64(void) { return steady_clock::now().time_since_epoch().count() * steady_clock::period::num; }
uint64_t timerGetFreqU64(void) { return steady_clock::period::den; }
@ -34,7 +35,7 @@ int timerInit(int const tickspersecond)
return 0;
}
ATTRIBUTE((flatten)) void timerUpdate(void)
ATTRIBUTE((flatten)) void timerUpdateClock(void)
{
auto time = steady_clock::now();
auto elapsedTime = time - timerlastsample;