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

Function calcSlope

source/core/gamefuncs.cpp:124–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122//==========================================================================
123
124void calcSlope(const sectortype* sec, double xpos, double ypos, double* pceilz, double* pflorz)
125{
126 int bits = 0;
127 if (pceilz)
128 {
129 bits |= sec->ceilingstat;
130 *pceilz = sec->ceilingz;
131 }
132 if (pflorz)
133 {
134 bits |= sec->floorstat;
135 *pflorz = sec->floorz;
136 }
137
138 if ((bits & CSTAT_SECTOR_SLOPE) == CSTAT_SECTOR_SLOPE)
139 {
140 auto wal = sec->walls.Data();
141 double len = wal->Length();
142 if (len != 0)
143 {
144 DVector2 wd = DVector2(xpos, ypos) - wal->pos;
145 double fac = wal->delta().dot(wd.Rotated90CW()) / len * (1. / SLOPEVAL_FACTOR);
146 if (pceilz && sec->ceilingstat & CSTAT_SECTOR_SLOPE) *pceilz += (sec->ceilingheinum * fac);
147 if (pflorz && sec->floorstat & CSTAT_SECTOR_SLOPE) *pflorz += (sec->floorheinum * fac);
148 }
149 }
150}
151
152//==========================================================================
153//

Callers 7

canseeFunction · 0.70
checkWallHitFunction · 0.70
checkSectorPlaneHitFunction · 0.70
checkRangeOfWallFunction · 0.70
getzrangeFunction · 0.70
checkOpeningFunction · 0.70
FindBestSectorFunction · 0.70

Calls 5

deltaMethod · 0.80
Rotated90CWMethod · 0.80
DataMethod · 0.45
LengthMethod · 0.45
dotMethod · 0.45

Tested by

no test coverage detected