diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index a6ccd9e4b..913a42bc5 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -3712,7 +3712,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RadiusGive) { FPortalGroupArray check(FPortalGroupArray::PGA_Full3d); double mid = self->Center(); - FMultiBlockThingsIterator it(check, self->X(), self->Y(), mid-distance, mid+distance, distance, false, self->Sector); + FMultiBlockThingsIterator it(check, self->Level, self->X(), self->Y(), mid-distance, mid+distance, distance, false, self->Sector); FMultiBlockThingsIterator::CheckResult cres; while ((it.Next(&cres)) && ((unlimited) || (given < limit))) diff --git a/src/p_destructible.cpp b/src/p_destructible.cpp index 56ab0ea5d..8882d9255 100755 --- a/src/p_destructible.cpp +++ b/src/p_destructible.cpp @@ -520,7 +520,7 @@ void P_GeometryRadiusAttack(AActor* bombspot, AActor* bombsource, int bombdamage // enumerate all lines around FBoundingBox bombbox(bombspot->X(), bombspot->Y(), bombdistance); - FBlockLinesIterator it(bombbox); + FBlockLinesIterator it(bombspot->Level, bombbox); line_t* ln; int vc = validcount; TArray lines; @@ -1070,4 +1070,4 @@ DEFINE_ACTION_FUNCTION(_Sector, SetHealth) *health = newhealth; if (grp) P_SetHealthGroupHealth(grp, newhealth); return 0; -} \ No newline at end of file +} diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 43a2b9ce2..17f1e8561 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -867,7 +867,7 @@ void P_NewChaseDir(AActor * actor) !(actor->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF)) { FBoundingBox box(actor->X(), actor->Y(), actor->radius); - FBlockLinesIterator it(box); + FBlockLinesIterator it(actor->Level, box); line_t *line; double deltax = 0; @@ -2627,7 +2627,7 @@ bool P_CheckForResurrection(AActor *self, bool usevilestates) FPortalGroupArray check(FPortalGroupArray::PGA_Full3d); - FMultiBlockThingsIterator it(check, viletry.X, viletry.Y, self->Z() - 64, self->Top() + 64, 32., false, NULL); + FMultiBlockThingsIterator it(check, self->Level, viletry.X, viletry.Y, self->Z() - 64, self->Top() + 64, 32., false, NULL); FMultiBlockThingsIterator::CheckResult cres; while (it.Next(&cres)) { diff --git a/src/p_map.cpp b/src/p_map.cpp index cfd905f0c..1d14c00bd 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -421,7 +421,7 @@ bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modi sector_t *sector = thing->Level->PointInSector(pos); FPortalGroupArray grouplist; - FMultiBlockLinesIterator mit(grouplist, pos.X, pos.Y, pos.Z, thing->Height, thing->radius, sector); + FMultiBlockLinesIterator mit(grouplist, thing->Level, pos.X, pos.Y, pos.Z, thing->Height, thing->radius, sector); FMultiBlockLinesIterator::CheckResult cres; while (mit.Next(&cres)) @@ -432,7 +432,7 @@ bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modi if (tmf.touchmidtex) tmf.dropoffz = tmf.floorz; - FMultiBlockThingsIterator mit2(grouplist, pos.X, pos.Y, pos.Z, thing->Height, thing->radius, false, sector); + FMultiBlockThingsIterator mit2(grouplist, thing->Level, pos.X, pos.Y, pos.Z, thing->Height, thing->radius, false, sector); FMultiBlockThingsIterator::CheckResult cres2; while (mit2.Next(&cres2)) @@ -1082,7 +1082,7 @@ static bool PIT_CheckPortal(FMultiBlockLinesIterator &mit, FMultiBlockLinesItera tm.thing->AddZ(zofs); FBoundingBox pbox(cres.Position.X, cres.Position.Y, tm.thing->radius); - FBlockLinesIterator it(pbox); + FBlockLinesIterator it(tm.thing->Level, pbox); bool ret = false; line_t *ld; @@ -1750,7 +1750,7 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, boo FBoundingBox box(pos.X, pos.Y, thing->radius); FPortalGroupArray pcheck; - FMultiBlockThingsIterator it2(pcheck, pos.X, pos.Y, thing->Z(), thing->Height, thing->radius, false, newsec); + FMultiBlockThingsIterator it2(pcheck, thing->Level, pos.X, pos.Y, thing->Z(), thing->Height, thing->radius, false, newsec); FMultiBlockThingsIterator::CheckResult tcres; while ((it2.Next(&tcres))) @@ -1822,7 +1822,7 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, boo return (thing->BlockingMobj = thingblocker) == NULL; - FMultiBlockLinesIterator it(pcheck, pos.X, pos.Y, thing->Z(), thing->Height, thing->radius, newsec); + FMultiBlockLinesIterator it(pcheck, thing->Level, pos.X, pos.Y, thing->Z(), thing->Height, thing->radius, newsec); FMultiBlockLinesIterator::CheckResult lcres; double thingdropoffz = tm.floorz; @@ -5836,7 +5836,7 @@ int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bom fulldamagedistance = clamp(fulldamagedistance, 0, bombdistance - 1); FPortalGroupArray grouplist(FPortalGroupArray::PGA_Full3d); - FMultiBlockThingsIterator it(grouplist, bombspot->X(), bombspot->Y(), bombspot->Z() - bombdistance, bombspot->Height + bombdistance*2, bombdistance, false, bombspot->Sector); + FMultiBlockThingsIterator it(grouplist, bombspot->Level, bombspot->X(), bombspot->Y(), bombspot->Z() - bombdistance, bombspot->Height + bombdistance*2, bombdistance, false, bombspot->Sector); FMultiBlockThingsIterator::CheckResult cres; if (flags & RADF_SOURCEISSPOT) diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 32c5b4b4b..4ea687216 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -581,9 +581,10 @@ void AActor::SetOrigin(double x, double y, double z, bool moving) // //=========================================================================== -FBlockLinesIterator::FBlockLinesIterator(int _minx, int _miny, int _maxx, int _maxy, bool keepvalidcount) +FBlockLinesIterator::FBlockLinesIterator(FLevelLocals *l, int _minx, int _miny, int _maxx, int _maxy, bool keepvalidcount) { if (!keepvalidcount) validcount++; + Level = l; minx = _minx; maxx = _maxx; miny = _miny; @@ -594,15 +595,16 @@ FBlockLinesIterator::FBlockLinesIterator(int _minx, int _miny, int _maxx, int _m void FBlockLinesIterator::init(const FBoundingBox &box) { validcount++; - maxy = level.blockmap.GetBlockY(box.Top()); - miny = level.blockmap.GetBlockY(box.Bottom()); - maxx = level.blockmap.GetBlockX(box.Right()); - minx = level.blockmap.GetBlockX(box.Left()); + maxy = Level->blockmap.GetBlockY(box.Top()); + miny = Level->blockmap.GetBlockY(box.Bottom()); + maxx = Level->blockmap.GetBlockX(box.Right()); + minx = Level->blockmap.GetBlockX(box.Left()); Reset(); } -FBlockLinesIterator::FBlockLinesIterator(const FBoundingBox &box) +FBlockLinesIterator::FBlockLinesIterator(FLevelLocals *l, const FBoundingBox &box) { + Level = l; init(box); } @@ -616,13 +618,13 @@ void FBlockLinesIterator::StartBlock(int x, int y) { curx = x; cury = y; - if (level.blockmap.isValidBlock(x, y)) + if (Level->blockmap.isValidBlock(x, y)) { - unsigned offset = y*level.blockmap.bmapwidth + x; - polyLink = level.PolyBlockMap.Size() > offset? level.PolyBlockMap[offset] : nullptr; + unsigned offset = y*Level->blockmap.bmapwidth + x; + polyLink = Level->PolyBlockMap.Size() > offset? Level->PolyBlockMap[offset] : nullptr; polyIndex = 0; - list = level.blockmap.GetLines(x, y); + list = Level->blockmap.GetLines(x, y); } else { @@ -681,7 +683,7 @@ line_t *FBlockLinesIterator::Next() { while (*list != -1) { - line_t *ld = &level.lines[*list]; + line_t *ld = &Level->lines[*list]; list++; if (ld->validcount != validcount) @@ -710,24 +712,24 @@ line_t *FBlockLinesIterator::Next() //=========================================================================== FMultiBlockLinesIterator::FMultiBlockLinesIterator(FPortalGroupArray &check, AActor *origin, double checkradius) - : checklist(check) + : checklist(check), blockIterator(origin->Level) { checkpoint = origin->Pos(); - if (!check.inited) level.CollectConnectedGroups(origin->Sector->PortalGroup, checkpoint, origin->Top(), checkradius, checklist); + if (!check.inited) origin->Level->CollectConnectedGroups(origin->Sector->PortalGroup, checkpoint, origin->Top(), checkradius, checklist); checkpoint.Z = checkradius == -1? origin->radius : checkradius; basegroup = origin->Sector->PortalGroup; startsector = origin->Sector; Reset(); } -FMultiBlockLinesIterator::FMultiBlockLinesIterator(FPortalGroupArray &check, double checkx, double checky, double checkz, double checkh, double checkradius, sector_t *newsec) - : checklist(check) +FMultiBlockLinesIterator::FMultiBlockLinesIterator(FPortalGroupArray &check, FLevelLocals *Level, double checkx, double checky, double checkz, double checkh, double checkradius, sector_t *newsec) + : checklist(check), blockIterator(Level) { checkpoint = { checkx, checky, checkz }; - if (newsec == NULL) newsec = level.PointInSector(checkx, checky); + if (newsec == NULL) newsec = Level->PointInSector(checkx, checky); startsector = newsec; basegroup = newsec->PortalGroup; - if (!check.inited) level.CollectConnectedGroups(basegroup, checkpoint, checkz + checkh, checkradius, checklist); + if (!check.inited) Level->CollectConnectedGroups(basegroup, checkpoint, checkz + checkh, checkradius, checklist); checkpoint.Z = checkradius; Reset(); } @@ -847,10 +849,10 @@ bool FMultiBlockLinesIterator::Next(FMultiBlockLinesIterator::CheckResult *item) bool FMultiBlockLinesIterator::startIteratorForGroup(int group) { - offset = level.Displacements.getOffset(basegroup, group); + offset = blockIterator.Level->Displacements.getOffset(basegroup, group); offset.X += checkpoint.X; offset.Y += checkpoint.Y; - cursector = group == startsector->PortalGroup ? startsector : level.PointInSector(offset); + cursector = group == startsector->PortalGroup ? startsector : blockIterator.Level->PointInSector(offset); // If we ended up in a different group, // presumably because the spot to be checked is too far outside the actual portal group, // the search needs to abort. @@ -880,18 +882,20 @@ void FMultiBlockLinesIterator::Reset() // //=========================================================================== -FBlockThingsIterator::FBlockThingsIterator() +FBlockThingsIterator::FBlockThingsIterator(FLevelLocals *l) : DynHash(0) { + Level = l; minx = maxx = 0; miny = maxy = 0; ClearHash(); block = NULL; } -FBlockThingsIterator::FBlockThingsIterator(int _minx, int _miny, int _maxx, int _maxy) +FBlockThingsIterator::FBlockThingsIterator(FLevelLocals *l, int _minx, int _miny, int _maxx, int _maxy) : DynHash(0) { + Level = l; minx = _minx; maxx = _maxx; miny = _miny; @@ -902,10 +906,10 @@ FBlockThingsIterator::FBlockThingsIterator(int _minx, int _miny, int _maxx, int void FBlockThingsIterator::init(const FBoundingBox &box) { - maxy = level.blockmap.GetBlockY(box.Top()); - miny = level.blockmap.GetBlockY(box.Bottom()); - maxx = level.blockmap.GetBlockX(box.Right()); - minx = level.blockmap.GetBlockX(box.Left()); + maxy = Level->blockmap.GetBlockY(box.Top()); + miny = Level->blockmap.GetBlockY(box.Bottom()); + maxx = Level->blockmap.GetBlockX(box.Right()); + minx = Level->blockmap.GetBlockX(box.Left()); ClearHash(); Reset(); } @@ -933,9 +937,9 @@ void FBlockThingsIterator::StartBlock(int x, int y) { curx = x; cury = y; - if (level.blockmap.isValidBlock(x, y)) + if (Level->blockmap.isValidBlock(x, y)) { - block = level.blockmap.blocklinks[y*level.blockmap.bmapwidth + x]; + block = Level->blockmap.blocklinks[y*Level->blockmap.bmapwidth + x]; } else { @@ -983,9 +987,9 @@ AActor *FBlockThingsIterator::Next(bool centeronly) if (centeronly) { // Block boundaries for compatibility mode - double blockleft = (curx * FBlockmap::MAPBLOCKUNITS) + level.blockmap.bmaporgx; + double blockleft = (curx * FBlockmap::MAPBLOCKUNITS) + Level->blockmap.bmaporgx; double blockright = blockleft + FBlockmap::MAPBLOCKUNITS; - double blockbottom = (cury * FBlockmap::MAPBLOCKUNITS) + level.blockmap.bmaporgy; + double blockbottom = (cury * FBlockmap::MAPBLOCKUNITS) + Level->blockmap.bmaporgy; double blocktop = blockbottom + FBlockmap::MAPBLOCKUNITS; // only return actors with the center in this block @@ -1052,24 +1056,24 @@ AActor *FBlockThingsIterator::Next(bool centeronly) //=========================================================================== FMultiBlockThingsIterator::FMultiBlockThingsIterator(FPortalGroupArray &check, AActor *origin, double checkradius, bool ignorerestricted) - : checklist(check) + : checklist(check), blockIterator(origin->Level) { checkpoint = origin->Pos(); - if (!check.inited) level.CollectConnectedGroups(origin->Sector->PortalGroup, checkpoint, origin->Top(), checkradius, checklist); + if (!check.inited) origin->Level->CollectConnectedGroups(origin->Sector->PortalGroup, checkpoint, origin->Top(), checkradius, checklist); checkpoint.Z = checkradius == -1? origin->radius : checkradius; basegroup = origin->Sector->PortalGroup; Reset(); } -FMultiBlockThingsIterator::FMultiBlockThingsIterator(FPortalGroupArray &check, double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted, sector_t *newsec) - : checklist(check) +FMultiBlockThingsIterator::FMultiBlockThingsIterator(FPortalGroupArray &check, FLevelLocals *Level, double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted, sector_t *newsec) + : checklist(check), blockIterator(Level) { checkpoint.X = checkx; checkpoint.Y = checky; checkpoint.Z = checkz; - if (newsec == NULL) newsec = level.PointInSector(checkx, checky); + if (newsec == NULL) newsec = Level->PointInSector(checkx, checky); basegroup = newsec->PortalGroup; - if (!check.inited) level.CollectConnectedGroups(basegroup, checkpoint, checkz + checkh, checkradius, checklist); + if (!check.inited) Level->CollectConnectedGroups(basegroup, checkpoint, checkz + checkh, checkradius, checklist); checkpoint.Z = checkradius; Reset(); } @@ -1086,7 +1090,7 @@ bool FMultiBlockThingsIterator::Next(FMultiBlockThingsIterator::CheckResult *ite if (thing != NULL) { item->thing = thing; - item->Position = checkpoint + level.Displacements.getOffset(basegroup, thing->Sector->PortalGroup); + item->Position = checkpoint + blockIterator.Level->Displacements.getOffset(basegroup, thing->Sector->PortalGroup); item->portalflags = portalflags; return true; } @@ -1125,7 +1129,7 @@ bool FMultiBlockThingsIterator::Next(FMultiBlockThingsIterator::CheckResult *ite void FMultiBlockThingsIterator::startIteratorForGroup(int group) { - DVector2 offset = level.Displacements.getOffset(basegroup, group); + DVector2 offset = blockIterator.Level->Displacements.getOffset(basegroup, group); offset.X += checkpoint.X; offset.Y += checkpoint.Y; bbox.setBox(offset.X, offset.Y, checkpoint.Z); @@ -1168,7 +1172,7 @@ TArray FPathTraverse::intercepts(128); void FPathTraverse::AddLineIntercepts(int bx, int by) { - FBlockLinesIterator it(bx, by, bx, by, true); + FBlockLinesIterator it(Level, bx, by, bx, by, true); line_t *ld; while ((ld = it.Next())) @@ -1542,7 +1546,7 @@ void FPathTraverse::init(double x1, double y1, double x2, double y2, int flags, bool compatible = (flags & PT_COMPATIBLE) && (i_compatflags & COMPATF_HITSCAN); // we want to use one list of checked actors for the entire operation - FBlockThingsIterator btit; + FBlockThingsIterator btit(Level); for (count = 0 ; count < 1000 ; count++) { if (flags & PT_ADDLINES) @@ -1689,14 +1693,15 @@ AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, in int finalStop; int count; AActor *target; - int bmapwidth = level.blockmap.bmapwidth; - int bmapheight = level.blockmap.bmapheight; + auto Level = mo->Level; + int bmapwidth = Level->blockmap.bmapwidth; + int bmapheight = Level->blockmap.bmapheight; - startX = level.blockmap.GetBlockX(mo->X()); - startY = level.blockmap.GetBlockY(mo->Y()); + startX = Level->blockmap.GetBlockX(mo->X()); + startY = Level->blockmap.GetBlockY(mo->Y()); validcount++; - if (level.blockmap.isValidBlock(startX, startY)) + if (Level->blockmap.isValidBlock(startX, startY)) { if ( (target = check (mo, startY*bmapwidth+startX, params)) ) { // found a target right away @@ -1787,7 +1792,7 @@ static AActor *RoughBlockCheck (AActor *mo, int index, void *param) FBlockNode *link; - for (link = level.blockmap.blocklinks[index]; link != NULL; link = link->NextActor) + for (link = mo->Level->blockmap.blocklinks[index]; link != NULL; link = link->NextActor) { if (link->Me != mo) { @@ -1936,8 +1941,8 @@ subsector_t *FLevelLocals::PointInSubsector(double x, double y) { int side; - auto node = level.HeadGamenode(); - if (node == nullptr) return &level.subsectors[0]; + auto node = HeadGamenode(); + if (node == nullptr) return &subsectors[0]; fixed_t xx = FloatToFixed(x); fixed_t yy = FloatToFixed(y); @@ -1960,8 +1965,8 @@ subsector_t *FLevelLocals::PointInSubsector(double x, double y) sector_t *FLevelLocals::PointInSectorBuggy(double x, double y) { // single subsector is a special case - auto node = level.HeadGamenode(); - if (node == nullptr) return level.subsectors[0].sector; + auto node = HeadGamenode(); + if (node == nullptr) return subsectors[0].sector; do { // Use original buggy point-on-side test when spawning @@ -1991,10 +1996,10 @@ subsector_t *FLevelLocals::PointInRenderSubsector (fixed_t x, fixed_t y) int side; // single subsector is a special case - if (level.nodes.Size() == 0) - return &level.subsectors[0]; + if (nodes.Size() == 0) + return &subsectors[0]; - node = level.HeadNode(); + node = HeadNode(); do { diff --git a/src/p_maputl.h b/src/p_maputl.h index c8b5cd9ff..161eaac29 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -206,6 +206,7 @@ private: class FBlockLinesIterator { friend class FMultiBlockLinesIterator; + FLevelLocals *Level; int minx, maxx; int miny, maxy; @@ -216,11 +217,11 @@ class FBlockLinesIterator void StartBlock(int x, int y); - FBlockLinesIterator() {} + FBlockLinesIterator(FLevelLocals *l) { Level = l; } void init(const FBoundingBox &box); public: - FBlockLinesIterator(int minx, int miny, int maxx, int maxy, bool keepvalidcount = false); - FBlockLinesIterator(const FBoundingBox &box); + FBlockLinesIterator(FLevelLocals *Level, int minx, int miny, int maxx, int maxy, bool keepvalidcount = false); + FBlockLinesIterator(FLevelLocals *Level, const FBoundingBox &box); line_t *Next(); void Reset() { StartBlock(minx, miny); } }; @@ -254,7 +255,7 @@ public: }; FMultiBlockLinesIterator(FPortalGroupArray &check, AActor *origin, double checkradius = -1); - FMultiBlockLinesIterator(FPortalGroupArray &check, double checkx, double checky, double checkz, double checkh, double checkradius, sector_t *newsec); + FMultiBlockLinesIterator(FPortalGroupArray &check, FLevelLocals *Level, double checkx, double checky, double checkz, double checkh, double checkradius, sector_t *newsec); bool Next(CheckResult *item); void Reset(); @@ -276,6 +277,7 @@ public: class FBlockThingsIterator { + FLevelLocals *Level; int minx, maxx; int miny, maxy; @@ -302,14 +304,14 @@ class FBlockThingsIterator // The following is only for use in the path traverser // and therefore declared private. - FBlockThingsIterator(); + FBlockThingsIterator(FLevelLocals *); friend class FPathTraverse; friend class FMultiBlockThingsIterator; public: - FBlockThingsIterator(int minx, int miny, int maxx, int maxy); - FBlockThingsIterator(const FBoundingBox &box) + FBlockThingsIterator(FLevelLocals *Level, int minx, int miny, int maxx, int maxy); + FBlockThingsIterator(FLevelLocals *Level, const FBoundingBox &box) { init(box); } @@ -331,7 +333,7 @@ class FMultiBlockThingsIterator void startIteratorForGroup(int group); protected: - FMultiBlockThingsIterator(FPortalGroupArray &check) : checklist(check) {} + FMultiBlockThingsIterator(FPortalGroupArray &check, FLevelLocals *Level) : checklist(check), blockIterator(Level) {} public: struct CheckResult @@ -342,7 +344,7 @@ public: }; FMultiBlockThingsIterator(FPortalGroupArray &check, AActor *origin, double checkradius = -1, bool ignorerestricted = false); - FMultiBlockThingsIterator(FPortalGroupArray &check, double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted, sector_t *newsec); + FMultiBlockThingsIterator(FPortalGroupArray &check, FLevelLocals *Level, double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted, sector_t *newsec); bool Next(CheckResult *item); void Reset(); const FBoundingBox &Box() const @@ -411,4 +413,4 @@ double P_InterceptVector(const divline_t *v2, const divline_t *v1); #define PT_COMPATIBLE 4 #define PT_DELTA 8 // x2,y2 is passed as a delta, not as an endpoint -#endif \ No newline at end of file +#endif diff --git a/src/p_secnodes.cpp b/src/p_secnodes.cpp index d7b2c1a64..3b3c1fced 100644 --- a/src/p_secnodes.cpp +++ b/src/p_secnodes.cpp @@ -237,7 +237,7 @@ msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector } FBoundingBox box(thing->X(), thing->Y(), radius); - FBlockLinesIterator it(box); + FBlockLinesIterator it(thing->Level, box); line_t *ld; while ((ld = it.Next())) diff --git a/src/p_sight.cpp b/src/p_sight.cpp index 0577f0d62..2e31e5f19 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -914,7 +914,7 @@ sightcounts[0]++; SightTask task = { 0, topslope, bottomslope, -1, sec->PortalGroup }; - SightCheck s(&level); + SightCheck s(t1->Level); s.init(t1, t2, sec, &task, flags); res = s.P_SightPathTraverse (); if (!res) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 942441890..effc55eed 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -249,7 +249,7 @@ DEFINE_ACTION_FUNCTION(_Line, RemoteActivate) bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType, DVector3 *optpos) { - auto Level = &level; + auto Level = line->GetLevel(); int lineActivation = line->activation; if (line->flags & ML_FIRSTSIDEONLY && side == 1) diff --git a/src/p_trace.cpp b/src/p_trace.cpp index 9fcecede5..624f11bd7 100644 --- a/src/p_trace.cpp +++ b/src/p_trace.cpp @@ -779,7 +779,7 @@ bool FTraceInfo::TraceTraverse (int ptflags) // Do a 3D floor check in the starting sector Setup3DFloors(); - FPathTraverse it(&level, Start.X, Start.Y, Vec.X * MaxDist, Vec.Y * MaxDist, ptflags | PT_DELTA, startfrac); + FPathTraverse it(Level, Start.X, Start.Y, Vec.X * MaxDist, Vec.Y * MaxDist, ptflags | PT_DELTA, startfrac); intercept_t *in; int lastsplashsector = -1; diff --git a/src/po_man.cpp b/src/po_man.cpp index 9f52f5a89..8c2aa750f 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -1232,7 +1232,7 @@ void FPolyObj::LinkPolyobj () void FPolyObj::RecalcActorFloorCeil(FBoundingBox bounds) const { - FBlockThingsIterator it(bounds); + FBlockThingsIterator it(Level, bounds); AActor *actor; while ((actor = it.Next()) != nullptr) diff --git a/src/portal.cpp b/src/portal.cpp index ed321829c..6cca8385d 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -1147,7 +1147,7 @@ bool FLevelLocals::CollectConnectedGroups(int startgroup, const DVector3 &positi { DVector2 disp = Displacements.getOffset(startgroup, thisgroup & ~FPortalGroupArray::FLAT); FBoundingBox box(position.X + disp.X, position.Y + disp.Y, checkradius); - FBlockLinesIterator it(box); + FBlockLinesIterator it(this, box); line_t *ld; while ((ld = it.Next())) { diff --git a/src/scripting/vmiterators.cpp b/src/scripting/vmiterators.cpp index f543ee59a..825dbef04 100644 --- a/src/scripting/vmiterators.cpp +++ b/src/scripting/vmiterators.cpp @@ -109,7 +109,7 @@ public: } DBlockLinesIterator(double x, double y, double z, double height, double radius, sector_t *sec) - :FMultiBlockLinesIterator(check, x, y, z, height, radius, sec) + :FMultiBlockLinesIterator(check, &level, x, y, z, height, radius, sec) { cres.line = nullptr; cres.Position.Zero(); @@ -183,7 +183,7 @@ public: } DBlockThingsIterator(double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted, sector_t *newsec) - : iterator(check, checkx, checky, checkz, checkh, checkradius, ignorerestricted, newsec) + : iterator(check, &level, checkx, checky, checkz, checkh, checkradius, ignorerestricted, newsec) { cres.thing = nullptr; cres.Position.Zero();