From 75d185cf188dd087fdd84d2ffb3cdbf288e1d594 Mon Sep 17 00:00:00 2001 From: Freddie Wang Date: Thu, 22 Apr 2021 20:52:49 +0800 Subject: [PATCH 1/2] fix airjump for antiping --- src/game/client/gameclient.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 3607f3feb..97b3998f3 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -1659,10 +1659,10 @@ void CGameClient::OnNewSnapshot() m_pGhost->OnNewSnapshot(); m_pRaceDemo->OnNewSnapshot(); - // detect air jump for unpredicted players + // detect air jump for other players for(int i = 0; i < MAX_CLIENTS; i++) if(m_Snap.m_aCharacters[i].m_Active && (m_Snap.m_aCharacters[i].m_Cur.m_Jumped & 2) && !(m_Snap.m_aCharacters[i].m_Prev.m_Jumped & 2)) - if(!Predict() || (!AntiPingPlayers() && i != m_Snap.m_LocalClientID)) + if(!Predict() || (i != m_Snap.m_LocalClientID && (!AntiPingPlayers() || i != m_PredictedDummyID))) { vec2 Pos = mix(vec2(m_Snap.m_aCharacters[i].m_Prev.m_X, m_Snap.m_aCharacters[i].m_Prev.m_Y), vec2(m_Snap.m_aCharacters[i].m_Cur.m_X, m_Snap.m_aCharacters[i].m_Cur.m_Y), @@ -1807,6 +1807,17 @@ void CGameClient::OnPredict() m_pSounds->PlayAndRecord(CSounds::CHN_WORLD, SOUND_HOOK_NOATTACH, 1.0f, Pos); } } + + // check if we want to trigger predicted airjump for dummy + if(AntiPingPlayers() && pDummyChar && Tick > m_LastNewPredictedTick[!Dummy]) + { + m_LastNewPredictedTick[!Dummy] = Tick; + vec2 Pos = pDummyChar->Core()->m_Pos; + int Events = pLocalChar->Core()->m_TriggeredEvents; + if(g_Config.m_ClPredict) + if(Events & COREEVENT_AIR_JUMP) + m_pEffects->AirJump(Pos); + } } // detect mispredictions of other players and make corrections smoother when possible From bef5dee897265a5727fb7e157e992a4c1b60f7bc Mon Sep 17 00:00:00 2001 From: Freddie Wang Date: Thu, 22 Apr 2021 20:58:30 +0800 Subject: [PATCH 2/2] Fix dummy's airjump trigger --- src/game/client/gameclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 97b3998f3..c1317d013 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -1813,7 +1813,7 @@ void CGameClient::OnPredict() { m_LastNewPredictedTick[!Dummy] = Tick; vec2 Pos = pDummyChar->Core()->m_Pos; - int Events = pLocalChar->Core()->m_TriggeredEvents; + int Events = pDummyChar->Core()->m_TriggeredEvents; if(g_Config.m_ClPredict) if(Events & COREEVENT_AIR_JUMP) m_pEffects->AirJump(Pos);