Added cl_showping

This commit is contained in:
Ryozuki 2016-05-03 16:06:10 +02:00
parent 43479e3768
commit 5c7856ee59
5 changed files with 14 additions and 6 deletions

View file

@ -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();

View file

@ -11,7 +11,7 @@ class CHud : public CComponent
void RenderCursor();
void RenderFps();
void RenderTextInfo();
void RenderConnectionWarning();
void RenderTeambalanceWarning();
void RenderVoting();

View file

@ -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++)
{

View file

@ -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())

View file

@ -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")