Refactor NetSync for Parties
This commit is contained in:
parent
4e8bb42fc5
commit
944cfa0cc9
1 changed files with 40 additions and 44 deletions
|
|
@ -623,15 +623,30 @@ static void P_NetSyncPlayers(savebuffer_t *save)
|
|||
TracyCZoneEnd(__zone);
|
||||
}
|
||||
|
||||
static void P_NetArchiveParties(savebuffer_t *save)
|
||||
static void P_NetSyncParties(savebuffer_t *save)
|
||||
{
|
||||
TracyCZone(__zone, true);
|
||||
|
||||
INT32 i, k;
|
||||
UINT8 partySize;
|
||||
|
||||
WRITEUINT32(save->p, ARCHIVEBLOCK_PARTIES);
|
||||
if (P_SyncUINT32(save, ARCHIVEBLOCK_PARTIES) != ARCHIVEBLOCK_PARTIES)
|
||||
I_Error("Bad $$$.sav at archive block Parties");
|
||||
|
||||
if (!save->write)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
G_DestroyParty(i);
|
||||
G_BuildLocalSplitscreenParty(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (save->write)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
|
|
@ -646,29 +661,9 @@ static void P_NetArchiveParties(savebuffer_t *save)
|
|||
WRITEUINT8(save->p, G_PartyMember(i, k));
|
||||
}
|
||||
}
|
||||
|
||||
TracyCZoneEnd(__zone);
|
||||
}
|
||||
|
||||
static void P_NetUnArchiveParties(savebuffer_t *save)
|
||||
else
|
||||
{
|
||||
TracyCZone(__zone, true);
|
||||
|
||||
INT32 i, k;
|
||||
UINT8 partySize;
|
||||
|
||||
if (READUINT32(save->p) != ARCHIVEBLOCK_PARTIES)
|
||||
I_Error("Bad $$$.sav at archive block Parties");
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
G_DestroyParty(i);
|
||||
G_BuildLocalSplitscreenParty(i);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
|
|
@ -681,6 +676,7 @@ static void P_NetUnArchiveParties(savebuffer_t *save)
|
|||
G_JoinParty(i, READUINT8(save->p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TracyCZoneEnd(__zone);
|
||||
}
|
||||
|
|
@ -5627,7 +5623,7 @@ void P_SaveNetGame(savebuffer_t *save, boolean resending)
|
|||
}
|
||||
|
||||
P_NetSyncPlayers(save);
|
||||
P_NetArchiveParties(save);
|
||||
P_NetSyncParties(save);
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
|
|
@ -5679,7 +5675,7 @@ boolean P_LoadNetGame(savebuffer_t *save, boolean reloading)
|
|||
if (!P_NetSyncMisc(save,reloading))
|
||||
return false;
|
||||
P_NetSyncPlayers(save);
|
||||
P_NetUnArchiveParties(save);
|
||||
P_NetSyncParties(save);
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue