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; + } + } + } + } }