MCPcopy Create free account
hub / github.com/ZDoom/Raze / checkRangeOfWall

Function checkRangeOfWall

source/core/gamefuncs.cpp:841–868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

839//==========================================================================
840
841bool checkRangeOfWall(walltype* wal, EWallFlags flagmask, const DVector3& pos, double maxdist, double* theZs)
842{
843 if (!wal->twoSided()) return false;
844 if (wal->cstat & flagmask) return false;
845 if (PointOnLineSide(pos.XY(), wal) > 0) return false;
846
847 auto nextsect = wal->nextSector();
848
849 // Rather pointless sky check that needs to be kept...
850 if (((nextsect->ceilingstat & CSTAT_SECTOR_SKY) == 0) && (pos.Z <= nextsect->ceilingz + 3)) return false;
851 if (((nextsect->floorstat & CSTAT_SECTOR_SKY) == 0) && (pos.Z >= nextsect->floorz - 3)) return false;
852
853 auto pos1 = wal->pos;
854 auto pos2 = wal->point2Wall()->pos;
855
856 // Checks borrowed from GZDoom.
857 DVector2 boxtl = pos.XY() - DVector2(maxdist, maxdist);
858 DVector2 boxbr = pos.XY() + DVector2(maxdist, maxdist);
859 if (!BoxInRange(boxtl, boxbr, pos1, pos2)) return false;
860 if (BoxOnLineSide(boxtl, boxbr, pos1, pos2 - pos1) != -1) return false;
861
862 auto closest = pos.XY();
863 if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE) // todo: need to check if it makes sense to have this always on.
864 SquareDistToSector(closest.X, closest.Y, nextsect, &closest);
865
866 calcSlope(nextsect, closest.X, closest.Y, &theZs[0], &theZs[1]);
867 return true;
868}
869
870//==========================================================================
871//

Callers 1

getzrangeFunction · 0.85

Calls 8

BoxInRangeFunction · 0.85
BoxOnLineSideFunction · 0.85
SquareDistToSectorFunction · 0.85
twoSidedMethod · 0.80
nextSectorMethod · 0.80
point2WallMethod · 0.80
PointOnLineSideFunction · 0.70
calcSlopeFunction · 0.70

Tested by

no test coverage detected