Add: Set Ping to any value you want

This commit is contained in:
def 2013-12-18 16:54:20 +01:00
parent 2d6a4874e3
commit da9ff2a696
3 changed files with 18 additions and 1 deletions

View file

@ -1207,6 +1207,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
{
int InputPredTick = Unpacker.GetInt();
int TimeLeft = Unpacker.GetInt();
int64 Now = time_get();
// adjust our prediction time
int64 Target = 0;
@ -1214,12 +1215,15 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
{
if(m_aInputs[k].m_Tick == InputPredTick)
{
Target = m_aInputs[k].m_PredictedTime + (time_get() - m_aInputs[k].m_Time);
Target = m_aInputs[k].m_PredictedTime + (Now - m_aInputs[k].m_Time);
Target = Target - (int64)(((TimeLeft-PREDICTION_MARGIN)/1000.0f)*time_freq());
break;
}
}
if ((Target - m_GameTime.Get(Now)) / 1000 < g_Config.m_ClSetPing)
Target = m_GameTime.Get(Now) + g_Config.m_ClSetPing * 1000;
if(Target)
m_PredictedTime.Update(&m_InputtimeMarginGraph, Target, TimeLeft, 1);
}

View file

@ -1112,6 +1112,18 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView)
g_Config.m_ClShowChat ^= 1;
}
// Set Ping
{
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_ClSetPing);
MainView.HSplitTop(20.0f, &Button, &MainView);
UI()->DoLabelScaled(&Button, Localize("Set Ping"), 14.0f, -1);
Button.VSplitLeft(190.0f, 0, &Button);
static float Offset = 0.0f;
DoEditBox(&g_Config.m_ClSetPing, &Button, aBuf, sizeof(aBuf), 14.0f, &Offset);
g_Config.m_ClSetPing = min(900, max(0, str_toint(aBuf)));
}
CUIRect aRects[2];
CUIRect Label;
MainView.HSplitTop(5.0f, 0, &MainView);

View file

@ -7,6 +7,7 @@
// client
MACRO_CONFIG_INT(ClPredict, cl_predict, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Predict client movements")
MACRO_CONFIG_INT(ClSetPing, cl_setping, 0, 0, 900, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Set ping (in ms; prediction time is increased as if you have that ping)")
MACRO_CONFIG_INT(ClAntiPing, cl_antiping, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Antiping (predict other players' movements)")
MACRO_CONFIG_INT(ClAntiPingGrenade, cl_antiping_grenade, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Antiping (predict grenades)")
MACRO_CONFIG_INT(ClNameplates, cl_nameplates, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show name plates")