Fix player 1 and player 2 affecting whether the other can see skyboxes or not

This commit is contained in:
Monster Iestyn 2016-05-18 18:20:56 +01:00
parent 1e50691e08
commit b4cf7fbc97
3 changed files with 16 additions and 1 deletions

View File

@ -2838,7 +2838,7 @@ boolean P_SetupLevel(boolean skipprecip)
savedata.lives = 0;
}
skyVisible = true; // assume the skybox is visible on level load.
skyVisible = skyVisible1 = skyVisible2 = true; // assume the skybox is visible on level load.
if (loadprecip) // uglier hack
{ // to make a newly loaded level start on the second frame.
INT32 buf = gametic % BACKUPTICS;

View File

@ -67,6 +67,7 @@ fixed_t viewx, viewy, viewz;
angle_t viewangle, aimingangle;
fixed_t viewcos, viewsin;
boolean viewsky, skyVisible;
boolean skyVisible1, skyVisible2; // saved values of skyVisible for P1 and P2, for splitscreen
sector_t *viewsector;
player_t *viewplayer;
@ -1301,6 +1302,12 @@ void R_RenderPlayerView(player_t *player)
V_DrawFill(0, 0, vid.width, vid.height, 128+(timeinmap&15));
}
// load previous saved value of skyVisible for the player
if (splitscreen && player == &players[secondarydisplayplayer])
skyVisible = skyVisible2;
else
skyVisible = skyVisible1;
portalrender = 0;
portal_base = portal_cap = NULL;
@ -1398,6 +1405,13 @@ void R_RenderPlayerView(player_t *player)
// Check for new console commands.
NetUpdate();
// save value to skyVisible1 or skyVisible2
// this is so that P1 can't affect whether P2 can see a skybox or not, or vice versa
if (splitscreen && player == &players[secondarydisplayplayer])
skyVisible2 = skyVisible;
else
skyVisible1 = skyVisible;
}
// =========================================================================

View File

@ -85,6 +85,7 @@ extern side_t *sides;
extern fixed_t viewx, viewy, viewz;
extern angle_t viewangle, aimingangle;
extern boolean viewsky, skyVisible;
extern boolean skyVisible1, skyVisible2; // saved values of skyVisible for P1 and P2, for splitscreen
extern sector_t *viewsector;
extern player_t *viewplayer;
extern UINT8 portalrender;