- fixed BlockThingsIterator to not reset its list of processed actors when traversing portals.

This commit is contained in:
Christoph Oelckers 2021-08-10 18:00:14 +02:00
parent 39513cf7ae
commit 61739b4086
2 changed files with 5 additions and 4 deletions

View file

@ -910,13 +910,13 @@ FBlockThingsIterator::FBlockThingsIterator(FLevelLocals *l, int _minx, int _miny
Reset(); Reset();
} }
void FBlockThingsIterator::init(const FBoundingBox &box) void FBlockThingsIterator::init(const FBoundingBox &box, bool clearhash)
{ {
maxy = Level->blockmap.GetBlockY(box.Top()); maxy = Level->blockmap.GetBlockY(box.Top());
miny = Level->blockmap.GetBlockY(box.Bottom()); miny = Level->blockmap.GetBlockY(box.Bottom());
maxx = Level->blockmap.GetBlockX(box.Right()); maxx = Level->blockmap.GetBlockX(box.Right());
minx = Level->blockmap.GetBlockX(box.Left()); minx = Level->blockmap.GetBlockX(box.Left());
ClearHash(); if (clearhash) ClearHash();
Reset(); Reset();
} }
@ -1139,7 +1139,7 @@ void FMultiBlockThingsIterator::startIteratorForGroup(int group)
offset.X += checkpoint.X; offset.X += checkpoint.X;
offset.Y += checkpoint.Y; offset.Y += checkpoint.Y;
bbox.setBox(offset.X, offset.Y, checkpoint.Z); bbox.setBox(offset.X, offset.Y, checkpoint.Z);
blockIterator.init(bbox); blockIterator.init(bbox, false);
} }
//=========================================================================== //===========================================================================
@ -1153,6 +1153,7 @@ void FMultiBlockThingsIterator::Reset()
index = -1; index = -1;
portalflags = 0; portalflags = 0;
startIteratorForGroup(basegroup); startIteratorForGroup(basegroup);
blockIterator.ClearHash();
} }
//=========================================================================== //===========================================================================

View file

@ -319,7 +319,7 @@ public:
Level = l; Level = l;
init(box); init(box);
} }
void init(const FBoundingBox &box); void init(const FBoundingBox &box, bool clearhash = true);
AActor *Next(bool centeronly = false); AActor *Next(bool centeronly = false);
void Reset() { StartBlock(minx, miny); } void Reset() { StartBlock(minx, miny); }
}; };