Don't reset antiping subconfiguration on startup

This commit is contained in:
heinrich5991 2015-09-10 12:09:38 +01:00
parent 2d404bdfa0
commit ba4eab1f1c
5 changed files with 23 additions and 29 deletions

View file

@ -57,7 +57,7 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
int PrevTick = Client()->PrevGameTick(); int PrevTick = Client()->PrevGameTick();
if (g_Config.m_ClAntiPingGrenade && LocalPlayerInGame && !(Client()->State() == IClient::STATE_DEMOPLAYBACK)) if (m_pClient->AntiPingGrenade() && LocalPlayerInGame && !(Client()->State() == IClient::STATE_DEMOPLAYBACK))
{ {
// calc predicted game tick // calc predicted game tick
static int Offset = 0; static int Offset = 0;

View file

@ -88,7 +88,7 @@ void CNamePlates::RenderNameplate(
void CNamePlates::OnRender() void CNamePlates::OnRender()
{ {
if (!g_Config.m_ClNameplates || g_Config.m_ClAntiPingPlayers) if (!g_Config.m_ClNameplates || m_pClient->AntiPingPlayers())
return; return;
for(int i = 0; i < MAX_CLIENTS; i++) for(int i = 0; i < MAX_CLIENTS; i++)

View file

@ -257,7 +257,7 @@ void CPlayers::RenderHook(
// set size // set size
RenderInfo.m_Size = 64.0f; RenderInfo.m_Size = 64.0f;
if (!g_Config.m_ClAntiPingPlayers) if (!m_pClient->AntiPingPlayers())
{ {
// use preditect players if needed // use preditect players if needed
if(pInfo.m_Local && g_Config.m_ClPredict && Client()->State() != IClient::STATE_DEMOPLAYBACK) if(pInfo.m_Local && g_Config.m_ClPredict && Client()->State() != IClient::STATE_DEMOPLAYBACK)
@ -290,7 +290,7 @@ void CPlayers::RenderHook(
} }
vec2 Position; vec2 Position;
if (!g_Config.m_ClAntiPingPlayers) if (!m_pClient->AntiPingPlayers())
Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick); Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick);
else else
Position = parPosition; Position = parPosition;
@ -305,7 +305,7 @@ void CPlayers::RenderHook(
vec2 Pos = Position; vec2 Pos = Position;
vec2 HookPos; vec2 HookPos;
if (!g_Config.m_ClAntiPingPlayers) if (!m_pClient->AntiPingPlayers())
{ {
if(pPlayerChar->m_HookedPlayer != -1) if(pPlayerChar->m_HookedPlayer != -1)
{ {
@ -440,7 +440,7 @@ void CPlayers::RenderPlayer(
// use preditect players if needed // use preditect players if needed
if (!g_Config.m_ClAntiPingPlayers) if (!m_pClient->AntiPingPlayers())
{ {
if(pInfo.m_Local && g_Config.m_ClPredict && Client()->State() != IClient::STATE_DEMOPLAYBACK) if(pInfo.m_Local && g_Config.m_ClPredict && Client()->State() != IClient::STATE_DEMOPLAYBACK)
{ {
@ -475,7 +475,7 @@ void CPlayers::RenderPlayer(
vec2 Direction = GetDirection((int)(Angle*256.0f)); vec2 Direction = GetDirection((int)(Angle*256.0f));
vec2 Position; vec2 Position;
if (!g_Config.m_ClAntiPingPlayers) if (!m_pClient->AntiPingPlayers())
Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick); Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick);
else else
Position = parPosition; Position = parPosition;
@ -878,7 +878,7 @@ void CPlayers::RenderPlayer(
Graphics()->QuadsEnd(); Graphics()->QuadsEnd();
} }
if(g_Config.m_ClNameplates && g_Config.m_ClAntiPingPlayers) if(g_Config.m_ClNameplates && m_pClient->AntiPingPlayers())
{ {
float FontSize = 18.0f + 20.0f * g_Config.m_ClNameplatesSize / 100.0f; float FontSize = 18.0f + 20.0f * g_Config.m_ClNameplatesSize / 100.0f;
float FontSizeClan = 18.0f + 20.0f * g_Config.m_ClNameplatesClanSize / 100.0f; float FontSizeClan = 18.0f + 20.0f * g_Config.m_ClNameplatesClanSize / 100.0f;
@ -972,7 +972,7 @@ void CPlayers::OnRender()
static int predcnt = 0; static int predcnt = 0;
if (g_Config.m_ClAntiPingPlayers) if (m_pClient->AntiPingPlayers())
{ {
for(int i = 0; i < MAX_CLIENTS; i++) for(int i = 0; i < MAX_CLIENTS; i++)
{ {
@ -999,7 +999,7 @@ void CPlayers::OnRender()
} }
} }
if(g_Config.m_ClAntiPingPlayers && g_Config.m_ClPredict && Client()->State() != IClient::STATE_DEMOPLAYBACK) if(m_pClient->AntiPingPlayers() && g_Config.m_ClPredict && Client()->State() != IClient::STATE_DEMOPLAYBACK)
if(m_pClient->m_Snap.m_pLocalCharacter && !(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_GAMEOVER)) if(m_pClient->m_Snap.m_pLocalCharacter && !(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_GAMEOVER))
{ {
// double ping = m_pClient->m_Snap.m_pLocalInfo->m_Latency; // double ping = m_pClient->m_Snap.m_pLocalInfo->m_Latency;

View file

@ -461,7 +461,7 @@ void CGameClient::UpdatePositions()
// local character position // local character position
if(g_Config.m_ClPredict && Client()->State() != IClient::STATE_DEMOPLAYBACK) if(g_Config.m_ClPredict && Client()->State() != IClient::STATE_DEMOPLAYBACK)
{ {
if (!g_Config.m_ClAntiPingPlayers) if(!AntiPingPlayers())
{ {
if(!m_Snap.m_pLocalCharacter || (m_Snap.m_pGameInfoObj && m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_GAMEOVER)) if(!m_Snap.m_pLocalCharacter || (m_Snap.m_pGameInfoObj && m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_GAMEOVER))
{ {
@ -488,7 +488,7 @@ void CGameClient::UpdatePositions()
vec2(m_Snap.m_pLocalCharacter->m_X, m_Snap.m_pLocalCharacter->m_Y), Client()->IntraGameTick()); vec2(m_Snap.m_pLocalCharacter->m_X, m_Snap.m_pLocalCharacter->m_Y), Client()->IntraGameTick());
} }
if (g_Config.m_ClAntiPingPlayers) if (AntiPingPlayers())
{ {
for (int i = 0; i < MAX_CLIENTS; i++) for (int i = 0; i < MAX_CLIENTS; i++)
{ {
@ -579,14 +579,6 @@ void CGameClient::OnRender()
m_NewTick = false; m_NewTick = false;
m_NewPredictedTick = false; m_NewPredictedTick = false;
if(g_Config.m_ClAntiPing != m_CurrentAntiPing)
{
g_Config.m_ClAntiPingPlayers = g_Config.m_ClAntiPing;
g_Config.m_ClAntiPingGrenade = g_Config.m_ClAntiPing;
g_Config.m_ClAntiPingWeapons = g_Config.m_ClAntiPing;
m_CurrentAntiPing = g_Config.m_ClAntiPing;
}
if(g_Config.m_ClDummy && !Client()->DummyConnected()) if(g_Config.m_ClDummy && !Client()->DummyConnected())
g_Config.m_ClDummy = 0; g_Config.m_ClDummy = 0;
@ -664,7 +656,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, bool IsDummy)
g_GameClient.m_pItems->AddExtraProjectile(&Proj); g_GameClient.m_pItems->AddExtraProjectile(&Proj);
if(g_Config.m_ClAntiPingWeapons && Proj.m_Type == WEAPON_GRENADE && !UseExtraInfo(&Proj)) if(AntiPingWeapons() && Proj.m_Type == WEAPON_GRENADE && !UseExtraInfo(&Proj))
{ {
vec2 StartPos; vec2 StartPos;
vec2 Direction; vec2 Direction;
@ -1310,7 +1302,7 @@ void CGameClient::OnPredict()
} }
static bool IsWeaker[2][MAX_CLIENTS] = {{0}}; static bool IsWeaker[2][MAX_CLIENTS] = {{0}};
if(g_Config.m_ClAntiPingPlayers) if(AntiPingPlayers())
FindWeaker(IsWeaker); FindWeaker(IsWeaker);
// repredict character // repredict character
@ -1338,7 +1330,7 @@ void CGameClient::OnPredict()
int ReloadTimer = 0; int ReloadTimer = 0;
vec2 PrevPos; vec2 PrevPos;
if(g_Config.m_ClAntiPingWeapons) if(AntiPingWeapons())
{ {
for(int Index = 0; Index < MaxProjectiles; Index++) for(int Index = 0; Index < MaxProjectiles; Index++)
PredictedProjectiles[Index].Deactivate(); PredictedProjectiles[Index].Deactivate();
@ -1419,7 +1411,7 @@ void CGameClient::OnPredict()
} }
} }
if(g_Config.m_ClAntiPingWeapons) if(AntiPingWeapons())
{ {
const float ProximityRadius = 28.0f; const float ProximityRadius = 28.0f;
CNetObj_PlayerInput Input; CNetObj_PlayerInput Input;
@ -1593,7 +1585,7 @@ void CGameClient::OnPredict()
} }
// calculate where everyone should move // calculate where everyone should move
if(g_Config.m_ClAntiPingPlayers) if(AntiPingPlayers())
{ {
//first apply Tick to weaker players (players that the local client has strong hook against), then local, then stronger players //first apply Tick to weaker players (players that the local client has strong hook against), then local, then stronger players
for(int h = 0; h < 3; h++) for(int h = 0; h < 3; h++)
@ -1623,7 +1615,7 @@ void CGameClient::OnPredict()
} }
// move all players and quantize their data // move all players and quantize their data
if(g_Config.m_ClAntiPingPlayers) if(AntiPingPlayers())
{ {
// Everyone with weaker hook // Everyone with weaker hook
for(int c = 0; c < MAX_CLIENTS; c++) for(int c = 0; c < MAX_CLIENTS; c++)
@ -1700,7 +1692,7 @@ void CGameClient::OnPredict()
{ {
m_PredictedChar = *World.m_apCharacters[m_Snap.m_LocalClientID]; m_PredictedChar = *World.m_apCharacters[m_Snap.m_LocalClientID];
if (g_Config.m_ClAntiPingPlayers) if (AntiPingPlayers())
{ {
for (int c = 0; c < MAX_CLIENTS; c++) for (int c = 0; c < MAX_CLIENTS; c++)
{ {

View file

@ -363,11 +363,13 @@ public:
void FindWeaker(bool IsWeaker[2][MAX_CLIENTS]); void FindWeaker(bool IsWeaker[2][MAX_CLIENTS]);
private: bool AntiPingPlayers() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingPlayers; }
bool AntiPingGrenade() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingGrenade; }
bool AntiPingWeapons() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingWeapons; }
private:
bool m_DDRaceMsgSent[2]; bool m_DDRaceMsgSent[2];
int m_ShowOthers[2]; int m_ShowOthers[2];
bool m_CurrentAntiPing;
}; };