mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
UDMF support for waypoints
Changes: - "waypoint ID" is now tag (previously angle) - "next waypoint ID" is now angle (previously Z height) - Z height is Z height - Radius is controlled by args[0] - "is finish line" is controlled by args[1] - Waypoint parameters linedef, riser things, and anchor things will not do anything in UDMF mode - Non-UDMF maps are unaffected
This commit is contained in:
parent
c3e7e51d89
commit
72672d68cf
2 changed files with 39 additions and 29 deletions
30
src/p_mobj.c
30
src/p_mobj.c
|
|
@ -11324,33 +11324,21 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
|
|||
const fixed_t mobjscale =
|
||||
mapheaderinfo[gamemap-1]->default_waypoint_radius;
|
||||
|
||||
// Just like MT_SPINMACEPOINT, this now works here too!
|
||||
INT32 line = P_FindSpecialLineFromTag(2000, mthing->angle, -1);
|
||||
|
||||
if (mobjscale == 0)
|
||||
mobj->radius = DEFAULT_WAYPOINT_RADIUS * mapobjectscale;
|
||||
else
|
||||
if (mthing->args[0] > 0)
|
||||
mobj->radius = (mthing->args[0]) * FRACUNIT;
|
||||
else if (mobjscale > 0)
|
||||
mobj->radius = mobjscale;
|
||||
else
|
||||
mobj->radius = DEFAULT_WAYPOINT_RADIUS * mapobjectscale;
|
||||
|
||||
// Set the radius, mobj z, and mthing z to match what the parameters want
|
||||
if (line != -1)
|
||||
{
|
||||
fixed_t lineradius = sides[lines[line].sidenum[0]].textureoffset;
|
||||
fixed_t linez = sides[lines[line].sidenum[0]].rowoffset;
|
||||
|
||||
if (lineradius > 0)
|
||||
mobj->radius = lineradius;
|
||||
mobj->z += linez;
|
||||
mthing->z += linez >> FRACBITS;
|
||||
}
|
||||
// Use threshold to store the next waypoint ID
|
||||
// movecount is being used for the current waypoint ID
|
||||
// reactiontime lets us know if we can respawn at it
|
||||
// lastlook is used for indicating the waypoint is a shortcut
|
||||
// extravalue1 is used for indicating the waypoint is disabled
|
||||
// extravalue2 is used for indicating the waypoint is the finishline
|
||||
mobj->threshold = ((mthing->options >> ZSHIFT));
|
||||
mobj->movecount = mthing->angle;
|
||||
mobj->threshold = mthing->angle;
|
||||
mobj->movecount = mthing->tag;
|
||||
if (mthing->options & MTF_EXTRA)
|
||||
{
|
||||
mobj->extravalue1 = 0; // The waypoint is disabled if extra is on
|
||||
|
|
@ -11375,9 +11363,9 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
|
|||
{
|
||||
mobj->reactiontime = 1;
|
||||
}
|
||||
if (mthing->extrainfo == 1)
|
||||
if (mthing->args[1] == 1)
|
||||
{
|
||||
mobj->extravalue2 = 1; // extrainfo of 1 means the waypoint is at the finish line
|
||||
mobj->extravalue2 = 1; // args[1] of 1 means the waypoint is at the finish line
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1357,9 +1357,7 @@ static void P_LoadThings(UINT8 *data)
|
|||
|
||||
mt->type &= 4095;
|
||||
|
||||
if (mt->type == mobjinfo[MT_WAYPOINT].doomednum)
|
||||
mt->z = 0; // Waypoints set Z pos in other methods
|
||||
else if (mt->type == 1705 || (mt->type == 750 && mt->extrainfo))
|
||||
if (mt->type == 1705 || (mt->type == 750 && mt->extrainfo))
|
||||
mt->z = mt->options; // NiGHTS Hoops use the full flags bits to set the height.
|
||||
else
|
||||
mt->z = mt->options >> ZSHIFT;
|
||||
|
|
@ -3159,6 +3157,27 @@ static void P_ConvertBinaryMap(void)
|
|||
case 780:
|
||||
mapthings[i].tag = mapthings[i].extrainfo;
|
||||
break;
|
||||
case 2001: // MT_WAYPOINT
|
||||
{
|
||||
INT32 firstline = P_FindSpecialLineFromTag(2000, mapthings[i].angle, -1);
|
||||
|
||||
mapthings[i].tag = mapthings[i].angle;
|
||||
mapthings[i].angle = mapthings[i].z;
|
||||
mapthings[i].args[1] = mapthings[i].extrainfo;
|
||||
mapthings[i].z = 0;
|
||||
|
||||
if (firstline != -1)
|
||||
{
|
||||
fixed_t lineradius = sides[lines[firstline].sidenum[0]].textureoffset;
|
||||
fixed_t linez = sides[lines[firstline].sidenum[0]].rowoffset;
|
||||
|
||||
if (lineradius > 0)
|
||||
mapthings[i].args[0] = lineradius / FRACUNIT;
|
||||
|
||||
mapthings[i].z = linez / FRACUNIT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -3991,9 +4010,6 @@ boolean P_LoadLevel(boolean fromnetsave)
|
|||
P_SpawnSpecialsAfterSlopes();
|
||||
|
||||
P_SpawnMapThings(!fromnetsave);
|
||||
|
||||
P_SpawnSpecialsThatRequireObjects();
|
||||
|
||||
skyboxmo[0] = skyboxviewpnts[0];
|
||||
skyboxmo[1] = skyboxcenterpnts[0];
|
||||
|
||||
|
|
@ -4001,7 +4017,13 @@ boolean P_LoadLevel(boolean fromnetsave)
|
|||
if (!playerstarts[numcoopstarts])
|
||||
break;
|
||||
|
||||
P_SpawnSpecialsThatRequireObjects();
|
||||
|
||||
if (!udmf)
|
||||
{
|
||||
// Backwards compatibility for non-UDMF maps
|
||||
K_AdjustWaypointsParameters();
|
||||
}
|
||||
|
||||
if (!fromnetsave) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame)
|
||||
P_SpawnPrecipitation();
|
||||
|
|
@ -4009,7 +4031,7 @@ boolean P_LoadLevel(boolean fromnetsave)
|
|||
// The waypoint data that's in PU_LEVEL needs to be reset back to 0/NULL now since PU_LEVEL was cleared
|
||||
K_ClearWaypoints();
|
||||
// Load the waypoints please!
|
||||
if ((gametyperules & GTR_CIRCUIT))
|
||||
if (gametyperules & GTR_CIRCUIT)
|
||||
{
|
||||
if (K_SetupWaypointList() == false)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue