- 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

@ -343,16 +343,16 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
floor->m_Speed = height;
case DFloor::floorLowerByValue:
floor->m_Direction = -1;
newheight = sec->floorplane.ZatPoint (sec->soundorg[0], sec->soundorg[1]) - height;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->soundorg[0], sec->soundorg[1], newheight);
newheight = sec->CenterFloor() - height;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
break;
case DFloor::floorRaiseInstant:
floor->m_Speed = height;
case DFloor::floorRaiseByValue:
floor->m_Direction = 1;
newheight = sec->floorplane.ZatPoint (sec->soundorg[0], sec->soundorg[1]) + height;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->soundorg[0], sec->soundorg[1], newheight);
newheight = sec->CenterFloor() + height;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
break;
case DFloor::floorMoveToValue:
@ -412,8 +412,8 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
case DFloor::floorLowerByTexture:
floor->m_Direction = -1;
newheight = sec->floorplane.ZatPoint (sec->soundorg[0], sec->soundorg[1]) - sec->FindShortestTextureAround ();
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->soundorg[0], sec->soundorg[1], newheight);
newheight = sec->CenterFloor() - sec->FindShortestTextureAround ();
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
break;
case DFloor::floorLowerToCeiling:
@ -429,14 +429,14 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
// since the code is identical to what was here. (Oddly
// enough, BOOM preserved the code here even though it
// also had this function.)
newheight = sec->floorplane.ZatPoint (sec->soundorg[0], sec->soundorg[1]) + sec->FindShortestTextureAround ();
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->soundorg[0], sec->soundorg[1], newheight);
newheight = sec->CenterFloor() + sec->FindShortestTextureAround ();
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
break;
case DFloor::floorRaiseAndChange:
floor->m_Direction = 1;
newheight = sec->floorplane.ZatPoint (sec->soundorg[0], sec->soundorg[1]) + height;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->soundorg[0], sec->soundorg[1], newheight);
newheight = sec->CenterFloor() + height;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
if (line != NULL)
{
FTextureID oldpic = sec->GetTexture(sector_t::floor);
@ -619,8 +619,8 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
floor->m_Hexencrush = false;
floor->m_Speed = speed;
height = sec->floorplane.ZatPoint (sec->soundorg[0], sec->soundorg[1]) + stairstep;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->soundorg[0], sec->soundorg[1], height);
height = sec->CenterFloor() + stairstep;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, height);
texture = sec->GetTexture(sector_t::floor);
osecnum = secnum; //jff 3/4/98 preserve loop index
@ -1037,15 +1037,15 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype,
// [RH] elevate up by a specific amount
case DElevator::elevateRaise:
elevator->m_Direction = 1;
elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->soundorg[0], sec->soundorg[1], floorheight + height);
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->soundorg[0], sec->soundorg[1], ceilingheight + height);
elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, floorheight + height);
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->centerspot, ceilingheight + height);
break;
// [RH] elevate down by a specific amount
case DElevator::elevateLower:
elevator->m_Direction = -1;
elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->soundorg[0], sec->soundorg[1], floorheight - height);
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->soundorg[0], sec->soundorg[1], ceilingheight - height);
elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, floorheight - height);
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->centerspot, ceilingheight - height);
break;
}
}