From 71851fb20c39f197ea28eb54ecb7fcad3701fb7a Mon Sep 17 00:00:00 2001 From: Sryder Date: Mon, 25 Jun 2018 22:21:42 +0100 Subject: [PATCH] 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 --- src/p_mobj.c | 31 +++++++++++++++++++++++++------ src/p_setup.c | 24 ------------------------ src/p_spec.c | 6 ++++-- 3 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5baba64c5..5f95bd2f9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -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)) + { + 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++) { - // 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 (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; } diff --git a/src/p_setup.c b/src/p_setup.c index 40fcc4dcf..bc29cc6cd 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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); - } } } diff --git a/src/p_spec.c b/src/p_spec.c index 7883a2ca7..8a1ef0609 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1709,14 +1709,14 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller { if (maptol & TOL_NIGHTS) lap = actor->player->mare; - else + else lap = actor->player->laps; } else { if (maptol & TOL_NIGHTS) lap = P_FindLowestMare(); - else + else lap = P_FindLowestLap(); } @@ -6566,6 +6566,8 @@ void P_SpawnSpecials(INT32 fromnetsave) break; #endif + case 2000: // Waypoint Parameters + break; default: break; }