mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Rewrite the awayview reset for both Got_Teamchange and P_SpectatorJoinGame.
This commit is contained in:
parent
913610b1b7
commit
006b6f00ac
2 changed files with 21 additions and 26 deletions
|
|
@ -3459,15 +3459,20 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||||
else if (NetPacket.packet.newteam == 0)
|
else if (NetPacket.packet.newteam == 0)
|
||||||
HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame
|
HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame
|
||||||
|
|
||||||
//reset view if you are changed, or viewing someone who was changed.
|
// Reset away view (some code referenced from P_SpectatorJoinGame)
|
||||||
if (playernum == consoleplayer || displayplayers[0] == playernum)
|
|
||||||
{
|
{
|
||||||
// Call ViewpointSwitch hooks here.
|
UINT8 i = 0;
|
||||||
// The viewpoint was forcibly changed.
|
INT32 *localplayertable = (splitscreen_partied[consoleplayer] ? splitscreen_party[consoleplayer] : g_localplayers);
|
||||||
if (displayplayers[0] != consoleplayer) // You're already viewing yourself. No big deal.
|
|
||||||
LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
|
|
||||||
|
|
||||||
displayplayers[0] = consoleplayer;
|
for (i = 0; i < r_splitscreen; i++)
|
||||||
|
{
|
||||||
|
if (localplayertable[i] == playernum)
|
||||||
|
{
|
||||||
|
LUAh_ViewpointSwitch(players+playernum, players+playernum, true);
|
||||||
|
displayplayers[i] = playernum;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (G_GametypeHasTeams())
|
/*if (G_GametypeHasTeams())
|
||||||
|
|
|
||||||
28
src/p_user.c
28
src/p_user.c
|
|
@ -3620,29 +3620,19 @@ boolean P_SpectatorJoinGame(player_t *player)
|
||||||
player->ctfteam = changeto;
|
player->ctfteam = changeto;
|
||||||
player->playerstate = PST_REBORN;
|
player->playerstate = PST_REBORN;
|
||||||
|
|
||||||
// Reset away view (some code referenced from P_IsLocalPlayer)
|
// Reset away view (some code referenced from Got_Teamchange)
|
||||||
{
|
{
|
||||||
UINT8 i = 0;
|
UINT8 i = 0;
|
||||||
if (splitscreen_partied[consoleplayer])
|
INT32 *localplayertable = (splitscreen_partied[consoleplayer] ? splitscreen_party[consoleplayer] : g_localplayers);
|
||||||
{
|
|
||||||
for (i = splitscreen_party_size[consoleplayer]; i > 0; i--)
|
|
||||||
{
|
|
||||||
if (splitscreen_party[consoleplayer][i-1] == (player-players))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == 0)
|
for (i = 0; i < r_splitscreen; i++)
|
||||||
for (i = r_splitscreen; i > 0; i--)
|
|
||||||
{
|
|
||||||
if (g_localplayers[i-1] == (player-players))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i && displayplayers[i-1] != (player-players))
|
|
||||||
{
|
{
|
||||||
LUAh_ViewpointSwitch(player, player, true);
|
if (localplayertable[i] == (player-players))
|
||||||
displayplayers[i-1] = (player-players);
|
{
|
||||||
|
LUAh_ViewpointSwitch(player, player, true);
|
||||||
|
displayplayers[i] = (player-players);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue