mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
Merge branch 'viewpoint-and-director-fixes' into 'master'
Fixes for F12 and Director Cam See merge request KartKrew/Kart!979
This commit is contained in:
commit
95a1cb7108
4 changed files with 28 additions and 29 deletions
|
|
@ -2608,15 +2608,6 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
||||||
|
|
||||||
LUA_HookPlayerQuit(&players[playernum], reason); // Lua hook for player quitting
|
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);
|
G_RemovePartyMember(playernum);
|
||||||
|
|
||||||
// Reset player data
|
// Reset player data
|
||||||
|
|
@ -2636,6 +2627,9 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
||||||
|
|
||||||
LUA_InvalidatePlayer(&players[playernum]);
|
LUA_InvalidatePlayer(&players[playernum]);
|
||||||
|
|
||||||
|
// don't look through someone's view who isn't there
|
||||||
|
G_ResetViews();
|
||||||
|
|
||||||
K_CheckBumpers();
|
K_CheckBumpers();
|
||||||
P_CheckRacers();
|
P_CheckRacers();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1589,21 +1589,8 @@ static void FinalisePlaystateChange(INT32 playernum)
|
||||||
K_StripItems(&players[playernum]);
|
K_StripItems(&players[playernum]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset away view (some code referenced from P_SpectatorJoinGame)
|
// Reset away view
|
||||||
{
|
G_ResetViews();
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
K_CheckBumpers(); // SRB2Kart
|
K_CheckBumpers(); // SRB2Kart
|
||||||
P_CheckRacers(); // also SRB2Kart
|
P_CheckRacers(); // also SRB2Kart
|
||||||
|
|
|
||||||
19
src/g_game.c
19
src/g_game.c
|
|
@ -1919,7 +1919,7 @@ boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive)
|
||||||
INT32 G_FindView(INT32 startview, UINT8 viewnum, boolean onlyactive, boolean reverse)
|
INT32 G_FindView(INT32 startview, UINT8 viewnum, boolean onlyactive, boolean reverse)
|
||||||
{
|
{
|
||||||
INT32 i, dir = reverse ? -1 : 1;
|
INT32 i, dir = reverse ? -1 : 1;
|
||||||
startview = min(max(startview, 0), MAXPLAYERS);
|
startview = min(max(startview, -1), MAXPLAYERS);
|
||||||
for (i = startview; i < MAXPLAYERS && i >= 0; i += dir)
|
for (i = startview; i < MAXPLAYERS && i >= 0; i += dir)
|
||||||
{
|
{
|
||||||
if (G_CanView(i, viewnum, onlyactive))
|
if (G_CanView(i, viewnum, onlyactive))
|
||||||
|
|
@ -1990,7 +1990,14 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
||||||
|
|
||||||
/* Check if anyone is available to view. */
|
/* Check if anyone is available to view. */
|
||||||
if (( playernum = G_FindView(playernum, viewnum, onlyactive, playernum < olddisplayplayer) ) == -1)
|
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. */
|
/* Focus our target view first so that we don't take its player. */
|
||||||
(*displayplayerp) = playernum;
|
(*displayplayerp) = playernum;
|
||||||
|
|
@ -1998,6 +2005,10 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
||||||
{
|
{
|
||||||
camerap = &camera[viewnum-1];
|
camerap = &camera[viewnum-1];
|
||||||
P_ResetCamera(&players[(*displayplayerp)], camerap);
|
P_ResetCamera(&players[(*displayplayerp)], camerap);
|
||||||
|
|
||||||
|
// Why does it need to be done twice?
|
||||||
|
R_ResetViewInterpolation(viewnum);
|
||||||
|
R_ResetViewInterpolation(viewnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewnum > splits)
|
if (viewnum > splits)
|
||||||
|
|
@ -2052,8 +2063,8 @@ void G_ResetViews(void)
|
||||||
/* Demote splits */
|
/* Demote splits */
|
||||||
if (playersviewable < splits)
|
if (playersviewable < splits)
|
||||||
{
|
{
|
||||||
splits = playersviewable;
|
splits = max(playersviewable, splitscreen + 1); // don't delete local players
|
||||||
r_splitscreen = max(splits-1, 0);
|
r_splitscreen = splits - 1;
|
||||||
R_ExecuteSetViewSize();
|
R_ExecuteSetViewSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -238,6 +238,13 @@ void K_UpdateDirector(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if there's only one player left in the list, just switch to that player
|
||||||
|
if (directorinfo.sortedplayers[0] != -1 && directorinfo.sortedplayers[1] == -1)
|
||||||
|
{
|
||||||
|
K_DirectorSwitch(directorinfo.sortedplayers[0], false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// aaight, time to walk through the standings to find the first interesting pair
|
// aaight, time to walk through the standings to find the first interesting pair
|
||||||
// NB: targetposition/sortedplayers is 0-indexed, aiming at the "back half" of a given pair by default.
|
// NB: targetposition/sortedplayers is 0-indexed, aiming at the "back half" of a given pair by default.
|
||||||
// we adjust for this when comparing to player->position or when looking at the leading player, Don't Freak Out
|
// we adjust for this when comparing to player->position or when looking at the leading player, Don't Freak Out
|
||||||
|
|
@ -291,4 +298,4 @@ void K_UpdateDirector(void)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue