mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Fix and fully implement leaving parties
This commit is contained in:
parent
46ac563eaf
commit
02757eac82
4 changed files with 39 additions and 12 deletions
|
|
@ -2652,7 +2652,6 @@ void CL_ClearPlayer(INT32 playernum)
|
||||||
}
|
}
|
||||||
|
|
||||||
splitscreen_invitations[playernum] = -1;
|
splitscreen_invitations[playernum] = -1;
|
||||||
splitscreen_partied[playernum] = false;
|
|
||||||
|
|
||||||
memset(&players[playernum], 0, sizeof (player_t));
|
memset(&players[playernum], 0, sizeof (player_t));
|
||||||
}
|
}
|
||||||
|
|
@ -2746,6 +2745,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||||
RemoveAdminPlayer(playernum); // don't stay admin after you're gone
|
RemoveAdminPlayer(playernum); // don't stay admin after you're gone
|
||||||
}
|
}
|
||||||
|
|
||||||
|
G_RemovePartyMember(playernum);
|
||||||
|
|
||||||
if (playernum == displayplayers[localdisplayplayers[0]] && !demo.playback)
|
if (playernum == displayplayers[localdisplayplayers[0]] && !demo.playback)
|
||||||
displayplayers[localdisplayplayers[0]] = consoleplayer; // don't look through someone's view who isn't there
|
displayplayers[localdisplayplayers[0]] = consoleplayer; // don't look through someone's view who isn't there
|
||||||
|
|
||||||
|
|
@ -3382,6 +3383,8 @@ void SV_ResetServer(void)
|
||||||
splitscreen_invitations[i] = -1;
|
splitscreen_invitations[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(splitscreen_partied, 0, sizeof splitscreen_partied);
|
||||||
|
|
||||||
mynode = 0;
|
mynode = 0;
|
||||||
cl_packetmissed = false;
|
cl_packetmissed = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2053,7 +2053,27 @@ static void Got_AcceptPartyInvite(UINT8 **cp,INT32 playernum)
|
||||||
|
|
||||||
static void Got_LeaveParty(UINT8 **cp,INT32 playernum)
|
static void Got_LeaveParty(UINT8 **cp,INT32 playernum)
|
||||||
{
|
{
|
||||||
|
if (playerconsole[playernum] != playernum)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, M_GetText("Illegal accept splitscreen invite received from %s\n"), player_names[playernum]);
|
||||||
|
if (server)
|
||||||
|
{
|
||||||
|
XBOXSTATIC UINT8 buf[2];
|
||||||
|
|
||||||
|
buf[0] = (UINT8)playernum;
|
||||||
|
buf[1] = KICK_MSG_CON_FAIL;
|
||||||
|
SendNetXCmd(XD_KICK, &buf, 2);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
splitscreen_invitations[playernum] = -1;
|
splitscreen_invitations[playernum] = -1;
|
||||||
|
if (splitscreen_party_size[playernum] >
|
||||||
|
splitscreen_original_party_size[playernum])
|
||||||
|
{
|
||||||
|
G_RemovePartyMember(playernum);
|
||||||
|
G_ResetSplitscreen(playernum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void D_SendPlayerConfig(void)
|
void D_SendPlayerConfig(void)
|
||||||
|
|
|
||||||
|
|
@ -310,6 +310,7 @@ void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive);
|
||||||
|
|
||||||
void G_AddPartyMember (int party_member, int new_party_member);
|
void G_AddPartyMember (int party_member, int new_party_member);
|
||||||
void G_RemovePartyMember (int party_member);
|
void G_RemovePartyMember (int party_member);
|
||||||
|
void G_ResetSplitscreen (int playernum);
|
||||||
|
|
||||||
void G_AddPlayer(INT32 playernum);
|
void G_AddPlayer(INT32 playernum);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ int splitscreen_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
boolean splitscreen_partied[MAXPLAYERS];
|
boolean splitscreen_partied[MAXPLAYERS];
|
||||||
|
|
||||||
static void
|
void
|
||||||
ResetParty (int playernum)
|
G_ResetSplitscreen (int playernum)
|
||||||
{
|
{
|
||||||
INT32 old_displayplayers[MAXSPLITSCREENPLAYERS];
|
INT32 old_displayplayers[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
|
|
@ -91,16 +91,16 @@ G_RemovePartyMember (int playernum)
|
||||||
memcpy(old_party, splitscreen_party[playernum], sizeof old_party);
|
memcpy(old_party, splitscreen_party[playernum], sizeof old_party);
|
||||||
memcpy(new_party, old_party, before * sizeof *old_party);
|
memcpy(new_party, old_party, before * sizeof *old_party);
|
||||||
|
|
||||||
while (i < after)
|
|
||||||
{
|
|
||||||
splitscreen_partied[old_party[i]] = false;
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(&new_party[before], &old_party[after],
|
memcpy(&new_party[before], &old_party[after],
|
||||||
( old_party_size - after ) * sizeof *new_party);
|
( old_party_size - after ) * sizeof *new_party);
|
||||||
|
|
||||||
|
if (splitscreen_partied[playernum] &&
|
||||||
|
localdisplayplayers[0] >= after)
|
||||||
|
{
|
||||||
|
for (i = 0; i < MAXSPLITSCREENPLAYERS; ++i)
|
||||||
|
localdisplayplayers[i] -= views;
|
||||||
|
}
|
||||||
|
|
||||||
views = ( old_party_size - views );
|
views = ( old_party_size - views );
|
||||||
|
|
||||||
for (i = 0; i < old_party_size; ++i)
|
for (i = 0; i < old_party_size; ++i)
|
||||||
|
|
@ -114,8 +114,7 @@ G_RemovePartyMember (int playernum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetParty(playernum);
|
/* don't want to remove yourself from your own screen! */
|
||||||
|
|
||||||
if (playernum != consoleplayer && splitscreen_partied[playernum])
|
if (playernum != consoleplayer && splitscreen_partied[playernum])
|
||||||
{
|
{
|
||||||
splitscreen_partied[playernum] = false;
|
splitscreen_partied[playernum] = false;
|
||||||
|
|
@ -181,6 +180,8 @@ G_AddPartyMember (int invitation, int playernum)
|
||||||
/* in my party or adding me? */
|
/* in my party or adding me? */
|
||||||
if (splitscreen_partied[invitation])
|
if (splitscreen_partied[invitation])
|
||||||
{
|
{
|
||||||
|
splitscreen_partied[playernum] = true;
|
||||||
|
|
||||||
for (i = old_party_size; i < new_party_size; ++i)
|
for (i = old_party_size; i < new_party_size; ++i)
|
||||||
{
|
{
|
||||||
displayplayers[i] = party[i];
|
displayplayers[i] = party[i];
|
||||||
|
|
@ -192,6 +193,8 @@ G_AddPartyMember (int invitation, int playernum)
|
||||||
}
|
}
|
||||||
else if (playernum == consoleplayer)
|
else if (playernum == consoleplayer)
|
||||||
{
|
{
|
||||||
|
splitscreen_partied[invitation] = true;
|
||||||
|
|
||||||
for (i = 0; i <= splitscreen; ++i)
|
for (i = 0; i <= splitscreen; ++i)
|
||||||
{
|
{
|
||||||
localdisplayplayers[i] = ( old_party_size + i );
|
localdisplayplayers[i] = ( old_party_size + i );
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue