Client: Verify our pSeat player entity directly, don't assume 'self' is the

player in CSQC_Parse_Event and CSQC_Input_Frame.
This commit is contained in:
Marco Cawthorne 2022-02-10 13:31:57 -08:00
parent bef8dfb117
commit f118e34792
Signed by: eukara
GPG key ID: C196CD8BA993248A
3 changed files with 16 additions and 8 deletions

View file

@ -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 */

View file

@ -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();

View file

@ -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;