- 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
parent 73ea59179c
commit 2ed2202caa
5 changed files with 25 additions and 29 deletions

View file

@ -2080,11 +2080,6 @@ uint8_t *FDynamicBuffer::GetData (int *len)
}
static int KillAll(PClassActor *cls)
{
return P_Massacre(false, cls);
}
static int RemoveClass(const PClass *cls)
{
AActor *actor;
@ -2564,11 +2559,11 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
if (cls != NULL)
{
killcount = KillAll(cls);
killcount = currentUILevel->Massacre(false, cls->TypeName);
PClassActor *cls_rep = cls->GetReplacement();
if (cls != cls_rep)
{
killcount += KillAll(cls_rep);
killcount += currentUILevel->Massacre(false, cls_rep->TypeName);
}
Printf ("Killed %d monsters of type %s.\n",killcount, s);
}

View file

@ -203,6 +203,7 @@ public:
bool CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line, double speed, double height, int crush, int change, bool hexencrush, bool hereticlower);
void DoDeferedScripts();
void AdjustPusher(int tag, int magnitude, int angle, bool wind);
int Massacre(bool baddies = false, FName cls = NAME_None);
bool EV_DoPlat(int tag, line_t *line, DPlat::EPlatType type, double height, double speed, int delay, int lip, int change);
void EV_StopPlat(int tag, bool remove);

View file

@ -319,7 +319,7 @@ void cht_DoCheat (player_t *player, int cheat)
case CHT_MASSACRE:
case CHT_MASSACRE2:
{
int killcount = P_Massacre (cheat == CHT_MASSACRE2);
int killcount = currentUILevel->Massacre (cheat == CHT_MASSACRE2);
// killough 3/22/98: make more intelligent about plural
// Ty 03/27/98 - string(s) *not* externalized
mysnprintf (msgbuild, countof(msgbuild), "%d %s%s Killed", killcount,

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 ()) )
{

View file

@ -1510,11 +1510,11 @@ FUNC(LS_Thing_Destroy)
if (arg0 == 0 && arg2 == 0)
{
P_Massacre ();
Level->Massacre ();
}
else if (arg0 == 0)
{
TThinkerIterator<AActor> iterator;
auto iterator = Level->GetThinkerIterator<AActor>();
actor = iterator.Next ();
while (actor)