mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-14 00:21:38 +00:00
- Duke (and Engine): Eliminate use of totalclock for game.
* Breaks every other game except Duke unless/until they get migrated. Done for the purpose of demonstrating PR #244. # Conflicts: # source/build/src/timer.cpp # source/games/duke/src/game.cpp
This commit is contained in:
parent
c5f523fb3c
commit
d3b506eb2b
8 changed files with 20 additions and 9 deletions
|
@ -1286,7 +1286,7 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
|
||||||
globalhoriz = fix16_to_int(qglobalhoriz);
|
globalhoriz = fix16_to_int(qglobalhoriz);
|
||||||
|
|
||||||
globalcursectnum = dacursectnum;
|
globalcursectnum = dacursectnum;
|
||||||
totalclocklock = totalclock;
|
totalclocklock = I_GetBuildTime();
|
||||||
|
|
||||||
if ((xyaspect != oxyaspect) || (xdimen != oxdimen) || (viewingrange != oviewingrange))
|
if ((xyaspect != oxyaspect) || (xdimen != oxdimen) || (viewingrange != oviewingrange))
|
||||||
dosetaspect();
|
dosetaspect();
|
||||||
|
|
|
@ -599,7 +599,7 @@ static 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)
|
fps = smooth->mdsmooth ? Blrintf((1.0f / ((float)tile2model[tile].smoothduration * (1.f / (float)UINT16_MAX))) * 66.f)
|
||||||
: anim ? anim->fpssc : 1;
|
: anim ? anim->fpssc : 1;
|
||||||
|
|
||||||
i = (mdtims - sprext->mdanimtims) * ((fps * timerGetClockRate()) / 120);
|
i = (mdtims - sprext->mdanimtims) * ((fps * 120) / 120);
|
||||||
|
|
||||||
j = (smooth->mdsmooth || !anim) ? 65536 : ((anim->endframe + 1 - anim->startframe) << 16);
|
j = (smooth->mdsmooth || !anim) ? 65536 : ((anim->endframe + 1 - anim->startframe) << 16);
|
||||||
|
|
||||||
|
@ -607,7 +607,7 @@ static void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal)
|
||||||
if (i < 0) { i = 0; sprext->mdanimtims = mdtims; }
|
if (i < 0) { i = 0; sprext->mdanimtims = mdtims; }
|
||||||
//compare with j*2 instead of j to ensure i stays > j-65536 for MDANIM_ONESHOT
|
//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
|
if (anim && (i >= j+j) && (fps) && !mdpause) //Keep mdanimtims close to mdtims to avoid the use of MOD
|
||||||
sprext->mdanimtims += j/((fps*timerGetClockRate())/120);
|
sprext->mdanimtims += j/((fps*120)/120);
|
||||||
|
|
||||||
k = i;
|
k = i;
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,4 @@ void timerUpdateClock(void)
|
||||||
|
|
||||||
totalclock += n;
|
totalclock += n;
|
||||||
timerlastsample += n*nanoseconds(1000000000/timerticspersec);
|
timerlastsample += n*nanoseconds(1000000000/timerticspersec);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,20 @@ void InputState::ClearAllInput()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
TArray<void(*)(void)> callbacks;
|
||||||
|
|
||||||
|
void(*timerSetCallback(void(*callback)(void)))(void)
|
||||||
|
{
|
||||||
|
callbacks.Push(callback);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -145,7 +159,7 @@ int32_t handleevents(void)
|
||||||
setsizeneeded = false;
|
setsizeneeded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
timerUpdateClock();
|
for (auto cb : callbacks) cb();
|
||||||
|
|
||||||
I_StartFrame();
|
I_StartFrame();
|
||||||
I_StartTic();
|
I_StartTic();
|
||||||
|
|
|
@ -60,5 +60,7 @@ public:
|
||||||
|
|
||||||
extern InputState inputState;
|
extern InputState inputState;
|
||||||
|
|
||||||
|
void (*timerSetCallback(void (*callback)(void)))(void);
|
||||||
|
|
||||||
void CONTROL_GetInput(ControlInfo* info);
|
void CONTROL_GetInput(ControlInfo* info);
|
||||||
int32_t handleevents(void);
|
int32_t handleevents(void);
|
||||||
|
|
|
@ -350,7 +350,6 @@ static void Startup(void)
|
||||||
SetDispatcher();
|
SetDispatcher();
|
||||||
S_InitSound();
|
S_InitSound();
|
||||||
|
|
||||||
timerInit(TICRATE);
|
|
||||||
|
|
||||||
loadcons();
|
loadcons();
|
||||||
fi.initactorflags();
|
fi.initactorflags();
|
||||||
|
|
|
@ -413,7 +413,6 @@ void GameInterface::RunGameFrame()
|
||||||
case GS_STARTUP:
|
case GS_STARTUP:
|
||||||
I_ResetTime();
|
I_ResetTime();
|
||||||
lastTic = -1;
|
lastTic = -1;
|
||||||
totalclock = 0;
|
|
||||||
gameclock = 0;
|
gameclock = 0;
|
||||||
lockclock = 0;
|
lockclock = 0;
|
||||||
|
|
||||||
|
|
|
@ -758,7 +758,6 @@ void resettimevars(void)
|
||||||
{
|
{
|
||||||
I_ResetTime();
|
I_ResetTime();
|
||||||
lastTic = -1;
|
lastTic = -1;
|
||||||
totalclock = 0;
|
|
||||||
gameclock = 0;
|
gameclock = 0;
|
||||||
cloudtotalclock = 0;
|
cloudtotalclock = 0;
|
||||||
levelTextTime = 85;
|
levelTextTime = 85;
|
||||||
|
|
Loading…
Reference in a new issue