mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Merge remote-tracking branch 'origin/master' into HEAD
This commit is contained in:
commit
e8ca96ceb4
3 changed files with 66 additions and 1 deletions
|
|
@ -348,6 +348,16 @@ size_t K_GetWaypointHeapIndex(waypoint_t *waypoint)
|
||||||
return waypointindex;
|
return waypointindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
size_t K_GetNumWaypoints(void)
|
||||||
|
|
||||||
|
See header file for description.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
size_t K_GetNumWaypoints(void)
|
||||||
|
{
|
||||||
|
return numwaypoints;
|
||||||
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
waypoint_t *K_GetWaypointFromIndex(size_t waypointindex)
|
waypoint_t *K_GetWaypointFromIndex(size_t waypointindex)
|
||||||
|
|
||||||
|
|
@ -1508,7 +1518,6 @@ static waypoint_t *K_MakeWaypoint(mobj_t *const mobj)
|
||||||
I_Assert(waypointcap != NULL); // No waypoint mobjs in map load
|
I_Assert(waypointcap != NULL); // No waypoint mobjs in map load
|
||||||
I_Assert(numwaypoints < numwaypointmobjs); // waypoint array reached max capacity
|
I_Assert(numwaypoints < numwaypointmobjs); // waypoint array reached max capacity
|
||||||
|
|
||||||
// numwaypoints is incremented later in K_SetupWaypoint
|
|
||||||
madewaypoint = &waypointheap[numwaypoints];
|
madewaypoint = &waypointheap[numwaypoints];
|
||||||
numwaypoints++;
|
numwaypoints++;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -287,6 +287,16 @@ waypoint_t *K_SearchWaypointHeapForMobj(mobj_t * const mobj);
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
size_t K_GetWaypointHeapIndex(waypoint_t *waypoint);
|
size_t K_GetWaypointHeapIndex(waypoint_t *waypoint);
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
size_t K_GetNumWaypoints(void)
|
||||||
|
|
||||||
|
Returns the number of waypoints that are in the heap.
|
||||||
|
Intended for Net Archiving/Unarchiving
|
||||||
|
|
||||||
|
Return:-
|
||||||
|
The number of waypoints in the heap
|
||||||
|
--------------------------------------------------*/
|
||||||
|
size_t K_GetNumWaypoints(void);
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
waypoint_t *K_GetWaypointFromIndex(size_t waypointindex)
|
waypoint_t *K_GetWaypointFromIndex(size_t waypointindex)
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ UINT8 *save_p;
|
||||||
#define ARCHIVEBLOCK_POBJS 0x7F928546
|
#define ARCHIVEBLOCK_POBJS 0x7F928546
|
||||||
#define ARCHIVEBLOCK_THINKERS 0x7F37037C
|
#define ARCHIVEBLOCK_THINKERS 0x7F37037C
|
||||||
#define ARCHIVEBLOCK_SPECIALS 0x7F228378
|
#define ARCHIVEBLOCK_SPECIALS 0x7F228378
|
||||||
|
#define ARCHIVEBLOCK_WAYPOINTS 0x7F46498F
|
||||||
|
|
||||||
// Note: This cannot be bigger
|
// Note: This cannot be bigger
|
||||||
// than an UINT16
|
// than an UINT16
|
||||||
|
|
@ -1892,6 +1893,49 @@ static void P_NetArchiveThinkers(void)
|
||||||
WRITEUINT8(save_p, tc_end);
|
WRITEUINT8(save_p, tc_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void P_NetArchiveWaypoints(void)
|
||||||
|
{
|
||||||
|
waypoint_t *waypoint;
|
||||||
|
size_t i;
|
||||||
|
size_t numWaypoints = K_GetNumWaypoints();
|
||||||
|
|
||||||
|
WRITEUINT32(save_p, ARCHIVEBLOCK_WAYPOINTS);
|
||||||
|
WRITEUINT32(save_p, numWaypoints);
|
||||||
|
|
||||||
|
for (i = 0U; i < numWaypoints; i++) {
|
||||||
|
waypoint = K_GetWaypointFromIndex(i);
|
||||||
|
|
||||||
|
// The only thing we save for each waypoint is the mobj.
|
||||||
|
// Waypoints should NEVER be completely created or destroyed mid-race as a result of this
|
||||||
|
WRITEUINT32(save_p, waypoint->mobj->mobjnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void P_NetUnArchiveWaypoints(void)
|
||||||
|
{
|
||||||
|
if (READUINT32(save_p) != ARCHIVEBLOCK_WAYPOINTS)
|
||||||
|
I_Error("Bad $$$.sav at archive block Waypoints!");
|
||||||
|
else {
|
||||||
|
UINT32 numArchiveWaypoints = READUINT32(save_p);
|
||||||
|
size_t numSpawnedWaypoints = K_GetNumWaypoints();
|
||||||
|
|
||||||
|
if (numArchiveWaypoints != numSpawnedWaypoints) {
|
||||||
|
I_Error("Bad $$$.sav: More saved waypoints than created!");
|
||||||
|
} else {
|
||||||
|
waypoint_t *waypoint;
|
||||||
|
UINT32 i;
|
||||||
|
UINT32 temp;
|
||||||
|
for (i = 0U; i < numArchiveWaypoints; i++) {
|
||||||
|
waypoint = K_GetWaypointFromIndex(i);
|
||||||
|
temp = READUINT32(save_p);
|
||||||
|
if (!P_SetTarget(&waypoint->mobj, P_FindNewPosition(temp))) {
|
||||||
|
CONS_Debug(DBG_GAMELOGIC, "waypoint mobj not found for %d\n", i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now save the pointers, tracer and target, but at load time we must
|
// Now save the pointers, tracer and target, but at load time we must
|
||||||
// relink to this; the savegame contains the old position in the pointer
|
// relink to this; the savegame contains the old position in the pointer
|
||||||
// field copyed in the info field temporarily, but finally we just search
|
// field copyed in the info field temporarily, but finally we just search
|
||||||
|
|
@ -3510,6 +3554,7 @@ void P_SaveNetGame(void)
|
||||||
#endif
|
#endif
|
||||||
P_NetArchiveThinkers();
|
P_NetArchiveThinkers();
|
||||||
P_NetArchiveSpecials();
|
P_NetArchiveSpecials();
|
||||||
|
P_NetArchiveWaypoints();
|
||||||
}
|
}
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
LUA_Archive();
|
LUA_Archive();
|
||||||
|
|
@ -3554,6 +3599,7 @@ boolean P_LoadNetGame(void)
|
||||||
#endif
|
#endif
|
||||||
P_NetUnArchiveThinkers();
|
P_NetUnArchiveThinkers();
|
||||||
P_NetUnArchiveSpecials();
|
P_NetUnArchiveSpecials();
|
||||||
|
P_NetUnArchiveWaypoints();
|
||||||
P_RelinkPointers();
|
P_RelinkPointers();
|
||||||
P_FinishMobjs();
|
P_FinishMobjs();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue