From b9fd612ef575aa015c1e0fd1bc1af542cf9731f4 Mon Sep 17 00:00:00 2001 From: furo Date: Thu, 23 Nov 2023 14:42:30 +0100 Subject: [PATCH] Replace `50` with `SERVER_TICK_SPEED` or `TickSpeed()` --- src/engine/client/client.cpp | 38 ++++++++++----------- src/engine/server/server.cpp | 8 ++--- src/game/client/components/items.cpp | 14 ++++---- src/game/client/components/killmessages.cpp | 2 +- src/game/client/components/menus_demo.cpp | 14 ++++---- src/game/client/components/players.cpp | 10 +++--- src/game/client/gameclient.cpp | 6 ++-- src/game/gamecore.h | 1 - src/game/server/entities/character.cpp | 2 +- src/game/server/teehistorian.cpp | 1 - src/game/tuning.h | 4 +-- 11 files changed, 49 insertions(+), 51 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index c9dbcbbf4..26a7b3c56 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -304,7 +304,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 +743,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 +1904,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 +1930,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 +2466,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 +2505,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 +2534,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 +4665,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 +4693,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 diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index b26c911c1..f142996fe 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -317,7 +317,7 @@ CServer::CServer() m_aDemoRecorder[i] = CDemoRecorder(&m_SnapshotDelta, true); m_aDemoRecorder[MAX_CLIENTS] = CDemoRecorder(&m_SnapshotDelta, false); - m_TickSpeed = SERVER_TICK_SPEED; + m_TickSpeed = TickSpeed(); m_pGameServer = 0; @@ -558,7 +558,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 +943,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 +970,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); diff --git a/src/game/client/components/items.cpp b/src/game/client/components/items.cpp index 41043f354..d3f8b21dd 100644 --- a/src/game/client/components/items.cpp +++ b/src/game/client/components/items.cpp @@ -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); diff --git a/src/game/client/components/killmessages.cpp b/src/game/client/components/killmessages.cpp index 82ec93a53..ac62949c9 100644 --- a/src/game/client/components/killmessages.cpp +++ b/src/game/client/components/killmessages.cpp @@ -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; diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index 578280fa9..3e69044e9 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -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); diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index 6fa651167..87cd222a0 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -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) diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index c9a0db2ad..b2e66bafd 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -355,7 +355,7 @@ 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_GameTickSpeed = Client()->GameTickSpeed(); m_GameWorld.m_pCollision = Collision(); m_GameWorld.m_pTuningList = m_aTuningList; @@ -2557,7 +2557,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++) { @@ -2688,7 +2688,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; diff --git a/src/game/gamecore.h b/src/game/gamecore.h index 26341a783..8c81c00bd 100644 --- a/src/game/gamecore.h +++ b/src/game/gamecore.h @@ -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 diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 3c4e702d4..7f177835c 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -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; } diff --git a/src/game/server/teehistorian.cpp b/src/game/server/teehistorian.cpp index d0bc838db..083ccd65d 100644 --- a/src/game/server/teehistorian.cpp +++ b/src/game/server/teehistorian.cpp @@ -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)) \ { \ diff --git a/src/game/tuning.h b/src/game/tuning.h index 887f43f97..ac6340012 100644 --- a/src/game/tuning.h +++ b/src/game/tuning.h @@ -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")