diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index 68eebbb9a..a8ca987cb 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -308,7 +308,7 @@ void CHud::MapscreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup) Graphics()->MapScreen(Points[0], Points[1], Points[2], Points[3]); } -void CHud::RenderFps() +void CHud::RenderTextInfo() { if(g_Config.m_ClShowfps) { @@ -319,6 +319,13 @@ void CHud::RenderFps() str_format(Buf, sizeof(Buf), "%d", (int)m_AverageFPS); TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,Buf,-1), 5, 12, Buf, -1); } + + if(g_Config.m_ClShowping) + { + char aBuf[64]; + str_format(aBuf, sizeof(aBuf), "%d", clamp(m_pClient->m_Snap.m_pLocalInfo->m_Latency, 0, 1000)); + TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,aBuf,-1), g_Config.m_ClShowfps ? 20 : 5, 12, aBuf, -1); + } } void CHud::RenderConnectionWarning() @@ -586,7 +593,7 @@ void CHud::OnRender() if (g_Config.m_ClShowhudScore) RenderScoreHud(); RenderWarmupTimer(); - RenderFps(); + RenderTextInfo(); RenderLocalTime((m_Width/7)*3); if(Client()->State() != IClient::STATE_DEMOPLAYBACK) RenderConnectionWarning(); diff --git a/src/game/client/components/hud.h b/src/game/client/components/hud.h index 2537a1ef2..03b719a58 100644 --- a/src/game/client/components/hud.h +++ b/src/game/client/components/hud.h @@ -11,7 +11,7 @@ class CHud : public CComponent void RenderCursor(); - void RenderFps(); + void RenderTextInfo(); void RenderConnectionWarning(); void RenderTeambalanceWarning(); void RenderVoting(); diff --git a/src/game/client/components/killmessages.cpp b/src/game/client/components/killmessages.cpp index 772bd1f82..07ca1e927 100644 --- a/src/game/client/components/killmessages.cpp +++ b/src/game/client/components/killmessages.cpp @@ -54,9 +54,7 @@ void CKillMessages::OnRender() Graphics()->MapScreen(0, 0, Width*1.5f, Height*1.5f); float StartX = Width*1.5f-10.0f; - float y = 20.0f; - if(g_Config.m_ClShowfps) - y = 150.0f; + float y = 30.0f + 100.0f * (g_Config.m_ClShowfps + g_Config.m_ClShowping); for(int i = 1; i <= MAX_KILLMSGS; i++) { diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 207215c6b..1c82da654 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -263,6 +263,8 @@ void CPlayer::PostTick() m_aActLatency[i] = GameServer()->m_apPlayers[i]->m_Latency.m_Min; } } + else + m_aActLatency[m_ClientID] = GameServer()->m_apPlayers[m_ClientID]->m_Latency.m_Min; // update view pos for spectators if((m_Team == TEAM_SPECTATORS || m_Paused) && m_SpectatorID != SPEC_FREEVIEW && GameServer()->m_apPlayers[m_SpectatorID] && GameServer()->m_apPlayers[m_SpectatorID]->GetCharacter()) diff --git a/src/game/variables.h b/src/game/variables.h index ff77bf9c0..5fa371680 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -36,6 +36,7 @@ MACRO_CONFIG_INT(ClShowKillMessages, cl_showkillmessages, 1, 0, 1, CFGFLAG_CLIEN MACRO_CONFIG_INT(ClShowVotesAfterVoting, cl_show_votes_after_voting, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show votes window after voting") MACRO_CONFIG_INT(ClShowLocalTimeAlways, cl_show_local_time_always, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Always show local time") MACRO_CONFIG_INT(ClShowfps, cl_showfps, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame FPS counter") +MACRO_CONFIG_INT(ClShowping, cl_showping, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame ping counter") MACRO_CONFIG_INT(ClEyeWheel, cl_eye_wheel, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show eye wheel along together with emotes") MACRO_CONFIG_INT(ClEyeDuration, cl_eye_duration, 999999, 1, 999999, CFGFLAG_CLIENT|CFGFLAG_SAVE, "How long the eyes emotes last")