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

Function PlayerSectorBound

source/games/sw/src/player.cpp:1898–1922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1896//---------------------------------------------------------------------------
1897
1898void PlayerSectorBound(DSWPlayer* pp, double amt)
1899{
1900 if (!pp->insector())
1901 return;
1902
1903 double cz,fz;
1904
1905 // player should never go into a sector
1906
1907 // was getting some problems with this
1908 // when jumping onto hight sloped sectors
1909
1910 // call this routine to make sure he doesn't
1911 // called from DoPlayerMove() but can be called
1912 // from anywhere it is needed
1913
1914 calcSlope(pp->cursector, pp->GetActor()->getPosWithOffsetZ(), &cz, &fz);
1915
1916 if (pp->GetActor()->getOffsetZ() > fz - amt)
1917 pp->posZset(fz - amt);
1918
1919 if (pp->GetActor()->getOffsetZ() < cz + amt)
1920 pp->posZset(cz + amt);
1921
1922}
1923
1924//---------------------------------------------------------------------------
1925//

Callers 3

DoPlayerJumpFunction · 0.85
DoPlayerFallFunction · 0.85

Calls 5

getPosWithOffsetZMethod · 0.80
getOffsetZMethod · 0.80
calcSlopeFunction · 0.50
insectorMethod · 0.45
GetActorMethod · 0.45

Tested by

no test coverage detected