Waypoint Spawning

Uses object MT_WAYPOINT, mapthing type 2001
Placing one by itself will always place it on the floor or ceiling (depending on object flip)
Placing one alongside another that uses Object Special will make the original use the z height of the 2nd
Angle will be used to determine the waypoint's ID
Z Height (threshold on mobjs) will be used to determine the ID of the previous waypoint
Waypoints with the Ambush Flag will be unable to be respawned at (reactiontime on mobjs internally)
This commit is contained in:
Sryder13 2017-11-12 01:10:02 +00:00
parent bb35f222c9
commit 3ae8623ebb
3 changed files with 64 additions and 2 deletions

View file

@ -15195,7 +15195,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_WAYPOINT
2001, // doomednum
S_NULL, // spawnstate
S_UNKNOWN, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
@ -15216,7 +15216,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
100, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOCLIP|MF_NOGRAVITY, // flags
MF_NOBLOCKMAP/*|MF_NOSECTOR*/|MF_NOCLIP|MF_NOGRAVITY, // flags
S_NULL // raisestate
},

View file

@ -9641,6 +9641,26 @@ void P_SpawnMapThing(mapthing_t *mthing)
else
mthing->z = (INT16)(z>>FRACBITS);
}
else if (i == MT_WAYPOINT && !(mthing->options & MTF_OBJECTSPECIAL))
{
// just gets set on either the floor or ceiling
boolean flip = (!!(mobjinfo[i].flags & MF_SPAWNCEILING) ^ !!(mthing->options & MTF_OBJECTFLIP));
// applying offsets! (if any)
if (flip)
{
z = ONCEILINGZ;
}
else
{
z = ONFLOORZ;
}
if (z == ONFLOORZ)
mthing->z = 0;
else
mthing->z = (INT16)(z>>FRACBITS);
}
else
{
fixed_t offset = 0;
@ -9893,6 +9913,24 @@ ML_NOCLIMB : Direction not controllable
case MT_TRAPGOYLELONG:
if (mthing->angle >= 360)
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));
}
if (mthing->options & MTF_AMBUSH)
{
mobj->reactiontime = 1;
}
else
{
mobj->reactiontime = 0;
}
break;
default:
break;
}

View file

@ -915,6 +915,24 @@ 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
//
@ -1050,6 +1068,12 @@ 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);
}
}
}