uint64 -> uint64_t, int64 -> int64_t

This commit is contained in:
Jupeyy 2021-06-23 07:05:49 +02:00
parent 3e1d4ad0b3
commit a663799188
88 changed files with 377 additions and 390 deletions

View file

@ -79,8 +79,8 @@ struct CAntibotData
{ {
CAntibotVersion m_Version; CAntibotVersion m_Version;
int64 m_Now; int64_t m_Now;
int64 m_Freq; int64_t m_Freq;
void (*m_pfnLog)(const char *pMessage, void *pUser); void (*m_pfnLog)(const char *pMessage, void *pUser);
void (*m_pfnReport)(int ClientID, const char *pMessage, void *pUser); void (*m_pfnReport)(int ClientID, const char *pMessage, void *pUser);
void (*m_pfnSend)(int ClientID, const void *pData, int DataSize, int Flags, void *pUser); void (*m_pfnSend)(int ClientID, const void *pData, int DataSize, int Flags, void *pUser);

View file

@ -17,7 +17,7 @@
#else #else
typedef struct typedef struct
{ {
uint64 length; uint64_t length;
uint32_t state[8]; uint32_t state[8];
uint32_t curlen; uint32_t curlen;
unsigned char buf[64]; unsigned char buf[64];

View file

@ -15,6 +15,8 @@
#include <chrono> #include <chrono>
#include <cinttypes>
#if defined(CONF_WEBSOCKETS) #if defined(CONF_WEBSOCKETS)
#include <engine/shared/websockets.h> #include <engine/shared/websockets.h>
#endif #endif
@ -942,14 +944,14 @@ static_assert(std::chrono::steady_clock::is_steady, "Compiler does not support s
static_assert(std::chrono::steady_clock::period::den / std::chrono::steady_clock::period::num >= 1000000, "Compiler has a bad timer precision and might be out of date."); static_assert(std::chrono::steady_clock::period::den / std::chrono::steady_clock::period::num >= 1000000, "Compiler has a bad timer precision and might be out of date.");
static const std::chrono::time_point<std::chrono::steady_clock> tw_start_time = std::chrono::steady_clock::now(); static const std::chrono::time_point<std::chrono::steady_clock> tw_start_time = std::chrono::steady_clock::now();
int64 time_get_impl(void) int64_t time_get_impl(void)
{ {
return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - tw_start_time).count(); return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - tw_start_time).count();
} }
int64 time_get(void) int64_t time_get(void)
{ {
static int64 last = 0; static int64_t last = 0;
if(new_tick == 0) if(new_tick == 0)
return last; return last;
if(new_tick != -1) if(new_tick != -1)
@ -959,12 +961,12 @@ int64 time_get(void)
return last; return last;
} }
int64 time_freq(void) int64_t time_freq(void)
{ {
return 1000000; return 1000000;
} }
int64 time_get_microseconds(void) int64_t time_get_microseconds(void)
{ {
return time_get_impl() / (time_freq() / 1000 / 1000); return time_get_impl() / (time_freq() / 1000 / 1000);
} }
@ -2908,7 +2910,7 @@ void str_timestamp(char *buffer, int buffer_size)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
int str_time(int64 centisecs, int format, char *buffer, int buffer_size) int str_time(int64_t centisecs, int format, char *buffer, int buffer_size)
{ {
const int sec = 100; const int sec = 100;
const int min = 60 * sec; const int min = 60 * sec;
@ -2927,24 +2929,24 @@ int str_time(int64 centisecs, int format, char *buffer, int buffer_size)
{ {
case TIME_DAYS: case TIME_DAYS:
if(centisecs >= day) if(centisecs >= day)
return str_format(buffer, buffer_size, "%lldd %02lld:%02lld:%02lld", centisecs / day, return str_format(buffer, buffer_size, "%" PRId64 "d %02" PRId64 ":%02" PRId64 ":%02" PRId64, centisecs / day,
(centisecs % day) / hour, (centisecs % hour) / min, (centisecs % min) / sec); (centisecs % day) / hour, (centisecs % hour) / min, (centisecs % min) / sec);
// fall through // fall through
case TIME_HOURS: case TIME_HOURS:
if(centisecs >= hour) if(centisecs >= hour)
return str_format(buffer, buffer_size, "%02lld:%02lld:%02lld", centisecs / hour, return str_format(buffer, buffer_size, "%02" PRId64 ":%02" PRId64 ":%02" PRId64, centisecs / hour,
(centisecs % hour) / min, (centisecs % min) / sec); (centisecs % hour) / min, (centisecs % min) / sec);
// fall through // fall through
case TIME_MINS: case TIME_MINS:
return str_format(buffer, buffer_size, "%02lld:%02lld", centisecs / min, return str_format(buffer, buffer_size, "%02" PRId64 ":%02" PRId64, centisecs / min,
(centisecs % min) / sec); (centisecs % min) / sec);
case TIME_HOURS_CENTISECS: case TIME_HOURS_CENTISECS:
if(centisecs >= hour) if(centisecs >= hour)
return str_format(buffer, buffer_size, "%02lld:%02lld:%02lld.%02lld", centisecs / hour, return str_format(buffer, buffer_size, "%02" PRId64 ":%02" PRId64 ":%02" PRId64 ".%02" PRId64, centisecs / hour,
(centisecs % hour) / min, (centisecs % min) / sec, centisecs % sec); (centisecs % hour) / min, (centisecs % min) / sec, centisecs % sec);
// fall through // fall through
case TIME_MINS_CENTISECS: case TIME_MINS_CENTISECS:
return str_format(buffer, buffer_size, "%02lld:%02lld.%02lld", centisecs / min, return str_format(buffer, buffer_size, "%02" PRId64 ":%02" PRId64 ".%02" PRId64, centisecs / min,
(centisecs % min) / sec, centisecs % sec); (centisecs % min) / sec, centisecs % sec);
} }

View file

@ -15,6 +15,7 @@
#endif #endif
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
@ -626,22 +627,6 @@ void sphore_wait(SEMAPHORE *sem);
void sphore_signal(SEMAPHORE *sem); void sphore_signal(SEMAPHORE *sem);
void sphore_destroy(SEMAPHORE *sem); void sphore_destroy(SEMAPHORE *sem);
/* Group: Timer */
#ifdef __GNUC__
/* if compiled with -pedantic-errors it will complain about long
not being a C90 thing.
*/
#ifdef CONF_PLATFORM_HAIKU
#include <SupportDefs.h>
#else
__extension__ typedef long long int64;
#endif
__extension__ typedef unsigned long long uint64;
#else
typedef long long int64;
typedef unsigned long long uint64;
#endif
void set_new_tick(void); void set_new_tick(void);
/* /*
@ -654,7 +639,7 @@ void set_new_tick(void);
Remarks: Remarks:
To know how fast the timer is ticking, see <time_freq>. To know how fast the timer is ticking, see <time_freq>.
*/ */
int64 time_get_impl(void); int64_t time_get_impl(void);
/* /*
Function: time_get Function: time_get
@ -667,7 +652,7 @@ int64 time_get_impl(void);
To know how fast the timer is ticking, see <time_freq>. To know how fast the timer is ticking, see <time_freq>.
Uses <time_get_impl> to fetch the sample. Uses <time_get_impl> to fetch the sample.
*/ */
int64 time_get(void); int64_t time_get(void);
/* /*
Function: time_freq Function: time_freq
@ -676,7 +661,7 @@ int64 time_get(void);
Returns: Returns:
Returns the frequency of the high resolution timer. Returns the frequency of the high resolution timer.
*/ */
int64 time_freq(void); int64_t time_freq(void);
/* /*
Function: time_timestamp Function: time_timestamp
@ -721,7 +706,7 @@ Fetches a sample from a high resolution timer and converts it in microseconds.
Returns: Returns:
Current value of the timer in microseconds. Current value of the timer in microseconds.
*/ */
int64 time_get_microseconds(void); int64_t time_get_microseconds(void);
/* Group: Network General */ /* Group: Network General */
typedef struct typedef struct
@ -1587,7 +1572,7 @@ enum
- Guarantees that buffer string will contain zero-termination, assuming - Guarantees that buffer string will contain zero-termination, assuming
buffer_size > 0. buffer_size > 0.
*/ */
int str_time(int64 centisecs, int format, char *buffer, int buffer_size); int str_time(int64_t centisecs, int format, char *buffer, int buffer_size);
int str_time_float(float secs, int format, char *buffer, int buffer_size); int str_time_float(float secs, int format, char *buffer, int buffer_size);
/* /*

View file

@ -51,7 +51,7 @@ public:
char m_aNews[3000]; char m_aNews[3000];
char m_aMapDownloadUrl[256]; char m_aMapDownloadUrl[256];
int m_Points; int m_Points;
int64 m_ReconnectTime; int64_t m_ReconnectTime;
class CSnapItem class CSnapItem
{ {

View file

@ -170,7 +170,7 @@ void CGraph::Render(IGraphics *pGraphics, IGraphics::CTextureHandle FontTexture,
pGraphics->QuadsEnd(); pGraphics->QuadsEnd();
} }
void CSmoothTime::Init(int64 Target) void CSmoothTime::Init(int64_t Target)
{ {
m_Snap = time_get(); m_Snap = time_get();
m_Current = Target; m_Current = Target;
@ -185,10 +185,10 @@ void CSmoothTime::SetAdjustSpeed(int Direction, float Value)
m_aAdjustSpeed[Direction] = Value; m_aAdjustSpeed[Direction] = Value;
} }
int64 CSmoothTime::Get(int64 Now) int64_t CSmoothTime::Get(int64_t Now)
{ {
int64 c = m_Current + (Now - m_Snap); int64_t c = m_Current + (Now - m_Snap);
int64 t = m_Target + (Now - m_Snap); int64_t t = m_Target + (Now - m_Snap);
// it's faster to adjust upward instead of downward // it's faster to adjust upward instead of downward
// we might need to adjust these abit // we might need to adjust these abit
@ -201,22 +201,22 @@ int64 CSmoothTime::Get(int64 Now)
if(a > 1.0f) if(a > 1.0f)
a = 1.0f; a = 1.0f;
int64 r = c + (int64)((t - c) * a); int64_t r = c + (int64_t)((t - c) * a);
m_Graph.Add(a + 0.5f, 1, 1, 1); m_Graph.Add(a + 0.5f, 1, 1, 1);
return r; return r;
} }
void CSmoothTime::UpdateInt(int64 Target) void CSmoothTime::UpdateInt(int64_t Target)
{ {
int64 Now = time_get(); int64_t Now = time_get();
m_Current = Get(Now); m_Current = Get(Now);
m_Snap = Now; m_Snap = Now;
m_Target = Target; m_Target = Target;
} }
void CSmoothTime::Update(CGraph *pGraph, int64 Target, int TimeLeft, int AdjustDirection) void CSmoothTime::Update(CGraph *pGraph, int64_t Target, int TimeLeft, int AdjustDirection)
{ {
int UpdateTimer = 1; int UpdateTimer = 1;
@ -506,7 +506,7 @@ void CClient::DirectInput(int *pInput, int Size)
void CClient::SendInput() void CClient::SendInput()
{ {
int64 Now = time_get(); int64_t Now = time_get();
if(m_PredTick[g_Config.m_ClDummy] <= 0) if(m_PredTick[g_Config.m_ClDummy] <= 0)
return; return;
@ -1001,7 +1001,7 @@ void CClient::SnapSetStaticsize(int ItemType, int Size)
void CClient::DebugRender() void CClient::DebugRender()
{ {
static NETSTATS Prev, Current; static NETSTATS Prev, Current;
static int64 LastSnap = 0; static int64_t LastSnap = 0;
static float FrameTimeAvg = 0; static float FrameTimeAvg = 0;
char aBuffer[512]; char aBuffer[512];
@ -1158,7 +1158,7 @@ void CClient::Render()
if(State() == IClient::STATE_ONLINE && g_Config.m_ClAntiPingLimit) if(State() == IClient::STATE_ONLINE && g_Config.m_ClAntiPingLimit)
{ {
int64 Now = time_get(); int64_t Now = time_get();
g_Config.m_ClAntiPing = (m_PredictedTime.Get(Now) - m_GameTime[g_Config.m_ClDummy].Get(Now)) * 1000 / (float)time_freq() > g_Config.m_ClAntiPingLimit; g_Config.m_ClAntiPing = (m_PredictedTime.Get(Now) - m_GameTime[g_Config.m_ClDummy].Get(Now)) * 1000 / (float)time_freq() > g_Config.m_ClAntiPingLimit;
} }
} }
@ -1398,7 +1398,7 @@ void CClient::ProcessServerInfo(int RawType, NETADDR *pFrom, const void *pData,
{ {
Up.GetString(); // extra info, reserved Up.GetString(); // extra info, reserved
uint64 Flag = (uint64)1 << PacketNo; uint64_t Flag = (uint64_t)1 << PacketNo;
DuplicatedPacket = Info.m_ReceivedPackets & Flag; DuplicatedPacket = Info.m_ReceivedPackets & Flag;
Info.m_ReceivedPackets |= Flag; Info.m_ReceivedPackets |= Flag;
} }
@ -1427,7 +1427,7 @@ void CClient::ProcessServerInfo(int RawType, NETADDR *pFrom, const void *pData,
{ {
if(SavedType == SERVERINFO_64_LEGACY) if(SavedType == SERVERINFO_64_LEGACY)
{ {
uint64 Flag = (uint64)1 << i; uint64_t Flag = (uint64_t)1 << i;
if(!(Info.m_ReceivedPackets & Flag)) if(!(Info.m_ReceivedPackets & Flag))
{ {
Info.m_ReceivedPackets |= Flag; Info.m_ReceivedPackets |= Flag;
@ -1825,16 +1825,16 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
{ {
int InputPredTick = Unpacker.GetInt(); int InputPredTick = Unpacker.GetInt();
int TimeLeft = Unpacker.GetInt(); int TimeLeft = Unpacker.GetInt();
int64 Now = time_get(); int64_t Now = time_get();
// adjust our prediction time // adjust our prediction time
int64 Target = 0; int64_t Target = 0;
for(int k = 0; k < 200; k++) for(int k = 0; k < 200; k++)
{ {
if(m_aInputs[g_Config.m_ClDummy][k].m_Tick == InputPredTick) if(m_aInputs[g_Config.m_ClDummy][k].m_Tick == InputPredTick)
{ {
Target = m_aInputs[g_Config.m_ClDummy][k].m_PredictedTime + (Now - m_aInputs[g_Config.m_ClDummy][k].m_Time); Target = m_aInputs[g_Config.m_ClDummy][k].m_PredictedTime + (Now - m_aInputs[g_Config.m_ClDummy][k].m_Time);
Target = Target - (int64)(((TimeLeft - PREDICTION_MARGIN) / 1000.0f) * time_freq()); Target = Target - (int64_t)(((TimeLeft - PREDICTION_MARGIN) / 1000.0f) * time_freq());
break; break;
} }
} }
@ -2032,9 +2032,9 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
// adjust game time // adjust game time
if(m_ReceivedSnapshots[g_Config.m_ClDummy] > 2) if(m_ReceivedSnapshots[g_Config.m_ClDummy] > 2)
{ {
int64 Now = m_GameTime[g_Config.m_ClDummy].Get(time_get()); int64_t Now = m_GameTime[g_Config.m_ClDummy].Get(time_get());
int64 TickStart = GameTick * time_freq() / 50; int64_t TickStart = GameTick * time_freq() / 50;
int64 TimeLeft = (TickStart - Now) * 1000 / time_freq(); int64_t TimeLeft = (TickStart - Now) * 1000 / time_freq();
m_GameTime[g_Config.m_ClDummy].Update(&m_GametimeMarginGraph, (GameTick - 1) * time_freq() / 50, TimeLeft, 0); m_GameTime[g_Config.m_ClDummy].Update(&m_GametimeMarginGraph, (GameTick - 1) * time_freq() / 50, TimeLeft, 0);
} }
@ -2304,9 +2304,9 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket)
// adjust game time // adjust game time
if(m_ReceivedSnapshots[!g_Config.m_ClDummy] > 2) if(m_ReceivedSnapshots[!g_Config.m_ClDummy] > 2)
{ {
int64 Now = m_GameTime[!g_Config.m_ClDummy].Get(time_get()); int64_t Now = m_GameTime[!g_Config.m_ClDummy].Get(time_get());
int64 TickStart = GameTick * time_freq() / 50; int64_t TickStart = GameTick * time_freq() / 50;
int64 TimeLeft = (TickStart - Now) * 1000 / time_freq(); int64_t TimeLeft = (TickStart - Now) * 1000 / time_freq();
m_GameTime[!g_Config.m_ClDummy].Update(&m_GametimeMarginGraph, (GameTick - 1) * time_freq() / 50, TimeLeft, 0); m_GameTime[!g_Config.m_ClDummy].Update(&m_GametimeMarginGraph, (GameTick - 1) * time_freq() / 50, TimeLeft, 0);
} }
@ -2692,11 +2692,11 @@ void CClient::Update()
if(m_ReceivedSnapshots[!g_Config.m_ClDummy] >= 3) if(m_ReceivedSnapshots[!g_Config.m_ClDummy] >= 3)
{ {
// switch dummy snapshot // switch dummy snapshot
int64 Now = m_GameTime[!g_Config.m_ClDummy].Get(time_get()); int64_t Now = m_GameTime[!g_Config.m_ClDummy].Get(time_get());
while(1) while(1)
{ {
CSnapshotStorage::CHolder *pCur = m_aSnapshots[!g_Config.m_ClDummy][SNAP_CURRENT]; CSnapshotStorage::CHolder *pCur = m_aSnapshots[!g_Config.m_ClDummy][SNAP_CURRENT];
int64 TickStart = (pCur->m_Tick) * time_freq() / 50; int64_t TickStart = (pCur->m_Tick) * time_freq() / 50;
if(TickStart < Now) if(TickStart < Now)
{ {
@ -2722,9 +2722,9 @@ void CClient::Update()
{ {
// switch snapshot // switch snapshot
int Repredict = 0; int Repredict = 0;
int64 Freq = time_freq(); int64_t Freq = time_freq();
int64 Now = m_GameTime[g_Config.m_ClDummy].Get(time_get()); int64_t Now = m_GameTime[g_Config.m_ClDummy].Get(time_get());
int64 PredNow = m_PredictedTime.Get(time_get()); int64_t PredNow = m_PredictedTime.Get(time_get());
if(m_LastDummy != (bool)g_Config.m_ClDummy && m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT] && m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV]) if(m_LastDummy != (bool)g_Config.m_ClDummy && m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT] && m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV])
{ {
@ -2736,7 +2736,7 @@ void CClient::Update()
while(1) while(1)
{ {
CSnapshotStorage::CHolder *pCur = m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]; CSnapshotStorage::CHolder *pCur = m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT];
int64 TickStart = (pCur->m_Tick) * time_freq() / 50; int64_t TickStart = (pCur->m_Tick) * time_freq() / 50;
if(TickStart < Now) if(TickStart < Now)
{ {
@ -2765,8 +2765,8 @@ void CClient::Update()
if(m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT] && m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV]) if(m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT] && m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV])
{ {
int64 CurtickStart = (m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_Tick) * time_freq() / 50; int64_t CurtickStart = (m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_Tick) * time_freq() / 50;
int64 PrevtickStart = (m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_Tick) * time_freq() / 50; int64_t PrevtickStart = (m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_Tick) * time_freq() / 50;
int PrevPredTick = (int)(PredNow * 50 / time_freq()); int PrevPredTick = (int)(PredNow * 50 / time_freq());
int NewPredTick = PrevPredTick + 1; int NewPredTick = PrevPredTick + 1;
@ -2814,8 +2814,8 @@ void CClient::Update()
m_CurrentServerNextPingTime >= 0 && m_CurrentServerNextPingTime >= 0 &&
time_get() > m_CurrentServerNextPingTime) time_get() > m_CurrentServerNextPingTime)
{ {
int64 Now = time_get(); int64_t Now = time_get();
int64 Freq = time_freq(); int64_t Freq = time_freq();
char aBuf[64]; char aBuf[64];
str_format(aBuf, sizeof(aBuf), "pinging current server%s", !m_ServerCapabilities.m_PingEx ? ", using fallback via server info" : ""); str_format(aBuf, sizeof(aBuf), "pinging current server%s", !m_ServerCapabilities.m_PingEx ? ", using fallback via server info" : "");
@ -2844,8 +2844,8 @@ void CClient::Update()
#ifdef CONF_DEBUG #ifdef CONF_DEBUG
if(g_Config.m_DbgStress) if(g_Config.m_DbgStress)
{ {
static int64 ActionTaken = 0; static int64_t ActionTaken = 0;
int64 Now = time_get(); int64_t Now = time_get();
if(State() == IClient::STATE_OFFLINE) if(State() == IClient::STATE_OFFLINE)
{ {
if(Now > ActionTaken + time_freq() * 2) if(Now > ActionTaken + time_freq() * 2)
@ -3141,8 +3141,8 @@ void CClient::Run()
bool LastE = false; bool LastE = false;
bool LastG = false; bool LastG = false;
int64 LastTime = time_get_microseconds(); int64_t LastTime = time_get_microseconds();
int64 LastRenderTime = time_get(); int64_t LastRenderTime = time_get();
while(1) while(1)
{ {
@ -3252,13 +3252,13 @@ void CClient::Run()
m_EditorActive = false; m_EditorActive = false;
Update(); Update();
int64 Now = time_get(); int64_t Now = time_get();
bool IsRenderActive = (g_Config.m_GfxBackgroundRender || m_pGraphics->WindowOpen()); bool IsRenderActive = (g_Config.m_GfxBackgroundRender || m_pGraphics->WindowOpen());
if(IsRenderActive && if(IsRenderActive &&
(!g_Config.m_GfxAsyncRenderOld || m_pGraphics->IsIdle()) && (!g_Config.m_GfxAsyncRenderOld || m_pGraphics->IsIdle()) &&
(!g_Config.m_GfxRefreshRate || (time_freq() / (int64)g_Config.m_GfxRefreshRate) <= Now - LastRenderTime)) (!g_Config.m_GfxRefreshRate || (time_freq() / (int64_t)g_Config.m_GfxRefreshRate) <= Now - LastRenderTime))
{ {
m_RenderFrames++; m_RenderFrames++;
@ -3286,7 +3286,7 @@ void CClient::Run()
m_FrameTimeAvg = m_FrameTimeAvg * 0.9f + m_RenderFrameTime * 0.1f; m_FrameTimeAvg = m_FrameTimeAvg * 0.9f + m_RenderFrameTime * 0.1f;
// keep the overflow time - it's used to make sure the gfx refreshrate is reached // keep the overflow time - it's used to make sure the gfx refreshrate is reached
int64 AdditionalTime = g_Config.m_GfxRefreshRate ? ((Now - LastRenderTime) - (time_freq() / (int64)g_Config.m_GfxRefreshRate)) : 0; int64_t AdditionalTime = g_Config.m_GfxRefreshRate ? ((Now - LastRenderTime) - (time_freq() / (int64_t)g_Config.m_GfxRefreshRate)) : 0;
// if the value is over a second time loose, reset the additional time (drop the frames, that are lost already) // if the value is over a second time loose, reset the additional time (drop the frames, that are lost already)
if(AdditionalTime > time_freq()) if(AdditionalTime > time_freq())
AdditionalTime = time_freq(); AdditionalTime = time_freq();
@ -3326,7 +3326,7 @@ void CClient::Run()
else if(!IsRenderActive) else if(!IsRenderActive)
{ {
// if the client does not render, it should reset its render time to a time where it would render the first frame, when it wakes up again // if the client does not render, it should reset its render time to a time where it would render the first frame, when it wakes up again
LastRenderTime = g_Config.m_GfxRefreshRate ? (Now - (time_freq() / (int64)g_Config.m_GfxRefreshRate)) : Now; LastRenderTime = g_Config.m_GfxRefreshRate ? (Now - (time_freq() / (int64_t)g_Config.m_GfxRefreshRate)) : Now;
} }
if(Input()->VideoRestartNeeded()) if(Input()->VideoRestartNeeded())
@ -3369,8 +3369,8 @@ void CClient::Run()
#endif #endif
// beNice // beNice
int64 Now = time_get_microseconds(); int64_t Now = time_get_microseconds();
int64 SleepTimeInMicroSeconds = 0; int64_t SleepTimeInMicroSeconds = 0;
bool Slept = false; bool Slept = false;
if( if(
#ifdef CONF_DEBUG #ifdef CONF_DEBUG
@ -3378,26 +3378,26 @@ void CClient::Run()
#endif #endif
(g_Config.m_ClRefreshRateInactive && !m_pGraphics->WindowActive())) (g_Config.m_ClRefreshRateInactive && !m_pGraphics->WindowActive()))
{ {
SleepTimeInMicroSeconds = ((int64)1000000 / (int64)g_Config.m_ClRefreshRateInactive) - (Now - LastTime); SleepTimeInMicroSeconds = ((int64_t)1000000 / (int64_t)g_Config.m_ClRefreshRateInactive) - (Now - LastTime);
if(SleepTimeInMicroSeconds / (int64)1000 > (int64)0) if(SleepTimeInMicroSeconds / (int64_t)1000 > (int64_t)0)
thread_sleep(SleepTimeInMicroSeconds); thread_sleep(SleepTimeInMicroSeconds);
Slept = true; Slept = true;
} }
else if(g_Config.m_ClRefreshRate) else if(g_Config.m_ClRefreshRate)
{ {
SleepTimeInMicroSeconds = ((int64)1000000 / (int64)g_Config.m_ClRefreshRate) - (Now - LastTime); SleepTimeInMicroSeconds = ((int64_t)1000000 / (int64_t)g_Config.m_ClRefreshRate) - (Now - LastTime);
if(SleepTimeInMicroSeconds > (int64)0) if(SleepTimeInMicroSeconds > (int64_t)0)
net_socket_read_wait(m_NetClient[CLIENT_MAIN].m_Socket, SleepTimeInMicroSeconds); net_socket_read_wait(m_NetClient[CLIENT_MAIN].m_Socket, SleepTimeInMicroSeconds);
Slept = true; Slept = true;
} }
if(Slept) if(Slept)
{ {
// if the diff gets too small it shouldn't get even smaller (drop the updates, that could not be handled) // if the diff gets too small it shouldn't get even smaller (drop the updates, that could not be handled)
if(SleepTimeInMicroSeconds < (int64)-1000000) if(SleepTimeInMicroSeconds < (int64_t)-1000000)
SleepTimeInMicroSeconds = (int64)-1000000; SleepTimeInMicroSeconds = (int64_t)-1000000;
// don't go higher than the game ticks speed, because the network is waking up the client with the server's snapshots anyway // don't go higher than the game ticks speed, because the network is waking up the client with the server's snapshots anyway
else if(SleepTimeInMicroSeconds > (int64)1000000 / m_GameTickSpeed) else if(SleepTimeInMicroSeconds > (int64_t)1000000 / m_GameTickSpeed)
SleepTimeInMicroSeconds = (int64)1000000 / m_GameTickSpeed; SleepTimeInMicroSeconds = (int64_t)1000000 / m_GameTickSpeed;
// the time diff between the time that was used actually used and the time the thread should sleep/wait // the time diff between the time that was used actually used and the time the thread should sleep/wait
// will be calculated in the sleep time of the next update tick by faking the time it should have slept/wait. // will be calculated in the sleep time of the next update tick by faking the time it should have slept/wait.
// so two cases (and the case it slept exactly the time it should): // so two cases (and the case it slept exactly the time it should):
@ -4512,15 +4512,15 @@ void CClient::RequestDDNetInfo()
int CClient::GetPredictionTime() int CClient::GetPredictionTime()
{ {
int64 Now = time_get(); int64_t Now = time_get();
return (int)((m_PredictedTime.Get(Now) - m_GameTime[g_Config.m_ClDummy].Get(Now)) * 1000 / (float)time_freq()); return (int)((m_PredictedTime.Get(Now) - m_GameTime[g_Config.m_ClDummy].Get(Now)) * 1000 / (float)time_freq());
} }
void CClient::GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) void CClient::GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount)
{ {
int64 GameTime = m_GameTime[g_Config.m_ClDummy].Get(time_get()); int64_t GameTime = m_GameTime[g_Config.m_ClDummy].Get(time_get());
int64 PredTime = m_PredictedTime.Get(time_get()); int64_t PredTime = m_PredictedTime.Get(time_get());
int64 SmoothTime = clamp(GameTime + (int64)(MixAmount * (PredTime - GameTime)), GameTime, PredTime); int64_t SmoothTime = clamp(GameTime + (int64_t)(MixAmount * (PredTime - GameTime)), GameTime, PredTime);
*pSmoothTick = (int)(SmoothTime * 50 / time_freq()) + 1; *pSmoothTick = (int)(SmoothTime * 50 / time_freq()) + 1;
*pSmoothIntraTick = (SmoothTime - (*pSmoothTick - 1) * time_freq() / 50) / (float)(time_freq() / 50); *pSmoothIntraTick = (SmoothTime - (*pSmoothTick - 1) * time_freq() / 50) / (float)(time_freq() / 50);

View file

@ -56,9 +56,9 @@ public:
class CSmoothTime class CSmoothTime
{ {
int64 m_Snap; int64_t m_Snap;
int64 m_Current; int64_t m_Current;
int64 m_Target; int64_t m_Target;
CGraph m_Graph; CGraph m_Graph;
@ -66,13 +66,13 @@ class CSmoothTime
float m_aAdjustSpeed[2]; // 0 = down, 1 = up float m_aAdjustSpeed[2]; // 0 = down, 1 = up
public: public:
void Init(int64 Target); void Init(int64_t Target);
void SetAdjustSpeed(int Direction, float Value); void SetAdjustSpeed(int Direction, float Value);
int64 Get(int64 Now); int64_t Get(int64_t Now);
void UpdateInt(int64 Target); void UpdateInt(int64_t Target);
void Update(CGraph *pGraph, int64 Target, int TimeLeft, int AdjustDirection); void Update(CGraph *pGraph, int64_t Target, int TimeLeft, int AdjustDirection);
}; };
class CServerCapabilities class CServerCapabilities
@ -131,12 +131,12 @@ class CClient : public IClient, public CDemoPlayer::IListener
CUuid m_ConnectionID; CUuid m_ConnectionID;
unsigned m_SnapshotParts[NUM_DUMMIES]; unsigned m_SnapshotParts[NUM_DUMMIES];
int64 m_LocalStartTime; int64_t m_LocalStartTime;
IGraphics::CTextureHandle m_DebugFont; IGraphics::CTextureHandle m_DebugFont;
int m_DebugSoundIndex = 0; int m_DebugSoundIndex = 0;
int64 m_LastRenderTime; int64_t m_LastRenderTime;
float m_RenderFrameTimeLow; float m_RenderFrameTimeLow;
float m_RenderFrameTimeHigh; float m_RenderFrameTimeHigh;
int m_RenderFrames; int m_RenderFrames;
@ -163,7 +163,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
char m_aVersionStr[10]; char m_aVersionStr[10];
// pinging // pinging
int64 m_PingStartTime; int64_t m_PingStartTime;
char m_aCurrentMap[MAX_PATH_LENGTH]; char m_aCurrentMap[MAX_PATH_LENGTH];
char m_aCurrentMapPath[MAX_PATH_LENGTH]; char m_aCurrentMapPath[MAX_PATH_LENGTH];
@ -206,8 +206,8 @@ class CClient : public IClient, public CDemoPlayer::IListener
{ {
int m_aData[MAX_INPUT_SIZE]; // the input data int m_aData[MAX_INPUT_SIZE]; // the input data
int m_Tick; // the tick that the input is for int m_Tick; // the tick that the input is for
int64 m_PredictedTime; // prediction latency when we sent this input int64_t m_PredictedTime; // prediction latency when we sent this input
int64 m_Time; int64_t m_Time;
} m_aInputs[NUM_DUMMIES][200]; } m_aInputs[NUM_DUMMIES][200];
int m_CurrentInput[NUM_DUMMIES]; int m_CurrentInput[NUM_DUMMIES];
@ -241,14 +241,14 @@ class CClient : public IClient, public CDemoPlayer::IListener
bool ShouldSendChatTimeoutCodeHeuristic(); bool ShouldSendChatTimeoutCodeHeuristic();
class CServerInfo m_CurrentServerInfo; class CServerInfo m_CurrentServerInfo;
int64 m_CurrentServerInfoRequestTime; // >= 0 should request, == -1 got info int64_t m_CurrentServerInfoRequestTime; // >= 0 should request, == -1 got info
int m_CurrentServerPingInfoType; int m_CurrentServerPingInfoType;
int m_CurrentServerPingBasicToken; int m_CurrentServerPingBasicToken;
int m_CurrentServerPingToken; int m_CurrentServerPingToken;
CUuid m_CurrentServerPingUuid; CUuid m_CurrentServerPingUuid;
int64 m_CurrentServerCurrentPingTime; // >= 0 request running int64_t m_CurrentServerCurrentPingTime; // >= 0 request running
int64 m_CurrentServerNextPingTime; // >= 0 should request int64_t m_CurrentServerNextPingTime; // >= 0 should request
// version info // version info
struct CVersionInfo struct CVersionInfo
@ -275,7 +275,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
#endif #endif
IOHANDLE m_BenchmarkFile; IOHANDLE m_BenchmarkFile;
int64 m_BenchmarkStopTime; int64_t m_BenchmarkStopTime;
public: public:
IEngine *Engine() { return m_pEngine; } IEngine *Engine() { return m_pEngine; }

View file

@ -15,8 +15,8 @@ class CInput : public IEngineInput
int m_InputGrabbed; int m_InputGrabbed;
char *m_pClipboardText; char *m_pClipboardText;
int64 m_LastRelease; int64_t m_LastRelease;
int64 m_ReleaseDelta; int64_t m_ReleaseDelta;
bool m_MouseFocus; bool m_MouseFocus;
int m_VideoRestartNeeded; int m_VideoRestartNeeded;

View file

@ -1161,8 +1161,8 @@ void CServerBrowser::UpdateFromHttp()
void CServerBrowser::Update(bool ForceResort) void CServerBrowser::Update(bool ForceResort)
{ {
int64 Timeout = time_freq(); int64_t Timeout = time_freq();
int64 Now = time_get(); int64_t Now = time_get();
const char *pHttpBestUrl; const char *pHttpBestUrl;
if(!m_pHttp->GetBestUrl(&pHttpBestUrl) && pHttpBestUrl != m_pHttpPrevBestUrl) if(!m_pHttp->GetBestUrl(&pHttpBestUrl) && pHttpBestUrl != m_pHttpPrevBestUrl)

View file

@ -22,7 +22,7 @@ public:
{ {
public: public:
NETADDR m_Addr; NETADDR m_Addr;
int64 m_RequestTime; int64_t m_RequestTime;
bool m_RequestIgnoreInfo; bool m_RequestIgnoreInfo;
int m_GotInfo; int m_GotInfo;
bool m_Request64Legacy; bool m_Request64Legacy;
@ -191,7 +191,7 @@ private:
char m_aFilterGametypeString[128]; char m_aFilterGametypeString[128];
int m_ServerlistType; int m_ServerlistType;
int64 m_BroadcastTime; int64_t m_BroadcastTime;
int m_RequestNumber; int m_RequestNumber;
unsigned char m_aTokenSeed[16]; unsigned char m_aTokenSeed[16];

View file

@ -143,7 +143,7 @@ void CChooseMaster::CJob::Run()
{ {
continue; continue;
} }
int64 StartTime = time_get_microseconds(); int64_t StartTime = time_get_microseconds();
CGet Get(pUrl, Timeout, HTTPLOG::FAILURE); CGet Get(pUrl, Timeout, HTTPLOG::FAILURE);
IEngine::RunJobBlocking(&Get); IEngine::RunJobBlocking(&Get);
int Time = (time_get_microseconds() - StartTime) / 1000; int Time = (time_get_microseconds() - StartTime) / 1000;

View file

@ -822,11 +822,11 @@ void CSound::SetVoiceTimeOffset(CVoiceHandle Voice, float offset)
{ {
int Tick = 0; int Tick = 0;
bool IsLooping = m_aVoices[VoiceID].m_Flags & ISound::FLAG_LOOP; bool IsLooping = m_aVoices[VoiceID].m_Flags & ISound::FLAG_LOOP;
uint64 TickOffset = m_aVoices[VoiceID].m_pSample->m_Rate * offset; uint64_t TickOffset = m_aVoices[VoiceID].m_pSample->m_Rate * offset;
if(m_aVoices[VoiceID].m_pSample->m_NumFrames > 0 && IsLooping) if(m_aVoices[VoiceID].m_pSample->m_NumFrames > 0 && IsLooping)
Tick = TickOffset % m_aVoices[VoiceID].m_pSample->m_NumFrames; Tick = TickOffset % m_aVoices[VoiceID].m_pSample->m_NumFrames;
else else
Tick = clamp(TickOffset, (uint64)0, (uint64)m_aVoices[VoiceID].m_pSample->m_NumFrames); Tick = clamp(TickOffset, (uint64_t)0, (uint64_t)m_aVoices[VoiceID].m_pSample->m_NumFrames);
// at least 200msec off, else depend on buffer size // at least 200msec off, else depend on buffer size
float Threshold = maximum(0.2f * m_aVoices[VoiceID].m_pSample->m_Rate, (float)m_MaxFrames); float Threshold = maximum(0.2f * m_aVoices[VoiceID].m_pSample->m_Rate, (float)m_MaxFrames);

View file

@ -33,7 +33,7 @@ struct SFontSizeChar
float m_AdvanceX; float m_AdvanceX;
float m_aUVs[4]; float m_aUVs[4];
int64 m_TouchTime; int64_t m_TouchTime;
FT_UInt m_GlyphIndex; FT_UInt m_GlyphIndex;
}; };
@ -1744,7 +1744,7 @@ public:
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f); Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
Graphics()->RenderQuadContainer(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex, 1, -1); Graphics()->RenderQuadContainer(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex, 1, -1);
static int64 s_CursorRenderTime = time_get_microseconds(); static int64_t s_CursorRenderTime = time_get_microseconds();
if((time_get_microseconds() - s_CursorRenderTime) > 500000) if((time_get_microseconds() - s_CursorRenderTime) > 500000)
Graphics()->RenderQuadContainer(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex, 0, 1); Graphics()->RenderQuadContainer(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex, 0, 1);

View file

@ -230,7 +230,7 @@ void CVideo::NextVideoFrameThread()
if(m_Vseq >= 2) if(m_Vseq >= 2)
{ {
m_ProcessingVideoFrame = true; m_ProcessingVideoFrame = true;
m_VideoStream.pFrame->pts = (int64)m_VideoStream.pEnc->frame_number; m_VideoStream.pFrame->pts = (int64_t)m_VideoStream.pEnc->frame_number;
//dbg_msg("video_recorder", "vframe: %d", m_VideoStream.pEnc->frame_number); //dbg_msg("video_recorder", "vframe: %d", m_VideoStream.pEnc->frame_number);
ReadRGBFromGL(); ReadRGBFromGL();
@ -416,7 +416,7 @@ AVFrame *CVideo::AllocPicture(enum AVPixelFormat PixFmt, int Width, int Height)
return pPicture; return pPicture;
} }
AVFrame *CVideo::AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64 ChannelLayout, int SampleRate, int NbSamples) AVFrame *CVideo::AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64_t ChannelLayout, int SampleRate, int NbSamples)
{ {
AVFrame *Frame = av_frame_alloc(); AVFrame *Frame = av_frame_alloc();
int Ret; int Ret;

View file

@ -27,7 +27,7 @@ typedef struct OutputStream
AVCodecContext *pEnc; AVCodecContext *pEnc;
/* pts of the next frame that will be generated */ /* pts of the next frame that will be generated */
int64 NextPts; int64_t NextPts;
int SamplesCount; int SamplesCount;
AVFrame *pFrame; AVFrame *pFrame;
@ -69,7 +69,7 @@ private:
bool OpenVideo(); bool OpenVideo();
bool OpenAudio(); bool OpenAudio();
AVFrame *AllocPicture(enum AVPixelFormat PixFmt, int Width, int Height); AVFrame *AllocPicture(enum AVPixelFormat PixFmt, int Width, int Height);
AVFrame *AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64 ChannelLayout, int SampleRate, int NbSamples); AVFrame *AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64_t ChannelLayout, int SampleRate, int NbSamples);
void WriteFrame(OutputStream *pStream) REQUIRES(g_WriteLock); void WriteFrame(OutputStream *pStream) REQUIRES(g_WriteLock);
void FinishFrames(OutputStream *pStream); void FinishFrames(OutputStream *pStream);

View file

@ -128,8 +128,8 @@ void CRegister::Init(CNetServer *pNetServer, IEngineMasterServer *pMasterServer,
void CRegister::RegisterUpdate(int Nettype) void CRegister::RegisterUpdate(int Nettype)
{ {
int64 Now = time_get(); int64_t Now = time_get();
int64 Freq = time_freq(); int64_t Freq = time_freq();
if(!g_Config.m_SvRegister) if(!g_Config.m_SvRegister)
return; return;

View file

@ -23,7 +23,7 @@ class CRegister
NETADDR m_Addr; NETADDR m_Addr;
int m_Count; int m_Count;
int m_Valid; int m_Valid;
int64 m_LastSend; int64_t m_LastSend;
SECURITY_TOKEN m_Token; SECURITY_TOKEN m_Token;
}; };
@ -34,10 +34,10 @@ class CRegister
bool m_Sixup; bool m_Sixup;
const char *m_pName; const char *m_pName;
int64 m_LastTokenRequest; int64_t m_LastTokenRequest;
int m_RegisterState; int m_RegisterState;
int64 m_RegisterStateStart; int64_t m_RegisterStateStart;
int m_RegisterFirst; int m_RegisterFirst;
int m_RegisterCount; int m_RegisterCount;

View file

@ -86,7 +86,7 @@ void CSnapIDPool::RemoveFirstTimeout()
int CSnapIDPool::NewID() int CSnapIDPool::NewID()
{ {
int64 Now = time_get(); int64_t Now = time_get();
// process timed ids // process timed ids
while(m_FirstTimed != -1 && m_aIDs[m_FirstTimed].m_Timeout < Now) while(m_FirstTimed != -1 && m_aIDs[m_FirstTimed].m_Timeout < Now)
@ -498,7 +498,7 @@ void CServer::Ban(int ClientID, int Seconds, const char *pReason)
return m_CurrentGameTick; return m_CurrentGameTick;
}*/ }*/
int64 CServer::TickStartTime(int Tick) int64_t CServer::TickStartTime(int Tick)
{ {
return m_GameStartTime + (time_freq() * Tick) / SERVER_TICK_SPEED; return m_GameStartTime + (time_freq() * Tick) / SERVER_TICK_SPEED;
} }
@ -1344,8 +1344,8 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
if(g_Config.m_SvNetlimit && Msg != NETMSG_REQUEST_MAP_DATA) if(g_Config.m_SvNetlimit && Msg != NETMSG_REQUEST_MAP_DATA)
{ {
int64 Now = time_get(); int64_t Now = time_get();
int64 Diff = Now - m_aClients[ClientID].m_TrafficSince; int64_t Diff = Now - m_aClients[ClientID].m_TrafficSince;
float Alpha = g_Config.m_SvNetlimitAlpha / 100.0f; float Alpha = g_Config.m_SvNetlimitAlpha / 100.0f;
float Limit = (float)g_Config.m_SvNetlimit * 1024 / time_freq(); float Limit = (float)g_Config.m_SvNetlimit * 1024 / time_freq();
@ -1508,7 +1508,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
else if(Msg == NETMSG_INPUT) else if(Msg == NETMSG_INPUT)
{ {
CClient::CInput *pInput; CClient::CInput *pInput;
int64 TagTime; int64_t TagTime;
m_aClients[ClientID].m_LastAckedSnapshot = Unpacker.GetInt(); m_aClients[ClientID].m_LastAckedSnapshot = Unpacker.GetInt();
int IntendedTick = Unpacker.GetInt(); int IntendedTick = Unpacker.GetInt();
@ -1746,7 +1746,7 @@ bool CServer::RateLimitServerInfoConnless()
if(g_Config.m_SvServerInfoPerSecond) if(g_Config.m_SvServerInfoPerSecond)
{ {
SendClients = m_ServerInfoNumRequests <= g_Config.m_SvServerInfoPerSecond; SendClients = m_ServerInfoNumRequests <= g_Config.m_SvServerInfoPerSecond;
const int64 Now = Tick(); const int64_t Now = Tick();
if(Now <= m_ServerInfoFirstRequest + TickSpeed()) if(Now <= m_ServerInfoFirstRequest + TickSpeed())
{ {
@ -2474,7 +2474,7 @@ int CServer::Run()
set_new_tick(); set_new_tick();
int64 t = time_get(); int64_t t = time_get();
int NewTicks = 0; int NewTicks = 0;
// load new map TODO: don't poll this // load new map TODO: don't poll this
@ -2662,7 +2662,7 @@ int CServer::Run()
m_ReloadedWhenEmpty = false; m_ReloadedWhenEmpty = false;
set_new_tick(); set_new_tick();
int64 t = time_get(); int64_t t = time_get();
int x = (TickStartTime(m_CurrentGameTick + 1) - t) * 1000000 / time_freq() + 1; int x = (TickStartTime(m_CurrentGameTick + 1) - t) * 1000000 / time_freq() + 1;
PacketWaiting = x > 0 ? net_socket_read_wait(m_NetServer.Socket(), x) : true; PacketWaiting = x > 0 ? net_socket_read_wait(m_NetServer.Socket(), x) : true;

View file

@ -155,7 +155,7 @@ public:
int m_SnapRate; int m_SnapRate;
float m_Traffic; float m_Traffic;
int64 m_TrafficSince; int64_t m_TrafficSince;
int m_LastAckedSnapshot; int m_LastAckedSnapshot;
int m_LastInputTick; int m_LastInputTick;
@ -214,7 +214,7 @@ public:
IEngineMap *m_pMap; IEngineMap *m_pMap;
int64 m_GameStartTime; int64_t m_GameStartTime;
//int m_CurrentGameTick; //int m_CurrentGameTick;
enum enum
@ -232,7 +232,7 @@ public:
int m_RconAuthLevel; int m_RconAuthLevel;
int m_PrintCBIndex; int m_PrintCBIndex;
int64 m_Lastheartbeat; int64_t m_Lastheartbeat;
//static NETADDR4 master_server; //static NETADDR4 master_server;
enum enum
@ -254,7 +254,7 @@ public:
int m_RconRestrict; int m_RconRestrict;
int64 m_ServerInfoFirstRequest; int64_t m_ServerInfoFirstRequest;
int m_ServerInfoNumRequests; int m_ServerInfoNumRequests;
char m_aErrorShutdownReason[128]; char m_aErrorShutdownReason[128];
@ -281,7 +281,7 @@ public:
bool DemoRecorder_IsRecording(); bool DemoRecorder_IsRecording();
//int Tick() //int Tick()
int64 TickStartTime(int Tick); int64_t TickStartTime(int Tick);
//int TickSpeed() //int TickSpeed()
int Init(); int Init();

View file

@ -46,7 +46,7 @@ public:
int m_ServerIndex; int m_ServerIndex;
int m_Type; int m_Type;
uint64 m_ReceivedPackets; uint64_t m_ReceivedPackets;
int m_NumReceivedClients; int m_NumReceivedClients;
NETADDR m_NetAddr; NETADDR m_NetAddr;

View file

@ -868,7 +868,7 @@ int CDemoPlayer::NextFrame()
return IsPlaying(); return IsPlaying();
} }
int64 CDemoPlayer::time() int64_t CDemoPlayer::time()
{ {
#if defined(CONF_VIDEORECORDER) #if defined(CONF_VIDEORECORDER)
static bool s_Recording = false; static bool s_Recording = false;
@ -883,7 +883,7 @@ int64 CDemoPlayer::time()
} }
else else
{ {
int64 Now = time_get(); int64_t Now = time_get();
if(s_Recording) if(s_Recording)
{ {
s_Recording = false; s_Recording = false;
@ -970,8 +970,8 @@ void CDemoPlayer::SetSpeedIndex(int Offset)
int CDemoPlayer::Update(bool RealTime) int CDemoPlayer::Update(bool RealTime)
{ {
int64 Now = time(); int64_t Now = time();
int64 Deltatime = Now - m_Info.m_LastUpdate; int64_t Deltatime = Now - m_Info.m_LastUpdate;
m_Info.m_LastUpdate = Now; m_Info.m_LastUpdate = Now;
if(!IsPlaying()) if(!IsPlaying())
@ -982,12 +982,12 @@ int CDemoPlayer::Update(bool RealTime)
} }
else else
{ {
int64 Freq = time_freq(); int64_t Freq = time_freq();
m_Info.m_CurrentTime += (int64)(Deltatime * (double)m_Info.m_Info.m_Speed); m_Info.m_CurrentTime += (int64_t)(Deltatime * (double)m_Info.m_Info.m_Speed);
while(1) while(1)
{ {
int64 CurtickStart = (m_Info.m_Info.m_CurrentTick) * Freq / SERVER_TICK_SPEED; int64_t CurtickStart = (m_Info.m_Info.m_CurrentTick) * Freq / SERVER_TICK_SPEED;
// break if we are ready // break if we are ready
if(RealTime && CurtickStart > m_Info.m_CurrentTime) if(RealTime && CurtickStart > m_Info.m_CurrentTime)
@ -1002,8 +1002,8 @@ int CDemoPlayer::Update(bool RealTime)
// update intratick // update intratick
{ {
int64 CurtickStart = (m_Info.m_Info.m_CurrentTick) * Freq / SERVER_TICK_SPEED; int64_t CurtickStart = (m_Info.m_Info.m_CurrentTick) * Freq / SERVER_TICK_SPEED;
int64 PrevtickStart = (m_Info.m_PreviousTick) * Freq / SERVER_TICK_SPEED; int64_t PrevtickStart = (m_Info.m_PreviousTick) * Freq / SERVER_TICK_SPEED;
m_Info.m_IntraTick = (m_Info.m_CurrentTime - PrevtickStart) / (float)(CurtickStart - PrevtickStart); m_Info.m_IntraTick = (m_Info.m_CurrentTime - PrevtickStart) / (float)(CurtickStart - PrevtickStart);
m_Info.m_TickTime = (m_Info.m_CurrentTime - PrevtickStart) / (float)Freq; m_Info.m_TickTime = (m_Info.m_CurrentTime - PrevtickStart) / (float)Freq;
} }

View file

@ -66,8 +66,8 @@ public:
IDemoPlayer::CInfo m_Info; IDemoPlayer::CInfo m_Info;
int64 m_LastUpdate; int64_t m_LastUpdate;
int64 m_CurrentTime; int64_t m_CurrentTime;
int m_SeekablePoints; int m_SeekablePoints;
@ -113,10 +113,10 @@ private:
void ScanFile(); void ScanFile();
int NextFrame(); int NextFrame();
int64 time(); int64_t time();
int64 m_TickTime; int64_t m_TickTime;
int64 m_Time; int64_t m_Time;
public: public:
CDemoPlayer(class CSnapshotDelta *pSnapshotDelta); CDemoPlayer(class CSnapshotDelta *pSnapshotDelta);

View file

@ -25,7 +25,7 @@ class CEcon
}; };
int m_State; int m_State;
int64 m_TimeConnected; int64_t m_TimeConnected;
int m_AuthTries; int m_AuthTries;
}; };
CClient m_aClients[NET_MAX_CONSOLE_CLIENTS]; CClient m_aClients[NET_MAX_CONSOLE_CLIENTS];

View file

@ -54,9 +54,9 @@ bool CFileCollection::IsFilenameValid(const char *pFilename)
return false; return false;
} }
int64 CFileCollection::ExtractTimestamp(const char *pTimestring) int64_t CFileCollection::ExtractTimestamp(const char *pTimestring)
{ {
int64 Timestamp = pTimestring[0] - '0'; int64_t Timestamp = pTimestring[0] - '0';
Timestamp <<= 4; Timestamp <<= 4;
Timestamp += pTimestring[1] - '0'; Timestamp += pTimestring[1] - '0';
Timestamp <<= 4; Timestamp <<= 4;
@ -87,7 +87,7 @@ int64 CFileCollection::ExtractTimestamp(const char *pTimestring)
return Timestamp; return Timestamp;
} }
void CFileCollection::BuildTimestring(int64 Timestamp, char *pTimestring) void CFileCollection::BuildTimestring(int64_t Timestamp, char *pTimestring)
{ {
pTimestring[19] = 0; pTimestring[19] = 0;
pTimestring[18] = (Timestamp & 0xF) + '0'; pTimestring[18] = (Timestamp & 0xF) + '0';
@ -142,7 +142,7 @@ void CFileCollection::Init(IStorage *pStorage, const char *pPath, const char *pF
m_pStorage->ListDirectory(IStorage::TYPE_SAVE, m_aPath, FilelistCallback, this); m_pStorage->ListDirectory(IStorage::TYPE_SAVE, m_aPath, FilelistCallback, this);
} }
void CFileCollection::AddEntry(int64 Timestamp) void CFileCollection::AddEntry(int64_t Timestamp)
{ {
if(m_NumTimestamps == 0) if(m_NumTimestamps == 0)
{ {
@ -157,7 +157,7 @@ void CFileCollection::AddEntry(int64 Timestamp)
// first entry // first entry
if(m_NumTimestamps <= m_MaxEntries) if(m_NumTimestamps <= m_MaxEntries)
{ {
mem_move(m_aTimestamps + 1, m_aTimestamps, m_NumTimestamps * sizeof(int64)); mem_move(m_aTimestamps + 1, m_aTimestamps, m_NumTimestamps * sizeof(int64_t));
m_aTimestamps[0] = Timestamp; m_aTimestamps[0] = Timestamp;
++m_NumTimestamps; ++m_NumTimestamps;
} }
@ -167,7 +167,7 @@ void CFileCollection::AddEntry(int64 Timestamp)
// last entry // last entry
if(m_NumTimestamps > m_MaxEntries) if(m_NumTimestamps > m_MaxEntries)
{ {
mem_move(m_aTimestamps, m_aTimestamps + 1, (m_NumTimestamps - 1) * sizeof(int64)); mem_move(m_aTimestamps, m_aTimestamps + 1, (m_NumTimestamps - 1) * sizeof(int64_t));
m_aTimestamps[m_NumTimestamps - 1] = Timestamp; m_aTimestamps[m_NumTimestamps - 1] = Timestamp;
} }
else else
@ -188,12 +188,12 @@ void CFileCollection::AddEntry(int64 Timestamp)
if(m_NumTimestamps > m_MaxEntries) if(m_NumTimestamps > m_MaxEntries)
{ {
mem_move(m_aTimestamps, m_aTimestamps + 1, (Right - 1) * sizeof(int64)); mem_move(m_aTimestamps, m_aTimestamps + 1, (Right - 1) * sizeof(int64_t));
m_aTimestamps[Right - 1] = Timestamp; m_aTimestamps[Right - 1] = Timestamp;
} }
else else
{ {
mem_move(m_aTimestamps + Right + 1, m_aTimestamps + Right, (m_NumTimestamps - Right) * sizeof(int64)); mem_move(m_aTimestamps + Right + 1, m_aTimestamps + Right, (m_NumTimestamps - Right) * sizeof(int64_t));
m_aTimestamps[Right] = Timestamp; m_aTimestamps[Right] = Timestamp;
++m_NumTimestamps; ++m_NumTimestamps;
} }
@ -221,7 +221,7 @@ void CFileCollection::AddEntry(int64 Timestamp)
} }
} }
int64 CFileCollection::GetTimestamp(const char *pFilename) int64_t CFileCollection::GetTimestamp(const char *pFilename)
{ {
if(m_aFileDesc[0] == '\0') if(m_aFileDesc[0] == '\0')
{ {
@ -243,7 +243,7 @@ int CFileCollection::FilelistCallback(const char *pFilename, int IsDir, int Stor
return 0; return 0;
// extract the timestamp // extract the timestamp
int64 Timestamp = pThis->GetTimestamp(pFilename); int64_t Timestamp = pThis->GetTimestamp(pFilename);
// add the entry // add the entry
pThis->AddEntry(Timestamp); pThis->AddEntry(Timestamp);
@ -260,7 +260,7 @@ int CFileCollection::RemoveCallback(const char *pFilename, int IsDir, int Storag
return 0; return 0;
// extract the timestamp // extract the timestamp
int64 Timestamp = pThis->GetTimestamp(pFilename); int64_t Timestamp = pThis->GetTimestamp(pFilename);
if(Timestamp == pThis->m_Remove) if(Timestamp == pThis->m_Remove)
{ {

View file

@ -15,7 +15,7 @@ class CFileCollection
TIMESTAMP_LENGTH = 20, // _YYYY-MM-DD_HH-MM-SS TIMESTAMP_LENGTH = 20, // _YYYY-MM-DD_HH-MM-SS
}; };
int64 m_aTimestamps[MAX_ENTRIES]; int64_t m_aTimestamps[MAX_ENTRIES];
int m_NumTimestamps; int m_NumTimestamps;
int m_MaxEntries; int m_MaxEntries;
char m_aFileDesc[128]; char m_aFileDesc[128];
@ -24,16 +24,16 @@ class CFileCollection
int m_FileExtLength; int m_FileExtLength;
char m_aPath[512]; char m_aPath[512];
IStorage *m_pStorage; IStorage *m_pStorage;
int64 m_Remove; // Timestamp we want to remove int64_t m_Remove; // Timestamp we want to remove
bool IsFilenameValid(const char *pFilename); bool IsFilenameValid(const char *pFilename);
int64 ExtractTimestamp(const char *pTimestring); int64_t ExtractTimestamp(const char *pTimestring);
void BuildTimestring(int64 Timestamp, char *pTimestring); void BuildTimestring(int64_t Timestamp, char *pTimestring);
int64 GetTimestamp(const char *pFilename); int64_t GetTimestamp(const char *pFilename);
public: public:
void Init(IStorage *pStorage, const char *pPath, const char *pFileDesc, const char *pFileExt, int MaxEntries); void Init(IStorage *pStorage, const char *pPath, const char *pFileDesc, const char *pFileExt, int MaxEntries);
void AddEntry(int64 Timestamp); void AddEntry(int64_t Timestamp);
static int FilelistCallback(const char *pFilename, int IsDir, int StorageType, void *pUser); static int FilelistCallback(const char *pFilename, int IsDir, int StorageType, void *pUser);
static int RemoveCallback(const char *pFilename, int IsDir, int StorageType, void *pUser); static int RemoveCallback(const char *pFilename, int IsDir, int StorageType, void *pUser);

View file

@ -142,8 +142,8 @@ public:
unsigned char *m_pData; unsigned char *m_pData;
int m_Sequence; int m_Sequence;
int64 m_LastSendTime; int64_t m_LastSendTime;
int64 m_FirstSendTime; int64_t m_FirstSendTime;
}; };
class CNetPacketConstruct class CNetPacketConstruct
@ -177,9 +177,9 @@ private:
CStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> m_Buffer; CStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> m_Buffer;
int64 m_LastUpdateTime; int64_t m_LastUpdateTime;
int64 m_LastRecvTime; int64_t m_LastRecvTime;
int64 m_LastSendTime; int64_t m_LastSendTime;
char m_aErrorString[256]; char m_aErrorString[256];
@ -223,8 +223,8 @@ public:
const char *ErrorString() const { return m_aErrorString; } const char *ErrorString() const { return m_aErrorString; }
// Needed for GotProblems in NetClient // Needed for GotProblems in NetClient
int64 LastRecvTime() const { return m_LastRecvTime; } int64_t LastRecvTime() const { return m_LastRecvTime; }
int64 ConnectTime() const { return m_LastUpdateTime; } int64_t ConnectTime() const { return m_LastUpdateTime; }
int AckSequence() const { return m_Ack; } int AckSequence() const { return m_Ack; }
int SeqSequence() const { return m_Sequence; } int SeqSequence() const { return m_Sequence; }
@ -302,7 +302,7 @@ class CNetServer
struct CSpamConn struct CSpamConn
{ {
NETADDR m_Addr; NETADDR m_Addr;
int64 m_Time; int64_t m_Time;
int m_Conns; int m_Conns;
}; };
@ -321,11 +321,11 @@ class CNetServer
void *m_pUser; void *m_pUser;
int m_NumConAttempts; // log flooding attacks int m_NumConAttempts; // log flooding attacks
int64 m_TimeNumConAttempts; int64_t m_TimeNumConAttempts;
unsigned char m_aSecurityTokenSeed[16]; unsigned char m_aSecurityTokenSeed[16];
// vanilla connect flood detection // vanilla connect flood detection
int64 m_VConnFirst; int64_t m_VConnFirst;
int m_VConnNum; int m_VConnNum;
CSpamConn m_aSpamConns[NET_CONNLIMIT_IPS]; CSpamConn m_aSpamConns[NET_CONNLIMIT_IPS];

View file

@ -230,7 +230,7 @@ void CNetConnection::DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken, SEC
m_PeerAddr = Addr; m_PeerAddr = Addr;
mem_zero(m_aErrorString, sizeof(m_aErrorString)); mem_zero(m_aErrorString, sizeof(m_aErrorString));
int64 Now = time_get(); int64_t Now = time_get();
m_LastSendTime = Now; m_LastSendTime = Now;
m_LastRecvTime = Now; m_LastRecvTime = Now;
m_LastUpdateTime = Now; m_LastUpdateTime = Now;
@ -272,7 +272,7 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr, SECURITY_
} }
m_PeerAck = pPacket->m_Ack; m_PeerAck = pPacket->m_Ack;
int64 Now = time_get(); int64_t Now = time_get();
// check if resend is requested // check if resend is requested
if(pPacket->m_Flags & NET_PACKETFLAG_RESEND) if(pPacket->m_Flags & NET_PACKETFLAG_RESEND)
@ -391,7 +391,7 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr, SECURITY_
int CNetConnection::Update() int CNetConnection::Update()
{ {
int64 Now = time_get(); int64_t Now = time_get();
if(State() == NET_CONNSTATE_ERROR && m_TimeoutSituation && (Now - m_LastRecvTime) > time_freq() * g_Config.m_ConnTimeoutProtection) if(State() == NET_CONNSTATE_ERROR && m_TimeoutSituation && (Now - m_LastRecvTime) > time_freq() * g_Config.m_ConnTimeoutProtection)
{ {
@ -465,7 +465,7 @@ int CNetConnection::Update()
void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, CStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *pResendBuffer, bool Sixup) void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, CStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *pResendBuffer, bool Sixup)
{ {
int64 Now = time_get(); int64_t Now = time_get();
m_Sequence = Sequence; m_Sequence = Sequence;
m_Ack = Ack; m_Ack = Ack;

View file

@ -183,7 +183,7 @@ int CNetServer::NumClientsWithAddr(NETADDR Addr)
bool CNetServer::Connlimit(NETADDR Addr) bool CNetServer::Connlimit(NETADDR Addr)
{ {
int64 Now = time_get(); int64_t Now = time_get();
int Oldest = 0; int Oldest = 0;
for(int i = 0; i < NET_CONNLIMIT_IPS; ++i) for(int i = 0; i < NET_CONNLIMIT_IPS; ++i)
@ -320,7 +320,7 @@ void CNetServer::OnPreConnMsg(NETADDR &Addr, CNetPacketConstruct &Packet)
//TODO: remove //TODO: remove
if(g_Config.m_Debug) if(g_Config.m_Debug)
{ {
int64 Now = time_get(); int64_t Now = time_get();
if(Now - m_TimeNumConAttempts > time_freq()) if(Now - m_TimeNumConAttempts > time_freq())
// reset // reset
@ -347,7 +347,7 @@ void CNetServer::OnPreConnMsg(NETADDR &Addr, CNetPacketConstruct &Packet)
{ {
// detect flooding // detect flooding
Flooding = m_VConnNum > g_Config.m_SvVanConnPerSecond; Flooding = m_VConnNum > g_Config.m_SvVanConnPerSecond;
const int64 Now = time_get(); const int64_t Now = time_get();
if(Now <= m_VConnFirst + time_freq()) if(Now <= m_VConnFirst + time_freq())
{ {

View file

@ -473,7 +473,7 @@ void CSnapshotStorage::PurgeUntil(int Tick)
m_pLast = 0; m_pLast = 0;
} }
void CSnapshotStorage::Add(int Tick, int64 Tagtime, int DataSize, void *pData, int CreateAlt) void CSnapshotStorage::Add(int Tick, int64_t Tagtime, int DataSize, void *pData, int CreateAlt)
{ {
// allocate memory for holder + snapshot_data // allocate memory for holder + snapshot_data
int TotalSize = sizeof(CHolder) + DataSize; int TotalSize = sizeof(CHolder) + DataSize;
@ -508,7 +508,7 @@ void CSnapshotStorage::Add(int Tick, int64 Tagtime, int DataSize, void *pData, i
m_pLast = pHolder; m_pLast = pHolder;
} }
int CSnapshotStorage::Get(int Tick, int64 *pTagtime, CSnapshot **ppData, CSnapshot **ppAltData) int CSnapshotStorage::Get(int Tick, int64_t *pTagtime, CSnapshot **ppData, CSnapshot **ppAltData)
{ {
CHolder *pHolder = m_pFirst; CHolder *pHolder = m_pFirst;

View file

@ -102,7 +102,7 @@ public:
CHolder *m_pPrev; CHolder *m_pPrev;
CHolder *m_pNext; CHolder *m_pNext;
int64 m_Tagtime; int64_t m_Tagtime;
int m_Tick; int m_Tick;
int m_SnapSize; int m_SnapSize;
@ -118,8 +118,8 @@ public:
void Init(); void Init();
void PurgeAll(); void PurgeAll();
void PurgeUntil(int Tick); void PurgeUntil(int Tick);
void Add(int Tick, int64 Tagtime, int DataSize, void *pData, int CreateAlt); void Add(int Tick, int64_t Tagtime, int DataSize, void *pData, int CreateAlt);
int Get(int Tick, int64 *pTagtime, CSnapshot **ppData, CSnapshot **ppAltData); int Get(int Tick, int64_t *pTagtime, CSnapshot **ppData, CSnapshot **ppAltData);
}; };
class CSnapshotBuilder class CSnapshotBuilder

View file

@ -6,9 +6,9 @@
IVideo *IVideo::ms_pCurrentVideo = 0; IVideo *IVideo::ms_pCurrentVideo = 0;
int64 IVideo::ms_Time = 0; int64_t IVideo::ms_Time = 0;
float IVideo::ms_LocalTime = 0; float IVideo::ms_LocalTime = 0;
int64 IVideo::ms_LocalStartTime = 0; int64_t IVideo::ms_LocalStartTime = 0;
int64 IVideo::ms_TickTime = 0; int64_t IVideo::ms_TickTime = 0;
#endif #endif

View file

@ -23,17 +23,17 @@ public:
static IVideo *Current() { return ms_pCurrentVideo; } static IVideo *Current() { return ms_pCurrentVideo; }
static int64 Time() { return ms_Time; } static int64_t Time() { return ms_Time; }
static float LocalTime() { return ms_LocalTime; } static float LocalTime() { return ms_LocalTime; }
static void SetLocalStartTime(int64 LocalStartTime) { ms_LocalStartTime = LocalStartTime; } static void SetLocalStartTime(int64_t LocalStartTime) { ms_LocalStartTime = LocalStartTime; }
static void SetFPS(int FPS) { ms_TickTime = time_freq() / FPS; } static void SetFPS(int FPS) { ms_TickTime = time_freq() / FPS; }
protected: protected:
static IVideo *ms_pCurrentVideo; static IVideo *ms_pCurrentVideo;
static int64 ms_Time; static int64_t ms_Time;
static int64 ms_LocalStartTime; static int64_t ms_LocalStartTime;
static float ms_LocalTime; static float ms_LocalTime;
static int64 ms_TickTime; static int64_t ms_TickTime;
}; };
#endif #endif

View file

@ -41,13 +41,13 @@ protected:
#endif #endif
#if defined(CONF_VIDEORECORDER) #if defined(CONF_VIDEORECORDER)
int64 time() const int64_t time() const
{ {
return IVideo::Current() ? IVideo::Time() : time_get(); return IVideo::Current() ? IVideo::Time() : time_get();
} }
float LocalTime() const { return IVideo::Current() ? IVideo::LocalTime() : Client()->LocalTime(); } float LocalTime() const { return IVideo::Current() ? IVideo::LocalTime() : Client()->LocalTime(); }
#else #else
int64 time() const int64_t time() const
{ {
return time_get(); return time_get();
} }

View file

@ -20,7 +20,7 @@ protected:
char m_aMapName[MAX_MAP_LENGTH]; char m_aMapName[MAX_MAP_LENGTH];
//to avoid spam when in menu //to avoid spam when in menu
int64 m_LastLoad; int64_t m_LastLoad;
//to avoid memory leak when switching to %current% //to avoid memory leak when switching to %current%
CBackgroundEngineMap *m_pBackgroundMap; CBackgroundEngineMap *m_pBackgroundMap;

View file

@ -102,7 +102,7 @@ void CChat::Reset()
m_CurrentLine = 0; m_CurrentLine = 0;
DisableMode(); DisableMode();
for(long long &LastSoundPlayed : m_aLastSoundPlayed) for(int64_t &LastSoundPlayed : m_aLastSoundPlayed)
LastSoundPlayed = 0; LastSoundPlayed = 0;
} }
@ -846,7 +846,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
} }
// play sound // play sound
int64 Now = time(); int64_t Now = time();
if(ClientID == -1) if(ClientID == -1)
{ {
if(Now - m_aLastSoundPlayed[CHAT_SERVER] >= time_freq() * 3 / 10) if(Now - m_aLastSoundPlayed[CHAT_SERVER] >= time_freq() * 3 / 10)
@ -940,7 +940,7 @@ void CChat::OnPrepareLines()
RealMsgPaddingTee = 0; RealMsgPaddingTee = 0;
} }
int64 Now = time(); int64_t Now = time();
float LineWidth = (IsScoreBoardOpen ? 85.0f : 200.0f) - (RealMsgPaddingX * 1.5f) - RealMsgPaddingTee; float LineWidth = (IsScoreBoardOpen ? 85.0f : 200.0f) - (RealMsgPaddingX * 1.5f) - RealMsgPaddingTee;
float HeightLimit = IsScoreBoardOpen ? 180.0f : m_PrevShowChat ? 50.0f : 200.0f; float HeightLimit = IsScoreBoardOpen ? 180.0f : m_PrevShowChat ? 50.0f : 200.0f;
@ -1257,7 +1257,7 @@ void CChat::OnRender()
float ScreenRatio = Graphics()->ScreenAspect(); float ScreenRatio = Graphics()->ScreenAspect();
bool IsScoreBoardOpen = m_pClient->m_pScoreboard->Active() && (ScreenRatio > 1.7f); // only assume scoreboard when screen ratio is widescreen(something around 16:9) bool IsScoreBoardOpen = m_pClient->m_pScoreboard->Active() && (ScreenRatio > 1.7f); // only assume scoreboard when screen ratio is widescreen(something around 16:9)
int64 Now = time(); int64_t Now = time();
float HeightLimit = IsScoreBoardOpen ? 180.0f : m_PrevShowChat ? 50.0f : 200.0f; float HeightLimit = IsScoreBoardOpen ? 180.0f : m_PrevShowChat ? 50.0f : 200.0f;
int OffsetType = IsScoreBoardOpen ? 1 : 0; int OffsetType = IsScoreBoardOpen ? 1 : 0;

View file

@ -22,7 +22,7 @@ class CChat : public CComponent
struct CLine struct CLine
{ {
int64 m_Time; int64_t m_Time;
float m_YOffset[2]; float m_YOffset[2];
int m_ClientID; int m_ClientID;
bool m_Team; bool m_Team;
@ -99,8 +99,8 @@ class CChat : public CComponent
CHistoryEntry *m_pHistoryEntry; CHistoryEntry *m_pHistoryEntry;
CStaticRingBuffer<CHistoryEntry, 64 * 1024, CRingBufferBase::FLAG_RECYCLE> m_History; CStaticRingBuffer<CHistoryEntry, 64 * 1024, CRingBufferBase::FLAG_RECYCLE> m_History;
int m_PendingChatCounter; int m_PendingChatCounter;
int64 m_LastChatSend; int64_t m_LastChatSend;
int64 m_aLastSoundPlayed[CHAT_NUM]; int64_t m_aLastSoundPlayed[CHAT_NUM];
static void ConSay(IConsole::IResult *pResult, void *pUserData); static void ConSay(IConsole::IResult *pResult, void *pUserData);
static void ConSayTeam(IConsole::IResult *pResult, void *pUserData); static void ConSayTeam(IConsole::IResult *pResult, void *pUserData);

View file

@ -246,7 +246,7 @@ void CControls::OnMessage(int Msg, void *pRawMsg)
int CControls::SnapInput(int *pData) int CControls::SnapInput(int *pData)
{ {
static int64 LastSendTime = 0; static int64_t LastSendTime = 0;
bool Send = false; bool Send = false;
// update player state // update player state
@ -399,7 +399,7 @@ void CControls::OnRender()
GAMEPAD_DEAD_ZONE = 65536 / 8, GAMEPAD_DEAD_ZONE = 65536 / 8,
}; };
int64 CurTime = time_get(); int64_t CurTime = time_get();
bool FireWasPressed = false; bool FireWasPressed = false;
if(m_Joystick) if(m_Joystick)

View file

@ -17,7 +17,7 @@ public:
SDL_Joystick *m_Joystick; SDL_Joystick *m_Joystick;
bool m_JoystickFirePressed; bool m_JoystickFirePressed;
bool m_JoystickRunPressed; bool m_JoystickRunPressed;
int64 m_JoystickTapTime; int64_t m_JoystickTapTime;
SDL_Joystick *m_Gamepad; SDL_Joystick *m_Gamepad;
bool m_UsingGamepad; bool m_UsingGamepad;

View file

@ -7,7 +7,7 @@
class CDamageInd : public CComponent class CDamageInd : public CComponent
{ {
int64 m_Lastupdate; int64_t m_Lastupdate;
struct CItem struct CItem
{ {
vec2 m_Pos; vec2 m_Pos;

View file

@ -254,8 +254,8 @@ void CEffects::HammerHit(vec2 Pos)
void CEffects::OnRender() void CEffects::OnRender()
{ {
static int64 LastUpdate100hz = 0; static int64_t LastUpdate100hz = 0;
static int64 LastUpdate50hz = 0; static int64_t LastUpdate50hz = 0;
if(Client()->State() == IClient::STATE_DEMOPLAYBACK) if(Client()->State() == IClient::STATE_DEMOPLAYBACK)
{ {

View file

@ -337,7 +337,7 @@ void CHud::RenderScoreHud()
if(m_pClient->m_GameInfo.m_TimeScore && g_Config.m_ClDDRaceScoreBoard) if(m_pClient->m_GameInfo.m_TimeScore && g_Config.m_ClDDRaceScoreBoard)
{ {
if(apPlayerInfo[t]->m_Score != -9999) if(apPlayerInfo[t]->m_Score != -9999)
str_time((int64)abs(apPlayerInfo[t]->m_Score) * 100, TIME_HOURS, aScore[t], sizeof(aScore[t])); str_time((int64_t)abs(apPlayerInfo[t]->m_Score) * 100, TIME_HOURS, aScore[t], sizeof(aScore[t]));
else else
aScore[t][0] = 0; aScore[t][0] = 0;
} }

View file

@ -84,10 +84,10 @@ void CMapLayers::EnvelopeEval(int TimeOffsetMillis, int Env, float *pChannels, v
CMapItemEnvelope *pItem = (CMapItemEnvelope *)pThis->m_pLayers->Map()->GetItem(Start + Env, 0, 0); CMapItemEnvelope *pItem = (CMapItemEnvelope *)pThis->m_pLayers->Map()->GetItem(Start + Env, 0, 0);
const int64 TickToMicroSeconds = (1000000ll / (int64)pThis->Client()->GameTickSpeed()); const int64_t TickToMicroSeconds = (1000000ll / (int64_t)pThis->Client()->GameTickSpeed());
static int64 s_Time = 0; static int64_t s_Time = 0;
static int64 s_LastLocalTime = time_get_microseconds(); static int64_t s_LastLocalTime = time_get_microseconds();
if(pThis->Client()->State() == IClient::STATE_DEMOPLAYBACK) if(pThis->Client()->State() == IClient::STATE_DEMOPLAYBACK)
{ {
const IDemoPlayer::CInfo *pInfo = pThis->DemoPlayer()->BaseInfo(); const IDemoPlayer::CInfo *pInfo = pThis->DemoPlayer()->BaseInfo();
@ -104,24 +104,24 @@ void CMapLayers::EnvelopeEval(int TimeOffsetMillis, int Env, float *pChannels, v
// get the lerp of the current tick and prev // get the lerp of the current tick and prev
int MinTick = pThis->Client()->PrevGameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick; int MinTick = pThis->Client()->PrevGameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick;
int CurTick = pThis->Client()->GameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick; int CurTick = pThis->Client()->GameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick;
s_Time = (int64)(mix<double>( s_Time = (int64_t)(mix<double>(
0, 0,
(CurTick - MinTick), (CurTick - MinTick),
pThis->Client()->IntraGameTick(g_Config.m_ClDummy)) * pThis->Client()->IntraGameTick(g_Config.m_ClDummy)) *
TickToMicroSeconds) + TickToMicroSeconds) +
MinTick * TickToMicroSeconds; MinTick * TickToMicroSeconds;
} }
else else
{ {
int MinTick = pThis->m_LastLocalTick; int MinTick = pThis->m_LastLocalTick;
s_Time = (int64)(mix<double>(0, s_Time = (int64_t)(mix<double>(0,
pThis->m_CurrentLocalTick - MinTick, pThis->m_CurrentLocalTick - MinTick,
pThis->Client()->IntraGameTick(g_Config.m_ClDummy)) * pThis->Client()->IntraGameTick(g_Config.m_ClDummy)) *
TickToMicroSeconds) + TickToMicroSeconds) +
MinTick * TickToMicroSeconds; MinTick * TickToMicroSeconds;
} }
} }
pThis->RenderTools()->RenderEvalEnvelope(pPoints + pItem->m_StartPoint, pItem->m_NumPoints, 4, s_Time + (int64)TimeOffsetMillis * 1000ll, pChannels); pThis->RenderTools()->RenderEvalEnvelope(pPoints + pItem->m_StartPoint, pItem->m_NumPoints, 4, s_Time + (int64_t)TimeOffsetMillis * 1000ll, pChannels);
} }
else else
{ {
@ -132,21 +132,21 @@ void CMapLayers::EnvelopeEval(int TimeOffsetMillis, int Env, float *pChannels, v
// get the lerp of the current tick and prev // get the lerp of the current tick and prev
int MinTick = pThis->Client()->PrevGameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick; int MinTick = pThis->Client()->PrevGameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick;
int CurTick = pThis->Client()->GameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick; int CurTick = pThis->Client()->GameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick;
s_Time = (int64)(mix<double>( s_Time = (int64_t)(mix<double>(
0, 0,
(CurTick - MinTick), (CurTick - MinTick),
pThis->Client()->IntraGameTick(g_Config.m_ClDummy)) * pThis->Client()->IntraGameTick(g_Config.m_ClDummy)) *
TickToMicroSeconds) + TickToMicroSeconds) +
MinTick * TickToMicroSeconds; MinTick * TickToMicroSeconds;
} }
} }
else else
{ {
int64 CurTime = time_get_microseconds(); int64_t CurTime = time_get_microseconds();
s_Time += CurTime - s_LastLocalTime; s_Time += CurTime - s_LastLocalTime;
s_LastLocalTime = CurTime; s_LastLocalTime = CurTime;
} }
pThis->RenderTools()->RenderEvalEnvelope(pPoints + pItem->m_StartPoint, pItem->m_NumPoints, 4, s_Time + (int64)TimeOffsetMillis * 1000ll, pChannels); pThis->RenderTools()->RenderEvalEnvelope(pPoints + pItem->m_StartPoint, pItem->m_NumPoints, 4, s_Time + (int64_t)TimeOffsetMillis * 1000ll, pChannels);
} }
} }

View file

@ -249,9 +249,9 @@ int CMenus::DoButton_MenuTab(const void *pID, const char *pText, int Checked, co
if(pAnimator != NULL) if(pAnimator != NULL)
{ {
int64 Time = time_get_microseconds(); int64_t Time = time_get_microseconds();
if(pAnimator->m_Time + (int64)100000 < Time) if(pAnimator->m_Time + (int64_t)100000 < Time)
{ {
pAnimator->m_Value = pAnimator->m_Active ? 1 : 0; pAnimator->m_Value = pAnimator->m_Active ? 1 : 0;
pAnimator->m_Time = Time; pAnimator->m_Time = Time;
@ -1099,7 +1099,7 @@ void CMenus::RenderLoading()
{ {
// TODO: not supported right now due to separate render thread // TODO: not supported right now due to separate render thread
static int64 LastLoadRender = 0; static int64_t LastLoadRender = 0;
float Percent = m_LoadCurrent++ / (float)m_LoadTotal; float Percent = m_LoadCurrent++ / (float)m_LoadTotal;
// make sure that we don't render for each little thing we load // make sure that we don't render for each little thing we load
@ -1228,7 +1228,7 @@ void CMenus::PopupMessage(const char *pTopic, const char *pBody, const char *pBu
m_Popup = POPUP_MESSAGE; m_Popup = POPUP_MESSAGE;
} }
void CMenus::PopupWarning(const char *pTopic, const char *pBody, const char *pButton, int64 Duration) void CMenus::PopupWarning(const char *pTopic, const char *pBody, const char *pButton, int64_t Duration)
{ {
dbg_msg(pTopic, "%s", pBody); dbg_msg(pTopic, "%s", pBody);
@ -1915,7 +1915,7 @@ int CMenus::Render()
if(Client()->MapDownloadTotalsize() > 0) if(Client()->MapDownloadTotalsize() > 0)
{ {
int64 Now = time_get(); int64_t Now = time_get();
if(Now - m_DownloadLastCheckTime >= time_freq()) if(Now - m_DownloadLastCheckTime >= time_freq())
{ {
if(m_DownloadLastCheckSize > Client()->MapDownloadAmount()) if(m_DownloadLastCheckSize > Client()->MapDownloadAmount())
@ -2802,7 +2802,7 @@ void CMenus::RenderUpdating(const char *pCaption, int current, int total)
{ {
// make sure that we don't render for each little thing we load // make sure that we don't render for each little thing we load
// because that will slow down loading if we have vsync // because that will slow down loading if we have vsync
static int64 LastLoadRender = 0; static int64_t LastLoadRender = 0;
if(time_get() - LastLoadRender < time_freq() / 60) if(time_get() - LastLoadRender < time_freq() / 60)
return; return;
LastLoadRender = time_get(); LastLoadRender = time_get();

View file

@ -290,7 +290,7 @@ protected:
vec2 m_MousePos; vec2 m_MousePos;
bool m_MouseSlow; bool m_MouseSlow;
int64 m_LastInput; int64_t m_LastInput;
// images // images
struct CMenuImage struct CMenuImage
@ -350,7 +350,7 @@ protected:
bool m_DeletePressed; bool m_DeletePressed;
// for map download popup // for map download popup
int64 m_DownloadLastCheckTime; int64_t m_DownloadLastCheckTime;
int m_DownloadLastCheckSize; int m_DownloadLastCheckSize;
float m_DownloadSpeed; float m_DownloadSpeed;
@ -649,10 +649,10 @@ public:
int GetCurPopup() { return m_Popup; } int GetCurPopup() { return m_Popup; }
bool CanDisplayWarning(); bool CanDisplayWarning();
void PopupWarning(const char *pTopic, const char *pBody, const char *pButton, int64 Duration); void PopupWarning(const char *pTopic, const char *pBody, const char *pButton, int64_t Duration);
int64 m_PopupWarningLastTime; int64_t m_PopupWarningLastTime;
int64 m_PopupWarningDuration; int64_t m_PopupWarningDuration;
int m_DemoPlayerState; int m_DemoPlayerState;
char m_aDemoPlayerPopupHint[256]; char m_aDemoPlayerPopupHint[256];

View file

@ -1144,7 +1144,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
if(pSelectedServer->m_aClients[i].m_Score == -9999 || pSelectedServer->m_aClients[i].m_Score == 0) if(pSelectedServer->m_aClients[i].m_Score == -9999 || pSelectedServer->m_aClients[i].m_Score == 0)
aTemp[0] = 0; aTemp[0] = 0;
else else
str_time((int64)abs(pSelectedServer->m_aClients[i].m_Score) * 100, TIME_HOURS, aTemp, sizeof(aTemp)); str_time((int64_t)abs(pSelectedServer->m_aClients[i].m_Score) * 100, TIME_HOURS, aTemp, sizeof(aTemp));
} }
else else
str_format(aTemp, sizeof(aTemp), "%d", pSelectedServer->m_aClients[i].m_Score); str_format(aTemp, sizeof(aTemp), "%d", pSelectedServer->m_aClients[i].m_Score);

View file

@ -73,7 +73,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
const float NameBarHeight = 20.0f; const float NameBarHeight = 20.0f;
const float Margins = 5.0f; const float Margins = 5.0f;
float TotalHeight; float TotalHeight;
static int64 LastSpeedChange = 0; static int64_t LastSpeedChange = 0;
// render popups // render popups
if(m_DemoPlayerState == DEMOPLAYER_SLICE_SAVE) if(m_DemoPlayerState == DEMOPLAYER_SLICE_SAVE)
@ -323,9 +323,9 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
// draw time // draw time
char aCurrentTime[32]; char aCurrentTime[32];
str_time((int64)CurrentTick / SERVER_TICK_SPEED * 100, TIME_HOURS, aCurrentTime, sizeof(aCurrentTime)); str_time((int64_t)CurrentTick / SERVER_TICK_SPEED * 100, TIME_HOURS, aCurrentTime, sizeof(aCurrentTime));
char aTotalTime[32]; char aTotalTime[32];
str_time((int64)TotalTicks / SERVER_TICK_SPEED * 100, TIME_HOURS, aTotalTime, sizeof(aTotalTime)); str_time((int64_t)TotalTicks / SERVER_TICK_SPEED * 100, TIME_HOURS, aTotalTime, sizeof(aTotalTime));
str_format(aBuffer, sizeof(aBuffer), "%s / %s", aCurrentTime, aTotalTime); str_format(aBuffer, sizeof(aBuffer), "%s / %s", aCurrentTime, aTotalTime);
UI()->DoLabel(&SeekBar, aBuffer, SeekBar.h * 0.70f, 0); UI()->DoLabel(&SeekBar, aBuffer, SeekBar.h * 0.70f, 0);
@ -920,7 +920,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
UI()->DoLabelScaled(&Left, Localize("Length:"), 14.0f, -1); UI()->DoLabelScaled(&Left, Localize("Length:"), 14.0f, -1);
int Length = m_lDemos[m_DemolistSelectedIndex].Length(); int Length = m_lDemos[m_DemolistSelectedIndex].Length();
char aBuf[64]; char aBuf[64];
str_time((int64)Length * 100, TIME_HOURS, aBuf, sizeof(aBuf)); str_time((int64_t)Length * 100, TIME_HOURS, aBuf, sizeof(aBuf));
UI()->DoLabelScaled(&Right, aBuf, 14.0f, -1); UI()->DoLabelScaled(&Right, aBuf, 14.0f, -1);
Labels.HSplitTop(5.0f, 0, &Labels); Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels); Labels.HSplitTop(20.0f, &Left, &Labels);
@ -1181,7 +1181,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
{ {
int Length = r.front().Length(); int Length = r.front().Length();
char aBuf[32]; char aBuf[32];
str_time((int64)Length * 100, TIME_HOURS, aBuf, sizeof(aBuf)); str_time((int64_t)Length * 100, TIME_HOURS, aBuf, sizeof(aBuf));
Button.VMargin(4.0f, &Button); Button.VMargin(4.0f, &Button);
UI()->DoLabelScaled(&Button, aBuf, 12.0f, 1); UI()->DoLabelScaled(&Button, aBuf, 12.0f, 1);
} }

View file

@ -7,7 +7,7 @@
class CMotd : public CComponent class CMotd : public CComponent
{ {
// motd // motd
int64 m_ServerMotdTime; int64_t m_ServerMotdTime;
public: public:
char m_aServerMotd[900]; char m_aServerMotd[900];

View file

@ -140,8 +140,8 @@ void CParticles::OnRender()
return; return;
set_new_tick(); set_new_tick();
static int64 LastTime = 0; static int64_t LastTime = 0;
int64 t = time(); int64_t t = time();
if(Client()->State() == IClient::STATE_DEMOPLAYBACK) if(Client()->State() == IClient::STATE_DEMOPLAYBACK)
{ {

View file

@ -262,7 +262,7 @@ void CPlayers::RenderPlayer(
// do skidding // do skidding
if(!InAir && WantOtherDir && length(Vel * 50) > 500.0f) if(!InAir && WantOtherDir && length(Vel * 50) > 500.0f)
{ {
static int64 SkidSoundTime = 0; static int64_t SkidSoundTime = 0;
if(time() - SkidSoundTime > time_freq() / 10) if(time() - SkidSoundTime > time_freq() / 10)
{ {
if(g_Config.m_SndGame) if(g_Config.m_SndGame)

View file

@ -428,7 +428,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
if(pInfo->m_Score == -9999) if(pInfo->m_Score == -9999)
aBuf[0] = 0; aBuf[0] = 0;
else else
str_time((int64)abs(pInfo->m_Score) * 100, TIME_HOURS, aBuf, sizeof(aBuf)); str_time((int64_t)abs(pInfo->m_Score) * 100, TIME_HOURS, aBuf, sizeof(aBuf));
} }
else else
str_format(aBuf, sizeof(aBuf), "%d", clamp(pInfo->m_Score, -999, 99999)); str_format(aBuf, sizeof(aBuf), "%d", clamp(pInfo->m_Score, -999, 99999));
@ -565,25 +565,25 @@ void CScoreboard::RenderRecordingNotification(float x)
if(m_pClient->DemoRecorder(RECORDER_MANUAL)->IsRecording()) if(m_pClient->DemoRecorder(RECORDER_MANUAL)->IsRecording())
{ {
str_time((int64)m_pClient->DemoRecorder(RECORDER_MANUAL)->Length() * 100, TIME_HOURS, aTime, sizeof(aTime)); str_time((int64_t)m_pClient->DemoRecorder(RECORDER_MANUAL)->Length() * 100, TIME_HOURS, aTime, sizeof(aTime));
str_format(aBuf2, sizeof(aBuf2), "%s %s ", Localize("Manual"), aTime); str_format(aBuf2, sizeof(aBuf2), "%s %s ", Localize("Manual"), aTime);
str_append(aBuf, aBuf2, sizeof(aBuf)); str_append(aBuf, aBuf2, sizeof(aBuf));
} }
if(m_pClient->DemoRecorder(RECORDER_RACE)->IsRecording()) if(m_pClient->DemoRecorder(RECORDER_RACE)->IsRecording())
{ {
str_time((int64)m_pClient->DemoRecorder(RECORDER_RACE)->Length() * 100, TIME_HOURS, aTime, sizeof(aTime)); str_time((int64_t)m_pClient->DemoRecorder(RECORDER_RACE)->Length() * 100, TIME_HOURS, aTime, sizeof(aTime));
str_format(aBuf2, sizeof(aBuf2), "%s %s ", Localize("Race"), aTime); str_format(aBuf2, sizeof(aBuf2), "%s %s ", Localize("Race"), aTime);
str_append(aBuf, aBuf2, sizeof(aBuf)); str_append(aBuf, aBuf2, sizeof(aBuf));
} }
if(m_pClient->DemoRecorder(RECORDER_AUTO)->IsRecording()) if(m_pClient->DemoRecorder(RECORDER_AUTO)->IsRecording())
{ {
str_time((int64)m_pClient->DemoRecorder(RECORDER_AUTO)->Length() * 100, TIME_HOURS, aTime, sizeof(aTime)); str_time((int64_t)m_pClient->DemoRecorder(RECORDER_AUTO)->Length() * 100, TIME_HOURS, aTime, sizeof(aTime));
str_format(aBuf2, sizeof(aBuf2), "%s %s ", Localize("Auto"), aTime); str_format(aBuf2, sizeof(aBuf2), "%s %s ", Localize("Auto"), aTime);
str_append(aBuf, aBuf2, sizeof(aBuf)); str_append(aBuf, aBuf2, sizeof(aBuf));
} }
if(m_pClient->DemoRecorder(RECORDER_REPLAYS)->IsRecording()) if(m_pClient->DemoRecorder(RECORDER_REPLAYS)->IsRecording())
{ {
str_time((int64)m_pClient->DemoRecorder(RECORDER_REPLAYS)->Length() * 100, TIME_HOURS, aTime, sizeof(aTime)); str_time((int64_t)m_pClient->DemoRecorder(RECORDER_REPLAYS)->Length() * 100, TIME_HOURS, aTime, sizeof(aTime));
str_format(aBuf2, sizeof(aBuf2), "%s %s ", Localize("Replay"), aTime); str_format(aBuf2, sizeof(aBuf2), "%s %s ", Localize("Replay"), aTime);
str_append(aBuf, aBuf2, sizeof(aBuf)); str_append(aBuf, aBuf2, sizeof(aBuf));
} }

View file

@ -149,7 +149,7 @@ void CSounds::OnRender()
// play sound from queue // play sound from queue
if(m_QueuePos > 0) if(m_QueuePos > 0)
{ {
int64 Now = time(); int64_t Now = time();
if(m_QueueWaitTime <= Now) if(m_QueueWaitTime <= Now)
{ {
Play(m_aQueue[0].m_Channel, m_aQueue[0].m_SetId, 1.0f); Play(m_aQueue[0].m_Channel, m_aQueue[0].m_SetId, 1.0f);

View file

@ -28,7 +28,7 @@ class CSounds : public CComponent
int m_SetId; int m_SetId;
} m_aQueue[QUEUE_SIZE]; } m_aQueue[QUEUE_SIZE];
int m_QueuePos; int m_QueuePos;
int64 m_QueueWaitTime; int64_t m_QueueWaitTime;
std::shared_ptr<CSoundLoading> m_pSoundJob; std::shared_ptr<CSoundLoading> m_pSoundJob;
bool m_WaitForSoundJob; bool m_WaitForSoundJob;

View file

@ -8,7 +8,7 @@ class CStatboard : public CComponent
private: private:
bool m_Active; bool m_Active;
bool m_ScreenshotTaken; bool m_ScreenshotTaken;
int64 m_ScreenshotTime; int64_t m_ScreenshotTime;
static void ConKeyStats(IConsole::IResult *pResult, void *pUserData); static void ConKeyStats(IConsole::IResult *pResult, void *pUserData);
void RenderGlobalStats(); void RenderGlobalStats();
void AutoStatScreenshot(); void AutoStatScreenshot();

View file

@ -16,7 +16,7 @@ class CVoting : public CComponent
static void ConCallvote(IConsole::IResult *pResult, void *pUserData); static void ConCallvote(IConsole::IResult *pResult, void *pUserData);
static void ConVote(IConsole::IResult *pResult, void *pUserData); static void ConVote(IConsole::IResult *pResult, void *pUserData);
int64 m_Closetime; int64_t m_Closetime;
char m_aDescription[VOTE_DESC_LENGTH]; char m_aDescription[VOTE_DESC_LENGTH];
char m_aReason[VOTE_REASON_LENGTH]; char m_aReason[VOTE_REASON_LENGTH];
int m_Voted; int m_Voted;

View file

@ -295,7 +295,7 @@ void CGameClient::OnInit()
m_RenderTools.Init(Graphics(), UI(), this); m_RenderTools.Init(Graphics(), UI(), this);
int64 Start = time_get(); int64_t Start = time_get();
if(GIT_SHORTREV_HASH) if(GIT_SHORTREV_HASH)
{ {
@ -379,7 +379,7 @@ void CGameClient::OnInit()
} }
} }
int64 End = time_get(); int64_t End = time_get();
str_format(aBuf, sizeof(aBuf), "initialisation finished after %.2fms", ((End - Start) * 1000) / (float)time_freq()); str_format(aBuf, sizeof(aBuf), "initialisation finished after %.2fms", ((End - Start) * 1000) / (float)time_freq());
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "gameclient", aBuf); Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "gameclient", aBuf);
@ -1838,7 +1838,7 @@ void CGameClient::OnPredict()
{ {
int PredTime = clamp(Client()->GetPredictionTime(), 0, 800); int PredTime = clamp(Client()->GetPredictionTime(), 0, 800);
float SmoothPace = 4 - 1.5f * PredTime / 800.f; // smoothing pace (a lower value will make the smoothing quicker) float SmoothPace = 4 - 1.5f * PredTime / 800.f; // smoothing pace (a lower value will make the smoothing quicker)
int64 Len = 1000 * PredTime * SmoothPace; int64_t Len = 1000 * PredTime * SmoothPace;
for(int i = 0; i < MAX_CLIENTS; i++) for(int i = 0; i < MAX_CLIENTS; i++)
{ {
@ -1869,8 +1869,8 @@ void CGameClient::OnPredict()
MixAmount[j] = 1.f - powf(1.f - MixAmount[j], 1 / 1.2f); MixAmount[j] = 1.f - powf(1.f - MixAmount[j], 1 / 1.2f);
} }
} }
int64 TimePassed = time_get() - m_aClients[i].m_SmoothStart[j]; int64_t TimePassed = time_get() - m_aClients[i].m_SmoothStart[j];
if(in_range(TimePassed, (int64)0, Len - 1)) if(in_range(TimePassed, (int64_t)0, Len - 1))
MixAmount[j] = minimum(MixAmount[j], (float)(TimePassed / (double)Len)); MixAmount[j] = minimum(MixAmount[j], (float)(TimePassed / (double)Len));
} }
for(int j = 0; j < 2; j++) for(int j = 0; j < 2; j++)
@ -1878,8 +1878,8 @@ void CGameClient::OnPredict()
MixAmount[j] = MixAmount[j ^ 1]; MixAmount[j] = MixAmount[j ^ 1];
for(int j = 0; j < 2; j++) for(int j = 0; j < 2; j++)
{ {
int64 Remaining = minimum((1.f - MixAmount[j]) * Len, minimum(time_freq() * 0.700f, (1.f - MixAmount[j ^ 1]) * Len + time_freq() * 0.300f)); // don't smooth for longer than 700ms, or more than 300ms longer along one axis than the other axis int64_t Remaining = minimum((1.f - MixAmount[j]) * Len, minimum(time_freq() * 0.700f, (1.f - MixAmount[j ^ 1]) * Len + time_freq() * 0.300f)); // don't smooth for longer than 700ms, or more than 300ms longer along one axis than the other axis
int64 Start = time_get() - (Len - Remaining); int64_t Start = time_get() - (Len - Remaining);
if(!in_range(Start + Len, m_aClients[i].m_SmoothStart[j], m_aClients[i].m_SmoothStart[j] + Len)) if(!in_range(Start + Len, m_aClients[i].m_SmoothStart[j], m_aClients[i].m_SmoothStart[j] + Len))
{ {
m_aClients[i].m_SmoothStart[j] = Start; m_aClients[i].m_SmoothStart[j] = Start;
@ -2581,12 +2581,12 @@ void CGameClient::DetectStrongHook()
vec2 CGameClient::GetSmoothPos(int ClientID) vec2 CGameClient::GetSmoothPos(int ClientID)
{ {
vec2 Pos = mix(m_aClients[ClientID].m_PrevPredicted.m_Pos, m_aClients[ClientID].m_Predicted.m_Pos, Client()->PredIntraGameTick(g_Config.m_ClDummy)); vec2 Pos = mix(m_aClients[ClientID].m_PrevPredicted.m_Pos, m_aClients[ClientID].m_Predicted.m_Pos, Client()->PredIntraGameTick(g_Config.m_ClDummy));
int64 Now = time_get(); int64_t Now = time_get();
for(int i = 0; i < 2; i++) for(int i = 0; i < 2; i++)
{ {
int64 Len = clamp(m_aClients[ClientID].m_SmoothLen[i], (int64)1, time_freq()); int64_t Len = clamp(m_aClients[ClientID].m_SmoothLen[i], (int64_t)1, time_freq());
int64 TimePassed = Now - m_aClients[ClientID].m_SmoothStart[i]; int64_t TimePassed = Now - m_aClients[ClientID].m_SmoothStart[i];
if(in_range(TimePassed, (int64)0, Len - 1)) if(in_range(TimePassed, (int64_t)0, Len - 1))
{ {
float MixAmount = 1.f - powf(1.f - TimePassed / (float)Len, 1.2f); float MixAmount = 1.f - powf(1.f - TimePassed / (float)Len, 1.2f);
int SmoothTick; int SmoothTick;

View file

@ -305,8 +305,8 @@ public:
vec2 m_RenderPos; vec2 m_RenderPos;
bool m_IsPredicted; bool m_IsPredicted;
bool m_IsPredictedLocal; bool m_IsPredictedLocal;
int64 m_SmoothStart[2]; int64_t m_SmoothStart[2];
int64 m_SmoothLen[2]; int64_t m_SmoothLen[2];
vec2 m_PredPos[200]; vec2 m_PredPos[200];
int m_PredTick[200]; int m_PredTick[200];
bool m_SpecCharPresent; bool m_SpecCharPresent;

View file

@ -86,7 +86,7 @@ void CProjectile::Tick()
if(m_LifeSpan > -1) if(m_LifeSpan > -1)
m_LifeSpan--; m_LifeSpan--;
int64 TeamMask = -1LL; int64_t TeamMask = -1LL;
bool isWeaponCollide = false; bool isWeaponCollide = false;
if( if(
pOwnerChar && pOwnerChar &&
@ -135,7 +135,7 @@ void CProjectile::Tick()
if(m_Owner >= 0) if(m_Owner >= 0)
pOwnerChar = GameWorld()->GetCharacterByID(m_Owner); pOwnerChar = GameWorld()->GetCharacterByID(m_Owner);
int64 TeamMask = -1LL; int64_t TeamMask = -1LL;
GameWorld()->CreateExplosion(ColPos, m_Owner, m_Type, m_Owner == -1, (!pOwnerChar ? -1 : pOwnerChar->Team()), GameWorld()->CreateExplosion(ColPos, m_Owner, m_Type, m_Owner == -1, (!pOwnerChar ? -1 : pOwnerChar->Team()),
(m_Owner != -1) ? TeamMask : -1LL); (m_Owner != -1) ? TeamMask : -1LL);

View file

@ -295,7 +295,7 @@ CEntity *CGameWorld::GetEntity(int ID, int EntType)
return 0; return 0;
} }
void CGameWorld::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask) void CGameWorld::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask)
{ {
if(Owner < 0 && m_WorldConfig.m_IsSolo && !(Weapon == WEAPON_SHOTGUN && m_WorldConfig.m_IsDDRace)) if(Owner < 0 && m_WorldConfig.m_IsSolo && !(Weapon == WEAPON_SHOTGUN && m_WorldConfig.m_IsDDRace))
return; return;

View file

@ -57,7 +57,7 @@ public:
class CCharacter *GetCharacterByID(int ID) { return (ID >= 0 && ID < MAX_CLIENTS) ? m_apCharacters[ID] : 0; } class CCharacter *GetCharacterByID(int ID) { return (ID >= 0 && ID < MAX_CLIENTS) ? m_apCharacters[ID] : 0; }
// from gamecontext // from gamecontext
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask); void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask);
// for client side prediction // for client side prediction
struct struct

View file

@ -112,7 +112,7 @@ public:
void RenderTee(class CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote, vec2 Dir, vec2 Pos, float Alpha = 1.0f); void RenderTee(class CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote, vec2 Dir, vec2 Pos, float Alpha = 1.0f);
// map render methods (gc_render_map.cpp) // map render methods (gc_render_map.cpp)
static void RenderEvalEnvelope(CEnvPoint *pPoints, int NumPoints, int Channels, int64 TimeMicros, float *pResult); static void RenderEvalEnvelope(CEnvPoint *pPoints, int NumPoints, int Channels, int64_t TimeMicros, float *pResult);
void RenderQuads(CQuad *pQuads, int NumQuads, int Flags, ENVELOPE_EVAL pfnEval, void *pUser); void RenderQuads(CQuad *pQuads, int NumQuads, int Flags, ENVELOPE_EVAL pfnEval, void *pUser);
void ForceRenderQuads(CQuad *pQuads, int NumQuads, int Flags, ENVELOPE_EVAL pfnEval, void *pUser, float Alpha = 1.0f); void ForceRenderQuads(CQuad *pQuads, int NumQuads, int Flags, ENVELOPE_EVAL pfnEval, void *pUser, float Alpha = 1.0f);
void RenderTilemap(CTile *pTiles, int w, int h, float Scale, ColorRGBA Color, int RenderFlags, ENVELOPE_EVAL pfnEval, void *pUser, int ColorEnv, int ColorEnvOffset); void RenderTilemap(CTile *pTiles, int w, int h, float Scale, ColorRGBA Color, int RenderFlags, ENVELOPE_EVAL pfnEval, void *pUser, int ColorEnv, int ColorEnvOffset);

View file

@ -11,7 +11,7 @@
#include <game/generated/client_data.h> #include <game/generated/client_data.h>
#include <game/generated/protocol.h> #include <game/generated/protocol.h>
void CRenderTools::RenderEvalEnvelope(CEnvPoint *pPoints, int NumPoints, int Channels, int64 TimeMicros, float *pResult) void CRenderTools::RenderEvalEnvelope(CEnvPoint *pPoints, int NumPoints, int Channels, int64_t TimeMicros, float *pResult)
{ {
if(NumPoints == 0) if(NumPoints == 0)
{ {
@ -31,7 +31,7 @@ void CRenderTools::RenderEvalEnvelope(CEnvPoint *pPoints, int NumPoints, int Cha
return; return;
} }
int64 MaxPointTime = (int64)pPoints[NumPoints - 1].m_Time * 1000ll; int64_t MaxPointTime = (int64_t)pPoints[NumPoints - 1].m_Time * 1000ll;
if(MaxPointTime > 0) // TODO: remove this check when implementing a IO check for maps(in this case broken envelopes) if(MaxPointTime > 0) // TODO: remove this check when implementing a IO check for maps(in this case broken envelopes)
TimeMicros = TimeMicros % MaxPointTime; TimeMicros = TimeMicros % MaxPointTime;
else else

View file

@ -108,7 +108,7 @@ struct SUIAnimator
bool m_ScaleLabel; bool m_ScaleLabel;
bool m_RepositionLabel; bool m_RepositionLabel;
int64 m_Time; int64_t m_Time;
float m_Value; float m_Value;
float m_XOffset; float m_XOffset;
@ -151,7 +151,7 @@ protected:
std::vector<SUIElementRect> m_UIRects; std::vector<SUIElementRect> m_UIRects;
// used for marquees or other user implemented things // used for marquees or other user implemented things
int64 m_ElementTime; int64_t m_ElementTime;
public: public:
CUIElement() = default; CUIElement() = default;

View file

@ -90,7 +90,7 @@ public:
int Eval(float Time, float *pResult) int Eval(float Time, float *pResult)
{ {
CRenderTools::RenderEvalEnvelope(m_lPoints.base_ptr(), m_lPoints.size(), m_Channels, (int64)((double)Time * 1000000.0), pResult); CRenderTools::RenderEvalEnvelope(m_lPoints.base_ptr(), m_lPoints.size(), m_Channels, (int64_t)((double)Time * 1000000.0), pResult);
return m_Channels; return m_Channels;
} }
@ -760,7 +760,7 @@ public:
virtual void UpdateMentions() { m_Mentions++; } virtual void UpdateMentions() { m_Mentions++; }
virtual void ResetMentions() { m_Mentions = 0; } virtual void ResetMentions() { m_Mentions = 0; }
int64 m_LastUndoUpdateTime; int64_t m_LastUndoUpdateTime;
bool m_UndoRunning; bool m_UndoRunning;
void CreateUndoStep(); void CreateUndoStep();
static void CreateUndoStepThread(void *pUser); static void CreateUndoStepThread(void *pUser);
@ -911,7 +911,7 @@ public:
bool m_ShowTileInfo; bool m_ShowTileInfo;
bool m_ShowDetail; bool m_ShowDetail;
bool m_Animate; bool m_Animate;
int64 m_AnimateStart; int64_t m_AnimateStart;
float m_AnimateTime; float m_AnimateTime;
float m_AnimateSpeed; float m_AnimateSpeed;

View file

@ -26,7 +26,7 @@ static unsigned int RotateRight32(unsigned int x, int Shift)
return (x >> Shift) | (x << (-Shift & 31)); return (x >> Shift) | (x << (-Shift & 31));
} }
void CPrng::Seed(uint64 aSeed[2]) void CPrng::Seed(uint64_t aSeed[2])
{ {
m_Seeded = true; m_Seeded = true;
str_format(m_aDescription, sizeof(m_aDescription), "%s:%08x%08x:%08x%08x", NAME, str_format(m_aDescription, sizeof(m_aDescription), "%s:%08x%08x:%08x%08x", NAME,
@ -42,10 +42,10 @@ unsigned int CPrng::RandomBits()
{ {
dbg_assert(m_Seeded, "prng needs to be seeded before it can generate random numbers"); dbg_assert(m_Seeded, "prng needs to be seeded before it can generate random numbers");
uint64 x = m_State; uint64_t x = m_State;
unsigned int Count = x >> 59; unsigned int Count = x >> 59;
static const uint64 MULTIPLIER = 6364136223846793005u; static const uint64_t MULTIPLIER = 6364136223846793005u;
m_State = x * MULTIPLIER + m_Increment; m_State = x * MULTIPLIER + m_Increment;
x ^= x >> 18; x ^= x >> 18;
return RotateRight32(x >> 27, Count); return RotateRight32(x >> 27, Count);

View file

@ -15,7 +15,7 @@ public:
// Seeds the random number generator with the given integer. The random // Seeds the random number generator with the given integer. The random
// sequence obtained by calling `RandomBits()` repeatedly is guaranteed // sequence obtained by calling `RandomBits()` repeatedly is guaranteed
// to be the same for the same seed. // to be the same for the same seed.
void Seed(uint64 aSeed[2]); void Seed(uint64_t aSeed[2]);
// Generates 32 random bits. `Seed()` must be called before calling // Generates 32 random bits. `Seed()` must be called before calling
// this function. // this function.
@ -25,8 +25,8 @@ private:
char m_aDescription[64]; char m_aDescription[64];
bool m_Seeded; bool m_Seeded;
uint64 m_State; uint64_t m_State;
uint64 m_Increment; uint64_t m_Increment;
}; };
#endif // GAME_PRNG_H #endif // GAME_PRNG_H

View file

@ -1034,7 +1034,7 @@ void CGameContext::ConJoinTeam(IConsole::IResult *pResult, void *pUserData)
{ {
int Team = pResult->GetInteger(0); int Team = pResult->GetInteger(0);
if(pPlayer->m_Last_Team + (int64)pSelf->Server()->TickSpeed() * g_Config.m_SvTeamChangeDelay > pSelf->Server()->Tick()) if(pPlayer->m_Last_Team + (int64_t)pSelf->Server()->TickSpeed() * g_Config.m_SvTeamChangeDelay > pSelf->Server()->Tick())
{ {
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join", pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join",
"You can\'t change teams that fast!"); "You can\'t change teams that fast!");
@ -1346,7 +1346,7 @@ void CGameContext::ConSayTime(IConsole::IResult *pResult, void *pUserData)
char aBufTime[32]; char aBufTime[32];
char aBuf[64]; char aBuf[64];
int64 Time = (int64)100 * (float)(pSelf->Server()->Tick() - pChr->m_StartTime) / ((float)pSelf->Server()->TickSpeed()); int64_t Time = (int64_t)100 * (float)(pSelf->Server()->Tick() - pChr->m_StartTime) / ((float)pSelf->Server()->TickSpeed());
str_time(Time, TIME_HOURS, aBufTime, sizeof(aBufTime)); str_time(Time, TIME_HOURS, aBufTime, sizeof(aBufTime));
str_format(aBuf, sizeof(aBuf), "%s current race time is %s", aBufName, aBufTime); str_format(aBuf, sizeof(aBuf), "%s current race time is %s", aBufName, aBufTime);
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "time", aBuf); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "time", aBuf);
@ -1369,7 +1369,7 @@ void CGameContext::ConSayTimeAll(IConsole::IResult *pResult, void *pUserData)
char aBufTime[32]; char aBufTime[32];
char aBuf[64]; char aBuf[64];
int64 Time = (int64)100 * (float)(pSelf->Server()->Tick() - pChr->m_StartTime) / ((float)pSelf->Server()->TickSpeed()); int64_t Time = (int64_t)100 * (float)(pSelf->Server()->Tick() - pChr->m_StartTime) / ((float)pSelf->Server()->TickSpeed());
const char *pName = pSelf->Server()->ClientName(pResult->m_ClientID); const char *pName = pSelf->Server()->ClientName(pResult->m_ClientID);
str_time(Time, TIME_HOURS, aBufTime, sizeof(aBufTime)); str_time(Time, TIME_HOURS, aBufTime, sizeof(aBufTime));
str_format(aBuf, sizeof(aBuf), "%s\'s current race time is %s", pName, aBufTime); str_format(aBuf, sizeof(aBuf), "%s\'s current race time is %s", pName, aBufTime);
@ -1391,7 +1391,7 @@ void CGameContext::ConTime(IConsole::IResult *pResult, void *pUserData)
char aBufTime[32]; char aBufTime[32];
char aBuf[64]; char aBuf[64];
int64 Time = (int64)100 * (float)(pSelf->Server()->Tick() - pChr->m_StartTime) / ((float)pSelf->Server()->TickSpeed()); int64_t Time = (int64_t)100 * (float)(pSelf->Server()->Tick() - pChr->m_StartTime) / ((float)pSelf->Server()->TickSpeed());
str_time(Time, TIME_HOURS, aBufTime, sizeof(aBufTime)); str_time(Time, TIME_HOURS, aBufTime, sizeof(aBufTime));
str_format(aBuf, sizeof(aBuf), "Your time is %s", aBufTime); str_format(aBuf, sizeof(aBuf), "Your time is %s", aBufTime);
pSelf->SendBroadcast(aBuf, pResult->m_ClientID); pSelf->SendBroadcast(aBuf, pResult->m_ClientID);

View file

@ -871,12 +871,12 @@ void CCharacter::TickDefered()
int Events = m_Core.m_TriggeredEvents; int Events = m_Core.m_TriggeredEvents;
int CID = m_pPlayer->GetCID(); int CID = m_pPlayer->GetCID();
int64 TeamMask = Teams()->TeamMask(Team(), -1, CID); int64_t TeamMask = Teams()->TeamMask(Team(), -1, CID);
// Some sounds are triggered client-side for the acting player // Some sounds are triggered client-side for the acting player
// so we need to avoid duplicating them // so we need to avoid duplicating them
int64 TeamMaskExceptSelf = Teams()->TeamMask(Team(), CID, CID); int64_t TeamMaskExceptSelf = Teams()->TeamMask(Team(), CID, CID);
// Some are triggered client-side but only on Sixup // Some are triggered client-side but only on Sixup
int64 TeamMaskExceptSelfIfSixup = Server()->IsSixup(CID) ? TeamMaskExceptSelf : TeamMask; int64_t TeamMaskExceptSelfIfSixup = Server()->IsSixup(CID) ? TeamMaskExceptSelf : TeamMask;
if(Events & COREEVENT_GROUND_JUMP) if(Events & COREEVENT_GROUND_JUMP)
GameServer()->CreateSound(m_Pos, SOUND_PLAYER_JUMP, TeamMaskExceptSelf); GameServer()->CreateSound(m_Pos, SOUND_PLAYER_JUMP, TeamMaskExceptSelf);
@ -1039,7 +1039,7 @@ bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon)
// do damage Hit sound // do damage Hit sound
if(From >= 0 && From != m_pPlayer->GetCID() && GameServer()->m_apPlayers[From]) if(From >= 0 && From != m_pPlayer->GetCID() && GameServer()->m_apPlayers[From])
{ {
int64 Mask = CmaskOne(From); int64_t Mask = CmaskOne(From);
for(int i = 0; i < MAX_CLIENTS; i++) for(int i = 0; i < MAX_CLIENTS; i++)
{ {
if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS && GameServer()->m_apPlayers[i]->m_SpectatorID == From) if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS && GameServer()->m_apPlayers[i]->m_SpectatorID == From)
@ -1355,7 +1355,7 @@ void CCharacter::HandleBroadcast()
else if((m_pPlayer->m_TimerType == CPlayer::TIMERTYPE_BROADCAST || m_pPlayer->m_TimerType == CPlayer::TIMERTYPE_GAMETIMER_AND_BROADCAST) && m_DDRaceState == DDRACE_STARTED && m_LastBroadcast + Server()->TickSpeed() * g_Config.m_SvTimeInBroadcastInterval <= Server()->Tick()) else if((m_pPlayer->m_TimerType == CPlayer::TIMERTYPE_BROADCAST || m_pPlayer->m_TimerType == CPlayer::TIMERTYPE_GAMETIMER_AND_BROADCAST) && m_DDRaceState == DDRACE_STARTED && m_LastBroadcast + Server()->TickSpeed() * g_Config.m_SvTimeInBroadcastInterval <= Server()->Tick())
{ {
char aBuf[32]; char aBuf[32];
int Time = (int64)100 * ((float)(Server()->Tick() - m_StartTime) / ((float)Server()->TickSpeed())); int Time = (int64_t)100 * ((float)(Server()->Tick() - m_StartTime) / ((float)Server()->TickSpeed()));
str_time(Time, TIME_HOURS, aBuf, sizeof(aBuf)); str_time(Time, TIME_HOURS, aBuf, sizeof(aBuf));
GameServer()->SendBroadcast(aBuf, m_pPlayer->GetCID(), false); GameServer()->SendBroadcast(aBuf, m_pPlayer->GetCID(), false);
m_CpLastBroadcast = m_CpActive; m_CpLastBroadcast = m_CpActive;
@ -2332,10 +2332,10 @@ void CCharacter::Rescue()
{ {
if(m_SetSavePos && !m_Super) if(m_SetSavePos && !m_Super)
{ {
if(m_LastRescue + (int64)g_Config.m_SvRescueDelay * Server()->TickSpeed() > Server()->Tick()) if(m_LastRescue + (int64_t)g_Config.m_SvRescueDelay * Server()->TickSpeed() > Server()->Tick())
{ {
char aBuf[256]; char aBuf[256];
str_format(aBuf, sizeof(aBuf), "You have to wait %d seconds until you can rescue yourself", (int)((m_LastRescue + (int64)g_Config.m_SvRescueDelay * Server()->TickSpeed() - Server()->Tick()) / Server()->TickSpeed())); str_format(aBuf, sizeof(aBuf), "You have to wait %d seconds until you can rescue yourself", (int)((m_LastRescue + (int64_t)g_Config.m_SvRescueDelay * Server()->TickSpeed() - Server()->Tick()) / Server()->TickSpeed()));
GameServer()->SendChatTarget(GetPlayer()->GetCID(), aBuf); GameServer()->SendChatTarget(GetPlayer()->GetCID(), aBuf);
return; return;
} }

View file

@ -229,8 +229,8 @@ public:
int m_MoveRestrictions; int m_MoveRestrictions;
vec2 m_Intersection; vec2 m_Intersection;
int64 m_LastStartWarning; int64_t m_LastStartWarning;
int64 m_LastRescue; int64_t m_LastRescue;
bool m_LastRefillJumps; bool m_LastRefillJumps;
bool m_LastPenalty; bool m_LastPenalty;
bool m_LastBonus; bool m_LastBonus;

View file

@ -265,7 +265,7 @@ void CLaser::Snap(int SnappingClient)
return; return;
CCharacter *pOwnerChar = 0; CCharacter *pOwnerChar = 0;
int64 TeamMask = -1LL; int64_t TeamMask = -1LL;
if(m_Owner >= 0) if(m_Owner >= 0)
pOwnerChar = GameServer()->GetPlayerChar(m_Owner); pOwnerChar = GameServer()->GetPlayerChar(m_Owner);

View file

@ -127,7 +127,7 @@ void CProjectile::Tick()
if(m_LifeSpan > -1) if(m_LifeSpan > -1)
m_LifeSpan--; m_LifeSpan--;
int64 TeamMask = -1LL; int64_t TeamMask = -1LL;
bool IsWeaponCollide = false; bool IsWeaponCollide = false;
if( if(
pOwnerChar && pOwnerChar &&
@ -251,7 +251,7 @@ void CProjectile::Tick()
if(m_Owner >= 0) if(m_Owner >= 0)
pOwnerChar = GameServer()->GetPlayerChar(m_Owner); pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
int64 TeamMask = -1LL; int64_t TeamMask = -1LL;
if(pOwnerChar && pOwnerChar->IsAlive()) if(pOwnerChar && pOwnerChar->IsAlive())
{ {
TeamMask = pOwnerChar->Teams()->TeamMask(pOwnerChar->Team(), -1, m_Owner); TeamMask = pOwnerChar->Teams()->TeamMask(pOwnerChar->Team(), -1, m_Owner);
@ -309,7 +309,7 @@ void CProjectile::Snap(int SnappingClient)
return; return;
CCharacter *pOwnerChar = 0; CCharacter *pOwnerChar = 0;
int64 TeamMask = -1LL; int64_t TeamMask = -1LL;
if(m_Owner >= 0) if(m_Owner >= 0)
pOwnerChar = GameServer()->GetPlayerChar(m_Owner); pOwnerChar = GameServer()->GetPlayerChar(m_Owner);

View file

@ -20,7 +20,7 @@ void CEventHandler::SetGameServer(CGameContext *pGameServer)
m_pGameServer = pGameServer; m_pGameServer = pGameServer;
} }
void *CEventHandler::Create(int Type, int Size, int64 Mask) void *CEventHandler::Create(int Type, int Size, int64_t Mask)
{ {
if(m_NumEvents == MAX_EVENTS) if(m_NumEvents == MAX_EVENTS)
return 0; return 0;

View file

@ -14,7 +14,7 @@ class CEventHandler
int m_aTypes[MAX_EVENTS]; // TODO: remove some of these arrays int m_aTypes[MAX_EVENTS]; // TODO: remove some of these arrays
int m_aOffsets[MAX_EVENTS]; int m_aOffsets[MAX_EVENTS];
int m_aSizes[MAX_EVENTS]; int m_aSizes[MAX_EVENTS];
int64 m_aClientMasks[MAX_EVENTS]; int64_t m_aClientMasks[MAX_EVENTS];
char m_aData[MAX_DATASIZE]; char m_aData[MAX_DATASIZE];
class CGameContext *m_pGameServer; class CGameContext *m_pGameServer;
@ -27,7 +27,7 @@ public:
void SetGameServer(CGameContext *pGameServer); void SetGameServer(CGameContext *pGameServer);
CEventHandler(); CEventHandler();
void *Create(int Type, int Size, int64 Mask = -1LL); void *Create(int Type, int Size, int64_t Mask = -1LL);
void Clear(); void Clear();
void Snap(int SnappingClient); void Snap(int SnappingClient);

View file

@ -175,7 +175,7 @@ void CGameContext::FillAntibot(CAntibotRoundData *pData)
} }
} }
void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int Amount, int64 Mask) void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int Amount, int64_t Mask)
{ {
float a = 3 * 3.14159f / 2 + Angle; float a = 3 * 3.14159f / 2 + Angle;
//float a = get_angle(dir); //float a = get_angle(dir);
@ -194,7 +194,7 @@ void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int Amount, int64 Mask
} }
} }
void CGameContext::CreateHammerHit(vec2 Pos, int64 Mask) void CGameContext::CreateHammerHit(vec2 Pos, int64_t Mask)
{ {
// create the event // create the event
CNetEvent_HammerHit *pEvent = (CNetEvent_HammerHit *)m_Events.Create(NETEVENTTYPE_HAMMERHIT, sizeof(CNetEvent_HammerHit), Mask); CNetEvent_HammerHit *pEvent = (CNetEvent_HammerHit *)m_Events.Create(NETEVENTTYPE_HAMMERHIT, sizeof(CNetEvent_HammerHit), Mask);
@ -205,7 +205,7 @@ void CGameContext::CreateHammerHit(vec2 Pos, int64 Mask)
} }
} }
void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask) void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask)
{ {
// create the event // create the event
CNetEvent_Explosion *pEvent = (CNetEvent_Explosion *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(CNetEvent_Explosion), Mask); CNetEvent_Explosion *pEvent = (CNetEvent_Explosion *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(CNetEvent_Explosion), Mask);
@ -220,7 +220,7 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag
float Radius = 135.0f; float Radius = 135.0f;
float InnerRadius = 48.0f; float InnerRadius = 48.0f;
int Num = m_World.FindEntities(Pos, Radius, (CEntity **)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER); int Num = m_World.FindEntities(Pos, Radius, (CEntity **)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER);
int64 TeamMask = -1; int64_t TeamMask = -1;
for(int i = 0; i < Num; i++) for(int i = 0; i < Num; i++)
{ {
vec2 Diff = apEnts[i]->m_Pos - Pos; vec2 Diff = apEnts[i]->m_Pos - Pos;
@ -260,7 +260,7 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag
} }
} }
void CGameContext::CreatePlayerSpawn(vec2 Pos, int64 Mask) void CGameContext::CreatePlayerSpawn(vec2 Pos, int64_t Mask)
{ {
// create the event // create the event
CNetEvent_Spawn *ev = (CNetEvent_Spawn *)m_Events.Create(NETEVENTTYPE_SPAWN, sizeof(CNetEvent_Spawn), Mask); CNetEvent_Spawn *ev = (CNetEvent_Spawn *)m_Events.Create(NETEVENTTYPE_SPAWN, sizeof(CNetEvent_Spawn), Mask);
@ -271,7 +271,7 @@ void CGameContext::CreatePlayerSpawn(vec2 Pos, int64 Mask)
} }
} }
void CGameContext::CreateDeath(vec2 Pos, int ClientID, int64 Mask) void CGameContext::CreateDeath(vec2 Pos, int ClientID, int64_t Mask)
{ {
// create the event // create the event
CNetEvent_Death *pEvent = (CNetEvent_Death *)m_Events.Create(NETEVENTTYPE_DEATH, sizeof(CNetEvent_Death), Mask); CNetEvent_Death *pEvent = (CNetEvent_Death *)m_Events.Create(NETEVENTTYPE_DEATH, sizeof(CNetEvent_Death), Mask);
@ -283,7 +283,7 @@ void CGameContext::CreateDeath(vec2 Pos, int ClientID, int64 Mask)
} }
} }
void CGameContext::CreateSound(vec2 Pos, int Sound, int64 Mask) void CGameContext::CreateSound(vec2 Pos, int Sound, int64_t Mask)
{ {
if(Sound < 0) if(Sound < 0)
return; return;
@ -322,7 +322,7 @@ void CGameContext::CallVote(int ClientID, const char *pDesc, const char *pCmd, c
if(m_VoteCloseTime) if(m_VoteCloseTime)
return; return;
int64 Now = Server()->Tick(); int64_t Now = Server()->Tick();
CPlayer *pPlayer = m_apPlayers[ClientID]; CPlayer *pPlayer = m_apPlayers[ClientID];
if(!pPlayer) if(!pPlayer)
@ -854,7 +854,7 @@ void CGameContext::OnTick()
// remember checked players, only the first player with a specific ip will be handled // remember checked players, only the first player with a specific ip will be handled
bool aVoteChecked[MAX_CLIENTS] = {false}; bool aVoteChecked[MAX_CLIENTS] = {false};
int64 Now = Server()->Tick(); int64_t Now = Server()->Tick();
for(int i = 0; i < MAX_CLIENTS; i++) for(int i = 0; i < MAX_CLIENTS; i++)
{ {
if(!m_apPlayers[i] || aVoteChecked[i]) if(!m_apPlayers[i] || aVoteChecked[i])
@ -1775,7 +1775,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
if(g_Config.m_SvSpamprotection && !str_startswith(pMsg->m_pMessage + 1, "timeout ") && pPlayer->m_LastCommands[0] && pPlayer->m_LastCommands[0] + Server()->TickSpeed() > Server()->Tick() && pPlayer->m_LastCommands[1] && pPlayer->m_LastCommands[1] + Server()->TickSpeed() > Server()->Tick() && pPlayer->m_LastCommands[2] && pPlayer->m_LastCommands[2] + Server()->TickSpeed() > Server()->Tick() && pPlayer->m_LastCommands[3] && pPlayer->m_LastCommands[3] + Server()->TickSpeed() > Server()->Tick()) if(g_Config.m_SvSpamprotection && !str_startswith(pMsg->m_pMessage + 1, "timeout ") && pPlayer->m_LastCommands[0] && pPlayer->m_LastCommands[0] + Server()->TickSpeed() > Server()->Tick() && pPlayer->m_LastCommands[1] && pPlayer->m_LastCommands[1] + Server()->TickSpeed() > Server()->Tick() && pPlayer->m_LastCommands[2] && pPlayer->m_LastCommands[2] + Server()->TickSpeed() > Server()->Tick() && pPlayer->m_LastCommands[3] && pPlayer->m_LastCommands[3] + Server()->TickSpeed() > Server()->Tick())
return; return;
int64 Now = Server()->Tick(); int64_t Now = Server()->Tick();
pPlayer->m_LastCommands[pPlayer->m_LastCommandPos] = Now; pPlayer->m_LastCommands[pPlayer->m_LastCommandPos] = Now;
pPlayer->m_LastCommandPos = (pPlayer->m_LastCommandPos + 1) % 4; pPlayer->m_LastCommandPos = (pPlayer->m_LastCommandPos + 1) % 4;
@ -2070,7 +2070,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
if(g_Config.m_SvSpamprotection && pPlayer->m_LastVoteTry && pPlayer->m_LastVoteTry + Server()->TickSpeed() * 3 > Server()->Tick()) if(g_Config.m_SvSpamprotection && pPlayer->m_LastVoteTry && pPlayer->m_LastVoteTry + Server()->TickSpeed() * 3 > Server()->Tick())
return; return;
int64 Now = Server()->Tick(); int64_t Now = Server()->Tick();
pPlayer->m_LastVoteTry = Now; pPlayer->m_LastVoteTry = Now;
pPlayer->UpdatePlaytime(); pPlayer->UpdatePlaytime();
@ -2107,7 +2107,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
pPlayer->m_LastSetTeam = Server()->Tick(); pPlayer->m_LastSetTeam = Server()->Tick();
int TimeLeft = (pPlayer->m_TeamChangeTick - Server()->Tick()) / Server()->TickSpeed(); int TimeLeft = (pPlayer->m_TeamChangeTick - Server()->Tick()) / Server()->TickSpeed();
char aTime[32]; char aTime[32];
str_time((int64)TimeLeft * 100, TIME_HOURS, aTime, sizeof(aTime)); str_time((int64_t)TimeLeft * 100, TIME_HOURS, aTime, sizeof(aTime));
char aBuf[128]; char aBuf[128];
str_format(aBuf, sizeof(aBuf), "Time to wait before changing team: %s", aTime); str_format(aBuf, sizeof(aBuf), "Time to wait before changing team: %s", aTime);
SendBroadcast(aBuf, ClientID); SendBroadcast(aBuf, ClientID);
@ -3076,7 +3076,7 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/)
m_GameUuid = RandomUuid(); m_GameUuid = RandomUuid();
Console()->SetTeeHistorianCommandCallback(CommandCallback, this); Console()->SetTeeHistorianCommandCallback(CommandCallback, this);
uint64 aSeed[2]; uint64_t aSeed[2];
secure_random_fill(aSeed, sizeof(aSeed)); secure_random_fill(aSeed, sizeof(aSeed));
m_Prng.Seed(aSeed); m_Prng.Seed(aSeed);
m_World.m_Core.m_pPrng = &m_Prng; m_World.m_Core.m_pPrng = &m_Prng;
@ -4081,8 +4081,8 @@ void CGameContext::ForceVote(int EnforcerID, bool Success)
bool CGameContext::RateLimitPlayerVote(int ClientID) bool CGameContext::RateLimitPlayerVote(int ClientID)
{ {
int64 Now = Server()->Tick(); int64_t Now = Server()->Tick();
int64 TickSpeed = Server()->TickSpeed(); int64_t TickSpeed = Server()->TickSpeed();
CPlayer *pPlayer = m_apPlayers[ClientID]; CPlayer *pPlayer = m_apPlayers[ClientID];
if(g_Config.m_SvRconVote && !Server()->GetAuthedState(ClientID)) if(g_Config.m_SvRconVote && !Server()->GetAuthedState(ClientID))

View file

@ -165,7 +165,7 @@ public:
int m_VoteCreator; int m_VoteCreator;
int m_VoteType; int m_VoteType;
int64 m_VoteCloseTime; int64_t m_VoteCloseTime;
bool m_VoteUpdate; bool m_VoteUpdate;
int m_VotePos; int m_VotePos;
char m_aVoteDescription[VOTE_DESC_LENGTH]; char m_aVoteDescription[VOTE_DESC_LENGTH];
@ -192,12 +192,12 @@ public:
CVoteOptionServer *m_pVoteOptionLast; CVoteOptionServer *m_pVoteOptionLast;
// helper functions // helper functions
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, int64 Mask = -1); void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, int64_t Mask = -1);
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask); void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask);
void CreateHammerHit(vec2 Pos, int64 Mask = -1); void CreateHammerHit(vec2 Pos, int64_t Mask = -1);
void CreatePlayerSpawn(vec2 Pos, int64 Mask = -1); void CreatePlayerSpawn(vec2 Pos, int64_t Mask = -1);
void CreateDeath(vec2 Pos, int Who, int64 Mask = -1); void CreateDeath(vec2 Pos, int Who, int64_t Mask = -1);
void CreateSound(vec2 Pos, int Sound, int64 Mask = -1); void CreateSound(vec2 Pos, int Sound, int64_t Mask = -1);
void CreateSoundGlobal(int Sound, int Target = -1); void CreateSoundGlobal(int Sound, int Target = -1);
enum enum
@ -277,8 +277,8 @@ public:
int ProcessSpamProtection(int ClientID, bool RespectChatInitialDelay = true); int ProcessSpamProtection(int ClientID, bool RespectChatInitialDelay = true);
int GetDDRaceTeam(int ClientID); int GetDDRaceTeam(int ClientID);
// Describes the time when the first player joined the server. // Describes the time when the first player joined the server.
int64 m_NonEmptySince; int64_t m_NonEmptySince;
int64 m_LastMapVote; int64_t m_LastMapVote;
int GetClientVersion(int ClientID) const; int GetClientVersion(int ClientID) const;
bool PlayerExists(int ClientID) const { return m_apPlayers[ClientID]; } bool PlayerExists(int ClientID) const { return m_apPlayers[ClientID]; }
// Returns true if someone is actively moderating. // Returns true if someone is actively moderating.
@ -462,9 +462,9 @@ public:
int m_ChatPrintCBIndex; int m_ChatPrintCBIndex;
}; };
inline int64 CmaskAll() { return -1LL; } inline int64_t CmaskAll() { return -1LL; }
inline int64 CmaskOne(int ClientID) { return 1LL << ClientID; } inline int64_t CmaskOne(int ClientID) { return 1LL << ClientID; }
inline int64 CmaskUnset(int64 Mask, int ClientID) { return Mask ^ CmaskOne(ClientID); } inline int64_t CmaskUnset(int64_t Mask, int ClientID) { return Mask ^ CmaskOne(ClientID); }
inline int64 CmaskAllExceptOne(int ClientID) { return CmaskUnset(CmaskAll(), ClientID); } inline int64_t CmaskAllExceptOne(int ClientID) { return CmaskUnset(CmaskAll(), ClientID); }
inline bool CmaskIsSet(int64 Mask, int ClientID) { return (Mask & CmaskOne(ClientID)) != 0; } inline bool CmaskIsSet(int64_t Mask, int ClientID) { return (Mask & CmaskOne(ClientID)) != 0; }
#endif #endif

View file

@ -680,7 +680,7 @@ int IGameController::ClampTeam(int Team)
return 0; return 0;
} }
int64 IGameController::GetMaskForPlayerWorldEvent(int Asker, int ExceptID) int64_t IGameController::GetMaskForPlayerWorldEvent(int Asker, int ExceptID)
{ {
// Send all world events to everyone by default // Send all world events to everyone by default
return CmaskAllExceptOne(ExceptID); return CmaskAllExceptOne(ExceptID);

View file

@ -142,7 +142,7 @@ public:
virtual bool CanJoinTeam(int Team, int NotThisID); virtual bool CanJoinTeam(int Team, int NotThisID);
int ClampTeam(int Team); int ClampTeam(int Team);
virtual int64 GetMaskForPlayerWorldEvent(int Asker, int ExceptID = -1); virtual int64_t GetMaskForPlayerWorldEvent(int Asker, int ExceptID = -1);
// DDRace // DDRace

View file

@ -197,7 +197,7 @@ void CGameControllerDDRace::DoTeamChange(class CPlayer *pPlayer, int Team, bool
IGameController::DoTeamChange(pPlayer, Team, DoChatMsg); IGameController::DoTeamChange(pPlayer, Team, DoChatMsg);
} }
int64 CGameControllerDDRace::GetMaskForPlayerWorldEvent(int Asker, int ExceptID) int64_t CGameControllerDDRace::GetMaskForPlayerWorldEvent(int Asker, int ExceptID)
{ {
if(Asker == -1) if(Asker == -1)
return CmaskAllExceptOne(ExceptID); return CmaskAllExceptOne(ExceptID);

View file

@ -27,7 +27,7 @@ public:
void DoTeamChange(class CPlayer *pPlayer, int Team, bool DoChatMsg = true) override; void DoTeamChange(class CPlayer *pPlayer, int Team, bool DoChatMsg = true) override;
int64 GetMaskForPlayerWorldEvent(int Asker, int ExceptID = -1) override; int64_t GetMaskForPlayerWorldEvent(int Asker, int ExceptID = -1) override;
void InitTeleporter(); void InitTeleporter();

View file

@ -123,8 +123,8 @@ void CPlayer::Reset()
m_ScoreQueryResult = nullptr; m_ScoreQueryResult = nullptr;
m_ScoreFinishResult = nullptr; m_ScoreFinishResult = nullptr;
int64 Now = Server()->Tick(); int64_t Now = Server()->Tick();
int64 TickSpeed = Server()->TickSpeed(); int64_t TickSpeed = Server()->TickSpeed();
// If the player joins within ten seconds of the server becoming // If the player joins within ten seconds of the server becoming
// non-empty, allow them to vote immediately. This allows players to // non-empty, allow them to vote immediately. This allows players to
// vote after map changes or when they join an empty server. // vote after map changes or when they join an empty server.
@ -807,7 +807,7 @@ void CPlayer::OverrideDefaultEmote(int Emote, int Tick)
bool CPlayer::CanOverrideDefaultEmote() const bool CPlayer::CanOverrideDefaultEmote() const
{ {
return m_LastEyeEmote == 0 || m_LastEyeEmote + (int64)g_Config.m_SvEyeEmoteChangeDelay * Server()->TickSpeed() < Server()->Tick(); return m_LastEyeEmote == 0 || m_LastEyeEmote + (int64_t)g_Config.m_SvEyeEmoteChangeDelay * Server()->TickSpeed() < Server()->Tick();
} }
void CPlayer::ProcessPause() void CPlayer::ProcessPause()
@ -844,7 +844,7 @@ int CPlayer::Pause(int State, bool Force)
case PAUSE_NONE: case PAUSE_NONE:
if(m_pCharacter->IsPaused()) // First condition might be unnecessary if(m_pCharacter->IsPaused()) // First condition might be unnecessary
{ {
if(!Force && m_LastPause && m_LastPause + (int64)g_Config.m_SvSpecFrequency * Server()->TickSpeed() > Server()->Tick()) if(!Force && m_LastPause && m_LastPause + (int64_t)g_Config.m_SvSpecFrequency * Server()->TickSpeed() > Server()->Tick())
{ {
GameServer()->SendChatTarget(m_ClientID, "Can't /spec that quickly."); GameServer()->SendChatTarget(m_ClientID, "Can't /spec that quickly.");
return m_Paused; // Do not update state. Do not collect $200 return m_Paused; // Do not update state. Do not collect $200

View file

@ -132,8 +132,8 @@ private:
int m_Team; int m_Team;
int m_Paused; int m_Paused;
int64 m_ForcePauseTime; int64_t m_ForcePauseTime;
int64 m_LastPause; int64_t m_LastPause;
int m_DefEmote; int m_DefEmote;
int m_OverrideEmote; int m_OverrideEmote;
@ -159,7 +159,7 @@ public:
}; };
bool m_DND; bool m_DND;
int64 m_FirstVoteTick; int64_t m_FirstVoteTick;
char m_TimeoutCode[64]; char m_TimeoutCode[64];
void ProcessPause(); void ProcessPause();
@ -168,8 +168,8 @@ public:
int IsPaused(); int IsPaused();
bool IsPlaying(); bool IsPlaying();
int64 m_Last_KickVote; int64_t m_Last_KickVote;
int64 m_Last_Team; int64_t m_Last_Team;
int m_ShowOthers; int m_ShowOthers;
bool m_ShowAll; bool m_ShowAll;
vec2 m_ShowDistance; vec2 m_ShowDistance;
@ -185,9 +185,9 @@ public:
bool AfkTimer(int new_target_x, int new_target_y); //returns true if kicked bool AfkTimer(int new_target_x, int new_target_y); //returns true if kicked
void UpdatePlaytime(); void UpdatePlaytime();
void AfkVoteTimer(CNetObj_PlayerInput *NewTarget); void AfkVoteTimer(CNetObj_PlayerInput *NewTarget);
int64 m_LastPlaytime; int64_t m_LastPlaytime;
int64 m_LastEyeEmote; int64_t m_LastEyeEmote;
int64 m_LastBroadcast; int64_t m_LastBroadcast;
bool m_LastBroadcastImportance; bool m_LastBroadcastImportance;
int m_LastTarget_x; int m_LastTarget_x;
int m_LastTarget_y; int m_LastTarget_y;
@ -203,12 +203,12 @@ public:
bool CanOverrideDefaultEmote() const; bool CanOverrideDefaultEmote() const;
bool m_FirstPacket; bool m_FirstPacket;
int64 m_LastSQLQuery; int64_t m_LastSQLQuery;
void ProcessScoreResult(CScorePlayerResult &Result); void ProcessScoreResult(CScorePlayerResult &Result);
std::shared_ptr<CScorePlayerResult> m_ScoreQueryResult; std::shared_ptr<CScorePlayerResult> m_ScoreQueryResult;
std::shared_ptr<CScorePlayerResult> m_ScoreFinishResult; std::shared_ptr<CScorePlayerResult> m_ScoreFinishResult;
bool m_NotEligibleForFinish; bool m_NotEligibleForFinish;
int64 m_EligibleForFinishCheck; int64_t m_EligibleForFinishCheck;
bool m_VotedForPractice; bool m_VotedForPractice;
int m_SwapTargetsClientID; //Client ID of the swap target for the given player int m_SwapTargetsClientID; //Client ID of the swap target for the given player
}; };

View file

@ -138,7 +138,7 @@ bool CScore::RateLimitPlayer(int ClientID)
CPlayer *pPlayer = GameServer()->m_apPlayers[ClientID]; CPlayer *pPlayer = GameServer()->m_apPlayers[ClientID];
if(pPlayer == 0) if(pPlayer == 0)
return true; return true;
if(pPlayer->m_LastSQLQuery + (int64)g_Config.m_SvSqlQueriesDelay * Server()->TickSpeed() >= Server()->Tick()) if(pPlayer->m_LastSQLQuery + (int64_t)g_Config.m_SvSqlQueriesDelay * Server()->TickSpeed() >= Server()->Tick())
return true; return true;
pPlayer->m_LastSQLQuery = Server()->Tick(); pPlayer->m_LastSQLQuery = Server()->Tick();
return false; return false;
@ -166,7 +166,7 @@ CScore::CScore(CGameContext *pGameServer, CDbConnectionPool *pPool) :
((CGameControllerDDRace *)(pGameServer->m_pController))->m_pInitResult = InitResult; ((CGameControllerDDRace *)(pGameServer->m_pController))->m_pInitResult = InitResult;
str_copy(Tmp->m_Map, g_Config.m_SvMap, sizeof(Tmp->m_Map)); str_copy(Tmp->m_Map, g_Config.m_SvMap, sizeof(Tmp->m_Map));
uint64 aSeed[2]; uint64_t aSeed[2];
secure_random_fill(aSeed, sizeof(aSeed)); secure_random_fill(aSeed, sizeof(aSeed));
m_Prng.Seed(aSeed); m_Prng.Seed(aSeed);
@ -471,7 +471,7 @@ bool CScore::MapInfoThread(IDbConnection *pSqlServer, const ISqlData *pGameData,
char aMedianString[60] = "\0"; char aMedianString[60] = "\0";
if(Median > 0) if(Median > 0)
{ {
str_time((int64)Median * 100, TIME_HOURS, aBuf, sizeof(aBuf)); str_time((int64_t)Median * 100, TIME_HOURS, aBuf, sizeof(aBuf));
str_format(aMedianString, sizeof(aMedianString), " in %s median", aBuf); str_format(aMedianString, sizeof(aMedianString), " in %s median", aBuf);
} }

View file

@ -355,9 +355,9 @@ bool CGameTeams::TeamFinished(int Team)
return true; return true;
} }
int64 CGameTeams::TeamMask(int Team, int ExceptID, int Asker) int64_t CGameTeams::TeamMask(int Team, int ExceptID, int Asker)
{ {
int64 Mask = 0; int64_t Mask = 0;
for(int i = 0; i < MAX_CLIENTS; ++i) for(int i = 0; i < MAX_CLIENTS; ++i)
{ {

View file

@ -14,10 +14,10 @@ class CGameTeams
int m_TeamState[MAX_CLIENTS]; int m_TeamState[MAX_CLIENTS];
bool m_TeeFinished[MAX_CLIENTS]; bool m_TeeFinished[MAX_CLIENTS];
bool m_TeamLocked[MAX_CLIENTS]; bool m_TeamLocked[MAX_CLIENTS];
uint64 m_Invited[MAX_CLIENTS]; uint64_t m_Invited[MAX_CLIENTS];
bool m_Practice[MAX_CLIENTS]; bool m_Practice[MAX_CLIENTS];
std::shared_ptr<CScoreSaveResult> m_pSaveTeamResult[MAX_CLIENTS]; std::shared_ptr<CScoreSaveResult> m_pSaveTeamResult[MAX_CLIENTS];
uint64 m_LastSwap[MAX_CLIENTS]; uint64_t m_LastSwap[MAX_CLIENTS];
class CGameContext *m_pGameContext; class CGameContext *m_pGameContext;
@ -68,7 +68,7 @@ public:
void ChangeTeamState(int Team, int State); void ChangeTeamState(int Team, int State);
int64 TeamMask(int Team, int ExceptID = -1, int Asker = -1); int64_t TeamMask(int Team, int ExceptID = -1, int Asker = -1);
int Count(int Team) const; int Count(int Team) const;

View file

@ -28,7 +28,7 @@ struct CCheckServer
NETADDR m_Address; NETADDR m_Address;
NETADDR m_AltAddress; NETADDR m_AltAddress;
int m_TryCount; int m_TryCount;
int64 m_TryTime; int64_t m_TryTime;
}; };
static CCheckServer m_aCheckServers[MAX_SERVERS]; static CCheckServer m_aCheckServers[MAX_SERVERS];
@ -38,7 +38,7 @@ struct CServerEntry
{ {
enum ServerType m_Type; enum ServerType m_Type;
NETADDR m_Address; NETADDR m_Address;
int64 m_Expire; int64_t m_Expire;
}; };
static CServerEntry m_aServers[MAX_SERVERS]; static CServerEntry m_aServers[MAX_SERVERS];
@ -259,8 +259,8 @@ void AddServer(NETADDR *pInfo, ServerType Type)
void UpdateServers() void UpdateServers()
{ {
int64 Now = time_get(); int64_t Now = time_get();
int64 Freq = time_freq(); int64_t Freq = time_freq();
for(int i = 0; i < m_NumCheckServers; i++) for(int i = 0; i < m_NumCheckServers; i++)
{ {
if(Now > m_aCheckServers[i].m_TryTime + Freq) if(Now > m_aCheckServers[i].m_TryTime + Freq)
@ -294,7 +294,7 @@ void UpdateServers()
void PurgeServers() void PurgeServers()
{ {
int64 Now = time_get(); int64_t Now = time_get();
int i = 0; int i = 0;
while(i < m_NumServers) while(i < m_NumServers)
{ {
@ -320,7 +320,7 @@ void ReloadBans()
int main(int argc, const char **argv) // ignore_convention int main(int argc, const char **argv) // ignore_convention
{ {
int64 LastBuild = 0, LastBanReload = 0; int64_t LastBuild = 0, LastBanReload = 0;
ServerType Type = SERVERTYPE_INVALID; ServerType Type = SERVERTYPE_INVALID;
NETADDR BindAddr; NETADDR BindAddr;

View file

@ -52,7 +52,7 @@ static const unsigned int PCG32_GLOBAL_DEMO[] = {
TEST(Prng, EqualsPcg32GlobalDemo) TEST(Prng, EqualsPcg32GlobalDemo)
{ {
uint64 aSeed[2] = {42, 54}; uint64_t aSeed[2] = {42, 54};
CPrng Prng; CPrng Prng;
Prng.Seed(aSeed); Prng.Seed(aSeed);
@ -67,9 +67,9 @@ TEST(Prng, Description)
CPrng Prng; CPrng Prng;
EXPECT_STREQ(Prng.Description(), "pcg-xsh-rr:unseeded"); EXPECT_STREQ(Prng.Description(), "pcg-xsh-rr:unseeded");
uint64 aSeed0[2] = {0xfedbca9876543210, 0x0123456789abcdef}; uint64_t aSeed0[2] = {0xfedbca9876543210, 0x0123456789abcdef};
uint64 aSeed1[2] = {0x0123456789abcdef, 0xfedcba9876543210}; uint64_t aSeed1[2] = {0x0123456789abcdef, 0xfedcba9876543210};
uint64 aSeed2[2] = {0x0000000000000000, 0x0000000000000000}; uint64_t aSeed2[2] = {0x0000000000000000, 0x0000000000000000};
Prng.Seed(aSeed0); Prng.Seed(aSeed0);
EXPECT_STREQ(Prng.Description(), "pcg-xsh-rr:fedbca9876543210:0123456789abcdef"); EXPECT_STREQ(Prng.Description(), "pcg-xsh-rr:fedbca9876543210:0123456789abcdef");

View file

@ -10,7 +10,7 @@ struct CPacket
CPacket *m_pNext; CPacket *m_pNext;
NETADDR m_SendTo; NETADDR m_SendTo;
int64 m_Timestamp; int64_t m_Timestamp;
int m_ID; int m_ID;
int m_DataSize; int m_DataSize;
char m_aData[1]; char m_aData[1];
@ -185,7 +185,7 @@ void Run(unsigned short Port, NETADDR Dest)
int MsSpike = Ping.m_Spike; int MsSpike = Ping.m_Spike;
int MsFlux = Ping.m_Flux; int MsFlux = Ping.m_Flux;
int MsPing = Ping.m_Base; int MsPing = Ping.m_Base;
m_CurrentLatency = ((time_freq() * MsPing) / 1000) + (int64)(((time_freq() * MsFlux) / 1000) * Flux); // 50ms m_CurrentLatency = ((time_freq() * MsPing) / 1000) + (int64_t)(((time_freq() * MsFlux) / 1000) * Flux); // 50ms
if(MsSpike && (p->m_ID % 100) == 0) if(MsSpike && (p->m_ID % 100) == 0)
{ {

View file

@ -110,7 +110,7 @@ static void SendFWCheckResponse(NETADDR *pAddr)
static int Run() static int Run()
{ {
int64 NextHeartBeat = 0; int64_t NextHeartBeat = 0;
NETADDR BindAddr = {NETTYPE_IPV4, {0}, 0}; NETADDR BindAddr = {NETTYPE_IPV4, {0}, 0};
if(!pNet->Open(BindAddr, 0, 0, 0, 0)) if(!pNet->Open(BindAddr, 0, 0, 0, 0))

View file

@ -46,7 +46,7 @@ int main(int argc, char **argv) // ignore_convention
g_NetOp.Send(&Packet); g_NetOp.Send(&Packet);
int64 startTime = time_get(); int64_t startTime = time_get();
net_socket_read_wait(g_NetOp.m_Socket, 1000000); net_socket_read_wait(g_NetOp.m_Socket, 1000000);
@ -64,7 +64,7 @@ int main(int argc, char **argv) // ignore_convention
if(Token != CurToken) if(Token != CurToken)
continue; continue;
int64 endTime = time_get(); int64_t endTime = time_get();
printf("%g ms\n", (double)(endTime - startTime) / time_freq() * 1000); printf("%g ms\n", (double)(endTime - startTime) / time_freq() * 1000);
} }
} }