mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-11 18:42:46 +00:00
Move party construction to G_AddPlayer
- Fixes crash when a player leaves when viewing a replay - Slightly refactors player joining code (including bots)
This commit is contained in:
parent
bf1e4cb5bc
commit
6c2736bd1d
5 changed files with 10 additions and 12 deletions
|
|
@ -3542,7 +3542,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
||||||
|
|
||||||
CONS_Debug(DBG_NETPLAY, "addplayer: %d %d\n", node, newplayernum);
|
CONS_Debug(DBG_NETPLAY, "addplayer: %d %d\n", node, newplayernum);
|
||||||
|
|
||||||
G_AddPlayer(newplayernum);
|
|
||||||
//G_SpectatePlayerOnJoin(newplayernum); -- caused desyncs in this spot :(
|
//G_SpectatePlayerOnJoin(newplayernum); -- caused desyncs in this spot :(
|
||||||
|
|
||||||
if (newplayernum+1 > doomcom->numslots)
|
if (newplayernum+1 > doomcom->numslots)
|
||||||
|
|
@ -3557,6 +3556,8 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
||||||
console = READUINT8(*p);
|
console = READUINT8(*p);
|
||||||
splitscreenplayer = READUINT8(*p);
|
splitscreenplayer = READUINT8(*p);
|
||||||
|
|
||||||
|
G_AddPlayer(newplayernum, console);
|
||||||
|
|
||||||
for (i = 0; i < MAXAVAILABILITY; i++)
|
for (i = 0; i < MAXAVAILABILITY; i++)
|
||||||
{
|
{
|
||||||
newplayer->availabilities[i] = READUINT8(*p);
|
newplayer->availabilities[i] = READUINT8(*p);
|
||||||
|
|
@ -3593,9 +3594,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
||||||
players[newplayernum].splitscreenindex = splitscreenplayer;
|
players[newplayernum].splitscreenindex = splitscreenplayer;
|
||||||
players[newplayernum].bot = false;
|
players[newplayernum].bot = false;
|
||||||
|
|
||||||
playerconsole[newplayernum] = console;
|
|
||||||
G_BuildLocalSplitscreenParty(newplayernum);
|
|
||||||
|
|
||||||
if (node == mynode && splitscreenplayer == 0)
|
if (node == mynode && splitscreenplayer == 0)
|
||||||
S_AttemptToRestoreMusic(); // Earliest viable point
|
S_AttemptToRestoreMusic(); // Earliest viable point
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,7 @@ void G_ReadDemoExtraData(void)
|
||||||
{
|
{
|
||||||
if (!playeringame[p])
|
if (!playeringame[p])
|
||||||
{
|
{
|
||||||
G_AddPlayer(p);
|
G_AddPlayer(p, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAXAVAILABILITY; i++)
|
for (i = 0; i < MAXAVAILABILITY; i++)
|
||||||
|
|
@ -3511,7 +3511,7 @@ void G_DoPlayDemo(const char *defdemoname)
|
||||||
if (!playeringame[displayplayers[0]] || players[displayplayers[0]].spectator)
|
if (!playeringame[displayplayers[0]] || players[displayplayers[0]].spectator)
|
||||||
displayplayers[0] = consoleplayer = serverplayer = p;
|
displayplayers[0] = consoleplayer = serverplayer = p;
|
||||||
|
|
||||||
G_AddPlayer(p);
|
G_AddPlayer(p, p);
|
||||||
players[p].spectator = spectator;
|
players[p].spectator = spectator;
|
||||||
|
|
||||||
if (flags & DEMO_KICKSTART)
|
if (flags & DEMO_KICKSTART)
|
||||||
|
|
|
||||||
|
|
@ -2919,13 +2919,16 @@ void G_DoReborn(INT32 playernum)
|
||||||
|
|
||||||
// These are the barest esentials.
|
// These are the barest esentials.
|
||||||
// This func probably doesn't even need to know if the player is a bot.
|
// This func probably doesn't even need to know if the player is a bot.
|
||||||
void G_AddPlayer(INT32 playernum)
|
void G_AddPlayer(INT32 playernum, INT32 console)
|
||||||
{
|
{
|
||||||
CL_ClearPlayer(playernum);
|
CL_ClearPlayer(playernum);
|
||||||
G_DestroyParty(playernum);
|
G_DestroyParty(playernum);
|
||||||
|
|
||||||
playeringame[playernum] = true;
|
playeringame[playernum] = true;
|
||||||
|
|
||||||
|
playerconsole[playernum] = console;
|
||||||
|
G_BuildLocalSplitscreenParty(playernum);
|
||||||
|
|
||||||
player_t *newplayer = &players[playernum];
|
player_t *newplayer = &players[playernum];
|
||||||
|
|
||||||
newplayer->playerstate = PST_REBORN;
|
newplayer->playerstate = PST_REBORN;
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive);
|
||||||
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive);
|
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive);
|
||||||
void G_FixCamera(UINT8 viewnum);
|
void G_FixCamera(UINT8 viewnum);
|
||||||
|
|
||||||
void G_AddPlayer(INT32 playernum);
|
void G_AddPlayer(INT32 playernum, INT32 console);
|
||||||
void G_SpectatePlayerOnJoin(INT32 playernum);
|
void G_SpectatePlayerOnJoin(INT32 playernum);
|
||||||
|
|
||||||
void G_SetExitGameFlag(void);
|
void G_SetExitGameFlag(void);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ void K_SetBot(UINT8 newplayernum, UINT8 skinnum, UINT8 difficulty, botStyle_e st
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_NETPLAY, "addbot: %d\n", newplayernum);
|
CONS_Debug(DBG_NETPLAY, "addbot: %d\n", newplayernum);
|
||||||
|
|
||||||
G_AddPlayer(newplayernum);
|
G_AddPlayer(newplayernum, newplayernum);
|
||||||
|
|
||||||
if (newplayernum+1 > doomcom->numslots)
|
if (newplayernum+1 > doomcom->numslots)
|
||||||
doomcom->numslots = (INT16)(newplayernum+1);
|
doomcom->numslots = (INT16)(newplayernum+1);
|
||||||
|
|
@ -121,9 +121,6 @@ void K_SetBot(UINT8 newplayernum, UINT8 skinnum, UINT8 difficulty, botStyle_e st
|
||||||
|
|
||||||
SetPlayerSkinByNum(newplayernum, skinnum);
|
SetPlayerSkinByNum(newplayernum, skinnum);
|
||||||
|
|
||||||
playerconsole[newplayernum] = newplayernum;
|
|
||||||
G_BuildLocalSplitscreenParty(newplayernum);
|
|
||||||
|
|
||||||
if (netgame)
|
if (netgame)
|
||||||
{
|
{
|
||||||
HU_AddChatText(va("\x82*Bot %d has been added to the game", newplayernum+1), false);
|
HU_AddChatText(va("\x82*Bot %d has been added to the game", newplayernum+1), false);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue