Fix desynch when toggling analog mode or flipcam

Special thanks to Lat' for asking weird questions
This commit is contained in:
Louis-Antoine 2018-10-29 00:49:23 +01:00
parent af46a076f2
commit 3d0daf2202
4 changed files with 4 additions and 36 deletions

View file

@ -3097,12 +3097,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
displayplayer = newplayernum;
secondarydisplayplayer = newplayernum;
DEBFILE("spawning me\n");
// Apply player flags as soon as possible!
players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
if (cv_flipcam.value)
players[newplayernum].pflags |= PF_FLIPCAM;
if (cv_analog.value)
players[newplayernum].pflags |= PF_ANALOGMODE;
}
else
{
@ -3110,12 +3104,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
DEBFILE("spawning my brother\n");
if (botingame)
players[newplayernum].bot = 1;
// Same goes for player 2 when relevant
players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
if (cv_flipcam2.value)
players[newplayernum].pflags |= PF_FLIPCAM;
if (cv_analog2.value)
players[newplayernum].pflags |= PF_ANALOGMODE;
}
D_SendPlayerConfig();
addedtogame = true;

View file

@ -1369,9 +1369,9 @@ void SendWeaponPref(void)
XBOXSTATIC UINT8 buf[1];
buf[0] = 0;
if (players[consoleplayer].pflags & PF_FLIPCAM)
if (cv_flipcam.value)
buf[0] |= 1;
if (players[consoleplayer].pflags & PF_ANALOGMODE)
if (cv_analog.value)
buf[0] |= 2;
SendNetXCmd(XD_WEAPONPREF, buf, 1);
}
@ -1381,9 +1381,9 @@ void SendWeaponPref2(void)
XBOXSTATIC UINT8 buf[1];
buf[0] = 0;
if (players[secondarydisplayplayer].pflags & PF_FLIPCAM)
if (cv_flipcam2.value)
buf[0] |= 1;
if (players[secondarydisplayplayer].pflags & PF_ANALOGMODE)
if (cv_analog2.value)
buf[0] |= 2;
SendNetXCmd2(XD_WEAPONPREF, buf, 1);
}

View file

@ -1575,11 +1575,6 @@ static void Analog_OnChange(void)
return;
}
if (cv_analog.value)
players[consoleplayer].pflags |= PF_ANALOGMODE;
else
players[consoleplayer].pflags &= ~PF_ANALOGMODE;
SendWeaponPref();
}
@ -1600,11 +1595,6 @@ static void Analog2_OnChange(void)
return;
}
if (cv_analog2.value)
players[secondarydisplayplayer].pflags |= PF_ANALOGMODE;
else
players[secondarydisplayplayer].pflags &= ~PF_ANALOGMODE;
SendWeaponPref2();
}

View file

@ -222,21 +222,11 @@ static void ChaseCam2_OnChange(void)
static void FlipCam_OnChange(void)
{
if (cv_flipcam.value)
players[consoleplayer].pflags |= PF_FLIPCAM;
else
players[consoleplayer].pflags &= ~PF_FLIPCAM;
SendWeaponPref();
}
static void FlipCam2_OnChange(void)
{
if (cv_flipcam2.value)
players[secondarydisplayplayer].pflags |= PF_FLIPCAM;
else
players[secondarydisplayplayer].pflags &= ~PF_FLIPCAM;
SendWeaponPref2();
}