mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Reset viewpoint to local player if last viewed player spectates or leaves
This commit is contained in:
parent
0bb6f96a13
commit
9578f5e05d
3 changed files with 15 additions and 27 deletions
|
|
@ -2608,15 +2608,6 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
|||
|
||||
LUA_HookPlayerQuit(&players[playernum], reason); // Lua hook for player quitting
|
||||
|
||||
// don't look through someone's view who isn't there
|
||||
if (playernum == displayplayers[0] && !demo.playback)
|
||||
{
|
||||
// Call ViewpointSwitch hooks here.
|
||||
// The viewpoint was forcibly changed.
|
||||
LUA_HookViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
|
||||
displayplayers[0] = consoleplayer;
|
||||
}
|
||||
|
||||
G_RemovePartyMember(playernum);
|
||||
|
||||
// Reset player data
|
||||
|
|
@ -2636,6 +2627,9 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
|||
|
||||
LUA_InvalidatePlayer(&players[playernum]);
|
||||
|
||||
// don't look through someone's view who isn't there
|
||||
G_ResetViews();
|
||||
|
||||
K_CheckBumpers();
|
||||
P_CheckRacers();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1589,21 +1589,8 @@ static void FinalisePlaystateChange(INT32 playernum)
|
|||
K_StripItems(&players[playernum]);
|
||||
}
|
||||
|
||||
// Reset away view (some code referenced from P_SpectatorJoinGame)
|
||||
{
|
||||
UINT8 i = 0;
|
||||
INT32 *localplayertable = (splitscreen_partied[consoleplayer] ? splitscreen_party[consoleplayer] : g_localplayers);
|
||||
|
||||
for (i = 0; i <= r_splitscreen; i++)
|
||||
{
|
||||
if (localplayertable[i] == playernum)
|
||||
{
|
||||
LUA_HookViewpointSwitch(players+playernum, players+playernum, true);
|
||||
displayplayers[i] = playernum;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Reset away view
|
||||
G_ResetViews();
|
||||
|
||||
K_CheckBumpers(); // SRB2Kart
|
||||
P_CheckRacers(); // also SRB2Kart
|
||||
|
|
|
|||
13
src/g_game.c
13
src/g_game.c
|
|
@ -2035,7 +2035,14 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
|||
|
||||
/* Check if anyone is available to view. */
|
||||
if (( playernum = G_FindView(playernum, viewnum, onlyactive, playernum < olddisplayplayer) ) == -1)
|
||||
return;
|
||||
{
|
||||
/* Fall back on true self */
|
||||
playernum = g_localplayers[viewnum-1];
|
||||
}
|
||||
|
||||
// Call ViewpointSwitch hooks here.
|
||||
// The viewpoint was forcibly changed.
|
||||
LUA_HookViewpointSwitch(&players[g_localplayers[viewnum - 1]], &players[playernum], true);
|
||||
|
||||
/* Focus our target view first so that we don't take its player. */
|
||||
(*displayplayerp) = playernum;
|
||||
|
|
@ -2097,8 +2104,8 @@ void G_ResetViews(void)
|
|||
/* Demote splits */
|
||||
if (playersviewable < splits)
|
||||
{
|
||||
splits = playersviewable;
|
||||
r_splitscreen = max(splits-1, 0);
|
||||
splits = max(playersviewable, splitscreen + 1); // don't delete local players
|
||||
r_splitscreen = splits - 1;
|
||||
R_ExecuteSetViewSize();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue