Merge branch 'waypoint-bruh' into 'next'

Fix waypoint sequence desyncs

See merge request STJr/SRB2!975
This commit is contained in:
LJ Sonic 2020-05-31 17:58:38 -04:00
commit 82af11d0df

View file

@ -717,6 +717,34 @@ static void P_NetUnArchiveColormaps(void)
net_colormaps = NULL; net_colormaps = NULL;
} }
static void P_NetArchiveWaypoints(void)
{
INT32 i, j;
for (i = 0; i < NUMWAYPOINTSEQUENCES; i++)
{
WRITEUINT16(save_p, numwaypoints[i]);
for (j = 0; j < numwaypoints[i]; j++)
WRITEUINT32(save_p, waypoints[i][j] ? waypoints[i][j]->mobjnum : 0);
}
}
static void P_NetUnArchiveWaypoints(void)
{
INT32 i, j;
UINT32 mobjnum;
for (i = 0; i < NUMWAYPOINTSEQUENCES; i++)
{
numwaypoints[i] = READUINT16(save_p);
for (j = 0; j < numwaypoints[i]; j++)
{
mobjnum = READUINT32(save_p);
waypoints[i][j] = (mobjnum == 0) ? NULL : P_FindNewPosition(mobjnum);
}
}
}
/// ///
/// World Archiving /// World Archiving
/// ///
@ -4042,6 +4070,7 @@ void P_SaveNetGame(void)
P_NetArchiveThinkers(); P_NetArchiveThinkers();
P_NetArchiveSpecials(); P_NetArchiveSpecials();
P_NetArchiveColormaps(); P_NetArchiveColormaps();
P_NetArchiveWaypoints();
} }
LUA_Archive(); LUA_Archive();
@ -4080,6 +4109,7 @@ boolean P_LoadNetGame(void)
P_NetUnArchiveThinkers(); P_NetUnArchiveThinkers();
P_NetUnArchiveSpecials(); P_NetUnArchiveSpecials();
P_NetUnArchiveColormaps(); P_NetUnArchiveColormaps();
P_NetUnArchiveWaypoints();
P_RelinkPointers(); P_RelinkPointers();
P_FinishMobjs(); P_FinishMobjs();
} }