mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-19 15:31:57 +00:00
- Duke: Create function to reset timer and apply in game where timer restarts are needed.
This commit is contained in:
parent
7d1f021fcd
commit
2231386830
6 changed files with 14 additions and 2 deletions
|
@ -170,6 +170,11 @@ int I_GetBuildTime()
|
|||
return NSToBuildTic(CurrentFrameStartTime - FirstFrameStartTime);
|
||||
}
|
||||
|
||||
void I_ResetTime()
|
||||
{
|
||||
FirstFrameStartTime = CurrentFrameStartTime = 0;
|
||||
}
|
||||
|
||||
double I_GetTimeFrac()
|
||||
{
|
||||
int currentTic = NSToTic(CurrentFrameStartTime - FirstFrameStartTime);
|
||||
|
|
|
@ -15,6 +15,9 @@ uint64_t I_GetTimeNS();
|
|||
// Called by Build games in liew of totalclock, returns current time in tics at ticrate of 120.
|
||||
int I_GetBuildTime();
|
||||
|
||||
// Reset timer variables to zero when called.
|
||||
void I_ResetTime();
|
||||
|
||||
double I_GetTimeFrac();
|
||||
|
||||
// like I_GetTime, except it waits for a new tic before returning
|
||||
|
|
|
@ -308,8 +308,6 @@ static void checkTimerActive()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static int lastTic;
|
||||
|
||||
bool GameTicker()
|
||||
{
|
||||
if (ps[myconnectindex].gm == MODE_DEMO)
|
||||
|
@ -413,6 +411,8 @@ void GameInterface::RunGameFrame()
|
|||
{
|
||||
default:
|
||||
case GS_STARTUP:
|
||||
I_ResetTime();
|
||||
lastTic = -1;
|
||||
totalclock = 0;
|
||||
gameclock = 0;
|
||||
lockclock = 0;
|
||||
|
|
|
@ -54,6 +54,7 @@ int max_armour_amount;
|
|||
int lasermode;
|
||||
|
||||
int gameclock = 0, cameradist = 0, cameraclock = 0;
|
||||
int lastTic = -1;
|
||||
int otherp;
|
||||
TileInfo tileinfo[MAXTILES]; // This is not from EDuke32.
|
||||
ActorInfo actorinfo[MAXTILES];
|
||||
|
|
|
@ -38,6 +38,7 @@ extern int max_armour_amount;
|
|||
extern int lasermode;
|
||||
|
||||
extern int gameclock;
|
||||
extern int lastTic;
|
||||
extern int cameraclock;
|
||||
extern int cameradist;
|
||||
extern int otherp; // transient helper, MP only
|
||||
|
|
|
@ -756,6 +756,8 @@ void prelevel_common(int g)
|
|||
|
||||
void resettimevars(void)
|
||||
{
|
||||
I_ResetTime();
|
||||
lastTic = -1;
|
||||
totalclock = 0;
|
||||
gameclock = 0;
|
||||
cloudtotalclock = 0;
|
||||
|
|
Loading…
Reference in a new issue