- All Games: Remove use of ClockTicks and replace with int.

This commit is contained in:
Mitchell Richters 2020-08-26 09:33:40 +10:00
parent 1c8b0a20fb
commit 76776d24d7
21 changed files with 34 additions and 35 deletions

View file

@ -56,7 +56,7 @@ void CChoke::sub_84110(int x, int y)
{ {
if (!at8) if (!at8)
return; return;
ClockTicks v4 = gFrameClock; int v4 = gFrameClock;
gFrameClock = gameclock; gFrameClock = gameclock;
at8->x = x; at8->x = x;
at8->y = y; at8->y = y;

View file

@ -86,7 +86,7 @@ void CGameMenuItemQAV::Draw(void)
if (raw.Size() > 0) if (raw.Size() > 0)
{ {
auto data = (QAV*)raw.Data(); auto data = (QAV*)raw.Data();
ClockTicks backFC = gFrameClock; int backFC = gFrameClock;
int currentclock = I_GetBuildTime(); int currentclock = I_GetBuildTime();
gFrameClock = currentclock; gFrameClock = currentclock;
int nTicks = currentclock - lastTick; int nTicks = currentclock - lastTick;

View file

@ -98,7 +98,7 @@ void FireInit(void)
void FireProcess(void) void FireProcess(void)
{ {
static ClockTicks lastUpdate; static int lastUpdate;
if (gameclock < lastUpdate || lastUpdate + 2 < gameclock) if (gameclock < lastUpdate || lastUpdate + 2 < gameclock)
{ {
DoFireFrame(); DoFireFrame();

View file

@ -33,8 +33,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
bool bVanilla = false; bool bVanilla = false;
ClockTicks gFrameClock; int gFrameClock;
ClockTicks gFrameTicks; int gFrameTicks;
int gameclock; int gameclock;
int lastTic; int lastTic;
int gFrame; int gFrame;

View file

@ -30,12 +30,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
extern ClockTicks gFrameClock; extern int gFrameClock;
extern ClockTicks gFrameTicks; extern int gFrameTicks;
extern int gameclock; extern int gameclock;
extern int lastTic; extern int lastTic;
extern int gFrame; extern int gFrame;
//extern ClockTicks gGameClock; //extern int gGameClock;
extern int gFrameRate; extern int gFrameRate;
extern bool bVanilla; extern bool bVanilla;

View file

@ -710,7 +710,7 @@ void MyLoadSave::Save(void)
Write(&gFrameClock, sizeof(gFrameClock)); Write(&gFrameClock, sizeof(gFrameClock));
Write(&gFrameTicks, sizeof(gFrameTicks)); Write(&gFrameTicks, sizeof(gFrameTicks));
Write(&gFrame, sizeof(gFrame)); Write(&gFrame, sizeof(gFrame));
ClockTicks nGameClock = gameclock; int nGameClock = gameclock;
Write(&nGameClock, sizeof(nGameClock)); Write(&nGameClock, sizeof(nGameClock));
Write(&gLevelTime, sizeof(gLevelTime)); Write(&gLevelTime, sizeof(gLevelTime));
Write(&paused, sizeof(paused)); Write(&paused, sizeof(paused));

View file

@ -40,7 +40,7 @@ BEGIN_BLD_NS
MapRecord *gStartNewGame = 0; MapRecord *gStartNewGame = 0;
PACKETMODE gPacketMode = PACKETMODE_1; PACKETMODE gPacketMode = PACKETMODE_1;
ClockTicks gNetFifoClock = 0; int gNetFifoClock = 0;
int gNetFifoTail = 0; int gNetFifoTail = 0;
int gNetFifoHead[8]; int gNetFifoHead[8];
int gPredictTail = 0; int gPredictTail = 0;

View file

@ -45,7 +45,7 @@ enum NETWORKMODE {
extern MapRecord *gStartNewGame; extern MapRecord *gStartNewGame;
extern PACKETMODE gPacketMode; extern PACKETMODE gPacketMode;
extern ClockTicks gNetFifoClock; extern int gNetFifoClock;
extern int gNetFifoTail; extern int gNetFifoTail;
extern int gNetFifoHead[8]; extern int gNetFifoHead[8];
extern int gPredictTail; extern int gPredictTail;

View file

@ -856,7 +856,7 @@ void playerReset(PLAYER *pPlayer)
} }
int dword_21EFB0[8]; int dword_21EFB0[8];
ClockTicks dword_21EFD0[8]; int dword_21EFD0[8];
void playerInit(int nPlayer, unsigned int a2) void playerInit(int nPlayer, unsigned int a2)
{ {

View file

@ -230,7 +230,7 @@ extern bool gRedFlagDropped;
extern PROFILE gProfile[kMaxPlayers]; extern PROFILE gProfile[kMaxPlayers];
extern int dword_21EFB0[kMaxPlayers]; extern int dword_21EFB0[kMaxPlayers];
extern ClockTicks dword_21EFD0[kMaxPlayers]; extern int dword_21EFD0[kMaxPlayers];
extern AMMOINFO gAmmoInfo[]; extern AMMOINFO gAmmoInfo[];
extern POWERUPINFO gPowerUpInfo[kMaxPowerUps]; extern POWERUPINFO gPowerUpInfo[kMaxPowerUps];

View file

@ -446,7 +446,7 @@ private:
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void viewDrawCtfHudVanilla(ClockTicks arg) void viewDrawCtfHudVanilla(int arg)
{ {
FString gTempStr; FString gTempStr;
int x = 1, y = 1; int x = 1, y = 1;
@ -477,7 +477,7 @@ private:
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void flashTeamScore(ClockTicks arg, int team, bool show) void flashTeamScore(int arg, int team, bool show)
{ {
dassert(0 == team || 1 == team); // 0: blue, 1: red dassert(0 == team || 1 == team); // 0: blue, 1: red
@ -498,7 +498,7 @@ private:
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void viewDrawCtfHud(ClockTicks arg) void viewDrawCtfHud(int arg)
{ {
if (hud_size == Hud_Nothing) if (hud_size == Hud_Nothing)
{ {
@ -744,7 +744,7 @@ private:
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
public: public:
void UpdateStatusBar(ClockTicks arg) void UpdateStatusBar(int arg)
{ {
PLAYER* pPlayer = gView; PLAYER* pPlayer = gView;
XSPRITE* pXSprite = pPlayer->pXSprite; XSPRITE* pXSprite = pPlayer->pXSprite;
@ -822,7 +822,7 @@ static void UpdateFrame(void)
twod->AddFlatFill(windowxy1.x - 3, windowxy2.y + 1, windowxy2.x + 1, windowxy2.y + 4, tex, 0, 1, 0xff2a2a2a); twod->AddFlatFill(windowxy1.x - 3, windowxy2.y + 1, windowxy2.x + 1, windowxy2.y + 4, tex, 0, 1, 0xff2a2a2a);
} }
void UpdateStatusBar(ClockTicks arg) void UpdateStatusBar(int arg)
{ {
DBloodStatusBar sbar; DBloodStatusBar sbar;

View file

@ -346,7 +346,7 @@ void viewInit(void)
gViewMap.sub_25C38(0, 0, gZoom, 0); gViewMap.sub_25C38(0, 0, gZoom, 0);
} }
void viewDrawInterface(ClockTicks arg) void viewDrawInterface(int arg)
{ {
UpdateStatusBar(arg); UpdateStatusBar(arg);
} }
@ -647,13 +647,13 @@ int32_t g_frameRate;
void viewDrawScreen(bool sceneonly) void viewDrawScreen(bool sceneonly)
{ {
int nPalette = 0; int nPalette = 0;
static ClockTicks lastUpdate; static int lastUpdate;
int defaultHoriz = r_horizcenter ? 100 : 90; int defaultHoriz = r_horizcenter ? 100 : 90;
#ifdef USE_OPENGL #ifdef USE_OPENGL
polymostcenterhoriz = defaultHoriz; polymostcenterhoriz = defaultHoriz;
#endif #endif
ClockTicks delta = gameclock - lastUpdate; int delta = gameclock - lastUpdate;
if (delta < 0) if (delta < 0)
delta = 0; delta = 0;
lastUpdate = gameclock; lastUpdate = gameclock;

View file

@ -154,9 +154,9 @@ void CalcInterpolations(void);
void RestoreInterpolations(void); void RestoreInterpolations(void);
void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int nPalette, int position, char shadow, unsigned int nStat = 0, uint8_t alpha = 255); void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int nPalette, int position, char shadow, unsigned int nStat = 0, uint8_t alpha = 255);
void InitStatusBar(void); void InitStatusBar(void);
void UpdateStatusBar(ClockTicks arg); void UpdateStatusBar(int arg);
void viewInit(void); void viewInit(void);
void viewDrawInterface(ClockTicks arg); void viewDrawInterface(int arg);
void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smooth); void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smooth);
void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, int zm); void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, int zm);
void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, int zm); void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, int zm);

View file

@ -950,7 +950,6 @@ static FORCE_INLINE char *Bstrncpyz(char *dst, const char *src, bsize_t n)
#include "fix16.h" #include "fix16.h"
#include "vectors.h" #include "vectors.h"
using ClockTicks = int;
inline FVector3 GetSoundPos(const vec3_t *pos) inline FVector3 GetSoundPos(const vec3_t *pos)
{ {

View file

@ -97,7 +97,7 @@ int myconnectindex, numplayers;
int connecthead, connectpoint2[MAXMULTIPLAYERS]; int connecthead, connectpoint2[MAXMULTIPLAYERS];
int32_t xres = -1, yres = -1, bpp = 0; int32_t xres = -1, yres = -1, bpp = 0;
auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries. auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries.
static ClockTicks lastototalclk; static int lastototalclk;
static uint64_t elapsedTime; static uint64_t elapsedTime;
static uint64_t lastTime; static uint64_t lastTime;
@ -1125,7 +1125,7 @@ void S_SetSoundPaused(int state)
} }
} }
double CalcSmoothRatio(ClockTicks totalclk, ClockTicks ototalclk, int realgameticspersec) double CalcSmoothRatio(int totalclk, int ototalclk, int realgameticspersec)
{ {
double ratio, result; double ratio, result;

View file

@ -192,7 +192,7 @@ void S_ResumeSound(bool notsfx);
void S_SetSoundPaused(int state); void S_SetSoundPaused(int state);
void G_FatalEngineError(void); void G_FatalEngineError(void);
double CalcSmoothRatio(ClockTicks totalclk, ClockTicks ototalclk, int realgameticspersec); double CalcSmoothRatio(int totalclk, int ototalclk, int realgameticspersec);
enum enum
{ {
MaxSmoothRatio = FRACUNIT MaxSmoothRatio = FRACUNIT

View file

@ -110,14 +110,14 @@ int animatevel[MAXANIMATES];
int16_t clouds[256]; int16_t clouds[256];
int16_t cloudx; int16_t cloudx;
int16_t cloudy; int16_t cloudy;
ClockTicks cloudclock; int cloudclock;
int16_t spriteq[1024]; int16_t spriteq[1024];
int16_t cyclers[MAXCYCLERS][6]; int16_t cyclers[MAXCYCLERS][6];
int16_t mirrorsector[64]; int16_t mirrorsector[64];
int16_t mirrorwall[64]; int16_t mirrorwall[64];
ClockTicks lockclock; int lockclock;
// Redneck Rampage // Redneck Rampage
int wupass; int wupass;

View file

@ -103,14 +103,14 @@ extern int animatevel[MAXANIMATES];
extern int16_t clouds[256]; extern int16_t clouds[256];
extern int16_t cloudx; extern int16_t cloudx;
extern int16_t cloudy; extern int16_t cloudy;
extern ClockTicks cloudclock; extern int cloudclock;
extern int16_t spriteq[1024]; extern int16_t spriteq[1024];
extern int16_t cyclers[MAXCYCLERS][6]; extern int16_t cyclers[MAXCYCLERS][6];
extern int16_t mirrorsector[64]; extern int16_t mirrorsector[64];
extern int16_t mirrorwall[64]; extern int16_t mirrorwall[64];
extern ClockTicks lockclock; extern int lockclock;
extern int wupass; extern int wupass;
extern int chickenplant; extern int chickenplant;

View file

@ -169,7 +169,7 @@ inline bool playrunning()
return (paused == 0 || (paused == 1 && (ud.recstat == 2 || ud.multimode > 1))); return (paused == 0 || (paused == 1 && (ud.recstat == 2 || ud.multimode > 1)));
} }
inline double calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk) inline double calc_smoothratio(int totalclk, int ototalclk)
{ {
double smoothratio = CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC); double smoothratio = CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC);
return (playrunning() ? smoothratio : MaxSmoothRatio); return (playrunning() ? smoothratio : MaxSmoothRatio);

View file

@ -2317,7 +2317,7 @@ void AudioUpdate(void); // stupid
extern short LastSaveNum; extern short LastSaveNum;
void LoadSaveMsg(const char *msg); void LoadSaveMsg(const char *msg);
void UpdateStatusBar(ClockTicks arg); void UpdateStatusBar(int arg);
void InitFonts(); void InitFonts();
int32_t registerosdcommands(void); int32_t registerosdcommands(void);
void registerinputcommands(); void registerinputcommands();

View file

@ -940,7 +940,7 @@ private:
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
public: public:
void UpdateStatusBar(ClockTicks arg) void UpdateStatusBar(int arg)
{ {
int nPalette = 0; int nPalette = 0;
double inv_x, inv_y; double inv_x, inv_y;
@ -1007,7 +1007,7 @@ static void UpdateFrame(void)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void UpdateStatusBar(ClockTicks arg) void UpdateStatusBar(int arg)
{ {
DSWStatusBar sbar; DSWStatusBar sbar;