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:
Sally Coolatta 2020-09-27 03:58:41 -04:00
parent c3e7e51d89
commit 72672d68cf
2 changed files with 39 additions and 29 deletions

View file

@ -11324,33 +11324,21 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
const fixed_t mobjscale = const fixed_t mobjscale =
mapheaderinfo[gamemap-1]->default_waypoint_radius; mapheaderinfo[gamemap-1]->default_waypoint_radius;
// Just like MT_SPINMACEPOINT, this now works here too! if (mthing->args[0] > 0)
INT32 line = P_FindSpecialLineFromTag(2000, mthing->angle, -1); mobj->radius = (mthing->args[0]) * FRACUNIT;
else if (mobjscale > 0)
if (mobjscale == 0)
mobj->radius = DEFAULT_WAYPOINT_RADIUS * mapobjectscale;
else
mobj->radius = mobjscale; 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 // Use threshold to store the next waypoint ID
// movecount is being used for the current waypoint ID // movecount is being used for the current waypoint ID
// reactiontime lets us know if we can respawn at it // reactiontime lets us know if we can respawn at it
// lastlook is used for indicating the waypoint is a shortcut // lastlook is used for indicating the waypoint is a shortcut
// extravalue1 is used for indicating the waypoint is disabled // extravalue1 is used for indicating the waypoint is disabled
// extravalue2 is used for indicating the waypoint is the finishline // extravalue2 is used for indicating the waypoint is the finishline
mobj->threshold = ((mthing->options >> ZSHIFT)); mobj->threshold = mthing->angle;
mobj->movecount = mthing->angle; mobj->movecount = mthing->tag;
if (mthing->options & MTF_EXTRA) if (mthing->options & MTF_EXTRA)
{ {
mobj->extravalue1 = 0; // The waypoint is disabled if extra is on 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; 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 else
{ {

View file

@ -1357,9 +1357,7 @@ static void P_LoadThings(UINT8 *data)
mt->type &= 4095; mt->type &= 4095;
if (mt->type == mobjinfo[MT_WAYPOINT].doomednum) if (mt->type == 1705 || (mt->type == 750 && mt->extrainfo))
mt->z = 0; // Waypoints set Z pos in other methods
else if (mt->type == 1705 || (mt->type == 750 && mt->extrainfo))
mt->z = mt->options; // NiGHTS Hoops use the full flags bits to set the height. mt->z = mt->options; // NiGHTS Hoops use the full flags bits to set the height.
else else
mt->z = mt->options >> ZSHIFT; mt->z = mt->options >> ZSHIFT;
@ -3159,6 +3157,27 @@ static void P_ConvertBinaryMap(void)
case 780: case 780:
mapthings[i].tag = mapthings[i].extrainfo; mapthings[i].tag = mapthings[i].extrainfo;
break; 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: default:
break; break;
} }
@ -3991,9 +4010,6 @@ boolean P_LoadLevel(boolean fromnetsave)
P_SpawnSpecialsAfterSlopes(); P_SpawnSpecialsAfterSlopes();
P_SpawnMapThings(!fromnetsave); P_SpawnMapThings(!fromnetsave);
P_SpawnSpecialsThatRequireObjects();
skyboxmo[0] = skyboxviewpnts[0]; skyboxmo[0] = skyboxviewpnts[0];
skyboxmo[1] = skyboxcenterpnts[0]; skyboxmo[1] = skyboxcenterpnts[0];
@ -4001,7 +4017,13 @@ boolean P_LoadLevel(boolean fromnetsave)
if (!playerstarts[numcoopstarts]) if (!playerstarts[numcoopstarts])
break; break;
K_AdjustWaypointsParameters(); P_SpawnSpecialsThatRequireObjects();
if (!udmf)
{
// Backwards compatibility for non-UDMF maps
K_AdjustWaypointsParameters();
}
if (!fromnetsave) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame) if (!fromnetsave) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame)
P_SpawnPrecipitation(); 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 // The waypoint data that's in PU_LEVEL needs to be reset back to 0/NULL now since PU_LEVEL was cleared
K_ClearWaypoints(); K_ClearWaypoints();
// Load the waypoints please! // Load the waypoints please!
if ((gametyperules & GTR_CIRCUIT)) if (gametyperules & GTR_CIRCUIT)
{ {
if (K_SetupWaypointList() == false) if (K_SetupWaypointList() == false)
{ {