Thing type 2003, MT_WAYPOINT_ANCHOR - Adjust waypoint's radius

The distance from the waypoint to the anchor will be the new radius.
This commit is contained in:
James R 2020-04-21 00:30:56 -07:00
parent 02f30814eb
commit fd51bf10b0
4 changed files with 87 additions and 1 deletions

View file

@ -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",

View file

@ -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

View file

@ -4830,6 +4830,7 @@ typedef enum mobj_type
MT_WAYPOINT,
MT_WAYPOINT_RISER,
MT_WAYPOINT_ANCHOR,
MT_RANDOMAUDIENCE,

View file

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