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

Function checkOpening

source/core/gamefuncs.cpp:1144–1163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1142//==========================================================================
1143
1144bool checkOpening(const DVector2& inpos, double z, const sectortype* sec, const sectortype* nextsec, double ceilingdist, double floordist, bool precise)
1145{
1146 DVector2 pos;
1147 if (precise) SquareDistToSector(inpos.X, inpos.Y, nextsec, &pos);
1148 else pos = inpos;
1149
1150 double c1, c2, f1, f2;
1151 calcSlope(sec, pos.X, pos.Y, &c1, &f1);
1152 calcSlope(nextsec, pos.X, pos.Y, &c2, &f2);
1153
1154 if (precise)
1155 {
1156 double sech = abs(f1 - c1);
1157 double nextsech = abs(f2 - c2);
1158 if (sech > nextsech && nextsech < ceilingdist + 2) return 1;
1159 }
1160
1161 return ((f2 < f1 - 1 && (nextsec->floorstat & CSTAT_SECTOR_SKY) == 0 && z >= f2 - (floordist - zmaptoworld)) ||
1162 (c2 > c1 + 1 && (nextsec->ceilingstat & CSTAT_SECTOR_SKY) == 0 && z <= c2 + (ceilingdist - zmaptoworld)));
1163}
1164
1165//==========================================================================
1166//

Callers 1

pushmoveFunction · 0.85

Calls 3

SquareDistToSectorFunction · 0.85
calcSlopeFunction · 0.70
absFunction · 0.50

Tested by

no test coverage detected