mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
Clamp xy angle range in P_SetSlope()
- This function just assumed that every xy angle passed to it was within the range [0,360). This is obviously bad, since anything outside that range can result in accessing data outside the range of the finecosine and finesine tables.
This commit is contained in:
parent
a60918f601
commit
5a5fb9b3d1
1 changed files with 8 additions and 2 deletions
|
@ -178,6 +178,12 @@ void P_SetSlope (secplane_t *plane, bool setCeil, int xyangi, int zangi,
|
|||
}
|
||||
zang >>= ANGLETOFINESHIFT;
|
||||
|
||||
// Sanitize xyangi to [0,360) range
|
||||
xyangi = xyangi % 360;
|
||||
if (xyangi < 0)
|
||||
{
|
||||
xyangi = 360 + xyangi;
|
||||
}
|
||||
xyang = (angle_t)Scale (xyangi, ANGLE_90, 90 << ANGLETOFINESHIFT);
|
||||
|
||||
FVector3 norm;
|
||||
|
@ -446,11 +452,11 @@ void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt, const int *oldve
|
|||
P_VavoomSlope(sec, mt->thingid, x, y, mt->z, mt->type & 1);
|
||||
}
|
||||
else if (mt->type <= THING_SlopeCeilingPointLine)
|
||||
{
|
||||
{ // THING_SlopeFloorPointLine and THING_SlopCeilingPointLine
|
||||
P_SlopeLineToPoint (mt->args[0], x, y, z, mt->type & 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
{ // THING_SetFloorSlope and THING_SetCeilingSlope
|
||||
P_SetSlope (refplane, mt->type & 1, mt->angle, mt->args[0], x, y, z);
|
||||
}
|
||||
mt->type = 0;
|
||||
|
|
Loading…
Reference in a new issue