ReaperThinker: Changed the conditions in the th iterations and moved that i=0 at the start of the loop.

This commit is contained in:
Latapostrophe 2018-10-21 10:05:05 +02:00
parent 39d24f2319
commit 1bd7959b20

View file

@ -8687,14 +8687,17 @@ void A_ReaperThinker(mobj_t *actor)
mo2 = (mobj_t *)th; mo2 = (mobj_t *)th;
if (mo2->type == MT_REAPERWAYPOINT && mo2->spawnpoint->angle == 0) if (mo2->type != MT_REAPERWAYPOINT)
{ continue;
if (mo2->spawnpoint->angle != 0)
continue;
P_SetTarget(&actor->target, mo2); // The main target we're pursing. P_SetTarget(&actor->target, mo2); // The main target we're pursing.
P_SetTarget(&actor->hnext, mo2); // The last waypoint we hit. We will default back to that if a player goes out of our range! P_SetTarget(&actor->hnext, mo2); // The last waypoint we hit. We will default back to that if a player goes out of our range!
actor->extravalue1 = 0; // This will store the angle of the last waypoint we touched. This will essentially be useful later on. actor->extravalue1 = 0; // This will store the angle of the last waypoint we touched. This will essentially be useful later on.
if (!actor->tracer) // If we already have a tracer (Waypoint #0), don't do anything. if (!actor->tracer) // If we already have a tracer (Waypoint #0), don't do anything.
{
P_SetTarget(&actor->tracer, mo2); // Because our target might be a player OR a waypoint, we need some sort of fallback option. This will always be waypoint 0. P_SetTarget(&actor->tracer, mo2); // Because our target might be a player OR a waypoint, we need some sort of fallback option. This will always be waypoint 0.
break; break;
} }
} }
@ -8706,8 +8709,7 @@ void A_ReaperThinker(mobj_t *actor)
actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y); actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y);
// The player we should target if it's near us: // The player we should target if it's near us:
i = 0; for (i=0; i<MAXPLAYERS; i++)
for (; i<MAXPLAYERS; i++)
{ {
if (!playeringame[i]) if (!playeringame[i])
@ -8751,15 +8753,17 @@ void A_ReaperThinker(mobj_t *actor)
mo2 = (mobj_t *)th; mo2 = (mobj_t *)th;
if (mo2->type == MT_REAPERWAYPOINT && mo2->spawnpoint->angle == actor->extravalue1+1) if (mo2->type != MT_REAPERWAYPOINT)
{ continue;
if (mo2->spawnpoint->angle != actor->extravalue1+1)
continue;
P_SetTarget(&actor->target, mo2); // The main target we're pursing. P_SetTarget(&actor->target, mo2); // The main target we're pursing.
P_SetTarget(&actor->hnext, mo2); // The last waypoint we hit. We will default back to that if a player goes out of our range! P_SetTarget(&actor->hnext, mo2); // The last waypoint we hit. We will default back to that if a player goes out of our range!
actor->extravalue1++; // This will store the angle of the last waypoint we touched. This will essentially be useful later on. actor->extravalue1++; // This will store the angle of the last waypoint we touched. This will essentially be useful later on.
break; break;
} }
} }
}
if (!actor->target) // If we have no target, revert back to waypoint 0. if (!actor->target) // If we have no target, revert back to waypoint 0.