From 593003b0f7a1159f5ca5c82029275979b533927e Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 3 Apr 2020 20:53:00 -0700 Subject: [PATCH 1/8] Line special 80, raise tagged things by type to this FOF Thing type is the front texture x offset. Tag here refers to the thing's angle. For example, you have two sectors tagged to one FOF. Put a ring in each sector, give it angle 0. Then give a line in the FOF control sector special 80 front texture x offset 300. Those rings will spawn on the FOF instead of on the sector floor. Also works for object flip and slopes. --- src/p_spec.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/src/p_spec.c b/src/p_spec.c index 425d1c779..0e182fa18 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5350,6 +5350,72 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f return ffloor; } +static fixed_t +Floor_height (sector_t *s, fixed_t x, fixed_t y) +{ +#ifdef ESLOPE + return s->f_slope ? P_GetZAt(s->f_slope, x, y) : s->floorheight; +#else + (void)x; + (void)y; + return s->floorheight; +#endif +} + +static fixed_t +Ceiling_height (sector_t *s, fixed_t x, fixed_t y) +{ +#ifdef ESLOPE + return s->c_slope ? P_GetZAt(s->c_slope, x, y) : s->ceilingheight; +#else + (void)x; + (void)y; + return s->ceilingheight; +#endif +} + +static void +P_RaiseTaggedThingsToFakeFloor ( + UINT16 type, + INT16 tag, + sector_t *control +){ + sector_t *target; + + mobj_t *mo; + mapthing_t *mthing; + + fixed_t offset; + + size_t i; + + for (i = 0; i < control->numattached; ++i) + { + target = §ors[control->attached[i]]; + + for (mo = target->thinglist; mo; mo = mo->snext) + { + mthing = mo->spawnpoint; + + if ( + mthing->type == type && + mthing->angle == tag + ){ + if (( mo->flags2 & MF2_OBJECTFLIP )) + { + offset = ( mo->ceilingz - mo->info->height ) - mo->z; + mo->z = ( Floor_height(control, mo->x, mo->y) - mo->info->height ) - offset; + } + else + { + offset = mo->z - mo->floorz; + mo->z = Ceiling_height(control, mo->x, mo->y) + offset; + } + } + } + } +} + // // SPECIAL SPAWNING // @@ -6813,6 +6879,22 @@ void P_SpawnSpecials(INT32 fromnetsave) } } + /* some things have to be done after FOF spawn */ + + for (i = 0; i < numlines; ++i) + { + switch (lines[i].special) + { + case 80: // Raise tagged things by type to this FOF + P_RaiseTaggedThingsToFakeFloor( + ( sides[lines[i].sidenum[0]].textureoffset >> FRACBITS ), + lines[i].tag, + lines[i].frontsector + ); + break; + } + } + // Allocate each list for (i = 0; i < numsectors; i++) if(secthinkers[i].thinkers) From 89a2f8ec8d4746c5f836228a6ca4ce29d0f9d26f Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 4 Apr 2020 01:20:38 -0700 Subject: [PATCH 2/8] Thing type 2002, MT_WAYPOINT_RISER - Raise tagged waypoints in sector to FOF sorted by height Thing height refers to the index of FOF. FOF are sorted by top height, lowest to highest. Set Object Flip to sort highest to lowest. If the waypoint thing set Object Flip, it will be placed on the bottom of the FOF. The sorting remains the same though. Set Ambush to raise the waypoint to the same z position. --- src/dehacked.c | 1 + src/info.c | 27 +++++++++++++++ src/info.h | 1 + src/k_waypoint.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ src/k_waypoint.h | 12 ++++++- src/p_local.h | 6 ++++ src/p_map.c | 48 +++++++++++++++++++++++++++ src/p_mobj.c | 5 +++ src/p_setup.c | 6 ++++ src/p_slopes.c | 1 - src/p_spec.c | 37 +++++++++++++++++++++ src/r_defs.h | 8 +++++ 12 files changed, 236 insertions(+), 2 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 60d61903a..ab3340ed1 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7898,6 +7898,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_DEZLASER", "MT_WAYPOINT", + "MT_WAYPOINT_RISER", "MT_RANDOMAUDIENCE", diff --git a/src/info.c b/src/info.c index 9c9759f31..298ca2c8c 100644 --- a/src/info.c +++ b/src/info.c @@ -16528,6 +16528,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_WAYPOINT_RISER + 2002, // doomednum + S_INVISIBLE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 100, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 1*FRACUNIT, // radius + 2*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags + S_NULL // raisestate + }, + { // MT_RANDOMAUDIENCE 1488, // doomednum S_RANDOMAUDIENCE, // spawnstate diff --git a/src/info.h b/src/info.h index ca2f71def..5cb0a8a45 100644 --- a/src/info.h +++ b/src/info.h @@ -4829,6 +4829,7 @@ typedef enum mobj_type MT_DEZLASER, MT_WAYPOINT, + MT_WAYPOINT_RISER, MT_RANDOMAUDIENCE, diff --git a/src/k_waypoint.c b/src/k_waypoint.c index a70e3a249..fc9a7ce1d 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -16,6 +16,7 @@ #include "d_netcmd.h" #include "p_local.h" #include "p_tick.h" +#include "r_state.h" #include "z_zone.h" #include "g_game.h" @@ -1770,3 +1771,88 @@ void K_ClearWaypoints(void) numwaypointmobjs = 0U; circuitlength = 0U; } + +/*-------------------------------------------------- + void K_AdjustWaypointsParameters(void) + + See header file for description. +--------------------------------------------------*/ + +void K_AdjustWaypointsParameters (void) +{ + mobj_t *waypointmobj; + mobj_t *riser; + + fixed_t x; + fixed_t y; + + sector_t *sector; + ffloor_t *rover; + + boolean descending; + + UINT16 fof_no; + + for ( + waypointmobj = waypointcap; + waypointmobj; + waypointmobj = waypointmobj->tracer + ){ + sector = waypointmobj->subsector->sector; + + for ( + riser = sector->thinglist; + riser; + riser = riser->snext + ){ + if ( + riser->type == MT_WAYPOINT_RISER && + riser->spawnpoint->angle == waypointmobj->spawnpoint->angle + ){ + if (( riser->spawnpoint->options & MTF_AMBUSH )) + { + waypointmobj->z = riser->z; + } + else + { + descending = ( riser->spawnpoint->options & MTF_OBJECTFLIP ); + + fof_no = ( riser->spawnpoint->options >> ZSHIFT ); + + if (descending) + rover = sector->highest_ffloor; + else + rover = sector->lowest_ffloor; + + while (rover) + { + if (fof_no > 0) + { + if (descending) + rover = rover->lower; + else + rover = rover->higher; + + fof_no--; + } + else + { + x = waypointmobj->x; + y = waypointmobj->y; + + if (( waypointmobj->flags2 & MF2_OBJECTFLIP )) + { + waypointmobj->z = P_GetFOFBottomZAt(rover, x, y) - + waypointmobj->info->height; + } + else + waypointmobj->z = P_GetFOFTopZAt(rover, x, y); + + break; + } + } + } + } + } + } +} diff --git a/src/k_waypoint.h b/src/k_waypoint.h index f1a678603..0017c443e 100644 --- a/src/k_waypoint.h +++ b/src/k_waypoint.h @@ -345,4 +345,14 @@ boolean K_SetupWaypointList(void); void K_ClearWaypoints(void); -#endif \ No newline at end of file +/*-------------------------------------------------- + void K_AdjustWaypointsParameters(void) + + Adjusts waypoint parameters after P_SpawnSpecials. This is for + raising waypoints to an FOF, which requires that the FOF is + already spawned. +--------------------------------------------------*/ + +void K_AdjustWaypointsParameters (void); + +#endif diff --git a/src/p_local.h b/src/p_local.h index 0d7d3ec3e..a45119a18 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -355,6 +355,12 @@ boolean PIT_PushableMoved(mobj_t *thing); boolean P_DoSpring(mobj_t *spring, mobj_t *object); +fixed_t P_GetFOFTopZAt (ffloor_t *rover, fixed_t x, fixed_t y); +fixed_t P_GetFOFBottomZAt (ffloor_t *rover, fixed_t x, fixed_t y); + +fixed_t P_VeryTopOfFOF (ffloor_t *rover); +fixed_t P_VeryBottomOfFOF (ffloor_t *rover); + // // P_SETUP // diff --git a/src/p_map.c b/src/p_map.c index 9a3864f2c..a6306bb19 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -4749,3 +4749,51 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) return floorz; } + +fixed_t +P_GetFOFTopZAt (ffloor_t *rover, fixed_t x, fixed_t y) +{ + (void)x; + (void)y; +#ifdef ESLOPE + if (*rover->t_slope) + return P_GetZAt(*rover->t_slope, x, y); + else +#endif + return *rover->topheight; +} + +fixed_t +P_GetFOFBottomZAt (ffloor_t *rover, fixed_t x, fixed_t y) +{ + (void)x; + (void)y; +#ifdef ESLOPE + if (*rover->b_slope) + return P_GetZAt(*rover->b_slope, x, y); + else +#endif + return *rover->bottomheight; +} + +fixed_t +P_VeryTopOfFOF (ffloor_t *rover) +{ +#ifdef ESLOPE + if (*rover->t_slope) + return (*rover->t_slope)->highz; + else +#endif + return *rover->topheight; +} + +fixed_t +P_VeryBottomOfFOF (ffloor_t *rover) +{ +#ifdef ESLOPE + if (*rover->b_slope) + return (*rover->b_slope)->lowz; + else +#endif + return *rover->bottomheight; +} diff --git a/src/p_mobj.c b/src/p_mobj.c index 2a12dcc7a..a989b0019 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -12324,6 +12324,11 @@ void P_SpawnMapThing(mapthing_t *mthing) y = mthing->y << FRACBITS; ss = R_PointInSubsector(x, y); + if (i == MT_WAYPOINT_RISER) + { + ss->sector->ffloor_sorting = true; + } + if (i == MT_NIGHTSBUMPER) z = ( #ifdef ESLOPE diff --git a/src/p_setup.c b/src/p_setup.c index 40ea643b7..0eb4abc5c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -741,6 +741,10 @@ static void P_LoadRawSectors(UINT8 *data, size_t i) ss->maxattached = 1; ss->moved = true; + ss->ffloor_sorting = false; + ss->lowest_ffloor = NULL; + ss->highest_ffloor = NULL; + ss->extra_colormap = NULL; ss->floor_xoffs = ss->ceiling_xoffs = ss->floor_yoffs = ss->ceiling_yoffs = 0; @@ -3126,6 +3130,8 @@ boolean P_SetupLevel(boolean skipprecip) // set up world state P_SpawnSpecials(fromnetsave); + K_AdjustWaypointsParameters(); + if (loadprecip) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame) P_SpawnPrecipitation(); diff --git a/src/p_slopes.c b/src/p_slopes.c index e623b6f19..6c6842458 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -757,7 +757,6 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y) return slope->o.z + FixedMul(dist, slope->zdelta); } - // // P_QuantizeMomentumToSlope // diff --git a/src/p_spec.c b/src/p_spec.c index 0e182fa18..158f44dda 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5150,14 +5150,51 @@ static inline void P_AddFFloorToList(sector_t *sec, ffloor_t *ffloor) { ffloor_t *rover; + fixed_t top; + if (!sec->ffloors) { sec->ffloors = ffloor; + if (sec->ffloor_sorting) + { + sec->lowest_ffloor = ffloor; + sec->highest_ffloor = ffloor; + } ffloor->next = 0; ffloor->prev = 0; return; } + if (sec->ffloor_sorting) + { + top = P_VeryTopOfFOF(ffloor); + + for (rover = sec->lowest_ffloor; rover; rover = rover->higher) + { + if (top < P_VeryTopOfFOF(rover)) + break; + } + + if (rover) + { + if (rover->lower) + rover->lower->higher = ffloor; + else + sec->lowest_ffloor = ffloor; + + ffloor->lower = rover->lower; + ffloor->higher = rover; + + rover->lower = ffloor; + } + else + { + sec->highest_ffloor->higher = ffloor; + ffloor->lower = sec->highest_ffloor; + sec->highest_ffloor = ffloor; + } + } + for (rover = sec->ffloors; rover->next; rover = rover->next); rover->next = ffloor; diff --git a/src/r_defs.h b/src/r_defs.h index c8a72044d..399dec087 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -170,6 +170,10 @@ typedef struct ffloor_s struct ffloor_s *next; struct ffloor_s *prev; + /* if sector->ffloor_sorting */ + struct ffloor_s *higher;/* by top height */ + struct ffloor_s *lower;/* by bottom height */ + INT32 lastlight; INT32 alpha; tic_t norender; // for culling @@ -347,6 +351,10 @@ typedef struct sector_s INT32 numlights; boolean moved; + boolean ffloor_sorting; + ffloor_t *lowest_ffloor; + ffloor_t *highest_ffloor; + // per-sector colormaps! extracolormap_t *extra_colormap; From 77e01f61e6a6fa79090773f635a69da1369c1a2c Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 4 Apr 2020 01:28:53 -0700 Subject: [PATCH 3/8] Waypoint Riser: Require Object Special for discrimination by tag So the default is to affect all waypoints in the sector. --- src/k_waypoint.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/k_waypoint.c b/src/k_waypoint.c index fc9a7ce1d..1bc48b2a5 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -1807,7 +1807,10 @@ void K_AdjustWaypointsParameters (void) ){ if ( riser->type == MT_WAYPOINT_RISER && - riser->spawnpoint->angle == waypointmobj->spawnpoint->angle + ( + !( riser->spawnpoint->options & MTF_OBJECTSPECIAL ) || + riser->spawnpoint->angle == waypointmobj->spawnpoint->angle + ) ){ if (( riser->spawnpoint->options & MTF_AMBUSH )) { From 0b3b13b3b59ada7533edd16aa9b83c97d4b10314 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 15 Apr 2020 19:16:49 -0700 Subject: [PATCH 4/8] Remove FOF height sorting --- src/p_mobj.c | 5 ----- src/p_setup.c | 4 ---- src/p_spec.c | 35 ----------------------------------- src/r_defs.h | 8 -------- 4 files changed, 52 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index a989b0019..2a12dcc7a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -12324,11 +12324,6 @@ void P_SpawnMapThing(mapthing_t *mthing) y = mthing->y << FRACBITS; ss = R_PointInSubsector(x, y); - if (i == MT_WAYPOINT_RISER) - { - ss->sector->ffloor_sorting = true; - } - if (i == MT_NIGHTSBUMPER) z = ( #ifdef ESLOPE diff --git a/src/p_setup.c b/src/p_setup.c index 0eb4abc5c..4ddc3c2a9 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -741,10 +741,6 @@ static void P_LoadRawSectors(UINT8 *data, size_t i) ss->maxattached = 1; ss->moved = true; - ss->ffloor_sorting = false; - ss->lowest_ffloor = NULL; - ss->highest_ffloor = NULL; - ss->extra_colormap = NULL; ss->floor_xoffs = ss->ceiling_xoffs = ss->floor_yoffs = ss->ceiling_yoffs = 0; diff --git a/src/p_spec.c b/src/p_spec.c index 158f44dda..f6c975d9b 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5155,46 +5155,11 @@ static inline void P_AddFFloorToList(sector_t *sec, ffloor_t *ffloor) if (!sec->ffloors) { sec->ffloors = ffloor; - if (sec->ffloor_sorting) - { - sec->lowest_ffloor = ffloor; - sec->highest_ffloor = ffloor; - } ffloor->next = 0; ffloor->prev = 0; return; } - if (sec->ffloor_sorting) - { - top = P_VeryTopOfFOF(ffloor); - - for (rover = sec->lowest_ffloor; rover; rover = rover->higher) - { - if (top < P_VeryTopOfFOF(rover)) - break; - } - - if (rover) - { - if (rover->lower) - rover->lower->higher = ffloor; - else - sec->lowest_ffloor = ffloor; - - ffloor->lower = rover->lower; - ffloor->higher = rover; - - rover->lower = ffloor; - } - else - { - sec->highest_ffloor->higher = ffloor; - ffloor->lower = sec->highest_ffloor; - sec->highest_ffloor = ffloor; - } - } - for (rover = sec->ffloors; rover->next; rover = rover->next); rover->next = ffloor; diff --git a/src/r_defs.h b/src/r_defs.h index 399dec087..c8a72044d 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -170,10 +170,6 @@ typedef struct ffloor_s struct ffloor_s *next; struct ffloor_s *prev; - /* if sector->ffloor_sorting */ - struct ffloor_s *higher;/* by top height */ - struct ffloor_s *lower;/* by bottom height */ - INT32 lastlight; INT32 alpha; tic_t norender; // for culling @@ -351,10 +347,6 @@ typedef struct sector_s INT32 numlights; boolean moved; - boolean ffloor_sorting; - ffloor_t *lowest_ffloor; - ffloor_t *highest_ffloor; - // per-sector colormaps! extracolormap_t *extra_colormap; From 62143d32b372f4332a618c314b90cf0c87c8fe1e Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 15 Apr 2020 19:31:23 -0700 Subject: [PATCH 5/8] Rise waypoint to highest FOF below riser, or lowest above --- src/k_waypoint.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/src/k_waypoint.c b/src/k_waypoint.c index 1bc48b2a5..07ea34dbe 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -1791,7 +1791,8 @@ void K_AdjustWaypointsParameters (void) boolean descending; - UINT16 fof_no; + fixed_t sort; + fixed_t z; for ( waypointmobj = waypointcap; @@ -1818,42 +1819,38 @@ void K_AdjustWaypointsParameters (void) } else { + x = waypointmobj->x; + y = waypointmobj->y; + descending = ( riser->spawnpoint->options & MTF_OBJECTFLIP ); - fof_no = ( riser->spawnpoint->options >> ZSHIFT ); - if (descending) - rover = sector->highest_ffloor; + sort = sector->ceilingheight; else - rover = sector->lowest_ffloor; + sort = sector->floorheight; - while (rover) - { - if (fof_no > 0) + for ( + rover = sector->ffloors; + rover; + rover = rover->next + ){ + if (descending) { - if (descending) - rover = rover->lower; - else - rover = rover->higher; + z = P_GetFOFBottomZAt(rover, x, y); - fof_no--; + if (z > riser->z && z < sort) + sort = z; } else { - x = waypointmobj->x; - y = waypointmobj->y; + z = P_GetFOFTopZAt(rover, x, y); - if (( waypointmobj->flags2 & MF2_OBJECTFLIP )) - { - waypointmobj->z = P_GetFOFBottomZAt(rover, x, y) - - waypointmobj->info->height; - } - else - waypointmobj->z = P_GetFOFTopZAt(rover, x, y); - - break; + if (z < riser->z && z > sort) + sort = z; } } + + waypointmobj->z = sort; } } } From 02f30814eb276e302ab7b0ff1fdd3f8d7762999f Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 21 Apr 2020 00:21:41 -0700 Subject: [PATCH 6/8] Do some cleanup --- src/k_waypoint.c | 145 ++++++++++++++++++++++++++++------------------- 1 file changed, 88 insertions(+), 57 deletions(-) diff --git a/src/k_waypoint.c b/src/k_waypoint.c index 07ea34dbe..0cc52fd89 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -1772,6 +1772,88 @@ void K_ClearWaypoints(void) circuitlength = 0U; } +/*-------------------------------------------------- + static boolean K_RaiseWaypoint( + mobj_t *const waypointmobj, + const mobj_t *const riser) + + Raise a waypoint according a waypoint riser thing. + + Input Arguments:- + waypointmobj - The mobj of the waypoint to raise + riser - The waypoint riser mobj + + Return:- + True if the waypoint was risen, false if not. +--------------------------------------------------*/ + +static boolean K_RaiseWaypoint( + mobj_t *const waypointmobj, + const mobj_t *const riser) +{ + fixed_t x; + fixed_t y; + + const sector_t *sector; + ffloor_t *rover; + + boolean descending; + + fixed_t sort; + fixed_t z; + + if ( + !( riser->spawnpoint->options & MTF_OBJECTSPECIAL ) || + riser->spawnpoint->angle == waypointmobj->spawnpoint->angle + ){ + if (( riser->spawnpoint->options & MTF_AMBUSH )) + { + waypointmobj->z = riser->z; + } + else + { + x = waypointmobj->x; + y = waypointmobj->y; + + descending = ( riser->spawnpoint->options & MTF_OBJECTFLIP ); + + sector = waypointmobj->subsector->sector; + + if (descending) + sort = sector->ceilingheight; + else + sort = sector->floorheight; + + for ( + rover = sector->ffloors; + rover; + rover = rover->next + ){ + if (descending) + { + z = P_GetFOFBottomZAt(rover, x, y); + + if (z > riser->z && z < sort) + sort = z; + } + else + { + z = P_GetFOFTopZAt(rover, x, y); + + if (z < riser->z && z > sort) + sort = z; + } + } + + waypointmobj->z = sort; + } + + return true; + } + else + return false; +} + /*-------------------------------------------------- void K_AdjustWaypointsParameters(void) @@ -1781,18 +1863,9 @@ void K_ClearWaypoints(void) void K_AdjustWaypointsParameters (void) { mobj_t *waypointmobj; - mobj_t *riser; + const mobj_t *riser; - fixed_t x; - fixed_t y; - - sector_t *sector; - ffloor_t *rover; - - boolean descending; - - fixed_t sort; - fixed_t z; + const sector_t *sector; for ( waypointmobj = waypointcap; @@ -1806,52 +1879,10 @@ void K_AdjustWaypointsParameters (void) riser; riser = riser->snext ){ - if ( - riser->type == MT_WAYPOINT_RISER && - ( - !( riser->spawnpoint->options & MTF_OBJECTSPECIAL ) || - riser->spawnpoint->angle == waypointmobj->spawnpoint->angle - ) - ){ - if (( riser->spawnpoint->options & MTF_AMBUSH )) - { - waypointmobj->z = riser->z; - } - else - { - x = waypointmobj->x; - y = waypointmobj->y; - - descending = ( riser->spawnpoint->options & MTF_OBJECTFLIP ); - - if (descending) - sort = sector->ceilingheight; - else - sort = sector->floorheight; - - for ( - rover = sector->ffloors; - rover; - rover = rover->next - ){ - if (descending) - { - z = P_GetFOFBottomZAt(rover, x, y); - - if (z > riser->z && z < sort) - sort = z; - } - else - { - z = P_GetFOFTopZAt(rover, x, y); - - if (z < riser->z && z > sort) - sort = z; - } - } - - waypointmobj->z = sort; - } + if (riser->type == MT_WAYPOINT_RISER) + { + if (K_RaiseWaypoint(waypointmobj, riser)) + break; } } } From fd51bf10b060a1b290318d9b00acb6e2782e8788 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 21 Apr 2020 00:30:56 -0700 Subject: [PATCH 7/8] Thing type 2003, MT_WAYPOINT_ANCHOR - Adjust waypoint's radius The distance from the waypoint to the anchor will be the new radius. --- src/dehacked.c | 1 + src/info.c | 27 ++++++++++++++++++++++ src/info.h | 1 + src/k_waypoint.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 87 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index ab3340ed1..8507a1b03 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7899,6 +7899,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_WAYPOINT", "MT_WAYPOINT_RISER", + "MT_WAYPOINT_ANCHOR", "MT_RANDOMAUDIENCE", diff --git a/src/info.c b/src/info.c index 298ca2c8c..7bed0a78d 100644 --- a/src/info.c +++ b/src/info.c @@ -16555,6 +16555,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_WAYPOINT_ANCHOR + 2003, // doomednum + S_INVISIBLE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 100, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 1*FRACUNIT, // radius + 2*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags + S_NULL // raisestate + }, + { // MT_RANDOMAUDIENCE 1488, // doomednum S_RANDOMAUDIENCE, // spawnstate diff --git a/src/info.h b/src/info.h index 5cb0a8a45..f86fed973 100644 --- a/src/info.h +++ b/src/info.h @@ -4830,6 +4830,7 @@ typedef enum mobj_type MT_WAYPOINT, MT_WAYPOINT_RISER, + MT_WAYPOINT_ANCHOR, MT_RANDOMAUDIENCE, diff --git a/src/k_waypoint.c b/src/k_waypoint.c index 0cc52fd89..f32cf68b0 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -16,7 +16,7 @@ #include "d_netcmd.h" #include "p_local.h" #include "p_tick.h" -#include "r_state.h" +#include "r_local.h" #include "z_zone.h" #include "g_game.h" @@ -1854,6 +1854,37 @@ static boolean K_RaiseWaypoint( return false; } +/*-------------------------------------------------- + static boolean K_AnchorWaypointRadius( + mobj_t *const waypointmobj, + const mobj_t *const anchor) + + Adjust a waypoint's radius by distance from an "anchor". + + Input Arguments:- + waypointmobj - The mobj of the waypoint whose radius to adjust + riser - The waypoint anchor mobj + + Return:- + True if the waypoint's radius was adjusted, false if not. +--------------------------------------------------*/ + +static boolean K_AnchorWaypointRadius( + mobj_t *const waypointmobj, + const mobj_t *const anchor) +{ + if (anchor->spawnpoint->angle == waypointmobj->spawnpoint->angle) + { + waypointmobj->radius = R_PointToDist2( + waypointmobj->x, waypointmobj->y, + anchor->x, anchor->y); + + return true; + } + else + return false; +} + /*-------------------------------------------------- void K_AdjustWaypointsParameters(void) @@ -1865,6 +1896,9 @@ void K_AdjustWaypointsParameters (void) mobj_t *waypointmobj; const mobj_t *riser; + const thinker_t *th; + const mobj_t *anchor; + const sector_t *sector; for ( @@ -1886,4 +1920,27 @@ void K_AdjustWaypointsParameters (void) } } } + + for ( + th = thinkercap.next; + th != &thinkercap; + th = th->next + ){ + if (th->function.acp1 == (actionf_p1)P_MobjThinker) + { + anchor = (const mobj_t *)th; + + if (anchor->type == MT_WAYPOINT_ANCHOR) + { + for ( + waypointmobj = waypointcap; + waypointmobj; + waypointmobj = waypointmobj->tracer + ){ + if (K_AnchorWaypointRadius(waypointmobj, anchor)) + break; + } + } + } + } } From 48b7c75e477c871276381fc321f7b0a2cd6ebf9a Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 24 Apr 2020 20:39:54 -0700 Subject: [PATCH 8/8] Why is this still here --- src/p_spec.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index fd3b717bf..ad711fb8b 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5150,8 +5150,6 @@ static inline void P_AddFFloorToList(sector_t *sec, ffloor_t *ffloor) { ffloor_t *rover; - fixed_t top; - if (!sec->ffloors) { sec->ffloors = ffloor;