Merge branch 'waypoints' into 'next'

Store waypoints at map load instead of iterating through the thinker list to find them

See merge request STJr/SRB2!938
This commit is contained in:
MascaraSnake 2020-05-18 16:00:46 -04:00
commit 33a22331f8
7 changed files with 152 additions and 408 deletions

View File

@ -620,6 +620,18 @@ extern mapthing_t *playerstarts[MAXPLAYERS]; // Cooperative
extern mapthing_t *bluectfstarts[MAXPLAYERS]; // CTF
extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
#define WAYPOINTSEQUENCESIZE 256
#define NUMWAYPOINTSEQUENCES 256
extern mobj_t *waypoints[NUMWAYPOINTSEQUENCES][WAYPOINTSEQUENCESIZE];
extern UINT16 numwaypoints[NUMWAYPOINTSEQUENCES];
void P_AddWaypoint(UINT8 sequence, UINT8 id, mobj_t *waypoint);
mobj_t *P_GetFirstWaypoint(UINT8 sequence);
mobj_t *P_GetLastWaypoint(UINT8 sequence);
mobj_t *P_GetPreviousWaypoint(mobj_t *current, boolean wrap);
mobj_t *P_GetNextWaypoint(mobj_t *current, boolean wrap);
mobj_t *P_GetClosestWaypoint(UINT8 sequence, mobj_t *mo);
// =====================================
// Internal parameters, used for engine.
// =====================================

View File

@ -8852,19 +8852,19 @@ void A_Dye(mobj_t *actor)
return;
if (color >= MAXTRANSLATIONS)
return;
if (!color)
target->colorized = false;
else
target->colorized = true;
// What if it's a player?
if (target->player)
{
target->player->powers[pw_dye] = color;
return;
}
target->color = color;
}
@ -12700,8 +12700,8 @@ void A_Boss5FindWaypoint(mobj_t *actor)
else // locvar1 == 0
{
fixed_t hackoffset = P_MobjFlip(actor)*56*FRACUNIT;
INT32 numwaypoints = 0;
mobj_t **waypoints;
INT32 numfangwaypoints = 0;
mobj_t **fangwaypoints;
INT32 key;
actor->z += hackoffset;
@ -12726,7 +12726,7 @@ void A_Boss5FindWaypoint(mobj_t *actor)
continue;
if (!P_CheckSight(actor, mapthings[i].mobj))
continue;
numwaypoints++;
numfangwaypoints++;
}
// players also count as waypoints apparently
@ -12748,11 +12748,11 @@ void A_Boss5FindWaypoint(mobj_t *actor)
continue;
if (!P_CheckSight(actor, players[i].mo))
continue;
numwaypoints++;
numfangwaypoints++;
}
}
if (!numwaypoints)
if (!numfangwaypoints)
{
// restore z position
actor->z -= hackoffset;
@ -12760,8 +12760,8 @@ void A_Boss5FindWaypoint(mobj_t *actor)
}
// allocate the table and reset count to zero
waypoints = Z_Calloc(sizeof(*waypoints)*numwaypoints, PU_STATIC, NULL);
numwaypoints = 0;
fangwaypoints = Z_Calloc(sizeof(*waypoints)*numfangwaypoints, PU_STATIC, NULL);
numfangwaypoints = 0;
// now find them again and add them to the table!
for (i = 0; i < nummapthings; i++)
@ -12786,7 +12786,7 @@ void A_Boss5FindWaypoint(mobj_t *actor)
}
if (!P_CheckSight(actor, mapthings[i].mobj))
continue;
waypoints[numwaypoints++] = mapthings[i].mobj;
fangwaypoints[numfangwaypoints++] = mapthings[i].mobj;
}
if (actor->extravalue2 > 1)
@ -12807,25 +12807,25 @@ void A_Boss5FindWaypoint(mobj_t *actor)
continue;
if (!P_CheckSight(actor, players[i].mo))
continue;
waypoints[numwaypoints++] = players[i].mo;
fangwaypoints[numfangwaypoints++] = players[i].mo;
}
}
// restore z position
actor->z -= hackoffset;
if (!numwaypoints)
if (!numfangwaypoints)
{
Z_Free(waypoints); // free table
Z_Free(fangwaypoints); // free table
goto nowaypoints; // ???
}
key = P_RandomKey(numwaypoints);
key = P_RandomKey(numfangwaypoints);
P_SetTarget(&actor->tracer, waypoints[key]);
P_SetTarget(&actor->tracer, fangwaypoints[key]);
if (actor->tracer->type == MT_FANGWAYPOINT)
actor->tracer->reactiontime = numwaypoints/4; // Monster Iestyn: is this how it should be? I count center waypoints as waypoints unlike the original Lua script
Z_Free(waypoints); // free table
actor->tracer->reactiontime = numfangwaypoints/4; // Monster Iestyn: is this how it should be? I count center waypoints as waypoints unlike the original Lua script
Z_Free(fangwaypoints); // free table
}
// now face the tracer you just set!

View File

@ -12678,9 +12678,14 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
mobj->threshold = min(mthing->extrainfo, 7);
break;
case MT_TUBEWAYPOINT:
mobj->health = mthing->angle & 255;
mobj->threshold = mthing->angle >> 8;
{
UINT8 sequence = mthing->angle >> 8;
UINT8 id = mthing->angle & 255;
mobj->health = id;
mobj->threshold = sequence;
P_AddWaypoint(sequence, id, mobj);
break;
}
case MT_IDEYAANCHOR:
mobj->health = mthing->extrainfo;
break;

View File

@ -1571,10 +1571,8 @@ void T_PolyObjMove(polymove_t *th)
void T_PolyObjWaypoint(polywaypoint_t *th)
{
mobj_t *mo2;
mobj_t *target = NULL;
mobj_t *waypoint = NULL;
thinker_t *wp;
fixed_t adjustx, adjusty, adjustz;
fixed_t momx, momy, momz, dist;
INT32 start;
@ -1593,30 +1591,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
#endif
// check for displacement due to override and reattach when possible
if (po->thinker == NULL)
if (!po->thinker)
po->thinker = &th->thinker;
/*
// Find out target first.
// We redo this each tic to make savegame compatibility easier.
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
{
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)wp;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold == th->sequence && mo2->health == th->pointnum)
{
target = mo2;
break;
}
}
*/
target = th->target;
if (!target)
@ -1683,38 +1660,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
if (!th->stophere)
{
CONS_Debug(DBG_POLYOBJ, "Looking for next waypoint...\n");
// Find next waypoint
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
{
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)wp;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != th->sequence)
continue;
if (th->direction == -1)
{
if (mo2->health == target->health - 1)
{
waypoint = mo2;
break;
}
}
else
{
if (mo2->health == target->health + 1)
{
waypoint = mo2;
break;
}
}
}
waypoint = (th->direction == -1) ? P_GetPreviousWaypoint(target, false) : P_GetNextWaypoint(target, false);
if (!waypoint && th->wrap) // If specified, wrap waypoints
{
@ -1724,35 +1670,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
th->stophere = true;
}
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
{
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)wp;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != th->sequence)
continue;
if (th->direction == -1)
{
if (waypoint == NULL)
waypoint = mo2;
else if (mo2->health > waypoint->health)
waypoint = mo2;
}
else
{
if (mo2->health == 0)
{
waypoint = mo2;
break;
}
}
}
waypoint = (th->direction == -1) ? P_GetLastWaypoint(th->sequence) : P_GetFirstWaypoint(th->sequence);
}
else if (!waypoint && th->comeback) // Come back to the start
{
@ -1761,36 +1679,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
if (!th->continuous)
th->comeback = false;
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
{
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)wp;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != th->sequence)
continue;
if (th->direction == -1)
{
if (mo2->health == target->health - 1)
{
waypoint = mo2;
break;
}
}
else
{
if (mo2->health == target->health + 1)
{
waypoint = mo2;
break;
}
}
}
waypoint = (th->direction == -1) ? P_GetPreviousWaypoint(target, false) : P_GetNextWaypoint(target, false);
}
}
@ -2276,11 +2165,9 @@ boolean EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
{
polyobj_t *po;
polywaypoint_t *th;
mobj_t *mo2;
mobj_t *first = NULL;
mobj_t *last = NULL;
mobj_t *target = NULL;
thinker_t *wp;
if (!(po = Polyobj_GetForNum(pwdata->polyObjNum)))
{
@ -2305,10 +2192,7 @@ boolean EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
th->polyObjNum = pwdata->polyObjNum;
th->speed = pwdata->speed;
th->sequence = pwdata->sequence; // Used to specify sequence #
if (pwdata->reverse)
th->direction = -1;
else
th->direction = 1;
th->direction = pwdata->reverse ? -1 : 1;
th->comeback = pwdata->comeback;
th->continuous = pwdata->continuous;
@ -2316,44 +2200,8 @@ boolean EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
th->stophere = false;
// Find the first waypoint we need to use
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
{
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)wp;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != th->sequence)
continue;
if (th->direction == -1) // highest waypoint #
{
if (mo2->health == 0)
last = mo2;
else
{
if (first == NULL)
first = mo2;
else if (mo2->health > first->health)
first = mo2;
}
}
else // waypoint 0
{
if (mo2->health == 0)
first = mo2;
else
{
if (last == NULL)
last = mo2;
else if (mo2->health > last->health)
last = mo2;
}
}
}
first = (th->direction == -1) ? P_GetLastWaypoint(th->sequence) : P_GetFirstWaypoint(th->sequence);
last = (th->direction == -1) ? P_GetFirstWaypoint(th->sequence) : P_GetLastWaypoint(th->sequence);
if (!first)
{
@ -2387,36 +2235,6 @@ boolean EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
// Find the actual target movement waypoint
target = first;
/*for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
{
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)wp;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != th->sequence)
continue;
if (th->direction == -1) // highest waypoint #
{
if (mo2->health == first->health - 1)
{
target = mo2;
break;
}
}
else // waypoint 0
{
if (mo2->health == first->health + 1)
{
target = mo2;
break;
}
}
}*/
if (!target)
{

View File

@ -144,6 +144,101 @@ mapthing_t *playerstarts[MAXPLAYERS];
mapthing_t *bluectfstarts[MAXPLAYERS];
mapthing_t *redctfstarts[MAXPLAYERS];
// Maintain waypoints
mobj_t *waypoints[NUMWAYPOINTSEQUENCES][WAYPOINTSEQUENCESIZE];
UINT16 numwaypoints[NUMWAYPOINTSEQUENCES];
void P_AddWaypoint(UINT8 sequence, UINT8 id, mobj_t *waypoint)
{
waypoints[sequence][id] = waypoint;
if (id >= numwaypoints[sequence])
numwaypoints[sequence] = id + 1;
}
static void P_ResetWaypoints(void)
{
UINT16 sequence, id;
for (sequence = 0; sequence < NUMWAYPOINTSEQUENCES; sequence++)
{
for (id = 0; id < numwaypoints[sequence]; id++)
waypoints[sequence][id] = NULL;
numwaypoints[sequence] = 0;
}
}
mobj_t *P_GetFirstWaypoint(UINT8 sequence)
{
return waypoints[sequence][0];
}
mobj_t *P_GetLastWaypoint(UINT8 sequence)
{
return waypoints[sequence][numwaypoints[sequence] - 1];
}
mobj_t *P_GetPreviousWaypoint(mobj_t *current, boolean wrap)
{
UINT8 sequence = current->threshold;
UINT8 id = current->health;
if (id == 0)
{
if (!wrap)
return NULL;
id = numwaypoints[sequence] - 1;
}
else
id--;
return waypoints[sequence][id];
}
mobj_t *P_GetNextWaypoint(mobj_t *current, boolean wrap)
{
UINT8 sequence = current->threshold;
UINT8 id = current->health;
if (id == numwaypoints[sequence] - 1)
{
if (!wrap)
return NULL;
id = 0;
}
else
id++;
return waypoints[sequence][id];
}
mobj_t *P_GetClosestWaypoint(UINT8 sequence, mobj_t *mo)
{
UINT8 wp;
mobj_t *mo2, *result = NULL;
fixed_t bestdist = 0;
fixed_t curdist;
for (wp = 0; wp < numwaypoints[sequence]; wp++)
{
mo2 = waypoints[sequence][wp];
if (!mo2)
continue;
curdist = P_AproxDistance(P_AproxDistance(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z);
if (result && curdist > bestdist)
continue;
result = mo2;
bestdist = curdist;
}
return result;
}
/** Logs an error about a map being corrupt, then terminate.
* This allows reporting highly technical errors for usefulness, without
* confusing a novice map designer who simply needs to run ZenNode.
@ -3545,6 +3640,8 @@ boolean P_LoadLevel(boolean fromnetsave)
P_ResetSpawnpoints();
P_ResetWaypoints();
P_MapStart();
if (!P_LoadMapFromFile())

View File

@ -4799,9 +4799,7 @@ DoneSection2:
INT32 sequence;
fixed_t speed;
INT32 lineindex;
thinker_t *th;
mobj_t *waypoint = NULL;
mobj_t *mo2;
angle_t an;
if (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT && player->powers[pw_carry] == CR_ZOOMTUBE)
@ -4826,25 +4824,7 @@ DoneSection2:
break;
}
// scan the thinkers
// to find the first waypoint
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != sequence)
continue;
if (mo2->health != 0)
continue;
waypoint = mo2;
break;
}
waypoint = P_GetFirstWaypoint(sequence);
if (!waypoint)
{
@ -4881,9 +4861,7 @@ DoneSection2:
INT32 sequence;
fixed_t speed;
INT32 lineindex;
thinker_t *th;
mobj_t *waypoint = NULL;
mobj_t *mo2;
angle_t an;
if (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT && player->powers[pw_carry] == CR_ZOOMTUBE)
@ -4908,25 +4886,7 @@ DoneSection2:
break;
}
// scan the thinkers
// to find the last waypoint
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != sequence)
continue;
if (!waypoint)
waypoint = mo2;
else if (mo2->health > waypoint->health)
waypoint = mo2;
}
waypoint = P_GetLastWaypoint(sequence);
if (!waypoint)
{
@ -5008,14 +4968,11 @@ DoneSection2:
INT32 sequence;
fixed_t speed;
INT32 lineindex;
thinker_t *th;
mobj_t *waypointmid = NULL;
mobj_t *waypointhigh = NULL;
mobj_t *waypointlow = NULL;
mobj_t *mo2;
mobj_t *closest = NULL;
vector3_t p, line[2], resulthigh, resultlow;
mobj_t *highest = NULL;
if (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT && player->powers[pw_carry] == CR_ROPEHANG)
break;
@ -5061,98 +5018,16 @@ DoneSection2:
// Determine the closest spot on the line between the three waypoints
// Put player at that location.
// scan the thinkers
// to find the first waypoint
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
waypointmid = P_GetClosestWaypoint(sequence, player->mo);
mo2 = (mobj_t *)th;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != sequence)
continue;
if (!highest)
highest = mo2;
else if (mo2->health > highest->health) // Find the highest waypoint # in case we wrap
highest = mo2;
if (closest && P_AproxDistance(P_AproxDistance(player->mo->x-mo2->x, player->mo->y-mo2->y),
player->mo->z-mo2->z) > P_AproxDistance(P_AproxDistance(player->mo->x-closest->x,
player->mo->y-closest->y), player->mo->z-closest->z))
continue;
// Found a target
closest = mo2;
}
waypointmid = closest;
closest = NULL;
if (waypointmid == NULL)
if (!waypointmid)
{
CONS_Debug(DBG_GAMELOGIC, "ERROR: WAYPOINT(S) IN SEQUENCE %d NOT FOUND.\n", sequence);
break;
}
// Find waypoint before this one (waypointlow)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != sequence)
continue;
if (waypointmid->health == 0)
{
if (mo2->health != highest->health)
continue;
}
else if (mo2->health != waypointmid->health - 1)
continue;
// Found a target
waypointlow = mo2;
break;
}
// Find waypoint after this one (waypointhigh)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != sequence)
continue;
if (waypointmid->health == highest->health)
{
if (mo2->health != 0)
continue;
}
else if (mo2->health != waypointmid->health + 1)
continue;
// Found a target
waypointhigh = mo2;
break;
}
waypointlow = P_GetPreviousWaypoint(waypointmid, true);
waypointhigh = P_GetNextWaypoint(waypointmid, true);
CONS_Debug(DBG_GAMELOGIC, "WaypointMid: %d; WaypointLow: %d; WaypointHigh: %d\n",
waypointmid->health, waypointlow ? waypointlow->health : -1, waypointhigh ? waypointhigh->health : -1);
@ -5199,6 +5074,7 @@ DoneSection2:
if (lines[lineindex].flags & ML_EFFECT1) // Don't wrap
{
mobj_t *highest = P_GetLastWaypoint(sequence);
highest->flags |= MF_SLIDEME;
}
@ -5210,7 +5086,7 @@ DoneSection2:
player->mo->y = resulthigh.y;
player->mo->z = resulthigh.z - P_GetPlayerHeight(player);
}
else if ((lines[lineindex].flags & ML_EFFECT1) && waypointmid->health == highest->health)
else if ((lines[lineindex].flags & ML_EFFECT1) && waypointmid->health == numwaypoints[sequence] - 1)
{
closest = waypointmid;
player->mo->x = resultlow.x;

View File

@ -8709,10 +8709,7 @@ static void P_MovePlayer(player_t *player)
static void P_DoZoomTube(player_t *player)
{
INT32 sequence;
fixed_t speed;
thinker_t *th;
mobj_t *mo2;
mobj_t *waypoint = NULL;
fixed_t dist;
boolean reverse;
@ -8728,8 +8725,6 @@ static void P_DoZoomTube(player_t *player)
speed = abs(player->speed);
sequence = player->mo->tracer->threshold;
// change slope
dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - player->mo->z);
@ -8761,28 +8756,7 @@ static void P_DoZoomTube(player_t *player)
CONS_Debug(DBG_GAMELOGIC, "Looking for next waypoint...\n");
// Find next waypoint
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != sequence)
continue;
if (reverse && mo2->health != player->mo->tracer->health - 1)
continue;
if (!reverse && mo2->health != player->mo->tracer->health + 1)
continue;
waypoint = mo2;
break;
}
waypoint = reverse ? P_GetPreviousWaypoint(player->mo->tracer, false) : P_GetNextWaypoint(player->mo->tracer, false);
if (waypoint)
{
@ -8833,8 +8807,6 @@ static void P_DoRopeHang(player_t *player)
{
INT32 sequence;
fixed_t speed;
thinker_t *th;
mobj_t *mo2;
mobj_t *waypoint = NULL;
fixed_t dist;
fixed_t playerz;
@ -8897,50 +8869,14 @@ static void P_DoRopeHang(player_t *player)
CONS_Debug(DBG_GAMELOGIC, "Looking for next waypoint...\n");
// Find next waypoint
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != sequence)
continue;
if (mo2->health != player->mo->tracer->health + 1)
continue;
waypoint = mo2;
break;
}
waypoint = P_GetNextWaypoint(player->mo->tracer, false);
if (!(player->mo->tracer->flags & MF_SLIDEME) && !waypoint)
{
CONS_Debug(DBG_GAMELOGIC, "Next waypoint not found, wrapping to start...\n");
// Wrap around back to first waypoint
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type != MT_TUBEWAYPOINT)
continue;
if (mo2->threshold != sequence)
continue;
if (mo2->health != 0)
continue;
waypoint = mo2;
break;
}
waypoint = P_GetFirstWaypoint(sequence);
}
if (waypoint)