Merge pull request #313 from LJSonik/analog-flipcam-synch-fix

Fix desynch when toggling analog mode or flipcam
This commit is contained in:
MonsterIestyn 2018-11-14 19:57:47 +00:00 committed by GitHub
commit a4f8411ae7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 36 deletions

View file

@ -3094,12 +3094,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
displayplayer = newplayernum; displayplayer = newplayernum;
secondarydisplayplayer = newplayernum; secondarydisplayplayer = newplayernum;
DEBFILE("spawning me\n"); 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 else
{ {
@ -3107,12 +3101,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
DEBFILE("spawning my brother\n"); DEBFILE("spawning my brother\n");
if (botingame) if (botingame)
players[newplayernum].bot = 1; 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(); D_SendPlayerConfig();
addedtogame = true; addedtogame = true;

View file

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

View file

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

View file

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