Merge pull request #7532 from furo321/magic-50

Replace `50` with `SERVER_TICK_SPEED` or `TickSpeed()`
This commit is contained in:
Dennis Felsing 2023-11-23 22:07:37 +00:00 committed by GitHub
commit 9f20636952
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 50 additions and 62 deletions

View file

@ -87,8 +87,6 @@ protected:
float m_GlobalTime;
float m_RenderFrameTime;
int m_GameTickSpeed;
float m_FrameTimeAvg;
TMapLoadingCallbackFunc m_MapLoadingCBFunc;
@ -141,7 +139,7 @@ public:
inline float PredIntraGameTick(int Conn) const { return m_aPredIntraTick[Conn]; }
inline float IntraGameTickSincePrev(int Conn) const { return m_aGameIntraTickSincePrev[Conn]; }
inline float GameTickTime(int Conn) const { return m_aGameTickTime[Conn]; }
inline int GameTickSpeed() const { return m_GameTickSpeed; }
inline int GameTickSpeed() const { return SERVER_TICK_SPEED; }
// other time access
inline float RenderFrameTime() const { return m_RenderFrameTime; }

View file

@ -83,8 +83,6 @@ CClient::CClient() :
m_RenderFrameTime = 0.0001f;
m_LastRenderTime = time_get();
m_GameTickSpeed = SERVER_TICK_SPEED;
m_SnapCrcErrors = 0;
m_AutoScreenshotRecycle = false;
m_AutoStatScreenshotRecycle = false;
@ -304,7 +302,7 @@ void CClient::Rcon(const char *pCmd)
bool CClient::ConnectionProblems() const
{
return m_aNetClient[g_Config.m_ClDummy].GotProblems(MaxLatencyTicks() * time_freq() / SERVER_TICK_SPEED) != 0;
return m_aNetClient[g_Config.m_ClDummy].GotProblems(MaxLatencyTicks() * time_freq() / GameTickSpeed()) != 0;
}
void CClient::DirectInput(int *pInput, int Size)
@ -743,7 +741,7 @@ int CClient::GetCurrentRaceTime()
{
if(GameClient()->GetLastRaceTick() < 0)
return 0;
return (GameTick(g_Config.m_ClDummy) - GameClient()->GetLastRaceTick()) / 50;
return (GameTick(g_Config.m_ClDummy) - GameClient()->GetLastRaceTick()) / GameTickSpeed();
}
void CClient::GetServerInfo(CServerInfo *pServerInfo) const
@ -1904,11 +1902,11 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
// start at 200ms and work from there
if(!Dummy)
{
m_PredictedTime.Init(GameTick * time_freq() / 50);
m_PredictedTime.Init(GameTick * time_freq() / GameTickSpeed());
m_PredictedTime.SetAdjustSpeed(CSmoothTime::ADJUSTDIRECTION_UP, 1000.0f);
m_PredictedTime.UpdateMargin(PredictionMargin() * time_freq() / 1000);
}
m_aGameTime[Conn].Init((GameTick - 1) * time_freq() / 50);
m_aGameTime[Conn].Init((GameTick - 1) * time_freq() / GameTickSpeed());
m_aapSnapshots[Conn][SNAP_PREV] = m_aSnapshotStorage[Conn].m_pFirst;
m_aapSnapshots[Conn][SNAP_CURRENT] = m_aSnapshotStorage[Conn].m_pLast;
if(!Dummy)
@ -1930,12 +1928,12 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
if(m_aReceivedSnapshots[Conn] > 2)
{
int64_t Now = m_aGameTime[Conn].Get(time_get());
int64_t TickStart = GameTick * time_freq() / 50;
int64_t TickStart = GameTick * time_freq() / GameTickSpeed();
int64_t TimeLeft = (TickStart - Now) * 1000 / time_freq();
m_aGameTime[Conn].Update(&m_GametimeMarginGraph, (GameTick - 1) * time_freq() / 50, TimeLeft, CSmoothTime::ADJUSTDIRECTION_DOWN);
m_aGameTime[Conn].Update(&m_GametimeMarginGraph, (GameTick - 1) * time_freq() / GameTickSpeed(), TimeLeft, CSmoothTime::ADJUSTDIRECTION_DOWN);
}
if(m_aReceivedSnapshots[Conn] > 50 && !m_aCodeRunAfterJoin[Conn])
if(m_aReceivedSnapshots[Conn] > GameTickSpeed() && !m_aCodeRunAfterJoin[Conn])
{
if(m_ServerCapabilities.m_ChatTimeoutCode)
{
@ -2466,7 +2464,7 @@ void CClient::Update()
while(true)
{
CSnapshotStorage::CHolder *pCur = m_aapSnapshots[!g_Config.m_ClDummy][SNAP_CURRENT];
int64_t TickStart = (pCur->m_Tick) * time_freq() / 50;
int64_t TickStart = (pCur->m_Tick) * time_freq() / GameTickSpeed();
if(TickStart < Now)
{
@ -2505,7 +2503,7 @@ void CClient::Update()
while(true)
{
CSnapshotStorage::CHolder *pCur = m_aapSnapshots[g_Config.m_ClDummy][SNAP_CURRENT];
int64_t TickStart = (pCur->m_Tick) * time_freq() / 50;
int64_t TickStart = (pCur->m_Tick) * time_freq() / GameTickSpeed();
if(TickStart < Now)
{
@ -2534,23 +2532,23 @@ void CClient::Update()
if(m_aapSnapshots[g_Config.m_ClDummy][SNAP_CURRENT] && m_aapSnapshots[g_Config.m_ClDummy][SNAP_PREV])
{
int64_t CurTickStart = m_aapSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_Tick * time_freq() / SERVER_TICK_SPEED;
int64_t PrevTickStart = m_aapSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_Tick * time_freq() / SERVER_TICK_SPEED;
int PrevPredTick = (int)(PredNow * SERVER_TICK_SPEED / time_freq());
int64_t CurTickStart = m_aapSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_Tick * time_freq() / GameTickSpeed();
int64_t PrevTickStart = m_aapSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_Tick * time_freq() / GameTickSpeed();
int PrevPredTick = (int)(PredNow * GameTickSpeed() / time_freq());
int NewPredTick = PrevPredTick + 1;
m_aGameIntraTick[g_Config.m_ClDummy] = (Now - PrevTickStart) / (float)(CurTickStart - PrevTickStart);
m_aGameTickTime[g_Config.m_ClDummy] = (Now - PrevTickStart) / (float)time_freq();
m_aGameIntraTickSincePrev[g_Config.m_ClDummy] = (Now - PrevTickStart) / (float)(time_freq() / SERVER_TICK_SPEED);
m_aGameIntraTickSincePrev[g_Config.m_ClDummy] = (Now - PrevTickStart) / (float)(time_freq() / GameTickSpeed());
int64_t CurPredTickStart = NewPredTick * time_freq() / SERVER_TICK_SPEED;
int64_t PrevPredTickStart = PrevPredTick * time_freq() / SERVER_TICK_SPEED;
int64_t CurPredTickStart = NewPredTick * time_freq() / GameTickSpeed();
int64_t PrevPredTickStart = PrevPredTick * time_freq() / GameTickSpeed();
m_aPredIntraTick[g_Config.m_ClDummy] = (PredNow - PrevPredTickStart) / (float)(CurPredTickStart - PrevPredTickStart);
if(absolute(NewPredTick - m_aapSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_Tick) > MaxLatencyTicks())
{
m_pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client", "prediction time reset!");
m_PredictedTime.Init(CurTickStart + 2 * time_freq() / SERVER_TICK_SPEED);
m_PredictedTime.Init(CurTickStart + 2 * time_freq() / GameTickSpeed());
}
if(NewPredTick > m_aPredTick[g_Config.m_ClDummy])
@ -4665,8 +4663,8 @@ void CClient::GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float Mix
int64_t PredTime = m_PredictedTime.Get(time_get());
int64_t SmoothTime = clamp(GameTime + (int64_t)(MixAmount * (PredTime - GameTime)), GameTime, PredTime);
*pSmoothTick = (int)(SmoothTime * 50 / time_freq()) + 1;
*pSmoothIntraTick = (SmoothTime - (*pSmoothTick - 1) * time_freq() / 50) / (float)(time_freq() / 50);
*pSmoothTick = (int)(SmoothTime * GameTickSpeed() / time_freq()) + 1;
*pSmoothIntraTick = (SmoothTime - (*pSmoothTick - 1) * time_freq() / GameTickSpeed()) / (float)(time_freq() / GameTickSpeed());
}
void CClient::AddWarning(const SWarning &Warning)
@ -4693,7 +4691,7 @@ SWarning *CClient::GetCurWarning()
int CClient::MaxLatencyTicks() const
{
return SERVER_TICK_SPEED + (PredictionMargin() * SERVER_TICK_SPEED) / 1000;
return GameTickSpeed() + (PredictionMargin() * GameTickSpeed()) / 1000;
}
int CClient::PredictionMargin() const

View file

@ -29,7 +29,6 @@ class IServer : public IInterface
MACRO_INTERFACE("server", 0)
protected:
int m_CurrentGameTick;
int m_TickSpeed;
public:
/*
@ -46,7 +45,7 @@ public:
};
int Tick() const { return m_CurrentGameTick; }
int TickSpeed() const { return m_TickSpeed; }
int TickSpeed() const { return SERVER_TICK_SPEED; }
virtual int Port() const = 0;
virtual int MaxClients() const = 0;

View file

@ -317,8 +317,6 @@ CServer::CServer()
m_aDemoRecorder[i] = CDemoRecorder(&m_SnapshotDelta, true);
m_aDemoRecorder[MAX_CLIENTS] = CDemoRecorder(&m_SnapshotDelta, false);
m_TickSpeed = SERVER_TICK_SPEED;
m_pGameServer = 0;
m_CurrentGameTick = MIN_TICK;
@ -558,7 +556,7 @@ void CServer::RedirectClient(int ClientID, int Port, bool Verbose)
int64_t CServer::TickStartTime(int Tick)
{
return m_GameStartTime + (time_freq() * Tick) / SERVER_TICK_SPEED;
return m_GameStartTime + (time_freq() * Tick) / TickSpeed();
}
int CServer::Init()
@ -943,7 +941,7 @@ void CServer::DoSnapshot()
continue;
// this client is trying to recover, don't spam snapshots
if(m_aClients[i].m_SnapRate == CClient::SNAPRATE_RECOVER && (Tick() % 50) != 0)
if(m_aClients[i].m_SnapRate == CClient::SNAPRATE_RECOVER && (Tick() % TickSpeed()) != 0)
continue;
// this client is trying to recover, don't spam snapshots
@ -970,7 +968,7 @@ void CServer::DoSnapshot()
// remove old snapshots
// keep 3 seconds worth of snapshots
m_aClients[i].m_Snapshots.PurgeUntil(m_CurrentGameTick - SERVER_TICK_SPEED * 3);
m_aClients[i].m_Snapshots.PurgeUntil(m_CurrentGameTick - TickSpeed() * 3);
// save the snapshot
m_aClients[i].m_Snapshots.Add(m_CurrentGameTick, time_get(), SnapshotSize, pData, 0, nullptr);

View file

@ -60,16 +60,16 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemID)
float Ct;
if(m_pClient->Predict() && m_pClient->AntiPingGrenade() && LocalPlayerInGame && !IsOtherTeam)
Ct = ((float)(Client()->PredGameTick(g_Config.m_ClDummy) - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy)) / (float)SERVER_TICK_SPEED;
Ct = ((float)(Client()->PredGameTick(g_Config.m_ClDummy) - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy)) / (float)Client()->GameTickSpeed();
else
Ct = (Client()->PrevGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) / (float)SERVER_TICK_SPEED + s_LastGameTickTime;
Ct = (Client()->PrevGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) / (float)Client()->GameTickSpeed() + s_LastGameTickTime;
if(Ct < 0)
{
if(Ct > -s_LastGameTickTime / 2)
{
// Fixup the timing which might be screwed during demo playback because
// s_LastGameTickTime depends on the system timer, while the other part
// (Client()->PrevGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) / (float)SERVER_TICK_SPEED
// (Client()->PrevGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) / (float)Client()->GameTickSpeed()
// is virtually constant (for projectiles fired on the current game tick):
// (x - (x+2)) / 50 = -0.04
//
@ -309,7 +309,7 @@ void CItems::RenderLaser(const CLaserData *pCurrent, bool IsPredicted)
Ticks = (float)(Client()->PredGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy);
else
Ticks = (float)(Client()->GameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) + Client()->IntraGameTick(g_Config.m_ClDummy);
float Ms = (Ticks / 50.0f) * 1000.0f;
float Ms = (Ticks / Client()->GameTickSpeed()) * 1000.0f;
float a = Ms / m_pClient->GetTuning(TuneZone)->m_LaserBounceDelay;
a = clamp(a, 0.0f, 1.0f);
float Ia = 1 - a;
@ -626,11 +626,11 @@ void CItems::ReconstructSmokeTrail(const CProjectileData *pCurrent, int DestroyT
Speed = pTuning->m_GunSpeed;
}
float Pt = ((float)(Client()->PredGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy)) / (float)SERVER_TICK_SPEED;
float Pt = ((float)(Client()->PredGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy)) / (float)Client()->GameTickSpeed();
if(Pt < 0)
return; // projectile haven't been shot yet
float Gt = (Client()->PrevGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) / (float)SERVER_TICK_SPEED + Client()->GameTickTime(g_Config.m_ClDummy);
float Gt = (Client()->PrevGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) / (float)Client()->GameTickSpeed() + Client()->GameTickTime(g_Config.m_ClDummy);
float Alpha = 1.f;
if(pCurrent->m_ExtraInfo && pCurrent->m_Owner >= 0 && m_pClient->IsOtherTeam(pCurrent->m_Owner))
@ -640,7 +640,7 @@ void CItems::ReconstructSmokeTrail(const CProjectileData *pCurrent, int DestroyT
float T = Pt;
if(DestroyTick >= 0)
T = minimum(Pt, ((float)(DestroyTick - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy)) / (float)SERVER_TICK_SPEED);
T = minimum(Pt, ((float)(DestroyTick - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy)) / (float)Client()->GameTickSpeed());
float MinTrailSpan = 0.4f * ((pCurrent->m_Type == WEAPON_GRENADE) ? 0.5f : 0.25f);
float Step = maximum(Client()->FrameTimeAvg(), (pCurrent->m_Type == WEAPON_GRENADE) ? 0.02f : 0.01f);

View file

@ -287,7 +287,7 @@ void CKillMessages::OnRender()
for(int i = 1; i <= MAX_KILLMSGS; i++)
{
int r = (m_KillmsgCurrent + i) % MAX_KILLMSGS;
if(Client()->GameTick(g_Config.m_ClDummy) > m_aKillmsgs[r].m_Tick + 50 * 10)
if(Client()->GameTick(g_Config.m_ClDummy) > m_aKillmsgs[r].m_Tick + Client()->GameTickSpeed() * 10)
continue;
float x = StartX;

View file

@ -155,7 +155,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
static int s_SkipDurationIndex = 1;
static const int s_aSkipDurationsSeconds[] = {1, 5, 10, 30, 60, 5 * 60, 10 * 60};
const int DemoLengthSeconds = TotalTicks / SERVER_TICK_SPEED;
const int DemoLengthSeconds = TotalTicks / Client()->GameTickSpeed();
int NumDurationLabels = 0;
for(size_t i = 0; i < std::size(s_aSkipDurationsSeconds); ++i)
{
@ -445,9 +445,9 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
// draw time
char aCurrentTime[32];
str_time((int64_t)CurrentTick / SERVER_TICK_SPEED * 100, TIME_HOURS, aCurrentTime, sizeof(aCurrentTime));
str_time((int64_t)CurrentTick / Client()->GameTickSpeed() * 100, TIME_HOURS, aCurrentTime, sizeof(aCurrentTime));
char aTotalTime[32];
str_time((int64_t)TotalTicks / SERVER_TICK_SPEED * 100, TIME_HOURS, aTotalTime, sizeof(aTotalTime));
str_time((int64_t)TotalTicks / Client()->GameTickSpeed() * 100, TIME_HOURS, aTotalTime, sizeof(aTotalTime));
str_format(aBuffer, sizeof(aBuffer), "%s / %s", aCurrentTime, aTotalTime);
UI()->DoLabel(&SeekBar, aBuffer, SeekBar.h * 0.70f, TEXTALIGN_MC);
@ -491,7 +491,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
{
const int HoveredTick = (int)(clamp((UI()->MouseX() - SeekBar.x - Rounding) / (float)(SeekBar.w - 2 * Rounding), 0.0f, 1.0f) * TotalTicks);
static char s_aHoveredTime[32];
str_time((int64_t)HoveredTick / SERVER_TICK_SPEED * 100, TIME_HOURS, s_aHoveredTime, sizeof(s_aHoveredTime));
str_time((int64_t)HoveredTick / Client()->GameTickSpeed() * 100, TIME_HOURS, s_aHoveredTime, sizeof(s_aHoveredTime));
GameClient()->m_Tooltips.DoToolTip(pId, &SeekBar, s_aHoveredTime);
}
}
@ -779,11 +779,11 @@ void CMenus::RenderDemoPlayerSliceSavePopup(CUIRect MainView)
const int64_t RealSliceBegin = g_Config.m_ClDemoSliceBegin == -1 ? 0 : (g_Config.m_ClDemoSliceBegin - pInfo->m_FirstTick);
const int64_t RealSliceEnd = (g_Config.m_ClDemoSliceEnd == -1 ? pInfo->m_LastTick : g_Config.m_ClDemoSliceEnd) - pInfo->m_FirstTick;
char aSliceBegin[32];
str_time(RealSliceBegin / SERVER_TICK_SPEED * 100, TIME_HOURS, aSliceBegin, sizeof(aSliceBegin));
str_time(RealSliceBegin / Client()->GameTickSpeed() * 100, TIME_HOURS, aSliceBegin, sizeof(aSliceBegin));
char aSliceEnd[32];
str_time(RealSliceEnd / SERVER_TICK_SPEED * 100, TIME_HOURS, aSliceEnd, sizeof(aSliceEnd));
str_time(RealSliceEnd / Client()->GameTickSpeed() * 100, TIME_HOURS, aSliceEnd, sizeof(aSliceEnd));
char aSliceLength[32];
str_time((RealSliceEnd - RealSliceBegin) / SERVER_TICK_SPEED * 100, TIME_HOURS, aSliceLength, sizeof(aSliceLength));
str_time((RealSliceEnd - RealSliceBegin) / Client()->GameTickSpeed() * 100, TIME_HOURS, aSliceLength, sizeof(aSliceLength));
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "%s: %s %s", Localize("Cut interval"), aSliceBegin, aSliceEnd);
UI()->DoLabel(&SliceInterval, aBuf, 18.0f, TEXTALIGN_ML);

View file

@ -377,15 +377,15 @@ void CPlayers::RenderPlayer(
}
bool PredictLocalWeapons = false;
float AttackTime = (Client()->PrevGameTick(g_Config.m_ClDummy) - Player.m_AttackTick) / (float)SERVER_TICK_SPEED + Client()->GameTickTime(g_Config.m_ClDummy);
float LastAttackTime = (Client()->PrevGameTick(g_Config.m_ClDummy) - Player.m_AttackTick) / (float)SERVER_TICK_SPEED + s_LastGameTickTime;
float AttackTime = (Client()->PrevGameTick(g_Config.m_ClDummy) - Player.m_AttackTick) / (float)Client()->GameTickSpeed() + Client()->GameTickTime(g_Config.m_ClDummy);
float LastAttackTime = (Client()->PrevGameTick(g_Config.m_ClDummy) - Player.m_AttackTick) / (float)Client()->GameTickSpeed() + s_LastGameTickTime;
if(ClientID >= 0 && m_pClient->m_aClients[ClientID].m_IsPredictedLocal && m_pClient->AntiPingGunfire())
{
PredictLocalWeapons = true;
AttackTime = (Client()->PredIntraGameTick(g_Config.m_ClDummy) + (Client()->PredGameTick(g_Config.m_ClDummy) - 1 - Player.m_AttackTick)) / (float)SERVER_TICK_SPEED;
LastAttackTime = (s_LastPredIntraTick + (Client()->PredGameTick(g_Config.m_ClDummy) - 1 - Player.m_AttackTick)) / (float)SERVER_TICK_SPEED;
AttackTime = (Client()->PredIntraGameTick(g_Config.m_ClDummy) + (Client()->PredGameTick(g_Config.m_ClDummy) - 1 - Player.m_AttackTick)) / (float)Client()->GameTickSpeed();
LastAttackTime = (s_LastPredIntraTick + (Client()->PredGameTick(g_Config.m_ClDummy) - 1 - Player.m_AttackTick)) / (float)Client()->GameTickSpeed();
}
float AttackTicksPassed = AttackTime * (float)SERVER_TICK_SPEED;
float AttackTicksPassed = AttackTime * (float)Client()->GameTickSpeed();
float Angle;
if(Local && (!m_pClient->m_Snap.m_SpecInfo.m_Active || m_pClient->m_Snap.m_SpecInfo.m_SpectatorID != SPEC_FREEVIEW) && Client()->State() != IClient::STATE_DEMOPLAYBACK)

View file

@ -355,7 +355,6 @@ void CGameClient::OnInit()
str_format(aBuf, sizeof(aBuf), "initialisation finished after %.2fms", ((End - Start) * 1000) / (float)time_freq());
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "gameclient", aBuf);
m_GameWorld.m_GameTickSpeed = SERVER_TICK_SPEED;
m_GameWorld.m_pCollision = Collision();
m_GameWorld.m_pTuningList = m_aTuningList;
@ -2581,7 +2580,7 @@ void CGameClient::UpdatePrediction()
}
// advance the gameworld to the current gametick
if(pLocalChar && absolute(m_GameWorld.GameTick() - Client()->GameTick(g_Config.m_ClDummy)) < SERVER_TICK_SPEED)
if(pLocalChar && absolute(m_GameWorld.GameTick() - Client()->GameTick(g_Config.m_ClDummy)) < Client()->GameTickSpeed())
{
for(int Tick = m_GameWorld.GameTick() + 1; Tick <= Client()->GameTick(g_Config.m_ClDummy); Tick++)
{
@ -2712,7 +2711,7 @@ void CGameClient::DetectStrongHook()
int ToPlayer = m_Snap.m_aCharacters[FromPlayer].m_Prev.m_HookedPlayer;
if(ToPlayer < 0 || ToPlayer >= MAX_CLIENTS || !m_Snap.m_aCharacters[ToPlayer].m_Active || ToPlayer != m_Snap.m_aCharacters[FromPlayer].m_Cur.m_HookedPlayer)
continue;
if(absolute(minimum(m_aLastUpdateTick[ToPlayer], m_aLastUpdateTick[FromPlayer]) - Client()->GameTick(g_Config.m_ClDummy)) < SERVER_TICK_SPEED / 4)
if(absolute(minimum(m_aLastUpdateTick[ToPlayer], m_aLastUpdateTick[FromPlayer]) - Client()->GameTick(g_Config.m_ClDummy)) < Client()->GameTickSpeed() / 4)
continue;
if(m_Snap.m_aCharacters[FromPlayer].m_Prev.m_Direction != m_Snap.m_aCharacters[FromPlayer].m_Cur.m_Direction || m_Snap.m_aCharacters[ToPlayer].m_Prev.m_Direction != m_Snap.m_aCharacters[ToPlayer].m_Cur.m_Direction)
continue;

View file

@ -593,7 +593,6 @@ void CGameWorld::CopyWorld(CGameWorld *pFrom)
pFrom->m_pChild = this;
m_GameTick = pFrom->m_GameTick;
m_GameTickSpeed = pFrom->m_GameTickSpeed;
m_pCollision = pFrom->m_pCollision;
m_WorldConfig = pFrom->m_WorldConfig;
for(int i = 0; i < 2; i++)

View file

@ -51,12 +51,11 @@ public:
std::vector<CCharacter *> IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, const CEntity *pNotThis = nullptr);
int m_GameTick;
int m_GameTickSpeed;
CCollision *m_pCollision;
// getter for server variables
int GameTick() { return m_GameTick; }
int GameTickSpeed() { return m_GameTickSpeed; }
int GameTickSpeed() { return SERVER_TICK_SPEED; }
CCollision *Collision() { return m_pCollision; }
CTeamsCore *Teams() { return &m_Teams; }
std::vector<SSwitchers> &Switchers() { return m_Core.m_vSwitchers; }

View file

@ -45,7 +45,6 @@ class CTuningParams
public:
CTuningParams()
{
const float TicksPerSecond = 50.0f;
#define MACRO_TUNING_PARAM(Name, ScriptName, Value, Description) m_##Name.Set((int)((Value)*100.0f));
#include "tuning.h"
#undef MACRO_TUNING_PARAM

View file

@ -1060,7 +1060,7 @@ void CCharacter::SnapCharacter(int SnappingClient, int ID)
if(Emote == EMOTE_NORMAL)
{
if(250 - ((Server()->Tick() - m_LastAction) % (250)) < 5)
if(5 * Server()->TickSpeed() - ((Server()->Tick() - m_LastAction) % (5 * Server()->TickSpeed())) < 5)
Emote = EMOTE_BLINK;
}

View file

@ -181,7 +181,6 @@ void CTeeHistorian::WriteHeader(const CGameInfo *pGameInfo)
First = true;
const float TicksPerSecond = 50.0f;
#define MACRO_TUNING_PARAM(Name, ScriptName, Value, Description) \
if(pGameInfo->m_pTuning->m_##Name.Get() != (int)((Value)*100)) \
{ \

View file

@ -5,11 +5,11 @@
// physics tuning
MACRO_TUNING_PARAM(GroundControlSpeed, ground_control_speed, 10.0f, "Max speed the tee can get on ground")
MACRO_TUNING_PARAM(GroundControlAccel, ground_control_accel, 100.0f / TicksPerSecond, "Acceleration speed on the ground")
MACRO_TUNING_PARAM(GroundControlAccel, ground_control_accel, 100.0f / SERVER_TICK_SPEED, "Acceleration speed on the ground")
MACRO_TUNING_PARAM(GroundFriction, ground_friction, 0.5f, "Friction on the ground")
MACRO_TUNING_PARAM(GroundJumpImpulse, ground_jump_impulse, 13.2f, "Impulse when jumping on ground")
MACRO_TUNING_PARAM(AirJumpImpulse, air_jump_impulse, 12.0f, "Impulse when jumping in air")
MACRO_TUNING_PARAM(AirControlSpeed, air_control_speed, 250.0f / TicksPerSecond, "Max speed the tee can get in the air")
MACRO_TUNING_PARAM(AirControlSpeed, air_control_speed, 250.0f / SERVER_TICK_SPEED, "Max speed the tee can get in the air")
MACRO_TUNING_PARAM(AirControlAccel, air_control_accel, 1.5f, "Acceleration speed in air")
MACRO_TUNING_PARAM(AirFriction, air_friction, 0.95f, "Friction in the air")
MACRO_TUNING_PARAM(HookLength, hook_length, 380.0f, "Length of the hook")