mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 14:08:19 +00:00
Replace 50
with SERVER_TICK_SPEED
or TickSpeed()
This commit is contained in:
parent
6fc27bea8c
commit
b9fd612ef5
|
@ -304,7 +304,7 @@ void CClient::Rcon(const char *pCmd)
|
||||||
|
|
||||||
bool CClient::ConnectionProblems() const
|
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)
|
void CClient::DirectInput(int *pInput, int Size)
|
||||||
|
@ -743,7 +743,7 @@ int CClient::GetCurrentRaceTime()
|
||||||
{
|
{
|
||||||
if(GameClient()->GetLastRaceTick() < 0)
|
if(GameClient()->GetLastRaceTick() < 0)
|
||||||
return 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
|
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
|
// start at 200ms and work from there
|
||||||
if(!Dummy)
|
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.SetAdjustSpeed(CSmoothTime::ADJUSTDIRECTION_UP, 1000.0f);
|
||||||
m_PredictedTime.UpdateMargin(PredictionMargin() * time_freq() / 1000);
|
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_PREV] = m_aSnapshotStorage[Conn].m_pFirst;
|
||||||
m_aapSnapshots[Conn][SNAP_CURRENT] = m_aSnapshotStorage[Conn].m_pLast;
|
m_aapSnapshots[Conn][SNAP_CURRENT] = m_aSnapshotStorage[Conn].m_pLast;
|
||||||
if(!Dummy)
|
if(!Dummy)
|
||||||
|
@ -1930,12 +1930,12 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
|
||||||
if(m_aReceivedSnapshots[Conn] > 2)
|
if(m_aReceivedSnapshots[Conn] > 2)
|
||||||
{
|
{
|
||||||
int64_t Now = m_aGameTime[Conn].Get(time_get());
|
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();
|
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)
|
if(m_ServerCapabilities.m_ChatTimeoutCode)
|
||||||
{
|
{
|
||||||
|
@ -2466,7 +2466,7 @@ void CClient::Update()
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
CSnapshotStorage::CHolder *pCur = m_aapSnapshots[!g_Config.m_ClDummy][SNAP_CURRENT];
|
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)
|
if(TickStart < Now)
|
||||||
{
|
{
|
||||||
|
@ -2505,7 +2505,7 @@ void CClient::Update()
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
CSnapshotStorage::CHolder *pCur = m_aapSnapshots[g_Config.m_ClDummy][SNAP_CURRENT];
|
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)
|
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])
|
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 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() / SERVER_TICK_SPEED;
|
int64_t PrevTickStart = m_aapSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_Tick * time_freq() / GameTickSpeed();
|
||||||
int PrevPredTick = (int)(PredNow * SERVER_TICK_SPEED / time_freq());
|
int PrevPredTick = (int)(PredNow * GameTickSpeed() / time_freq());
|
||||||
int NewPredTick = PrevPredTick + 1;
|
int NewPredTick = PrevPredTick + 1;
|
||||||
|
|
||||||
m_aGameIntraTick[g_Config.m_ClDummy] = (Now - PrevTickStart) / (float)(CurTickStart - PrevTickStart);
|
m_aGameIntraTick[g_Config.m_ClDummy] = (Now - PrevTickStart) / (float)(CurTickStart - PrevTickStart);
|
||||||
m_aGameTickTime[g_Config.m_ClDummy] = (Now - PrevTickStart) / (float)time_freq();
|
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 CurPredTickStart = NewPredTick * time_freq() / GameTickSpeed();
|
||||||
int64_t PrevPredTickStart = PrevPredTick * time_freq() / SERVER_TICK_SPEED;
|
int64_t PrevPredTickStart = PrevPredTick * time_freq() / GameTickSpeed();
|
||||||
m_aPredIntraTick[g_Config.m_ClDummy] = (PredNow - PrevPredTickStart) / (float)(CurPredTickStart - PrevPredTickStart);
|
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())
|
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_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])
|
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 PredTime = m_PredictedTime.Get(time_get());
|
||||||
int64_t SmoothTime = clamp(GameTime + (int64_t)(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 * GameTickSpeed() / time_freq()) + 1;
|
||||||
*pSmoothIntraTick = (SmoothTime - (*pSmoothTick - 1) * time_freq() / 50) / (float)(time_freq() / 50);
|
*pSmoothIntraTick = (SmoothTime - (*pSmoothTick - 1) * time_freq() / GameTickSpeed()) / (float)(time_freq() / GameTickSpeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClient::AddWarning(const SWarning &Warning)
|
void CClient::AddWarning(const SWarning &Warning)
|
||||||
|
@ -4693,7 +4693,7 @@ SWarning *CClient::GetCurWarning()
|
||||||
|
|
||||||
int CClient::MaxLatencyTicks() const
|
int CClient::MaxLatencyTicks() const
|
||||||
{
|
{
|
||||||
return SERVER_TICK_SPEED + (PredictionMargin() * SERVER_TICK_SPEED) / 1000;
|
return GameTickSpeed() + (PredictionMargin() * GameTickSpeed()) / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CClient::PredictionMargin() const
|
int CClient::PredictionMargin() const
|
||||||
|
|
|
@ -317,7 +317,7 @@ CServer::CServer()
|
||||||
m_aDemoRecorder[i] = CDemoRecorder(&m_SnapshotDelta, true);
|
m_aDemoRecorder[i] = CDemoRecorder(&m_SnapshotDelta, true);
|
||||||
m_aDemoRecorder[MAX_CLIENTS] = CDemoRecorder(&m_SnapshotDelta, false);
|
m_aDemoRecorder[MAX_CLIENTS] = CDemoRecorder(&m_SnapshotDelta, false);
|
||||||
|
|
||||||
m_TickSpeed = SERVER_TICK_SPEED;
|
m_TickSpeed = TickSpeed();
|
||||||
|
|
||||||
m_pGameServer = 0;
|
m_pGameServer = 0;
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ void CServer::RedirectClient(int ClientID, int Port, bool Verbose)
|
||||||
|
|
||||||
int64_t 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) / TickSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CServer::Init()
|
int CServer::Init()
|
||||||
|
@ -943,7 +943,7 @@ void CServer::DoSnapshot()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// this client is trying to recover, don't spam snapshots
|
// 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;
|
continue;
|
||||||
|
|
||||||
// this client is trying to recover, don't spam snapshots
|
// this client is trying to recover, don't spam snapshots
|
||||||
|
@ -970,7 +970,7 @@ void CServer::DoSnapshot()
|
||||||
|
|
||||||
// remove old snapshots
|
// remove old snapshots
|
||||||
// keep 3 seconds worth of 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
|
// save the snapshot
|
||||||
m_aClients[i].m_Snapshots.Add(m_CurrentGameTick, time_get(), SnapshotSize, pData, 0, nullptr);
|
m_aClients[i].m_Snapshots.Add(m_CurrentGameTick, time_get(), SnapshotSize, pData, 0, nullptr);
|
||||||
|
|
|
@ -60,16 +60,16 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemID)
|
||||||
|
|
||||||
float Ct;
|
float Ct;
|
||||||
if(m_pClient->Predict() && m_pClient->AntiPingGrenade() && LocalPlayerInGame && !IsOtherTeam)
|
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
|
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 < 0)
|
||||||
{
|
{
|
||||||
if(Ct > -s_LastGameTickTime / 2)
|
if(Ct > -s_LastGameTickTime / 2)
|
||||||
{
|
{
|
||||||
// Fixup the timing which might be screwed during demo playback because
|
// Fixup the timing which might be screwed during demo playback because
|
||||||
// s_LastGameTickTime depends on the system timer, while the other part
|
// 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):
|
// is virtually constant (for projectiles fired on the current game tick):
|
||||||
// (x - (x+2)) / 50 = -0.04
|
// (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);
|
Ticks = (float)(Client()->PredGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy);
|
||||||
else
|
else
|
||||||
Ticks = (float)(Client()->GameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) + Client()->IntraGameTick(g_Config.m_ClDummy);
|
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;
|
float a = Ms / m_pClient->GetTuning(TuneZone)->m_LaserBounceDelay;
|
||||||
a = clamp(a, 0.0f, 1.0f);
|
a = clamp(a, 0.0f, 1.0f);
|
||||||
float Ia = 1 - a;
|
float Ia = 1 - a;
|
||||||
|
@ -626,11 +626,11 @@ void CItems::ReconstructSmokeTrail(const CProjectileData *pCurrent, int DestroyT
|
||||||
Speed = pTuning->m_GunSpeed;
|
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)
|
if(Pt < 0)
|
||||||
return; // projectile haven't been shot yet
|
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;
|
float Alpha = 1.f;
|
||||||
if(pCurrent->m_ExtraInfo && pCurrent->m_Owner >= 0 && m_pClient->IsOtherTeam(pCurrent->m_Owner))
|
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;
|
float T = Pt;
|
||||||
if(DestroyTick >= 0)
|
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 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);
|
float Step = maximum(Client()->FrameTimeAvg(), (pCurrent->m_Type == WEAPON_GRENADE) ? 0.02f : 0.01f);
|
||||||
|
|
|
@ -287,7 +287,7 @@ void CKillMessages::OnRender()
|
||||||
for(int i = 1; i <= MAX_KILLMSGS; i++)
|
for(int i = 1; i <= MAX_KILLMSGS; i++)
|
||||||
{
|
{
|
||||||
int r = (m_KillmsgCurrent + i) % MAX_KILLMSGS;
|
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;
|
continue;
|
||||||
|
|
||||||
float x = StartX;
|
float x = StartX;
|
||||||
|
|
|
@ -155,7 +155,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
|
|
||||||
static int s_SkipDurationIndex = 1;
|
static int s_SkipDurationIndex = 1;
|
||||||
static const int s_aSkipDurationsSeconds[] = {1, 5, 10, 30, 60, 5 * 60, 10 * 60};
|
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;
|
int NumDurationLabels = 0;
|
||||||
for(size_t i = 0; i < std::size(s_aSkipDurationsSeconds); ++i)
|
for(size_t i = 0; i < std::size(s_aSkipDurationsSeconds); ++i)
|
||||||
{
|
{
|
||||||
|
@ -445,9 +445,9 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
|
|
||||||
// draw time
|
// draw time
|
||||||
char aCurrentTime[32];
|
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];
|
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);
|
str_format(aBuffer, sizeof(aBuffer), "%s / %s", aCurrentTime, aTotalTime);
|
||||||
UI()->DoLabel(&SeekBar, aBuffer, SeekBar.h * 0.70f, TEXTALIGN_MC);
|
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);
|
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];
|
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);
|
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 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;
|
const int64_t RealSliceEnd = (g_Config.m_ClDemoSliceEnd == -1 ? pInfo->m_LastTick : g_Config.m_ClDemoSliceEnd) - pInfo->m_FirstTick;
|
||||||
char aSliceBegin[32];
|
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];
|
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];
|
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];
|
char aBuf[256];
|
||||||
str_format(aBuf, sizeof(aBuf), "%s: %s – %s", Localize("Cut interval"), aSliceBegin, aSliceEnd);
|
str_format(aBuf, sizeof(aBuf), "%s: %s – %s", Localize("Cut interval"), aSliceBegin, aSliceEnd);
|
||||||
UI()->DoLabel(&SliceInterval, aBuf, 18.0f, TEXTALIGN_ML);
|
UI()->DoLabel(&SliceInterval, aBuf, 18.0f, TEXTALIGN_ML);
|
||||||
|
|
|
@ -377,15 +377,15 @@ void CPlayers::RenderPlayer(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PredictLocalWeapons = false;
|
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 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)SERVER_TICK_SPEED + s_LastGameTickTime;
|
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())
|
if(ClientID >= 0 && m_pClient->m_aClients[ClientID].m_IsPredictedLocal && m_pClient->AntiPingGunfire())
|
||||||
{
|
{
|
||||||
PredictLocalWeapons = true;
|
PredictLocalWeapons = true;
|
||||||
AttackTime = (Client()->PredIntraGameTick(g_Config.m_ClDummy) + (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)SERVER_TICK_SPEED;
|
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;
|
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)
|
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)
|
||||||
|
|
|
@ -355,7 +355,7 @@ void CGameClient::OnInit()
|
||||||
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);
|
||||||
|
|
||||||
m_GameWorld.m_GameTickSpeed = SERVER_TICK_SPEED;
|
m_GameWorld.m_GameTickSpeed = Client()->GameTickSpeed();
|
||||||
m_GameWorld.m_pCollision = Collision();
|
m_GameWorld.m_pCollision = Collision();
|
||||||
m_GameWorld.m_pTuningList = m_aTuningList;
|
m_GameWorld.m_pTuningList = m_aTuningList;
|
||||||
|
|
||||||
|
@ -2557,7 +2557,7 @@ void CGameClient::UpdatePrediction()
|
||||||
}
|
}
|
||||||
|
|
||||||
// advance the gameworld to the current gametick
|
// 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++)
|
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;
|
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)
|
if(ToPlayer < 0 || ToPlayer >= MAX_CLIENTS || !m_Snap.m_aCharacters[ToPlayer].m_Active || ToPlayer != m_Snap.m_aCharacters[FromPlayer].m_Cur.m_HookedPlayer)
|
||||||
continue;
|
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;
|
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)
|
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;
|
continue;
|
||||||
|
|
|
@ -45,7 +45,6 @@ class CTuningParams
|
||||||
public:
|
public:
|
||||||
CTuningParams()
|
CTuningParams()
|
||||||
{
|
{
|
||||||
const float TicksPerSecond = 50.0f;
|
|
||||||
#define MACRO_TUNING_PARAM(Name, ScriptName, Value, Description) m_##Name.Set((int)((Value)*100.0f));
|
#define MACRO_TUNING_PARAM(Name, ScriptName, Value, Description) m_##Name.Set((int)((Value)*100.0f));
|
||||||
#include "tuning.h"
|
#include "tuning.h"
|
||||||
#undef MACRO_TUNING_PARAM
|
#undef MACRO_TUNING_PARAM
|
||||||
|
|
|
@ -1060,7 +1060,7 @@ void CCharacter::SnapCharacter(int SnappingClient, int ID)
|
||||||
|
|
||||||
if(Emote == EMOTE_NORMAL)
|
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;
|
Emote = EMOTE_BLINK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,6 @@ void CTeeHistorian::WriteHeader(const CGameInfo *pGameInfo)
|
||||||
|
|
||||||
First = true;
|
First = true;
|
||||||
|
|
||||||
const float TicksPerSecond = 50.0f;
|
|
||||||
#define MACRO_TUNING_PARAM(Name, ScriptName, Value, Description) \
|
#define MACRO_TUNING_PARAM(Name, ScriptName, Value, Description) \
|
||||||
if(pGameInfo->m_pTuning->m_##Name.Get() != (int)((Value)*100)) \
|
if(pGameInfo->m_pTuning->m_##Name.Get() != (int)((Value)*100)) \
|
||||||
{ \
|
{ \
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
|
|
||||||
// physics tuning
|
// physics tuning
|
||||||
MACRO_TUNING_PARAM(GroundControlSpeed, ground_control_speed, 10.0f, "Max speed the tee can get on ground")
|
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(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(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(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(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(AirFriction, air_friction, 0.95f, "Friction in the air")
|
||||||
MACRO_TUNING_PARAM(HookLength, hook_length, 380.0f, "Length of the hook")
|
MACRO_TUNING_PARAM(HookLength, hook_length, 380.0f, "Length of the hook")
|
||||||
|
|
Loading…
Reference in a new issue