- 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

@ -144,15 +144,15 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
if (floordist == 0)
{
newheight = (sector->CenterFloor () + sector->CenterCeiling ()) / 2;
m_FloorTarget = sector->floorplane.PointToDist (sector->soundorg[0], sector->soundorg[1], newheight);
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->soundorg[0], sector->soundorg[1], newheight);
m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight);
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->centerspot, newheight);
floordist = newheight - sector->CenterFloor ();
}
else
{
newheight = sector->CenterFloor () + floordist;
m_FloorTarget = sector->floorplane.PointToDist (sector->soundorg[0], sector->soundorg[1], newheight);
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->soundorg[0], sector->soundorg[1], newheight);
m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight);
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->centerspot, newheight);
}
ceilingdist = sector->CenterCeiling () - newheight;
}
@ -168,8 +168,8 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
}
else
{
newheight = sector->floorplane.ZatPoint (0, 0) - floordist;
m_FloorTarget = sector->floorplane.PointToDist (0, 0, newheight);
newheight = sector->CenterFloor() - floordist;
m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight);
}
if (ceilingdist == 0)
{
@ -179,8 +179,8 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
}
else
{
newheight = sector->ceilingplane.ZatPoint (0, 0) + ceilingdist;
m_CeilingTarget = sector->ceilingplane.PointToDist (0, 0, newheight);
newheight = sector->CenterCeiling() + ceilingdist;
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->centerspot, newheight);
}
}