mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
- update more millisecond-storing data structures to u/int64_t to fix possible rollover bugs
This commit is contained in:
parent
16fa0cba21
commit
909daadd75
14 changed files with 36 additions and 35 deletions
|
@ -938,7 +938,7 @@ void D_Display ()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// wipe update
|
// wipe update
|
||||||
unsigned int wipestart, nowtime, diff;
|
uint64_t wipestart, nowtime, diff;
|
||||||
bool done;
|
bool done;
|
||||||
|
|
||||||
GSnd->SetSfxPaused(true, 1);
|
GSnd->SetSfxPaused(true, 1);
|
||||||
|
@ -1053,10 +1053,10 @@ void D_DoomLoop ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
I_StartTic ();
|
||||||
TryRunTics (); // will run at least one tic
|
TryRunTics (); // will run at least one tic
|
||||||
}
|
}
|
||||||
// Update display, next frame, with current state.
|
// Update display, next frame, with current state.
|
||||||
I_StartTic ();
|
|
||||||
D_Display ();
|
D_Display ();
|
||||||
if (wantToRestart)
|
if (wantToRestart)
|
||||||
{
|
{
|
||||||
|
|
|
@ -113,9 +113,9 @@ bool remoteresend[MAXNETNODES]; // set when local needs tics
|
||||||
int resendto[MAXNETNODES]; // set when remote needs tics
|
int resendto[MAXNETNODES]; // set when remote needs tics
|
||||||
int resendcount[MAXNETNODES];
|
int resendcount[MAXNETNODES];
|
||||||
|
|
||||||
unsigned int lastrecvtime[MAXPLAYERS]; // [RH] Used for pings
|
uint64_t lastrecvtime[MAXPLAYERS]; // [RH] Used for pings
|
||||||
unsigned int currrecvtime[MAXPLAYERS];
|
uint64_t currrecvtime[MAXPLAYERS];
|
||||||
unsigned int lastglobalrecvtime; // Identify the last time a packet was received.
|
uint64_t lastglobalrecvtime; // Identify the last time a packet was received.
|
||||||
bool hadlate;
|
bool hadlate;
|
||||||
int netdelay[MAXNETNODES][BACKUPTICS]; // Used for storing network delay times.
|
int netdelay[MAXNETNODES][BACKUPTICS]; // Used for storing network delay times.
|
||||||
int lastaverage;
|
int lastaverage;
|
||||||
|
|
|
@ -615,7 +615,7 @@ void DObject::CheckIfSerialized () const
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DObject, MSTime)
|
DEFINE_ACTION_FUNCTION(DObject, MSTime)
|
||||||
{
|
{
|
||||||
ACTION_RETURN_INT(I_msTime());
|
ACTION_RETURN_INT((uint32_t)I_msTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void *DObject::ScriptVar(FName field, PType *type)
|
void *DObject::ScriptVar(FName field, PType *type)
|
||||||
|
|
|
@ -187,8 +187,8 @@ static void AppendLightStats(FString &out)
|
||||||
ADD_STAT(rendertimes)
|
ADD_STAT(rendertimes)
|
||||||
{
|
{
|
||||||
static FString buff;
|
static FString buff;
|
||||||
static int lasttime=0;
|
static int64_t lasttime=0;
|
||||||
int t=I_msTime();
|
int64_t t=I_msTime();
|
||||||
if (t-lasttime>1000)
|
if (t-lasttime>1000)
|
||||||
{
|
{
|
||||||
buff.Truncate(0);
|
buff.Truncate(0);
|
||||||
|
@ -217,7 +217,7 @@ void AppendMissingTextureStats(FString &out);
|
||||||
|
|
||||||
static int printstats;
|
static int printstats;
|
||||||
static bool switchfps;
|
static bool switchfps;
|
||||||
static unsigned int waitstart;
|
static uint64_t waitstart;
|
||||||
EXTERN_CVAR(Bool, vid_fps)
|
EXTERN_CVAR(Bool, vid_fps)
|
||||||
|
|
||||||
void CheckBench()
|
void CheckBench()
|
||||||
|
|
|
@ -955,7 +955,7 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
|
||||||
if (!loaded)
|
if (!loaded)
|
||||||
{
|
{
|
||||||
// none found - we have to build new ones!
|
// none found - we have to build new ones!
|
||||||
unsigned int startTime, endTime;
|
uint64_t startTime, endTime;
|
||||||
|
|
||||||
startTime = I_msTime ();
|
startTime = I_msTime ();
|
||||||
TArray<FNodeBuilder::FPolyStart> polyspots, anchors;
|
TArray<FNodeBuilder::FPolyStart> polyspots, anchors;
|
||||||
|
@ -973,7 +973,7 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
|
||||||
builder.Extract (level);
|
builder.Extract (level);
|
||||||
endTime = I_msTime ();
|
endTime = I_msTime ();
|
||||||
DPrintf (DMSG_NOTIFY, "BSP generation took %.3f sec (%u segs)\n", (endTime - startTime) * 0.001, level.segs.Size());
|
DPrintf (DMSG_NOTIFY, "BSP generation took %.3f sec (%u segs)\n", (endTime - startTime) * 0.001, level.segs.Size());
|
||||||
buildtime = endTime - startTime;
|
buildtime = (int32_t)(endTime - startTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3933,7 +3933,7 @@ void P_SetupLevel (const char *lumpname, int position)
|
||||||
}
|
}
|
||||||
else reloop = true;
|
else reloop = true;
|
||||||
|
|
||||||
unsigned int startTime=0, endTime=0;
|
uint64_t startTime=0, endTime=0;
|
||||||
|
|
||||||
bool BuildGLNodes;
|
bool BuildGLNodes;
|
||||||
if (ForceNodeBuild)
|
if (ForceNodeBuild)
|
||||||
|
@ -3990,7 +3990,7 @@ void P_SetupLevel (const char *lumpname, int position)
|
||||||
// If the original nodes being loaded are not GL nodes they will be kept around for
|
// If the original nodes being loaded are not GL nodes they will be kept around for
|
||||||
// use in P_PointInSubsector to avoid problems with maps that depend on the specific
|
// use in P_PointInSubsector to avoid problems with maps that depend on the specific
|
||||||
// nodes they were built with (P:AR E1M3 is a good example for a map where this is the case.)
|
// nodes they were built with (P:AR E1M3 is a good example for a map where this is the case.)
|
||||||
reloop |= P_CheckNodes(map, BuildGLNodes, endTime - startTime);
|
reloop |= P_CheckNodes(map, BuildGLNodes, (uint32_t)(endTime - startTime));
|
||||||
hasglnodes = true;
|
hasglnodes = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -165,7 +165,7 @@ void R_InitSkyMap ()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void R_UpdateSky (uint32_t mstime)
|
void R_UpdateSky (uint64_t mstime)
|
||||||
{
|
{
|
||||||
// Scroll the sky
|
// Scroll the sky
|
||||||
double ms = (double)mstime * FRACUNIT;
|
double ms = (double)mstime * FRACUNIT;
|
||||||
|
|
|
@ -44,6 +44,6 @@ extern int freelookviewheight;
|
||||||
|
|
||||||
// Called whenever the sky changes.
|
// Called whenever the sky changes.
|
||||||
void R_InitSkyMap ();
|
void R_InitSkyMap ();
|
||||||
void R_UpdateSky (uint32_t mstime);
|
void R_UpdateSky (uint64_t mstime);
|
||||||
|
|
||||||
#endif //__R_SKY_H__
|
#endif //__R_SKY_H__
|
||||||
|
|
|
@ -876,7 +876,7 @@ FDoorAnimation *FTextureManager::FindAnimatedDoor (FTextureID picnum)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void FAnimDef::SetSwitchTime (uint32_t mstime)
|
void FAnimDef::SetSwitchTime (uint64_t mstime)
|
||||||
{
|
{
|
||||||
int speedframe = bDiscrete ? CurFrame : 0;
|
int speedframe = bDiscrete ? CurFrame : 0;
|
||||||
|
|
||||||
|
@ -917,7 +917,7 @@ void FTextureManager::SetTranslation (FTextureID fromtexnum, FTextureID totexnum
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void FTextureManager::UpdateAnimations (uint32_t mstime)
|
void FTextureManager::UpdateAnimations (uint64_t mstime)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < mAnimations.Size(); ++j)
|
for (unsigned int j = 0; j < mAnimations.Size(); ++j)
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,7 +90,7 @@ struct FAnimDef
|
||||||
uint16_t CurFrame;
|
uint16_t CurFrame;
|
||||||
uint8_t AnimType;
|
uint8_t AnimType;
|
||||||
bool bDiscrete; // taken out of AnimType to have better control
|
bool bDiscrete; // taken out of AnimType to have better control
|
||||||
uint32_t SwitchTime; // Time to advance to next frame
|
uint64_t SwitchTime; // Time to advance to next frame
|
||||||
struct FAnimFrame
|
struct FAnimFrame
|
||||||
{
|
{
|
||||||
uint32_t SpeedMin; // Speeds are in ms, not tics
|
uint32_t SpeedMin; // Speeds are in ms, not tics
|
||||||
|
@ -106,7 +106,7 @@ struct FAnimDef
|
||||||
ANIM_Random
|
ANIM_Random
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetSwitchTime (uint32_t mstime);
|
void SetSwitchTime (uint64_t mstime);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FSwitchDef
|
struct FSwitchDef
|
||||||
|
@ -505,7 +505,7 @@ public:
|
||||||
|
|
||||||
int NumTextures () const { return (int)Textures.Size(); }
|
int NumTextures () const { return (int)Textures.Size(); }
|
||||||
|
|
||||||
void UpdateAnimations (uint32_t mstime);
|
void UpdateAnimations (uint64_t mstime);
|
||||||
int GuesstimateNumTextures ();
|
int GuesstimateNumTextures ();
|
||||||
|
|
||||||
FSwitchDef *FindSwitch (FTextureID texture);
|
FSwitchDef *FindSwitch (FTextureID texture);
|
||||||
|
@ -604,8 +604,8 @@ public:
|
||||||
void SetSpeed(float fac) { Speed = fac; }
|
void SetSpeed(float fac) { Speed = fac; }
|
||||||
FTexture *GetRedirect(bool wantwarped);
|
FTexture *GetRedirect(bool wantwarped);
|
||||||
|
|
||||||
uint32_t GenTime;
|
uint64_t GenTime;
|
||||||
uint32_t GenTimeBgra;
|
uint64_t GenTimeBgra;
|
||||||
float Speed;
|
float Speed;
|
||||||
int WidthOffsetMultiplier, HeightOffsetMultiplier; // [mxd]
|
int WidthOffsetMultiplier, HeightOffsetMultiplier; // [mxd]
|
||||||
protected:
|
protected:
|
||||||
|
@ -613,7 +613,7 @@ protected:
|
||||||
uint8_t *Pixels;
|
uint8_t *Pixels;
|
||||||
Span **Spans;
|
Span **Spans;
|
||||||
|
|
||||||
virtual void MakeTexture (uint32_t time);
|
virtual void MakeTexture (uint64_t time);
|
||||||
int NextPo2 (int v); // [mxd]
|
int NextPo2 (int v); // [mxd]
|
||||||
void SetupMultipliers (int width, int height); // [mxd]
|
void SetupMultipliers (int width, int height); // [mxd]
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include "textures/textures.h"
|
#include "textures/textures.h"
|
||||||
|
|
||||||
template<class TYPE>
|
template<class TYPE>
|
||||||
void WarpBuffer(TYPE *Pixels, const TYPE *source, int width, int height, int xmul, int ymul, unsigned time, float Speed, int warptype)
|
void WarpBuffer(TYPE *Pixels, const TYPE *source, int width, int height, int xmul, int ymul, uint64_t time, float Speed, int warptype)
|
||||||
{
|
{
|
||||||
int ymask = height - 1;
|
int ymask = height - 1;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
|
@ -86,7 +86,7 @@ bool FWarpTexture::CheckModified ()
|
||||||
|
|
||||||
const uint8_t *FWarpTexture::GetPixels ()
|
const uint8_t *FWarpTexture::GetPixels ()
|
||||||
{
|
{
|
||||||
uint32_t time = screen->FrameTime;
|
uint64_t time = screen->FrameTime;
|
||||||
|
|
||||||
if (Pixels == NULL || time != GenTime)
|
if (Pixels == NULL || time != GenTime)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ const uint8_t *FWarpTexture::GetPixels ()
|
||||||
|
|
||||||
const uint32_t *FWarpTexture::GetPixelsBgra()
|
const uint32_t *FWarpTexture::GetPixelsBgra()
|
||||||
{
|
{
|
||||||
uint32_t time = screen->FrameTime;
|
uint64_t time = screen->FrameTime;
|
||||||
if (Pixels == NULL || time != GenTime)
|
if (Pixels == NULL || time != GenTime)
|
||||||
MakeTexture(time);
|
MakeTexture(time);
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ const uint32_t *FWarpTexture::GetPixelsBgra()
|
||||||
|
|
||||||
const uint8_t *FWarpTexture::GetColumn (unsigned int column, const Span **spans_out)
|
const uint8_t *FWarpTexture::GetColumn (unsigned int column, const Span **spans_out)
|
||||||
{
|
{
|
||||||
uint32_t time =screen->FrameTime;
|
uint64_t time =screen->FrameTime;
|
||||||
|
|
||||||
if (Pixels == NULL || time != GenTime)
|
if (Pixels == NULL || time != GenTime)
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ const uint8_t *FWarpTexture::GetColumn (unsigned int column, const Span **spans_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FWarpTexture::MakeTexture(uint32_t time)
|
void FWarpTexture::MakeTexture(uint64_t time)
|
||||||
{
|
{
|
||||||
const uint8_t *otherpix = SourcePic->GetPixels();
|
const uint8_t *otherpix = SourcePic->GetPixels();
|
||||||
|
|
||||||
|
|
|
@ -870,8 +870,8 @@ void DFrameBuffer::DrawRateStuff ()
|
||||||
// Draws frame time and cumulative fps
|
// Draws frame time and cumulative fps
|
||||||
if (vid_fps)
|
if (vid_fps)
|
||||||
{
|
{
|
||||||
uint32_t ms = screen->FrameTime;
|
uint64_t ms = screen->FrameTime;
|
||||||
uint32_t howlong = ms - LastMS;
|
uint64_t howlong = ms - LastMS;
|
||||||
if ((signed)howlong >= 0)
|
if ((signed)howlong >= 0)
|
||||||
{
|
{
|
||||||
char fpsbuff[40];
|
char fpsbuff[40];
|
||||||
|
@ -888,7 +888,7 @@ void DFrameBuffer::DrawRateStuff ()
|
||||||
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||||
DTA_KeepRatio, true, TAG_DONE);
|
DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
|
||||||
uint32_t thisSec = ms/1000;
|
uint32_t thisSec = (uint32_t)(ms/1000);
|
||||||
if (LastSec < thisSec)
|
if (LastSec < thisSec)
|
||||||
{
|
{
|
||||||
LastCount = FrameCount / (thisSec - LastSec);
|
LastCount = FrameCount / (thisSec - LastSec);
|
||||||
|
@ -903,8 +903,8 @@ void DFrameBuffer::DrawRateStuff ()
|
||||||
// draws little dots on the bottom of the screen
|
// draws little dots on the bottom of the screen
|
||||||
if (ticker)
|
if (ticker)
|
||||||
{
|
{
|
||||||
int i = I_GetTime();
|
int64_t i = I_GetTime();
|
||||||
int tics = i - LastTic;
|
int64_t tics = i - LastTic;
|
||||||
uint8_t *buffer = GetBuffer();
|
uint8_t *buffer = GetBuffer();
|
||||||
|
|
||||||
LastTic = i;
|
LastTic = i;
|
||||||
|
@ -931,6 +931,7 @@ void DFrameBuffer::DrawRateStuff ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
for (i = 0; i < tics*2; i += 2) Clear(i, Height-1, i+1, Height, 255, 0);
|
for (i = 0; i < tics*2; i += 2) Clear(i, Height-1, i+1, Height, 255, 0);
|
||||||
for ( ; i < 20*2; i += 2) Clear(i, Height-1, i+1, Height, 0, 0);
|
for ( ; i < 20*2; i += 2) Clear(i, Height-1, i+1, Height, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -442,7 +442,7 @@ public:
|
||||||
|
|
||||||
virtual void ScaleCoordsFromWindow(int16_t &x, int16_t &y) {}
|
virtual void ScaleCoordsFromWindow(int16_t &x, int16_t &y) {}
|
||||||
|
|
||||||
uint32_t GetLastFPS() const { return LastCount; }
|
uint64_t GetLastFPS() const { return LastCount; }
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
virtual void PaletteChanged () = 0;
|
virtual void PaletteChanged () = 0;
|
||||||
|
@ -463,7 +463,7 @@ protected:
|
||||||
DFrameBuffer () {}
|
DFrameBuffer () {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t LastMS, LastSec, FrameCount, LastCount, LastTic;
|
uint64_t LastMS, LastSec, FrameCount, LastCount, LastTic;
|
||||||
bool isIn2D = false;
|
bool isIn2D = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue