Waypoint spawning update

Use Linedef Action 2000 as Waypoint Parameters to set height and radius, instead of having separate mobjs
use movecount as current ID instead
This commit is contained in:
Sryder 2018-06-25 22:21:42 +01:00
parent c0dc643295
commit 71851fb20c
3 changed files with 29 additions and 32 deletions

View file

@ -10222,7 +10222,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
else
mthing->z = (INT16)(z>>FRACBITS);
}
else if (i == MT_WAYPOINT && !(mthing->options & MTF_OBJECTSPECIAL))
else if (i == MT_WAYPOINT)
{
// just gets set on either the floor or ceiling
boolean flip = (!!(mobjinfo[i].flags & MF_SPAWNCEILING) ^ !!(mthing->options & MTF_OBJECTFLIP));
@ -10496,13 +10496,31 @@ ML_NOCLIMB : Direction not controllable
mobj->tics += 7*(mthing->angle / 360) + 1; // starting delay
break;
case MT_WAYPOINT:
if (!(mthing->options & MTF_OBJECTSPECIAL))
{
// Z is already altered to account for proper height
// Use threshold to store the previous waypoint ID
// Angle is being used for the current waypoint ID
mobj->threshold = ((mthing->options >> ZSHIFT));
size_t line;
mobj->radius = 256*FRACUNIT;
// Same reason as for MT_SPINMACEPOINT we can't use the function to find the linedef
for (line = 0; line < numlines; line++)
{
if (lines[line].special == 2000 && lines[line].tag == mthing->angle)
break;
}
// Set the radius, mobj z, and mthing z to match what the parameters want
if (line < numlines)
{
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
mobj->threshold = ((mthing->options >> ZSHIFT));
mobj->movecount = mthing->angle;
if (mthing->options & MTF_AMBUSH)
{
mobj->reactiontime = 1;
@ -10512,6 +10530,7 @@ ML_NOCLIMB : Direction not controllable
mobj->reactiontime = 0;
}
break;
}
default:
break;
}

View file

@ -923,24 +923,6 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum)
}
#endif
static void P_SetWaypointsHeight(mapthing_t *mt)
{
mapthing_t *mt2 = mapthings;
size_t i;
for (i = 0; i < nummapthings; i++, mt2++)
{
if (!(mt2->type == mobjinfo[MT_WAYPOINT].doomednum && (mt2->options & MTF_OBJECTSPECIAL)))
continue;
if (mt->angle == mt2->angle) // same waypoint id
{
mt->z = mt2->z;
mt->mobj->z = mt2->mobj->z;
P_RemoveMobj(mt2->mobj);
}
}
}
//
// P_LoadThings
//
@ -1079,12 +1061,6 @@ static void P_LoadThings(void)
P_SpawnHoopsAndRings (mt);
}
if (mt->type == mobjinfo[MT_WAYPOINT].doomednum && !(mt->options & MTF_OBJECTSPECIAL))
{
// use any "2nd" waypoint mobjs to set the height of original, then remove the 2nds mobjs
P_SetWaypointsHeight(mt);
}
}
}

View file

@ -6566,6 +6566,8 @@ void P_SpawnSpecials(INT32 fromnetsave)
break;
#endif
case 2000: // Waypoint Parameters
break;
default:
break;
}