Fix duplicated player views from ResetViews

This commit is contained in:
fickleheart 2019-02-16 22:24:37 -06:00
parent c00abd1683
commit a6bc581520
2 changed files with 5 additions and 5 deletions

View file

@ -2133,13 +2133,13 @@ boolean G_CouldView(INT32 playernum)
// G_CanView // G_CanView
// Return whether a player can be viewed on a particular view (splitscreen). // Return whether a player can be viewed on a particular view (splitscreen).
// //
boolean G_CanView(INT32 playernum, UINT8 viewnum) boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive)
{ {
UINT8 splits; UINT8 splits;
UINT8 viewd; UINT8 viewd;
INT32 *displayplayerp; INT32 *displayplayerp;
if (!G_CouldView(playernum)) if (!(onlyactive ? G_CouldView(playernum) : (playeringame[playernum] && !players[playernum].spectator)))
return false; return false;
splits = splitscreen+1; splits = splitscreen+1;
@ -2173,12 +2173,12 @@ INT32 G_FindView(INT32 startview, UINT8 viewnum, boolean onlyactive)
startview = min(max(startview, 0), MAXPLAYERS); startview = min(max(startview, 0), MAXPLAYERS);
for (i = startview; i < MAXPLAYERS; ++i) for (i = startview; i < MAXPLAYERS; ++i)
{ {
if (onlyactive ? G_CanView(i, viewnum) : (playeringame[i] && !players[i].spectator)) if (G_CanView(i, viewnum, onlyactive))
return i; return i;
} }
for (i = 0; i < startview; ++i) for (i = 0; i < startview; ++i)
{ {
if (onlyactive ? G_CanView(i, viewnum) : (playeringame[i] && !players[i].spectator)) if (G_CanView(i, viewnum, onlyactive))
return i; return i;
} }
return -1; return -1;

View file

@ -235,7 +235,7 @@ boolean G_Responder(event_t *ev);
INT32 *G_GetDisplayplayerPtr(UINT8 viewnum); INT32 *G_GetDisplayplayerPtr(UINT8 viewnum);
boolean G_CouldView(INT32 playernum); boolean G_CouldView(INT32 playernum);
boolean G_CanView(INT32 playernum, UINT8 viewnum); boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive);
INT32 G_FindView(INT32 startview, UINT8 viewnum, boolean onlyactive); INT32 G_FindView(INT32 startview, UINT8 viewnum, boolean onlyactive);
INT32 G_CountPlayersPotentiallyViewable(boolean active); INT32 G_CountPlayersPotentiallyViewable(boolean active);