- fixed some places in p_pillar.cpp where sector plane z's were calculated at (0, 0) which could cause overflows if the actual plane is too far away from the origin.

- renamed sector_t::soundorg in centerspot, changed the type to a fixedvec2 and removed the CenterSpot #define.

Since this thing was used in lots of places that have nothing to do with sound the name made no sense. Having it as a fixed_t array also made it clumsy to use and the CenterSpot #define used a potentially dangerous type cast.
This commit is contained in:
Christoph Oelckers 2016-02-24 14:49:59 +01:00
commit 58d3b04590
11 changed files with 63 additions and 61 deletions

View file

@ -3221,9 +3221,9 @@ static void P_GroupLines (bool buildmap)
}
}
// set the soundorg to the middle of the bounding box
sector->soundorg[0] = bbox.Right()/2 + bbox.Left()/2;
sector->soundorg[1] = bbox.Top()/2 + bbox.Bottom()/2;
// set the center to the middle of the bounding box
sector->centerspot.x = bbox.Right()/2 + bbox.Left()/2;
sector->centerspot.y = bbox.Top()/2 + bbox.Bottom()/2;
// For triangular sectors the above does not calculate good points unless the longest of the triangle's lines is perfectly horizontal and vertical
if (sector->linecount == 3)
@ -3245,8 +3245,8 @@ static void P_GroupLines (bool buildmap)
if (DMulScale32 (v->y - Triangle[0]->y, dx,
Triangle[0]->x - v->x, dy) != 0)
{
sector->soundorg[0] = Triangle[0]->x / 3 + Triangle[1]->x / 3 + v->x / 3;
sector->soundorg[1] = Triangle[0]->y / 3 + Triangle[1]->y / 3 + v->y / 3;
sector->centerspot.x = Triangle[0]->x / 3 + Triangle[1]->x / 3 + v->x / 3;
sector->centerspot.y = Triangle[0]->y / 3 + Triangle[1]->y / 3 + v->y / 3;
break;
}
}