mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-22 20:02:03 +00:00
Move sphere redistribution to its own function
This commit is contained in:
parent
2b2797ec66
commit
dc39957539
1 changed files with 56 additions and 50 deletions
|
@ -2316,30 +2316,16 @@ static void UnlinkPlayerFromNode(INT32 playernum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// If in a special stage, redistribute the player's
|
||||||
// CL_RemovePlayer
|
// spheres across the remaining players.
|
||||||
//
|
// I feel like this shouldn't even be in this file at all, but well.
|
||||||
// Removes a player from the current game
|
static void RedistributeSpecialStageSpheres(INT32 playernum)
|
||||||
//
|
|
||||||
void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
|
||||||
{
|
|
||||||
// Sanity check: exceptional cases (i.e. c-fails) can cause multiple
|
|
||||||
// kick commands to be issued for the same player.
|
|
||||||
if (!playeringame[playernum])
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (server)
|
|
||||||
UnlinkPlayerFromNode(playernum);
|
|
||||||
|
|
||||||
if (gametyperules & GTR_TEAMFLAGS)
|
|
||||||
P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you!
|
|
||||||
|
|
||||||
// If in a special stage, redistribute the player's spheres across
|
|
||||||
// the remaining players.
|
|
||||||
if (G_IsSpecialStage(gamemap))
|
|
||||||
{
|
{
|
||||||
INT32 i, count, sincrement, spheres, rincrement, rings;
|
INT32 i, count, sincrement, spheres, rincrement, rings;
|
||||||
|
|
||||||
|
if (!G_IsSpecialStage(gamemap))
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0, count = 0; i < MAXPLAYERS; i++)
|
for (i = 0, count = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (playeringame[i])
|
if (playeringame[i])
|
||||||
|
@ -2385,6 +2371,26 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// CL_RemovePlayer
|
||||||
|
//
|
||||||
|
// Removes a player from the current game
|
||||||
|
//
|
||||||
|
void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
||||||
|
{
|
||||||
|
// Sanity check: exceptional cases (i.e. c-fails) can cause multiple
|
||||||
|
// kick commands to be issued for the same player.
|
||||||
|
if (!playeringame[playernum])
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (server)
|
||||||
|
UnlinkPlayerFromNode(playernum);
|
||||||
|
|
||||||
|
if (gametyperules & GTR_TEAMFLAGS)
|
||||||
|
P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you!
|
||||||
|
|
||||||
|
RedistributeSpecialStageSpheres(playernum);
|
||||||
|
|
||||||
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
|
// don't look through someone's view who isn't there
|
||||||
|
|
Loading…
Reference in a new issue