Skip to content

Commit

Permalink
Improved freeze update detection, fixed a bug with unfreeze delay helper
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Feb 22, 2022
1 parent 2d7911f commit af7c9f9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/engine/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4542,7 +4542,7 @@ int CClient::MaxLatencyTicks() const

int CClient::PredictionMargin() const
{
if(g_Config.m_ClAmIFrozen && g_Config.m_ClUnfreezeDelayHelper)
if(g_Config.m_ClAmIFrozen && g_Config.m_ClUnfreezeDelayHelper && m_CurGameTick[g_Config.m_ClDummy]-g_Config.m_ClFreezeTick > 12)
return -min(g_Config.m_ClWhatsMyPing * g_Config.m_ClUnfreezeHelperPercent / 100, g_Config.m_ClUnfreezeHelperLimit);

return g_Config.m_ClPredictionMargin;
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/components/controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ int CControls::SnapInput(int *pData)
m_InputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_PLAYING;
}

if(m_pClient->m_Scoreboard.Active())
if(m_pClient->m_Scoreboard.Active() || g_Config.m_ClWhatsMyPing == 0)
m_InputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_SCOREBOARD;

if(m_InputData[g_Config.m_ClDummy].m_PlayerFlags != PLAYERFLAG_PLAYING)
Expand Down
4 changes: 1 addition & 3 deletions src/game/client/components/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,10 @@ void CHud::RenderTextInfo()
if(g_Config.m_ClShowFrozenText > 0)
TextRender()->Text(0, m_Width / 2 - TextRender()->TextWidth(0, 10, aBuf, -1, -1.0f) / 2, 12, 10, aBuf, -1.0f);

//if(m_pClient->m_PredictedChar.m_ActiveWeapon)

//str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientID].m_PrevPredicted.m_FreezeEnd);
//str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_ClWhatsMyPing);

//TextRender()->Text(0, m_Width / 2 - TextRender()->TextWidth(0, 10, aBuf, -1, -1.0f) / 2, 20, 10, aBuf, -1.0f);

if(g_Config.m_ClShowFrozenHud > 0 && !m_pClient->m_Scoreboard.Active() && !(LocalTeamID == 0 && g_Config.m_ClFrozenHudTeamOnly))
{
CTeeRenderInfo FreezeInfo;
Expand Down
14 changes: 11 additions & 3 deletions src/game/client/components/players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,17 @@ void CPlayers::OnRender()
CNetObj_Character PrevChar = m_pClient->m_aClients[i].m_RenderPrev;
CNetObj_Character CurChar = m_pClient->m_aClients[i].m_RenderCur;

if(Local && g_Config.m_ClAmIFrozen && g_Config.m_ClFreezeUpdateFix)
{
CurChar.m_Weapon = WEAPON_NINJA;
if (CurChar.m_Emote == EMOTE_NORMAL) {
CurChar.m_Emote = EMOTE_BLINK;
}
}
if (Local) {
if(m_pClient->m_Snap.m_pLocalInfo)
g_Config.m_ClWhatsMyPing = m_pClient->m_Snap.m_paPlayerInfos[i]->m_Latency;
}
if(p < 3)
{
RenderHook(&PrevChar, &CurChar, &m_aRenderInfo[i], i);
Expand All @@ -749,10 +760,7 @@ void CPlayers::OnRender()
{
RenderPlayer(&PrevChar, &CurChar, &m_aRenderInfo[i], i);
}
if(Local)
g_Config.m_ClWhatsMyPing = m_pClient->m_Snap.m_paPlayerInfos[i]->m_Latency;
}

}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/game/client/gameclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2456,9 +2456,14 @@ void CGameClient::UpdateRenderedCharacters()
m_aClients[i].m_RenderCur.m_Weapon = m_aClients[i].m_Predicted.m_ActiveWeapon;
}
if(pChar && pChar->m_FreezeTime > 0)
{
g_Config.m_ClAmIFrozen = 1;
}
else
{
g_Config.m_ClAmIFrozen = 0;
g_Config.m_ClFreezeTick = Client()->GameTick(g_Config.m_ClDummy);
}

}
else
Expand Down
2 changes: 2 additions & 0 deletions src/game/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ MACRO_CONFIG_INT(ClUnfreezeHelperLimit, tc_unfreeze_helper_limit, 45, 0, 500, CF

//AAAAAAA
MACRO_CONFIG_INT(ClAmIFrozen, EEEfrz, 0, 0, 1, CFGFLAG_CLIENT, "eeeee.")
MACRO_CONFIG_INT(ClFreezeTick, EEEfrztck, 0, 0, 9999, CFGFLAG_CLIENT, "eeeee.")

MACRO_CONFIG_INT(ClWhatsMyPing, EEEpng, 0, 0, 9999, CFGFLAG_CLIENT, "eeeee.")


Expand Down

0 comments on commit af7c9f9

Please sign in to comment.