Merge pull request #466 from Ryozuki/pr_showpred

Fixed cl_showping (now cl_showpred)
This commit is contained in:
Dennis Felsing 2016-05-05 18:59:01 +02:00
commit e7af8cfdd7
7 changed files with 14 additions and 10 deletions

View file

@ -140,6 +140,8 @@ public:
virtual void CheckVersionUpdate() = 0;
virtual int GetPredictionTime() = 0;
// snapshot interface
enum

View file

@ -933,7 +933,6 @@ void CClient::DebugRender()
static NETSTATS Prev, Current;
static int64 LastSnap = 0;
static float FrameTimeAvg = 0;
int64 Now = time_get();
char aBuffer[512];
if(!g_Config.m_Debug)
@ -999,8 +998,7 @@ void CClient::DebugRender()
}
}
str_format(aBuffer, sizeof(aBuffer), "pred: %d ms",
(int)((m_PredictedTime.Get(Now)-m_GameTime[g_Config.m_ClDummy].Get(Now))*1000/(float)time_freq()));
str_format(aBuffer, sizeof(aBuffer), "pred: %d ms", GetPredictionTime());
Graphics()->QuadsText(2, 70, 16, aBuffer);
Graphics()->QuadsEnd();
@ -3548,3 +3546,9 @@ void CClient::RequestDDNetSrvList()
Packet.m_Flags = NETSENDFLAG_CONNLESS;
m_NetClient[g_Config.m_ClDummy].Send(&Packet);
}
int CClient::GetPredictionTime()
{
int64 Now = time_get();
return (int)((m_PredictedTime.Get(Now)-m_GameTime[g_Config.m_ClDummy].Get(Now))*1000/(float)time_freq());
}

View file

@ -270,6 +270,7 @@ public:
// ---
int GetPredictionTime();
void *SnapGetItem(int SnapID, int Index, CSnapItem *pItem);
void SnapInvalidateItem(int SnapID, int Index);
void *SnapFindItem(int SnapID, int Type, int ID);

View file

@ -319,11 +319,10 @@ void CHud::RenderTextInfo()
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)
if(g_Config.m_ClShowpred)
{
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%d", clamp(m_pClient->m_Snap.m_pLocalInfo->m_Latency, 0, 1000));
str_format(aBuf, sizeof(aBuf), "%d", Client()->GetPredictionTime());
TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,aBuf,-1), g_Config.m_ClShowfps ? 20 : 5, 12, aBuf, -1);
}
}

View file

@ -54,7 +54,7 @@ void CKillMessages::OnRender()
Graphics()->MapScreen(0, 0, Width*1.5f, Height*1.5f);
float StartX = Width*1.5f-10.0f;
float y = 30.0f + 100.0f * (g_Config.m_ClShowfps + g_Config.m_ClShowping);
float y = 30.0f + 100.0f * (g_Config.m_ClShowfps + g_Config.m_ClShowpred);
for(int i = 1; i <= MAX_KILLMSGS; i++)
{

View file

@ -263,8 +263,6 @@ 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,7 +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(ClShowpred, cl_showpred, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame prediction time in milliseconds")
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")