- removed all remaining references to level and TThinkerIterator from p_enemy.cpp.

This commit is contained in:
Christoph Oelckers 2019-01-27 14:49:51 +01:00
commit 2ed2202caa
5 changed files with 25 additions and 29 deletions

View file

@ -1201,7 +1201,7 @@ int P_LookForMonsters (AActor *actor)
{
int count;
AActor *mo;
TThinkerIterator<AActor> iterator;
auto iterator = actor->Level->GetThinkerIterator<AActor>();
if (!P_CheckSight (players[0].mo, actor, SF_SEEPASTBLOCKEVERYTHING))
{ // Player can't see monster
@ -1258,7 +1258,7 @@ AActor *LookForTIDInBlock (AActor *lookee, int index, void *extparams)
AActor *link;
AActor *other;
for (block = level.blockmap.blocklinks[index]; block != NULL; block = block->NextActor)
for (block = lookee->Level->blockmap.blocklinks[index]; block != NULL; block = block->NextActor)
{
link = block->Me;
@ -1339,7 +1339,7 @@ int P_LookForTID (AActor *actor, INTBOOL allaround, FLookExParams *params)
actor->LastLookActor = nullptr;
}
auto iterator = level.GetActorIterator(actor->TIDtoHate, actor->LastLookActor);
auto iterator = actor->Level->GetActorIterator(actor->TIDtoHate, actor->LastLookActor);
int c = (pr_look3() & 31) + 7; // Look for between 7 and 38 hatees at a time
while ((other = iterator.Next()) != actor->LastLookActor)
{
@ -1429,7 +1429,7 @@ AActor *LookForEnemiesInBlock (AActor *lookee, int index, void *extparam)
AActor *other;
FLookExParams *params = (FLookExParams *)extparam;
for (block = level.blockmap.blocklinks[index]; block != NULL; block = block->NextActor)
for (block = lookee->Level->blockmap.blocklinks[index]; block != NULL; block = block->NextActor)
{
link = block->Me;
@ -1760,10 +1760,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look)
// [RH] Set goal now if appropriate
if (self->special == Thing_SetGoal && self->args[0] == 0)
{
auto iterator = level.GetActorIterator(NAME_PatrolPoint, self->args[1]);
auto iterator = self->Level->GetActorIterator(NAME_PatrolPoint, self->args[1]);
self->special = 0;
self->goal = iterator.Next ();
self->reactiontime = self->args[2] * TICRATE + level.maptime;
self->reactiontime = self->args[2] * TICRATE + self->Level->maptime;
if (self->args[3] == 0) self->flags5 &= ~MF5_CHASEGOAL;
else self->flags5 |= MF5_CHASEGOAL;
}
@ -1838,7 +1838,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look)
// [RH] Don't start chasing after a goal if it isn't time yet.
if (self->target == self->goal)
{
if (self->reactiontime > level.maptime)
if (self->reactiontime > self->Level->maptime)
self->target = nullptr;
}
else if (self->SeeSound)
@ -1889,10 +1889,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_LookEx)
// [RH] Set goal now if appropriate
if (self->special == Thing_SetGoal && self->args[0] == 0)
{
auto iterator = level.GetActorIterator(NAME_PatrolPoint, self->args[1]);
auto iterator = self->Level->GetActorIterator(NAME_PatrolPoint, self->args[1]);
self->special = 0;
self->goal = iterator.Next ();
self->reactiontime = self->args[2] * TICRATE + level.maptime;
self->reactiontime = self->args[2] * TICRATE + self->Level->maptime;
if (self->args[3] == 0)
self->flags5 &= ~MF5_CHASEGOAL;
else
@ -2020,7 +2020,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LookEx)
// [RH] Don't start chasing after a goal if it isn't time yet.
if (self->target == self->goal)
{
if (self->reactiontime > level.maptime)
if (self->reactiontime > self->Level->maptime)
self->target = nullptr;
}
else if (self->SeeSound && !(flags & LOF_NOSEESOUND))
@ -2150,7 +2150,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look2)
if (targ && (targ->flags & MF_SHOOTABLE))
{
if ((level.flags & LEVEL_NOALLIES) ||
if ((self->Level->flags & LEVEL_NOALLIES) ||
(self->flags & MF_FRIENDLY) != (targ->flags & MF_FRIENDLY))
{
if (self->flags & MF_AMBUSH)
@ -2372,8 +2372,8 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
if (result)
{
// reached the goal
auto iterator = level.GetActorIterator(NAME_PatrolPoint, actor->goal->args[0]);
auto specit = level.GetActorIterator(NAME_PatrolSpecial, actor->goal->tid);
auto iterator = actor->Level->GetActorIterator(NAME_PatrolPoint, actor->goal->args[0]);
auto specit = actor->Level->GetActorIterator(NAME_PatrolSpecial, actor->goal->tid);
AActor *spec;
// Execute the specials of any PatrolSpecials with the same TID
@ -2390,7 +2390,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
if (newgoal != NULL && actor->goal == actor->target)
{
delay = newgoal->args[1];
actor->reactiontime = delay * TICRATE + level.maptime;
actor->reactiontime = delay * TICRATE + actor->Level->maptime;
}
else
{
@ -3044,7 +3044,7 @@ int CheckBossDeath (AActor *actor)
return false; // no one left alive, so do not end game
// Make sure all bosses are dead
TThinkerIterator<AActor> iterator;
auto iterator = actor->Level->GetThinkerIterator<AActor>();
AActor *other;
while ( (other = iterator.Next ()) )
@ -3074,7 +3074,7 @@ void A_BossDeath(AActor *self)
// Do generic special death actions first
bool checked = false;
auto Level = &level;
auto Level = self->Level;
for (unsigned i = 0; i < Level->info->specialactions.Size(); i++)
{
FSpecialAction *sa = &Level->info->specialactions[i];
@ -3125,7 +3125,7 @@ void A_BossDeath(AActor *self)
// victory!
if (Level->flags & LEVEL_SPECKILLMONSTERS)
{ // Kill any remaining monsters
P_Massacre ();
Level->Massacre ();
}
if (Level->flags & LEVEL_MAP07SPECIAL)
{
@ -3174,7 +3174,7 @@ void A_BossDeath(AActor *self)
//
//----------------------------------------------------------------------------
int P_Massacre (bool baddies, PClassActor *cls)
int FLevelLocals::Massacre (bool baddies, FName cls)
{
// jff 02/01/98 'em' cheat - kill all monsters
// partially taken from Chi's .46 port
@ -3184,7 +3184,7 @@ int P_Massacre (bool baddies, PClassActor *cls)
int killcount = 0;
AActor *actor;
TThinkerIterator<AActor> iterator(cls? cls : RUNTIME_CLASS(AActor));
auto iterator = GetThinkerIterator<AActor>(cls);
while ( (actor = iterator.Next ()) )
{