From f118e347923d9b4aac982372f2737713c48c06e1 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Thu, 10 Feb 2022 13:31:57 -0800 Subject: [PATCH] Client: Verify our pSeat player entity directly, don't assume 'self' is the player in CSQC_Parse_Event and CSQC_Input_Frame. --- src/botlib/bot.qc | 3 +++ src/client/entry.qc | 13 +++++++++---- src/client/predict.qc | 8 ++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/botlib/bot.qc b/src/botlib/bot.qc index 3a065608..9080c2a1 100644 --- a/src/botlib/bot.qc +++ b/src/botlib/bot.qc @@ -392,6 +392,9 @@ bot::RunAI(void) angles[2] = Math_FixDelta(v_angle[2]); input_angles = v_angle; + /* always look ahead as the default */ + aimpos = origin + (v_forward * 32); + /* now that aiming is sorted, we need to correct the movement */ if ((m_eTarget && enemyvisible && !enemydistant) && vlen(aimpos - origin) > 256) { /* we are far away, inch closer */ diff --git a/src/client/entry.qc b/src/client/entry.qc index 69d226fd..e6909ff0 100644 --- a/src/client/entry.qc +++ b/src/client/entry.qc @@ -493,13 +493,16 @@ Hijacks and controls what input globals are being sent to the server void CSQC_Input_Frame(void) { - CSQC_UpdateSeat(); + entity me; - if (self.classname == "player") { + CSQC_UpdateSeat(); + me = pSeat->m_ePlayer; + + if (me.classname == "player") { player pl; pl = (player)pSeat->m_ePlayer; pl.ClientInputFrame(); - } else if (self.classname == "spectator") { + } else if (me.classname == "spectator") { spectator spec; spec = (spectator)pSeat->m_ePlayer; spec.ClientInputFrame(); @@ -517,8 +520,10 @@ Whenever we call a SVC_CGAMEPACKET on the SSQC, this is being run void CSQC_Parse_Event(void) { + entity me; /* always 0, unless it was sent with a MULTICAST_ONE or MULTICAST_ONE_R to p2+ */ CSQC_UpdateSeat(); + me = pSeat->m_ePlayer; float fHeader = readbyte(); @@ -622,7 +627,7 @@ CSQC_Parse_Event(void) setproperty(VF_ANGLES, a); break; case EV_SHAKE: - if (self.classname == "spectator") + if (me.classname == "spectator") break; pSeat->m_flShakeDuration = readfloat(); pSeat->m_flShakeAmp = readfloat(); diff --git a/src/client/predict.qc b/src/client/predict.qc index 414b0950..b30348f9 100644 --- a/src/client/predict.qc +++ b/src/client/predict.qc @@ -92,15 +92,15 @@ Predict_PlayerPreFrame(player pl) continue; } - if (i==clientcommandframe){ - CSQC_Input_Frame(); - } - /* don't do partial frames, aka incomplete input packets */ if (input_timelength == 0) { break; } + if (i==clientcommandframe){ + CSQC_Input_Frame(); + } + /* this global is for our shared random number seed */ input_sequence = i;