Merge branch 'floatcvt' of https://github.com/rheit/zdoom into floatcvt

# Conflicts:
#	src/r_data/r_interpolate.cpp
This commit is contained in:
Christoph Oelckers 2016-03-29 13:12:15 +02:00
commit 37e6429cf3
30 changed files with 251 additions and 250 deletions

View file

@ -168,7 +168,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
{ {
case 0: case 0:
// FLOOR // FLOOR
lastpos = m_Sector->floorplane.d; lastpos = m_Sector->floorplane.fixD();
switch (direction) switch (direction)
{ {
case -1: case -1:
@ -180,11 +180,11 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
if (!MoveAttached(crush, move, 0, true)) return crushed; if (!MoveAttached(crush, move, 0, true)) return crushed;
m_Sector->floorplane.d = dest; m_Sector->floorplane.setD(dest);
flag = P_ChangeSector (m_Sector, crush, move, 0, false); flag = P_ChangeSector (m_Sector, crush, move, 0, false);
if (flag) if (flag)
{ {
m_Sector->floorplane.d = lastpos; m_Sector->floorplane.setD(lastpos);
P_ChangeSector (m_Sector, crush, -move, 0, true); P_ChangeSector (m_Sector, crush, -move, 0, true);
MoveAttached(crush, -move, 0, false); MoveAttached(crush, -move, 0, false);
} }
@ -199,12 +199,12 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
{ {
if (!MoveAttached(crush, -speed, 0, true)) return crushed; if (!MoveAttached(crush, -speed, 0, true)) return crushed;
m_Sector->floorplane.d = movedest; m_Sector->floorplane.setD(movedest);
flag = P_ChangeSector (m_Sector, crush, -speed, 0, false); flag = P_ChangeSector (m_Sector, crush, -speed, 0, false);
if (flag) if (flag)
{ {
m_Sector->floorplane.d = lastpos; m_Sector->floorplane.setD(lastpos);
P_ChangeSector (m_Sector, crush, speed, 0, true); P_ChangeSector (m_Sector, crush, speed, 0, true);
MoveAttached(crush, speed, 0, false); MoveAttached(crush, speed, 0, false);
return crushed; return crushed;
@ -222,11 +222,10 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
// jff 02/04/98 keep floor from moving thru ceilings // jff 02/04/98 keep floor from moving thru ceilings
// [RH] not so easy with arbitrary planes // [RH] not so easy with arbitrary planes
//destheight = (dest < m_Sector->ceilingheight) ? dest : m_Sector->ceilingheight; //destheight = (dest < m_Sector->ceilingheight) ? dest : m_Sector->ceilingheight;
if ((m_Sector->ceilingplane.a | m_Sector->ceilingplane.b | if (!m_Sector->ceilingplane.isSlope() && !m_Sector->floorplane.isSlope() &&
m_Sector->floorplane.a | m_Sector->floorplane.b) == 0 && (!(i_compatflags2 & COMPATF2_FLOORMOVE) && -dest > m_Sector->ceilingplane.fixD()))
(!(i_compatflags2 & COMPATF2_FLOORMOVE) && -dest > m_Sector->ceilingplane.d))
{ {
dest = -m_Sector->ceilingplane.d; dest = -m_Sector->ceilingplane.fixD();
} }
movedest = m_Sector->floorplane.GetChangedHeight (speed); movedest = m_Sector->floorplane.GetChangedHeight (speed);
@ -237,12 +236,12 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
if (!MoveAttached(crush, move, 0, true)) return crushed; if (!MoveAttached(crush, move, 0, true)) return crushed;
m_Sector->floorplane.d = dest; m_Sector->floorplane.setD(dest);
flag = P_ChangeSector (m_Sector, crush, move, 0, false); flag = P_ChangeSector (m_Sector, crush, move, 0, false);
if (flag) if (flag)
{ {
m_Sector->floorplane.d = lastpos; m_Sector->floorplane.setD(lastpos);
P_ChangeSector (m_Sector, crush, -move, 0, true); P_ChangeSector (m_Sector, crush, -move, 0, true);
MoveAttached(crush, -move, 0, false); MoveAttached(crush, -move, 0, false);
} }
@ -257,7 +256,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
{ {
if (!MoveAttached(crush, speed, 0, true)) return crushed; if (!MoveAttached(crush, speed, 0, true)) return crushed;
m_Sector->floorplane.d = movedest; m_Sector->floorplane.setD(movedest);
// COULD GET CRUSHED // COULD GET CRUSHED
flag = P_ChangeSector (m_Sector, crush, speed, 0, false); flag = P_ChangeSector (m_Sector, crush, speed, 0, false);
@ -269,7 +268,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
m_Sector->AdjustFloorClip (); m_Sector->AdjustFloorClip ();
return crushed; return crushed;
} }
m_Sector->floorplane.d = lastpos; m_Sector->floorplane.setD(lastpos);
P_ChangeSector (m_Sector, crush, -speed, 0, true); P_ChangeSector (m_Sector, crush, -speed, 0, true);
MoveAttached(crush, -speed, 0, false); MoveAttached(crush, -speed, 0, false);
return crushed; return crushed;
@ -283,7 +282,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
case 1: case 1:
// CEILING // CEILING
lastpos = m_Sector->ceilingplane.d; lastpos = m_Sector->ceilingplane.fixD();
switch (direction) switch (direction)
{ {
case -1: case -1:
@ -291,11 +290,10 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
// jff 02/04/98 keep ceiling from moving thru floors // jff 02/04/98 keep ceiling from moving thru floors
// [RH] not so easy with arbitrary planes // [RH] not so easy with arbitrary planes
//destheight = (dest > m_Sector->floorheight) ? dest : m_Sector->floorheight; //destheight = (dest > m_Sector->floorheight) ? dest : m_Sector->floorheight;
if ((m_Sector->ceilingplane.a | m_Sector->ceilingplane.b | if (!m_Sector->ceilingplane.isSlope() && !m_Sector->floorplane.isSlope() &&
m_Sector->floorplane.a | m_Sector->floorplane.b) == 0 && (!(i_compatflags2 & COMPATF2_FLOORMOVE) && dest < -m_Sector->floorplane.fixD()))
(!(i_compatflags2 & COMPATF2_FLOORMOVE) && dest < -m_Sector->floorplane.d))
{ {
dest = -m_Sector->floorplane.d; dest = -m_Sector->floorplane.fixD();
} }
movedest = m_Sector->ceilingplane.GetChangedHeight (-speed); movedest = m_Sector->ceilingplane.GetChangedHeight (-speed);
if (movedest <= dest) if (movedest <= dest)
@ -304,12 +302,12 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
if (!MoveAttached(crush, move, 1, true)) return crushed; if (!MoveAttached(crush, move, 1, true)) return crushed;
m_Sector->ceilingplane.d = dest; m_Sector->ceilingplane.setD(dest);
flag = P_ChangeSector (m_Sector, crush, move, 1, false); flag = P_ChangeSector (m_Sector, crush, move, 1, false);
if (flag) if (flag)
{ {
m_Sector->ceilingplane.d = lastpos; m_Sector->ceilingplane.setD(lastpos);
P_ChangeSector (m_Sector, crush, -move, 1, true); P_ChangeSector (m_Sector, crush, -move, 1, true);
MoveAttached(crush, -move, 1, false); MoveAttached(crush, -move, 1, false);
} }
@ -323,7 +321,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
{ {
if (!MoveAttached(crush, -speed, 1, true)) return crushed; if (!MoveAttached(crush, -speed, 1, true)) return crushed;
m_Sector->ceilingplane.d = movedest; m_Sector->ceilingplane.setD(movedest);
// COULD GET CRUSHED // COULD GET CRUSHED
flag = P_ChangeSector (m_Sector, crush, -speed, 1, false); flag = P_ChangeSector (m_Sector, crush, -speed, 1, false);
@ -334,7 +332,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
m_Sector->ChangePlaneTexZ(sector_t::ceiling, m_Sector->ceilingplane.HeightDiff (lastpos)); m_Sector->ChangePlaneTexZ(sector_t::ceiling, m_Sector->ceilingplane.HeightDiff (lastpos));
return crushed; return crushed;
} }
m_Sector->ceilingplane.d = lastpos; m_Sector->ceilingplane.setD(lastpos);
P_ChangeSector (m_Sector, crush, speed, 1, true); P_ChangeSector (m_Sector, crush, speed, 1, true);
MoveAttached(crush, speed, 1, false); MoveAttached(crush, speed, 1, false);
return crushed; return crushed;
@ -352,12 +350,12 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
if (!MoveAttached(crush, move, 1, true)) return crushed; if (!MoveAttached(crush, move, 1, true)) return crushed;
m_Sector->ceilingplane.d = dest; m_Sector->ceilingplane.setD(dest);
flag = P_ChangeSector (m_Sector, crush, move, 1, false); flag = P_ChangeSector (m_Sector, crush, move, 1, false);
if (flag) if (flag)
{ {
m_Sector->ceilingplane.d = lastpos; m_Sector->ceilingplane.setD(lastpos);
P_ChangeSector (m_Sector, crush, move, 1, true); P_ChangeSector (m_Sector, crush, move, 1, true);
MoveAttached(crush, move, 1, false); MoveAttached(crush, move, 1, false);
} }
@ -371,12 +369,12 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
{ {
if (!MoveAttached(crush, speed, 1, true)) return crushed; if (!MoveAttached(crush, speed, 1, true)) return crushed;
m_Sector->ceilingplane.d = movedest; m_Sector->ceilingplane.setD(movedest);
flag = P_ChangeSector (m_Sector, crush, speed, 1, false); flag = P_ChangeSector (m_Sector, crush, speed, 1, false);
if (flag) if (flag)
{ {
m_Sector->ceilingplane.d = lastpos; m_Sector->ceilingplane.setD(lastpos);
P_ChangeSector (m_Sector, crush, -speed, 1, true); P_ChangeSector (m_Sector, crush, -speed, 1, true);
MoveAttached(crush, -speed, 1, false); MoveAttached(crush, -speed, 1, false);
return crushed; return crushed;

View file

@ -1638,7 +1638,7 @@ public:
m_FloorDestDist = moveheight; m_FloorDestDist = moveheight;
// Do not interpolate instant movement floors. // Do not interpolate instant movement floors.
fixed_t movedist = abs(-sec->floorplane.d - moveheight); fixed_t movedist = abs(-sec->floorplane.fixD() - moveheight);
if (m_Speed >= movedist) if (m_Speed >= movedist)
{ {
StopInterpolation(true); StopInterpolation(true);
@ -1790,7 +1790,7 @@ public:
m_Direction=destheight>sec->GetPlaneTexZ(sector_t::ceiling)? 1:-1; m_Direction=destheight>sec->GetPlaneTexZ(sector_t::ceiling)? 1:-1;
// Do not interpolate instant movement ceilings. // Do not interpolate instant movement ceilings.
fixed_t movedist = abs(sec->ceilingplane.d - m_BottomHeight); fixed_t movedist = abs(sec->ceilingplane.fixD() - m_BottomHeight);
if (m_Speed >= movedist) if (m_Speed >= movedist)
{ {
StopInterpolation (true); StopInterpolation (true);

View file

@ -101,7 +101,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightGoesOut)
fixed_t oldtheight = sec->floorplane.Zat0(); fixed_t oldtheight = sec->floorplane.Zat0();
newheight = sec->FindLowestFloorSurrounding(&spot); newheight = sec->FindLowestFloorSurrounding(&spot);
sec->floorplane.d = sec->floorplane.PointToDist (spot, newheight); sec->floorplane.setD(sec->floorplane.PointToDist (spot, newheight));
fixed_t newtheight = sec->floorplane.Zat0(); fixed_t newtheight = sec->floorplane.Zat0();
sec->ChangePlaneTexZ(sector_t::floor, newtheight - oldtheight); sec->ChangePlaneTexZ(sector_t::floor, newtheight - oldtheight);
sec->CheckPortalPlane(sector_t::floor); sec->CheckPortalPlane(sector_t::floor);

View file

@ -189,7 +189,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
ffloor->top.vindex = ffloor->bottom.vindex = -1; ffloor->top.vindex = ffloor->bottom.vindex = -1;
// The engine cannot handle sloped translucent floors. Sorry // The engine cannot handle sloped translucent floors. Sorry
if (ffloor->top.plane->a || ffloor->top.plane->b || ffloor->bottom.plane->a || ffloor->bottom.plane->b) if (ffloor->top.plane->isSlope() || ffloor->bottom.plane->isSlope())
{ {
ffloor->alpha = OPAQUE; ffloor->alpha = OPAQUE;
ffloor->flags &= ~FF_ADDITIVETRANS; ffloor->flags &= ~FF_ADDITIVETRANS;
@ -815,12 +815,12 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
if (highestfloorplanes[0]) if (highestfloorplanes[0])
{ {
open.frontfloorplane = *highestfloorplanes[0]; open.frontfloorplane = *highestfloorplanes[0];
if (open.frontfloorplane.c < 0) open.frontfloorplane.FlipVert(); if (open.frontfloorplane.fC() < 0) open.frontfloorplane.FlipVert();
} }
if (highestfloorplanes[1]) if (highestfloorplanes[1])
{ {
open.backfloorplane = *highestfloorplanes[1]; open.backfloorplane = *highestfloorplanes[1];
if (open.backfloorplane.c < 0) open.backfloorplane.FlipVert(); if (open.backfloorplane.fC() < 0) open.backfloorplane.FlipVert();
} }
} }
@ -908,7 +908,7 @@ secplane_t P_FindFloorPlane(sector_t * sector, const DVector3 &pos)
if (rover->top.plane->ZatPoint(pos) == pos.Z) if (rover->top.plane->ZatPoint(pos) == pos.Z)
{ {
retplane = *rover->top.plane; retplane = *rover->top.plane;
if (retplane.c<0) retplane.FlipVert(); if (retplane.fC() < 0) retplane.FlipVert();
break; break;
} }
} }

View file

@ -1426,9 +1426,9 @@ DPlaneWatcher::DPlaneWatcher (AActor *it, line_t *line, int lineSide, bool ceili
{ {
plane = Sector->floorplane; plane = Sector->floorplane;
} }
LastD = plane.d; LastD = plane.fixD();
plane.ChangeHeight (height << FRACBITS); plane.ChangeHeight (height << FRACBITS);
WatchD = plane.d; WatchD = plane.fixD();
} }
else else
{ {
@ -1458,11 +1458,11 @@ void DPlaneWatcher::Tick ()
if (bCeiling) if (bCeiling)
{ {
newd = Sector->ceilingplane.d; newd = Sector->ceilingplane.fixD();
} }
else else
{ {
newd = Sector->floorplane.d; newd = Sector->floorplane.fixD();
} }
if ((LastD < WatchD && newd >= WatchD) || if ((LastD < WatchD && newd >= WatchD) ||

View file

@ -403,9 +403,7 @@ static void LoadSectors (sectortype *bsec)
sec->e = &sectors[0].e[i]; sec->e = &sectors[0].e[i];
sec->SetPlaneTexZ(sector_t::floor, -(LittleLong(bsec->floorZ) << 8)); sec->SetPlaneTexZ(sector_t::floor, -(LittleLong(bsec->floorZ) << 8));
sec->floorplane.d = -sec->GetPlaneTexZ(sector_t::floor); sec->floorplane.set(0, 0, -FRACUNIT, -sec->GetPlaneTexZ(sector_t::floor));
sec->floorplane.c = FRACUNIT;
sec->floorplane.ic = FRACUNIT;
mysnprintf (tnam, countof(tnam), "BTIL%04d", LittleShort(bsec->floorpicnum)); mysnprintf (tnam, countof(tnam), "BTIL%04d", LittleShort(bsec->floorpicnum));
sec->SetTexture(sector_t::floor, TexMan.GetTexture (tnam, FTexture::TEX_Build)); sec->SetTexture(sector_t::floor, TexMan.GetTexture (tnam, FTexture::TEX_Build));
sec->SetXScale(sector_t::floor, (bsec->floorstat & 8) ? FRACUNIT*2 : FRACUNIT); sec->SetXScale(sector_t::floor, (bsec->floorstat & 8) ? FRACUNIT*2 : FRACUNIT);
@ -416,9 +414,7 @@ static void LoadSectors (sectortype *bsec)
sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING); sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING);
sec->SetPlaneTexZ(sector_t::ceiling, -(LittleLong(bsec->ceilingZ) << 8)); sec->SetPlaneTexZ(sector_t::ceiling, -(LittleLong(bsec->ceilingZ) << 8));
sec->ceilingplane.d = sec->GetPlaneTexZ(sector_t::ceiling); sec->ceilingplane.set(0, 0, -FRACUNIT, sec->GetPlaneTexZ(sector_t::ceiling));
sec->ceilingplane.c = -FRACUNIT;
sec->ceilingplane.ic = -FRACUNIT;
mysnprintf (tnam, countof(tnam), "BTIL%04d", LittleShort(bsec->ceilingpicnum)); mysnprintf (tnam, countof(tnam), "BTIL%04d", LittleShort(bsec->ceilingpicnum));
sec->SetTexture(sector_t::ceiling, TexMan.GetTexture (tnam, FTexture::TEX_Build)); sec->SetTexture(sector_t::ceiling, TexMan.GetTexture (tnam, FTexture::TEX_Build));
if (bsec->ceilingstat & 1) if (bsec->ceilingstat & 1)
@ -826,17 +822,14 @@ static void CalcPlane (SlopeWork &slope, secplane_t &plane)
pt[1] = DVector3(slope.x[2] - slope.x[0], slope.y[0] - slope.y[2], (slope.z[2] - slope.z[0]) / 16); pt[1] = DVector3(slope.x[2] - slope.x[0], slope.y[0] - slope.y[2], (slope.z[2] - slope.z[0]) / 16);
pt[2] = (pt[0] ^ pt[1]).Unit(); pt[2] = (pt[0] ^ pt[1]).Unit();
if ((pt[2][2] < 0 && plane.c > 0) || (pt[2][2] > 0 && plane.c < 0)) if ((pt[2][2] < 0 && plane.fC() > 0) || (pt[2][2] > 0 && plane.fC() < 0))
{ {
pt[2] = -pt[2]; pt[2] = -pt[2];
} }
plane.a = FLOAT2FIXED(pt[2][0]); plane.set(pt[2][0], pt[2][1], pt[2][2], 0.);
plane.b = FLOAT2FIXED(pt[2][1]); plane.setD(-TMulScale8
plane.c = FLOAT2FIXED(pt[2][2]); (plane.fixA(), slope.x[0]<<4, plane.fixB(), (-slope.y[0])<<4, plane.fixC(), slope.z[0]));
plane.ic = DivScale32(1, plane.c);
plane.d = -TMulScale8
(plane.a, slope.x[0]<<4, plane.b, (-slope.y[0])<<4, plane.c, slope.z[0]);
} }
//========================================================================== //==========================================================================

View file

@ -264,7 +264,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
{ {
case ceilCrushAndRaise: case ceilCrushAndRaise:
case ceilCrushRaiseAndStay: case ceilCrushRaiseAndStay:
ceiling->m_TopHeight = sec->ceilingplane.d; ceiling->m_TopHeight = sec->ceilingplane.fixD();
case ceilLowerAndCrush: case ceilLowerAndCrush:
targheight = sec->FindHighestFloorPoint (&spot); targheight = sec->FindHighestFloorPoint (&spot);
targheight += height; targheight += height;
@ -404,11 +404,11 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
if (ceiling->m_Direction < 0) if (ceiling->m_Direction < 0)
{ {
movedist = sec->ceilingplane.d - ceiling->m_BottomHeight; movedist = sec->ceilingplane.fixD() - ceiling->m_BottomHeight;
} }
else else
{ {
movedist = ceiling->m_TopHeight - sec->ceilingplane.d; movedist = ceiling->m_TopHeight - sec->ceilingplane.fixD();
} }
if (ceiling->m_Speed >= movedist) if (ceiling->m_Speed >= movedist)
{ {

View file

@ -82,12 +82,12 @@ void DDoor::Tick ()
{ {
EResult res; EResult res;
if (m_Sector->floorplane.d != m_OldFloorDist) if (m_Sector->floorplane.fixD() != m_OldFloorDist)
{ {
if (!m_Sector->floordata || !m_Sector->floordata->IsKindOf(RUNTIME_CLASS(DPlat)) || if (!m_Sector->floordata || !m_Sector->floordata->IsKindOf(RUNTIME_CLASS(DPlat)) ||
!(barrier_cast<DPlat*>(m_Sector->floordata))->IsLift()) !(barrier_cast<DPlat*>(m_Sector->floordata))->IsLift())
{ {
m_OldFloorDist = m_Sector->floorplane.d; m_OldFloorDist = m_Sector->floorplane.fixD();
m_BotDist = m_Sector->ceilingplane.PointToDist (m_BotSpot, m_BotDist = m_Sector->ceilingplane.PointToDist (m_BotSpot,
m_Sector->floorplane.ZatPoint (m_BotSpot)); m_Sector->floorplane.ZatPoint (m_BotSpot));
} }
@ -140,10 +140,10 @@ void DDoor::Tick ()
res = MoveCeiling (m_Speed, m_BotDist, -1, m_Direction, false); res = MoveCeiling (m_Speed, m_BotDist, -1, m_Direction, false);
// killough 10/98: implement gradual lighting effects // killough 10/98: implement gradual lighting effects
if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.d) if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fixD())
{ {
EV_LightTurnOnPartway (m_LightTag, EV_LightTurnOnPartway (m_LightTag,
FIXED2DBL(FixedDiv (m_Sector->ceilingplane.d + m_Sector->floorplane.d, m_TopDist + m_Sector->floorplane.d))); FIXED2DBL(FixedDiv (m_Sector->ceilingplane.fixD() + m_Sector->floorplane.fixD(), m_TopDist + m_Sector->floorplane.fixD())));
} }
if (res == pastdest) if (res == pastdest)
@ -186,10 +186,10 @@ void DDoor::Tick ()
res = MoveCeiling (m_Speed, m_TopDist, -1, m_Direction, false); res = MoveCeiling (m_Speed, m_TopDist, -1, m_Direction, false);
// killough 10/98: implement gradual lighting effects // killough 10/98: implement gradual lighting effects
if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.d) if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fixD())
{ {
EV_LightTurnOnPartway (m_LightTag, EV_LightTurnOnPartway (m_LightTag,
FIXED2DBL(FixedDiv (m_Sector->ceilingplane.d + m_Sector->floorplane.d, m_TopDist + m_Sector->floorplane.d))); FIXED2DBL(FixedDiv (m_Sector->ceilingplane.fixD() + m_Sector->floorplane.fixD(), m_TopDist + m_Sector->floorplane.fixD())));
} }
if (res == pastdest) if (res == pastdest)
@ -376,12 +376,12 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa
m_Direction = 1; m_Direction = 1;
height = sec->FindLowestCeilingSurrounding (&spot); height = sec->FindLowestCeilingSurrounding (&spot);
m_TopDist = sec->ceilingplane.PointToDist (spot, height - 4*FRACUNIT); m_TopDist = sec->ceilingplane.PointToDist (spot, height - 4*FRACUNIT);
if (m_TopDist != sec->ceilingplane.d) if (m_TopDist != sec->ceilingplane.fixD())
DoorSound (true); DoorSound (true);
break; break;
case doorCloseWaitOpen: case doorCloseWaitOpen:
m_TopDist = sec->ceilingplane.d; m_TopDist = sec->ceilingplane.fixD();
m_Direction = -1; m_Direction = -1;
DoorSound (false); DoorSound (false);
break; break;
@ -397,8 +397,8 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa
m_Type = DDoor::doorRaise; m_Type = DDoor::doorRaise;
height = sec->FindHighestFloorPoint (&m_BotSpot); height = sec->FindHighestFloorPoint (&m_BotSpot);
m_BotDist = sec->ceilingplane.PointToDist (m_BotSpot, height); m_BotDist = sec->ceilingplane.PointToDist (m_BotSpot, height);
m_OldFloorDist = sec->floorplane.d; m_OldFloorDist = sec->floorplane.fixD();
m_TopDist = sec->ceilingplane.d; m_TopDist = sec->ceilingplane.fixD();
break; break;
} }
@ -414,7 +414,7 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa
height = sec->FindLowestCeilingPoint(&m_BotSpot); height = sec->FindLowestCeilingPoint(&m_BotSpot);
m_BotDist = sec->ceilingplane.PointToDist (m_BotSpot, height); m_BotDist = sec->ceilingplane.PointToDist (m_BotSpot, height);
} }
m_OldFloorDist = sec->floorplane.d; m_OldFloorDist = sec->floorplane.fixD();
} }
//============================================================================ //============================================================================
@ -559,7 +559,7 @@ bool DAnimatedDoor::StartClosing ()
return false; return false;
} }
fixed_t topdist = m_Sector->ceilingplane.d; fixed_t topdist = m_Sector->ceilingplane.fixD();
if (MoveCeiling (2048*FRACUNIT, m_BotDist, 0, -1, false) == crushed) if (MoveCeiling (2048*FRACUNIT, m_BotDist, 0, -1, false) == crushed)
{ {
return false; return false;
@ -722,7 +722,7 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay,
FTexture *tex = TexMan[picnum]; FTexture *tex = TexMan[picnum];
topdist = tex ? tex->GetScaledHeight() : 64; topdist = tex ? tex->GetScaledHeight() : 64;
topdist = m_Sector->ceilingplane.d - topdist * m_Sector->ceilingplane.c; topdist = m_Sector->ceilingplane.fixD() - topdist * m_Sector->ceilingplane.fixC();
m_Status = Opening; m_Status = Opening;
m_Speed = speed; m_Speed = speed;
@ -733,7 +733,7 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay,
m_SetBlocking2 = !!(m_Line2->flags & ML_BLOCKING); m_SetBlocking2 = !!(m_Line2->flags & ML_BLOCKING);
m_Line1->flags |= ML_BLOCKING; m_Line1->flags |= ML_BLOCKING;
m_Line2->flags |= ML_BLOCKING; m_Line2->flags |= ML_BLOCKING;
m_BotDist = m_Sector->ceilingplane.d; m_BotDist = m_Sector->ceilingplane.fixD();
MoveCeiling (2048*FRACUNIT, topdist, 1); MoveCeiling (2048*FRACUNIT, topdist, 1);
if (m_DoorAnim->OpenSound != NAME_None) if (m_DoorAnim->OpenSound != NAME_None)
{ {

View file

@ -312,7 +312,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
floor->m_Hexencrush = hexencrush; floor->m_Hexencrush = hexencrush;
floor->m_Speed = speed; floor->m_Speed = speed;
floor->m_ResetCount = 0; // [RH] floor->m_ResetCount = 0; // [RH]
floor->m_OrgDist = sec->floorplane.d; // [RH] floor->m_OrgDist = sec->floorplane.fixD(); // [RH]
switch (floortype) switch (floortype)
{ {
@ -322,7 +322,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight); floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
// [RH] DOOM's turboLower type did this. I've just extended it // [RH] DOOM's turboLower type did this. I've just extended it
// to be applicable to all LowerToHighest types. // to be applicable to all LowerToHighest types.
if (hereticlower || floor->m_FloorDestDist != sec->floorplane.d) if (hereticlower || floor->m_FloorDestDist != sec->floorplane.fixD())
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight+height); floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight+height);
break; break;
@ -358,7 +358,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
case DFloor::floorMoveToValue: case DFloor::floorMoveToValue:
sec->FindHighestFloorPoint (&spot); sec->FindHighestFloorPoint (&spot);
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, height); floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, height);
floor->m_Direction = (floor->m_FloorDestDist > sec->floorplane.d) ? -1 : 1; floor->m_Direction = (floor->m_FloorDestDist > sec->floorplane.fixD()) ? -1 : 1;
break; break;
case DFloor::floorRaiseAndCrushDoom: case DFloor::floorRaiseAndCrushDoom:
@ -475,9 +475,9 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
// Do not interpolate instant movement floors. // Do not interpolate instant movement floors.
bool silent = false; bool silent = false;
if ((floor->m_Direction>0 && floor->m_FloorDestDist>sec->floorplane.d) || // moving up but going down if ((floor->m_Direction>0 && floor->m_FloorDestDist>sec->floorplane.fixD()) || // moving up but going down
(floor->m_Direction<0 && floor->m_FloorDestDist<sec->floorplane.d) || // moving down but going up (floor->m_Direction<0 && floor->m_FloorDestDist<sec->floorplane.fixD()) || // moving down but going up
(floor->m_Speed >= abs(sec->floorplane.d - floor->m_FloorDestDist))) // moving in one step (floor->m_Speed >= abs(sec->floorplane.fixD() - floor->m_FloorDestDist))) // moving in one step
{ {
floor->StopInterpolation(true); floor->StopInterpolation(true);
@ -609,7 +609,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
stairstep = stairsize * floor->m_Direction; stairstep = stairsize * floor->m_Direction;
floor->m_Type = DFloor::buildStair; //jff 3/31/98 do not leave uninited floor->m_Type = DFloor::buildStair; //jff 3/31/98 do not leave uninited
floor->m_ResetCount = reset; // [RH] Tics until reset (0 if never) floor->m_ResetCount = reset; // [RH] Tics until reset (0 if never)
floor->m_OrgDist = sec->floorplane.d; // [RH] Height to reset to floor->m_OrgDist = sec->floorplane.fixD(); // [RH] Height to reset to
// [RH] Set up delay values // [RH] Set up delay values
floor->m_Delay = delay; floor->m_Delay = delay;
floor->m_PauseTime = 0; floor->m_PauseTime = 0;
@ -731,7 +731,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
floor->m_Crush = (!(usespecials & DFloor::stairUseSpecials) && speed == 4*FRACUNIT) ? 10 : -1; //jff 2/27/98 fix uninitialized crush field floor->m_Crush = (!(usespecials & DFloor::stairUseSpecials) && speed == 4*FRACUNIT) ? 10 : -1; //jff 2/27/98 fix uninitialized crush field
floor->m_Hexencrush = false; floor->m_Hexencrush = false;
floor->m_ResetCount = reset; // [RH] Tics until reset (0 if never) floor->m_ResetCount = reset; // [RH] Tics until reset (0 if never)
floor->m_OrgDist = sec->floorplane.d; // [RH] Height to reset to floor->m_OrgDist = sec->floorplane.fixD(); // [RH] Height to reset to
} }
} while (ok); } while (ok);
// [RH] make sure the first sector doesn't point to a previous one, otherwise // [RH] make sure the first sector doesn't point to a previous one, otherwise
@ -902,8 +902,8 @@ void DElevator::Tick ()
fixed_t oldfloor, oldceiling; fixed_t oldfloor, oldceiling;
oldfloor = m_Sector->floorplane.d; oldfloor = m_Sector->floorplane.fixD();
oldceiling = m_Sector->ceilingplane.d; oldceiling = m_Sector->ceilingplane.fixD();
if (m_Direction < 0) // moving down if (m_Direction < 0) // moving down
{ {
@ -1031,7 +1031,7 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype,
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (line->v1, newheight); elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (line->v1, newheight);
elevator->m_Direction = elevator->m_Direction =
elevator->m_FloorDestDist > sec->floorplane.d ? -1 : 1; elevator->m_FloorDestDist > sec->floorplane.fixD() ? -1 : 1;
break; break;
// [RH] elevate up by a specific amount // [RH] elevate up by a specific amount
@ -1204,9 +1204,9 @@ void DWaggleBase::DoWaggle (bool ceiling)
case WGLSTATE_REDUCE: case WGLSTATE_REDUCE:
if ((m_Scale -= m_ScaleDelta) <= 0) if ((m_Scale -= m_ScaleDelta) <= 0)
{ // Remove { // Remove
dist = FixedMul (m_OriginalDist - plane->d, plane->ic); dist = FixedDiv (m_OriginalDist - plane->fixD(), plane->fixC());
m_Sector->ChangePlaneTexZ(pos, -plane->HeightDiff (m_OriginalDist)); m_Sector->ChangePlaneTexZ(pos, -plane->HeightDiff (m_OriginalDist));
plane->d = m_OriginalDist; plane->setD(m_OriginalDist);
P_ChangeSector (m_Sector, true, dist, ceiling, false); P_ChangeSector (m_Sector, true, dist, ceiling, false);
if (ceiling) if (ceiling)
{ {
@ -1236,8 +1236,8 @@ void DWaggleBase::DoWaggle (bool ceiling)
fixed_t mag = finesine[(m_Accumulator>>9)&8191]*8; fixed_t mag = finesine[(m_Accumulator>>9)&8191]*8;
dist = plane->d; dist = plane->fixD();
plane->d = m_OriginalDist + plane->PointToDist (0, 0, FixedMul (mag, m_Scale)); plane->setD(m_OriginalDist + plane->PointToDist (0, 0, FixedMul (mag, m_Scale)));
m_Sector->ChangePlaneTexZ(pos, plane->HeightDiff (dist)); m_Sector->ChangePlaneTexZ(pos, plane->HeightDiff (dist));
dist = plane->HeightDiff (dist); dist = plane->HeightDiff (dist);
@ -1322,12 +1322,12 @@ bool EV_StartWaggle (int tag, line_t *line, int height, int speed, int offset,
if (ceiling) if (ceiling)
{ {
waggle = new DCeilingWaggle (sector); waggle = new DCeilingWaggle (sector);
waggle->m_OriginalDist = sector->ceilingplane.d; waggle->m_OriginalDist = sector->ceilingplane.fixD();
} }
else else
{ {
waggle = new DFloorWaggle (sector); waggle = new DFloorWaggle (sector);
waggle->m_OriginalDist = sector->floorplane.d; waggle->m_OriginalDist = sector->floorplane.fixD();
} }
waggle->m_Accumulator = offset*FRACUNIT; waggle->m_Accumulator = offset*FRACUNIT;
waggle->m_AccDelta = speed << (FRACBITS-6); waggle->m_AccDelta = speed << (FRACBITS-6);

View file

@ -101,8 +101,7 @@ static bool MoveCeiling(sector_t *sector, int crush, fixed_t move)
if (P_ChangeSector(sector, crush, move, 1, true)) return false; if (P_ChangeSector(sector, crush, move, 1, true)) return false;
// Don't let the ceiling go below the floor // Don't let the ceiling go below the floor
if ((sector->ceilingplane.a | sector->ceilingplane.b | if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() &&
sector->floorplane.a | sector->floorplane.b) == 0 &&
sector->GetPlaneTexZ(sector_t::floor) > sector->GetPlaneTexZ(sector_t::ceiling)) return false; sector->GetPlaneTexZ(sector_t::floor) > sector->GetPlaneTexZ(sector_t::ceiling)) return false;
return true; return true;
@ -116,8 +115,7 @@ static bool MoveFloor(sector_t *sector, int crush, fixed_t move)
if (P_ChangeSector(sector, crush, move, 0, true)) return false; if (P_ChangeSector(sector, crush, move, 0, true)) return false;
// Don't let the floor go above the ceiling // Don't let the floor go above the ceiling
if ((sector->ceilingplane.a | sector->ceilingplane.b | if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() &&
sector->floorplane.a | sector->floorplane.b) == 0 &&
sector->GetPlaneTexZ(sector_t::floor) > sector->GetPlaneTexZ(sector_t::ceiling)) return false; sector->GetPlaneTexZ(sector_t::floor) > sector->GetPlaneTexZ(sector_t::ceiling)) return false;
return true; return true;

View file

@ -45,7 +45,7 @@ struct FTranslatedLineTarget;
#include <stdlib.h> #include <stdlib.h>
#define STEEPSLOPE 46342 // [RH] Minimum floorplane.c value for walking #define STEEPSLOPE 46342 // [RH] Minimum floorplane.fixC() value for walking
#define BONUSADD 6 #define BONUSADD 6

View file

@ -808,7 +808,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
if (!(tm.thing->flags & MF_DROPOFF) && if (!(tm.thing->flags & MF_DROPOFF) &&
!(tm.thing->flags & (MF_NOGRAVITY | MF_NOCLIP))) !(tm.thing->flags & (MF_NOGRAVITY | MF_NOCLIP)))
{ {
if ((open.frontfloorplane.c < STEEPSLOPE) != (open.backfloorplane.c < STEEPSLOPE)) if ((open.frontfloorplane.fixC() < STEEPSLOPE) != (open.backfloorplane.fixC() < STEEPSLOPE))
{ {
// on the boundary of a steep slope // on the boundary of a steep slope
return false; return false;
@ -2901,7 +2901,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
if (thisplanez > planezhere && thisplanez <= actor->Z() + actor->MaxStepHeight) if (thisplanez > planezhere && thisplanez <= actor->Z() + actor->MaxStepHeight)
{ {
copyplane = *rover->top.plane; copyplane = *rover->top.plane;
if (copyplane.c < 0) copyplane.FlipVert(); if (copyplane.fC() < 0) copyplane.FlipVert();
plane = &copyplane; plane = &copyplane;
planezhere = thisplanez; planezhere = thisplanez;
} }
@ -2918,7 +2918,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
if (thisplanez > planezhere && thisplanez <= actor->Z() + actor->MaxStepHeight) if (thisplanez > planezhere && thisplanez <= actor->Z() + actor->MaxStepHeight)
{ {
copyplane = *rover->top.plane; copyplane = *rover->top.plane;
if (copyplane.c < 0) copyplane.FlipVert(); if (copyplane.fC() < 0) copyplane.FlipVert();
plane = &copyplane; plane = &copyplane;
planezhere = thisplanez; planezhere = thisplanez;
} }
@ -2947,7 +2947,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
if (t < 0) if (t < 0)
{ // Desired location is behind (below) the plane { // Desired location is behind (below) the plane
// (i.e. Walking up the plane) // (i.e. Walking up the plane)
if (plane->c < STEEPSLOPE) if (plane->fixC() < STEEPSLOPE)
{ // Can't climb up slopes of ~45 degrees or more { // Can't climb up slopes of ~45 degrees or more
if (actor->flags & MF_NOCLIP) if (actor->flags & MF_NOCLIP)
{ {
@ -2958,12 +2958,12 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
const msecnode_t *node; const msecnode_t *node;
bool dopush = true; bool dopush = true;
if (plane->c > STEEPSLOPE * 2 / 3) if (plane->fixC() > STEEPSLOPE * 2 / 3)
{ {
for (node = actor->touching_sectorlist; node; node = node->m_tnext) for (node = actor->touching_sectorlist; node; node = node->m_tnext)
{ {
sector_t *sec = node->m_sector; sector_t *sec = node->m_sector;
if (sec->floorplane.c >= STEEPSLOPE) if (sec->floorplane.fixC() >= STEEPSLOPE)
{ {
DVector3 pos = actor->PosRelative(sec) +move; DVector3 pos = actor->PosRelative(sec) +move;

View file

@ -218,9 +218,9 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, co
} }
else else
{ {
if ((front->floorplane.a | front->floorplane.b) == 0) if (!front->floorplane.isSlope())
usefront = true; usefront = true;
else if ((back->floorplane.a | front->floorplane.b) == 0) else if (!back->floorplane.isSlope())
usefront = false; usefront = false;
else else
usefront = !P_PointOnLineSide (*ref, linedef); usefront = !P_PointOnLineSide (*ref, linedef);

View file

@ -1530,7 +1530,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane)
} }
} }
if (plane.c < 0) if (plane.fC() < 0)
{ // on ceiling { // on ceiling
if (!(BounceFlags & BOUNCE_Ceilings)) if (!(BounceFlags & BOUNCE_Ceilings))
return true; return true;
@ -1582,7 +1582,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane)
FState *bouncestate; FState *bouncestate;
names[0] = NAME_Bounce; names[0] = NAME_Bounce;
names[1] = plane.c < 0 ? NAME_Ceiling : NAME_Floor; names[1] = plane.fC() < 0 ? NAME_Ceiling : NAME_Floor;
bouncestate = FindState(2, names); bouncestate = FindState(2, names);
if (bouncestate != NULL) if (bouncestate != NULL)
{ {
@ -1597,7 +1597,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane)
} }
else if (BounceFlags & (BOUNCE_AutoOff|BOUNCE_AutoOffFloorOnly)) else if (BounceFlags & (BOUNCE_AutoOff|BOUNCE_AutoOffFloorOnly))
{ {
if (plane.c > 0 || (BounceFlags & BOUNCE_AutoOff)) if (plane.fC() > 0 || (BounceFlags & BOUNCE_AutoOff))
{ {
// AutoOff only works when bouncing off a floor, not a ceiling (or in compatibility mode.) // AutoOff only works when bouncing off a floor, not a ceiling (or in compatibility mode.)
if (!(flags & MF_NOGRAVITY) && (Vel.Z < 3)) if (!(flags & MF_NOGRAVITY) && (Vel.Z < 3))
@ -3644,18 +3644,18 @@ void AActor::Tick ()
// Check 3D floors as well // Check 3D floors as well
floorplane = P_FindFloorPlane(floorsector, PosAtZ(floorz)); floorplane = P_FindFloorPlane(floorsector, PosAtZ(floorz));
if (floorplane.c < STEEPSLOPE && if (floorplane.fixC() < STEEPSLOPE &&
floorplane.ZatPoint (PosRelative(floorsector)) <= floorz) floorplane.ZatPoint (PosRelative(floorsector)) <= floorz)
{ {
const msecnode_t *node; const msecnode_t *node;
bool dopush = true; bool dopush = true;
if (floorplane.c > STEEPSLOPE*2/3) if (floorplane.fixC() > STEEPSLOPE*2/3)
{ {
for (node = touching_sectorlist; node; node = node->m_tnext) for (node = touching_sectorlist; node; node = node->m_tnext)
{ {
const sector_t *sec = node->m_sector; const sector_t *sec = node->m_sector;
if (sec->floorplane.c >= STEEPSLOPE) if (sec->floorplane.fixC() >= STEEPSLOPE)
{ {
if (floorplane.ZatPoint(PosRelative(node->m_sector)) >= Z() - MaxStepHeight) if (floorplane.ZatPoint(PosRelative(node->m_sector)) >= Z() - MaxStepHeight)
{ {

View file

@ -91,8 +91,8 @@ void DPillar::Tick ()
int r, s; int r, s;
fixed_t oldfloor, oldceiling; fixed_t oldfloor, oldceiling;
oldfloor = m_Sector->floorplane.d; oldfloor = m_Sector->floorplane.fixD();
oldceiling = m_Sector->ceilingplane.d; oldceiling = m_Sector->ceilingplane.fixD();
if (m_Type == pillarBuild) if (m_Type == pillarBuild)
{ {

View file

@ -198,7 +198,7 @@ void DPlat::Tick ()
case waiting: case waiting:
if (m_Count > 0 && !--m_Count) if (m_Count > 0 && !--m_Count)
{ {
if (m_Sector->floorplane.d == m_Low) if (m_Sector->floorplane.fixD() == m_Low)
m_Status = up; m_Status = up;
else else
m_Status = down; m_Status = down;
@ -277,7 +277,7 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
//jff 1/26/98 Avoid raise plat bouncing a head off a ceiling and then //jff 1/26/98 Avoid raise plat bouncing a head off a ceiling and then
//going down forever -- default lower to plat height when triggered //going down forever -- default lower to plat height when triggered
plat->m_Low = sec->floorplane.d; plat->m_Low = sec->floorplane.fixD();
if (change) if (change)
{ {
@ -292,7 +292,7 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
case DPlat::platRaiseAndStayLockout: case DPlat::platRaiseAndStayLockout:
newheight = sec->FindNextHighestFloor (&spot); newheight = sec->FindNextHighestFloor (&spot);
plat->m_High = sec->floorplane.PointToDist (spot, newheight); plat->m_High = sec->floorplane.PointToDist (spot, newheight);
plat->m_Low = sec->floorplane.d; plat->m_Low = sec->floorplane.fixD();
plat->m_Status = DPlat::up; plat->m_Status = DPlat::up;
plat->PlayPlatSound ("Floor"); plat->PlayPlatSound ("Floor");
sec->ClearSpecial(); sec->ClearSpecial();
@ -302,7 +302,7 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
case DPlat::platUpByValueStay: case DPlat::platUpByValueStay:
newheight = sec->floorplane.ZatPoint (0, 0) + height; newheight = sec->floorplane.ZatPoint (0, 0) + height;
plat->m_High = sec->floorplane.PointToDist (0, 0, newheight); plat->m_High = sec->floorplane.PointToDist (0, 0, newheight);
plat->m_Low = sec->floorplane.d; plat->m_Low = sec->floorplane.fixD();
plat->m_Status = DPlat::up; plat->m_Status = DPlat::up;
plat->PlayPlatSound ("Floor"); plat->PlayPlatSound ("Floor");
break; break;
@ -310,7 +310,7 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
case DPlat::platDownByValue: case DPlat::platDownByValue:
newheight = sec->floorplane.ZatPoint (0, 0) - height; newheight = sec->floorplane.ZatPoint (0, 0) - height;
plat->m_Low = sec->floorplane.PointToDist (0, 0, newheight); plat->m_Low = sec->floorplane.PointToDist (0, 0, newheight);
plat->m_High = sec->floorplane.d; plat->m_High = sec->floorplane.fixD();
plat->m_Status = DPlat::down; plat->m_Status = DPlat::down;
plat->PlayPlatSound ("Floor"); plat->PlayPlatSound ("Floor");
break; break;
@ -320,10 +320,10 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
newheight = sec->FindLowestFloorSurrounding (&spot) + lip*FRACUNIT; newheight = sec->FindLowestFloorSurrounding (&spot) + lip*FRACUNIT;
plat->m_Low = sec->floorplane.PointToDist (spot, newheight); plat->m_Low = sec->floorplane.PointToDist (spot, newheight);
if (plat->m_Low < sec->floorplane.d) if (plat->m_Low < sec->floorplane.fixD())
plat->m_Low = sec->floorplane.d; plat->m_Low = sec->floorplane.fixD();
plat->m_High = sec->floorplane.d; plat->m_High = sec->floorplane.fixD();
plat->m_Status = DPlat::down; plat->m_Status = DPlat::down;
plat->PlayPlatSound (type == DPlat::platDownWaitUpStay ? "Platform" : "Floor"); plat->PlayPlatSound (type == DPlat::platDownWaitUpStay ? "Platform" : "Floor");
break; break;
@ -338,10 +338,10 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
newheight = sec->FindHighestFloorSurrounding (&spot); newheight = sec->FindHighestFloorSurrounding (&spot);
} }
plat->m_High = sec->floorplane.PointToDist (spot, newheight); plat->m_High = sec->floorplane.PointToDist (spot, newheight);
plat->m_Low = sec->floorplane.d; plat->m_Low = sec->floorplane.fixD();
if (plat->m_High > sec->floorplane.d) if (plat->m_High > sec->floorplane.fixD())
plat->m_High = sec->floorplane.d; plat->m_High = sec->floorplane.fixD();
plat->m_Status = DPlat::up; plat->m_Status = DPlat::up;
plat->PlayPlatSound ("Platform"); plat->PlayPlatSound ("Platform");
@ -351,14 +351,14 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
newheight = sec->FindLowestFloorSurrounding (&spot) + lip*FRACUNIT; newheight = sec->FindLowestFloorSurrounding (&spot) + lip*FRACUNIT;
plat->m_Low = sec->floorplane.PointToDist (spot, newheight); plat->m_Low = sec->floorplane.PointToDist (spot, newheight);
if (plat->m_Low < sec->floorplane.d) if (plat->m_Low < sec->floorplane.fixD())
plat->m_Low = sec->floorplane.d; plat->m_Low = sec->floorplane.fixD();
newheight = sec->FindHighestFloorSurrounding (&spot); newheight = sec->FindHighestFloorSurrounding (&spot);
plat->m_High = sec->floorplane.PointToDist (spot, newheight); plat->m_High = sec->floorplane.PointToDist (spot, newheight);
if (plat->m_High > sec->floorplane.d) if (plat->m_High > sec->floorplane.fixD())
plat->m_High = sec->floorplane.d; plat->m_High = sec->floorplane.fixD();
plat->m_Status = pr_doplat() & 1 ? DPlat::up : DPlat::down; plat->m_Status = pr_doplat() & 1 ? DPlat::up : DPlat::down;
@ -371,7 +371,7 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
// set up toggling between ceiling, floor inclusive // set up toggling between ceiling, floor inclusive
newheight = sec->FindLowestCeilingPoint (&spot); newheight = sec->FindLowestCeilingPoint (&spot);
plat->m_Low = sec->floorplane.PointToDist (spot, newheight); plat->m_Low = sec->floorplane.PointToDist (spot, newheight);
plat->m_High = sec->floorplane.d; plat->m_High = sec->floorplane.fixD();
plat->m_Status = DPlat::down; plat->m_Status = DPlat::down;
SN_StartSequence (sec, CHAN_FLOOR, "Silence", 0); SN_StartSequence (sec, CHAN_FLOOR, "Silence", 0);
break; break;
@ -380,17 +380,17 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
newheight = sec->FindNextLowestFloor (&spot) + lip*FRACUNIT; newheight = sec->FindNextLowestFloor (&spot) + lip*FRACUNIT;
plat->m_Low = sec->floorplane.PointToDist (spot, newheight); plat->m_Low = sec->floorplane.PointToDist (spot, newheight);
plat->m_Status = DPlat::down; plat->m_Status = DPlat::down;
plat->m_High = sec->floorplane.d; plat->m_High = sec->floorplane.fixD();
plat->PlayPlatSound ("Platform"); plat->PlayPlatSound ("Platform");
break; break;
case DPlat::platDownToLowestCeiling: case DPlat::platDownToLowestCeiling:
newheight = sec->FindLowestCeilingSurrounding (&spot); newheight = sec->FindLowestCeilingSurrounding (&spot);
plat->m_Low = sec->floorplane.PointToDist (spot, newheight); plat->m_Low = sec->floorplane.PointToDist (spot, newheight);
plat->m_High = sec->floorplane.d; plat->m_High = sec->floorplane.fixD();
if (plat->m_Low < sec->floorplane.d) if (plat->m_Low < sec->floorplane.fixD())
plat->m_Low = sec->floorplane.d; plat->m_Low = sec->floorplane.fixD();
plat->m_Status = DPlat::down; plat->m_Status = DPlat::down;
plat->PlayPlatSound ("Platform"); plat->PlayPlatSound ("Platform");

View file

@ -279,7 +279,7 @@ void DPusher::Tick ()
continue; continue;
sector_t *hsec = sec->GetHeightSec(); sector_t *hsec = sec->GetHeightSec();
fixedvec3 pos = thing->_f_PosRelative(sec); DVector3 pos = thing->PosRelative(sec);
DVector2 pushvel; DVector2 pushvel;
if (m_Type == p_wind) if (m_Type == p_wind)
{ {
@ -296,7 +296,7 @@ void DPusher::Tick ()
} }
else // special water sector else // special water sector
{ {
ht = hsec->floorplane.ZatPointF(pos); ht = hsec->floorplane.ZatPoint(pos);
if (thing->Z() > ht) // above ground if (thing->Z() > ht) // above ground
{ {
pushvel = m_PushVec; // full force pushvel = m_PushVec; // full force
@ -323,7 +323,7 @@ void DPusher::Tick ()
{ // special water sector { // special water sector
floor = &hsec->floorplane; floor = &hsec->floorplane;
} }
if (thing->Z() > floor->ZatPointF(pos)) if (thing->Z() > floor->ZatPoint(pos))
{ // above ground { // above ground
pushvel.Zero(); // no force pushvel.Zero(); // no force
} }

View file

@ -617,14 +617,14 @@ fixed_t sector_t::FindHighestFloorPoint (vertex_t **v) const
fixed_t probeheight; fixed_t probeheight;
vertex_t *spot = NULL; vertex_t *spot = NULL;
if ((floorplane.a | floorplane.b) == 0) if (!floorplane.isSlope())
{ {
if (v != NULL) if (v != NULL)
{ {
if (linecount == 0) *v = &vertexes[0]; if (linecount == 0) *v = &vertexes[0];
else *v = lines[0]->v1; else *v = lines[0]->v1;
} }
return -floorplane.d; return floorplane.Zat0();
} }
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)
@ -659,14 +659,14 @@ fixed_t sector_t::FindLowestCeilingPoint (vertex_t **v) const
fixed_t probeheight; fixed_t probeheight;
vertex_t *spot = NULL; vertex_t *spot = NULL;
if ((ceilingplane.a | ceilingplane.b) == 0) if (!ceilingplane.isSlope())
{ {
if (v != NULL) if (v != NULL)
{ {
if (linecount == 0) *v = &vertexes[0]; if (linecount == 0) *v = &vertexes[0];
else *v = lines[0]->v1; else *v = lines[0]->v1;
} }
return ceilingplane.d; return ceilingplane.fixD();
} }
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)

View file

@ -1509,13 +1509,9 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
ss->e = &sectors[0].e[i]; ss->e = &sectors[0].e[i];
if (!map->HasBehavior) ss->Flags |= SECF_FLOORDROP; if (!map->HasBehavior) ss->Flags |= SECF_FLOORDROP;
ss->SetPlaneTexZ(sector_t::floor, LittleShort(ms->floorheight)<<FRACBITS); ss->SetPlaneTexZ(sector_t::floor, LittleShort(ms->floorheight)<<FRACBITS);
ss->floorplane.d = -ss->GetPlaneTexZ(sector_t::floor); ss->floorplane.set(0, 0, FRACUNIT, -ss->GetPlaneTexZ(sector_t::floor));
ss->floorplane.c = FRACUNIT;
ss->floorplane.ic = FRACUNIT;
ss->SetPlaneTexZ(sector_t::ceiling, LittleShort(ms->ceilingheight)<<FRACBITS); ss->SetPlaneTexZ(sector_t::ceiling, LittleShort(ms->ceilingheight)<<FRACBITS);
ss->ceilingplane.d = ss->GetPlaneTexZ(sector_t::ceiling); ss->ceilingplane.set(0, 0, -FRACUNIT, ss->GetPlaneTexZ(sector_t::ceiling));
ss->ceilingplane.c = -FRACUNIT;
ss->ceilingplane.ic = -FRACUNIT;
SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex, true); SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex, true);
SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex, true); SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex, true);
ss->lightlevel = LittleShort(ms->lightlevel); ss->lightlevel = LittleShort(ms->lightlevel);

View file

@ -103,14 +103,10 @@ static void P_SlopeLineToPoint (int lineid, fixed_t x, fixed_t y, fixed_t z, boo
cross = -cross; cross = -cross;
} }
plane->a = FLOAT2FIXED (cross[0]); plane->set(cross[0], cross[1], cross[2], 0.);
plane->b = FLOAT2FIXED (cross[1]); plane->setD(-TMulScale16 (plane->fixA(), x,
plane->c = FLOAT2FIXED (cross[2]); plane->fixB(), y,
//plane->ic = FLOAT2FIXED (1.f/cross[2]); plane->fixC(), z));
plane->ic = DivScale32 (1, plane->c);
plane->d = -TMulScale16 (plane->a, x,
plane->b, y,
plane->c, z);
} }
} }
@ -203,14 +199,8 @@ void P_SetSlope (secplane_t *plane, bool setCeil, int xyangi, int zangi,
} }
norm[2] = double(finesine[zang]) * 65536.f; norm[2] = double(finesine[zang]) * 65536.f;
norm.MakeUnit(); norm.MakeUnit();
plane->a = FLOAT2FIXED(norm[0]); plane->set(norm[0], norm[1], norm[2], 0.);
plane->b = FLOAT2FIXED(norm[1]); plane->setD(-TMulScale16(plane->fixA(), x, plane->fixB(), y, plane->fixC(), z));
plane->c = FLOAT2FIXED(norm[2]);
//plane->ic = (int)(65536.f / norm[2]);
plane->ic = DivScale32 (1, plane->c);
plane->d = -TMulScale16 (plane->a, x,
plane->b, y,
plane->c, z);
} }
@ -255,15 +245,8 @@ void P_VavoomSlope(sector_t * sec, int id, fixed_t x, fixed_t y, fixed_t z, int
cross = -cross; cross = -cross;
} }
srcplane->set(cross[0], cross[1], cross[2], 0.);
srcplane->a = FLOAT2FIXED (cross[0]); srcplane->setD(-TMulScale16(srcplane->fixA(), x, srcplane->fixB(), y, srcplane->fixC(), z));
srcplane->b = FLOAT2FIXED (cross[1]);
srcplane->c = FLOAT2FIXED (cross[2]);
//plane->ic = FLOAT2FIXED (1.f/cross[2]);
srcplane->ic = DivScale32 (1, srcplane->c);
srcplane->d = -TMulScale16 (srcplane->a, x,
srcplane->b, y,
srcplane->c, z);
return; return;
} }
} }
@ -388,15 +371,12 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
cross = -cross; cross = -cross;
} }
secplane_t *srcplane = j==0? &sec->floorplane : &sec->ceilingplane; secplane_t *plane = j==0? &sec->floorplane : &sec->ceilingplane;
srcplane->a = FLOAT2FIXED (cross[0]); plane->set(cross[0], cross[1], cross[2], 0.);
srcplane->b = FLOAT2FIXED (cross[1]); plane->setD(-TMulScale16 (plane->fixA(), vertexes[vi3].fixX(),
srcplane->c = FLOAT2FIXED (cross[2]); plane->fixB(), vertexes[vi3].fixY(),
srcplane->ic = DivScale32 (1, srcplane->c); plane->fixC(), FLOAT2FIXED(vt3.Z)));
srcplane->d = -TMulScale16 (srcplane->a, vertexes[vi3].fixX(),
srcplane->b, vertexes[vi3].fixY(),
srcplane->c, FLOAT2FIXED(vt3.Z));
} }
} }
} }
@ -546,14 +526,10 @@ static void P_AlignPlane (sector_t *sec, line_t *line, int which)
cross = -cross; cross = -cross;
} }
srcplane->a = FLOAT2FIXED (cross[0]); srcplane->set(cross[0], cross[1], cross[2], 0.);
srcplane->b = FLOAT2FIXED (cross[1]); srcplane->setD(-TMulScale16 (srcplane->fixA(), line->v1->fixX(),
srcplane->c = FLOAT2FIXED (cross[2]); srcplane->fixB(), line->v1->fixY(),
//srcplane->ic = FLOAT2FIXED (1.f/cross[2]); srcplane->fixC(), destheight));
srcplane->ic = DivScale32 (1, srcplane->c);
srcplane->d = -TMulScale16 (srcplane->a, line->v1->fixX(),
srcplane->b, line->v1->fixY(),
srcplane->c, destheight);
} }
//=========================================================================== //===========================================================================

View file

@ -930,13 +930,13 @@ bool FTraceInfo::TraceTraverse (int ptflags)
bool FTraceInfo::CheckPlane (const secplane_t &plane) bool FTraceInfo::CheckPlane (const secplane_t &plane)
{ {
fixed_t den = TMulScale16 (plane.a, Vx, plane.b, Vy, plane.c, Vz); fixed_t den = TMulScale16 (plane.fixA(), Vx, plane.fixB(), Vy, plane.fixC(), Vz);
if (den != 0) if (den != 0)
{ {
fixed_t num = TMulScale16 (plane.a, StartX, fixed_t num = TMulScale16 (plane.fixA(), StartX,
plane.b, StartY, plane.fixB(), StartY,
plane.c, StartZ) + plane.d; plane.fixC(), StartZ) + plane.fixD();
fixed_t hitdist = FixedDiv (-num, den); fixed_t hitdist = FixedDiv (-num, den);

View file

@ -1600,39 +1600,22 @@ public:
// Reset the planes to their defaults if not all of the plane equation's parameters were found. // Reset the planes to their defaults if not all of the plane equation's parameters were found.
if (fplaneflags != 15) if (fplaneflags != 15)
{ {
sec->floorplane.a = sec->floorplane.b = 0; sec->floorplane.set(0, 0, FRACUNIT, -sec->GetPlaneTexZ(sector_t::floor));
sec->floorplane.d = -sec->GetPlaneTexZ(sector_t::floor);
sec->floorplane.c = FRACUNIT;
sec->floorplane.ic = FRACUNIT;
} }
else else
{ {
double ulen = DVector3(fp[0], fp[1], fp[2]).Length();
// normalize the vector, it must have a length of 1 // normalize the vector, it must have a length of 1
sec->floorplane.a = FLOAT2FIXED(fp[0] / ulen); DVector3 n = DVector3(fp[0], fp[1], fp[2]).Unit();
sec->floorplane.b = FLOAT2FIXED(fp[1] / ulen); sec->floorplane.set(n.X, n.Y, n.Z, fp[3]);
sec->floorplane.c = FLOAT2FIXED(fp[2] / ulen);
sec->floorplane.d = FLOAT2FIXED(fp[3] / ulen);
sec->floorplane.ic = FLOAT2FIXED(ulen / fp[2]);
} }
if (cplaneflags != 15) if (cplaneflags != 15)
{ {
sec->ceilingplane.a = sec->ceilingplane.b = 0; sec->ceilingplane.set(0, 0, -FRACUNIT, sec->GetPlaneTexZ(sector_t::ceiling));
sec->ceilingplane.d = sec->GetPlaneTexZ(sector_t::ceiling);
sec->ceilingplane.c = -FRACUNIT;
sec->ceilingplane.ic = -FRACUNIT;
} }
else else
{ {
double ulen = DVector3(cp[0], cp[1], cp[2]).Length(); DVector3 n = DVector3(cp[0], cp[1], cp[2]).Unit();
sec->ceilingplane.set(n.X, n.Y, n.Z, cp[3]);
// normalize the vector, it must have a length of 1
sec->ceilingplane.a = FLOAT2FIXED(cp[0] / ulen);
sec->ceilingplane.b = FLOAT2FIXED(cp[1] / ulen);
sec->ceilingplane.c = FLOAT2FIXED(cp[2] / ulen);
sec->ceilingplane.d = FLOAT2FIXED(cp[3] / ulen);
sec->ceilingplane.ic = FLOAT2FIXED(ulen / cp[2]);
} }
if (lightcolor == -1 && fadecolor == -1 && desaturation == -1) if (lightcolor == -1 && fadecolor == -1 && desaturation == -1)

View file

@ -968,7 +968,7 @@ void P_CreateLinkedPortals()
if (box != NULL && box->special1 == SKYBOX_LINKEDPORTAL) if (box != NULL && box->special1 == SKYBOX_LINKEDPORTAL)
{ {
secplane_t &plane = j == 0 ? sectors[i].floorplane : sectors[i].ceilingplane; secplane_t &plane = j == 0 ? sectors[i].floorplane : sectors[i].ceilingplane;
if (plane.a || plane.b) if (plane.isSlope())
{ {
// The engine cannot deal with portals on a sloped plane. // The engine cannot deal with portals on a sloped plane.
sectors[i].SkyBoxes[j] = NULL; sectors[i].SkyBoxes[j] = NULL;

View file

@ -1169,7 +1169,7 @@ void R_Subsector (subsector_t *sub)
fakeFloor = frontsector->e->XFloor.ffloors[i]; fakeFloor = frontsector->e->XFloor.ffloors[i];
if (!(fakeFloor->flags & FF_EXISTS)) continue; if (!(fakeFloor->flags & FF_EXISTS)) continue;
if (!fakeFloor->model) continue; if (!fakeFloor->model) continue;
if (fakeFloor->bottom.plane->a || fakeFloor->bottom.plane->b) continue; if (fakeFloor->bottom.plane->isSlope()) continue;
if (!(fakeFloor->flags & FF_NOSHADE) || (fakeFloor->flags & (FF_RENDERPLANES|FF_RENDERSIDES))) if (!(fakeFloor->flags & FF_NOSHADE) || (fakeFloor->flags & (FF_RENDERPLANES|FF_RENDERSIDES)))
{ {
R_3D_AddHeight(fakeFloor->top.plane, frontsector); R_3D_AddHeight(fakeFloor->top.plane, frontsector);
@ -1230,7 +1230,7 @@ void R_Subsector (subsector_t *sub)
fakeFloor = frontsector->e->XFloor.ffloors[i]; fakeFloor = frontsector->e->XFloor.ffloors[i];
if (!(fakeFloor->flags & FF_EXISTS)) continue; if (!(fakeFloor->flags & FF_EXISTS)) continue;
if (!fakeFloor->model) continue; if (!fakeFloor->model) continue;
if (fakeFloor->top.plane->a || fakeFloor->top.plane->b) continue; if (fakeFloor->top.plane->isSlope()) continue;
if (!(fakeFloor->flags & FF_NOSHADE) || (fakeFloor->flags & (FF_RENDERPLANES|FF_RENDERSIDES))) if (!(fakeFloor->flags & FF_NOSHADE) || (fakeFloor->flags & (FF_RENDERPLANES|FF_RENDERSIDES)))
{ {
R_3D_AddHeight(fakeFloor->bottom.plane, frontsector); R_3D_AddHeight(fakeFloor->bottom.plane, frontsector);

View file

@ -440,12 +440,12 @@ void DSectorPlaneInterpolation::UpdateInterpolation()
{ {
if (!ceiling) if (!ceiling)
{ {
oldheight = sector->floorplane.d; oldheight = sector->floorplane.fixD();
oldtexz = sector->GetPlaneTexZ(sector_t::floor); oldtexz = sector->GetPlaneTexZ(sector_t::floor);
} }
else else
{ {
oldheight = sector->ceilingplane.d; oldheight = sector->ceilingplane.fixD();
oldtexz = sector->GetPlaneTexZ(sector_t::ceiling); oldtexz = sector->GetPlaneTexZ(sector_t::ceiling);
} }
} }
@ -460,12 +460,12 @@ void DSectorPlaneInterpolation::Restore()
{ {
if (!ceiling) if (!ceiling)
{ {
sector->floorplane.d = bakheight; sector->floorplane.setD(bakheight);
sector->SetPlaneTexZ(sector_t::floor, baktexz, true); sector->SetPlaneTexZ(sector_t::floor, baktexz, true);
} }
else else
{ {
sector->ceilingplane.d = bakheight; sector->ceilingplane.setD(bakheight);
sector->SetPlaneTexZ(sector_t::ceiling, baktexz, true); sector->SetPlaneTexZ(sector_t::ceiling, baktexz, true);
} }
P_RecalculateAttached3DFloors(sector); P_RecalculateAttached3DFloors(sector);
@ -480,21 +480,21 @@ void DSectorPlaneInterpolation::Restore()
void DSectorPlaneInterpolation::Interpolate(fixed_t smoothratio) void DSectorPlaneInterpolation::Interpolate(fixed_t smoothratio)
{ {
fixed_t *pheight; secplane_t *pplane;
int pos; int pos;
if (!ceiling) if (!ceiling)
{ {
pheight = &sector->floorplane.d; pplane = &sector->floorplane;
pos = sector_t::floor; pos = sector_t::floor;
} }
else else
{ {
pheight = &sector->ceilingplane.d; pplane = &sector->ceilingplane;
pos = sector_t::ceiling; pos = sector_t::ceiling;
} }
bakheight = *pheight; bakheight = pplane->fixD();
baktexz = sector->GetPlaneTexZ(pos); baktexz = sector->GetPlaneTexZ(pos);
if (refcount == 0 && oldheight == bakheight) if (refcount == 0 && oldheight == bakheight)
@ -503,7 +503,7 @@ void DSectorPlaneInterpolation::Interpolate(fixed_t smoothratio)
} }
else else
{ {
*pheight = oldheight + FixedMul(bakheight - oldheight, smoothratio); pplane->setD(oldheight + FixedMul(bakheight - oldheight, smoothratio));
sector->SetPlaneTexZ(pos, oldtexz + FixedMul(baktexz - oldtexz, smoothratio), true); sector->SetPlaneTexZ(pos, oldtexz + FixedMul(baktexz - oldtexz, smoothratio), true);
P_RecalculateAttached3DFloors(sector); P_RecalculateAttached3DFloors(sector);
sector->CheckPortalPlane(pos); sector->CheckPortalPlane(pos);

View file

@ -305,26 +305,88 @@ class ASkyViewpoint;
struct secplane_t struct secplane_t
{ {
friend FArchive &operator<< (FArchive &arc, secplane_t &plane);
// the plane is defined as a*x + b*y + c*z + d = 0 // the plane is defined as a*x + b*y + c*z + d = 0
// ic is 1/c, for faster Z calculations // ic is 1/c, for faster Z calculations
private:
fixed_t a, b, c, d, ic; fixed_t a, b, c, d, ic;
public:
void set(fixed_t aa, fixed_t bb, fixed_t cc, fixed_t dd)
{
a = aa;
b = bb;
c = cc;
d = dd;
ic = FixedDiv(FRACUNIT, c);
}
void set(double aa, double bb, double cc, double dd)
{
a = FLOAT2FIXED(aa);
b = FLOAT2FIXED(bb);
c = FLOAT2FIXED(cc);
d = FLOAT2FIXED(dd);
ic = FixedDiv(FRACUNIT, c);
}
void setD(fixed_t dd)
{
d = dd;
}
void changeD(fixed_t dd)
{
d += dd;
}
void setD(double dd)
{
d = FLOAT2FIXED(dd);
}
void changeD(double dd)
{
d += FLOAT2FIXED(dd);
}
fixed_t fixA() const
{
return a;
}
fixed_t fixB() const
{
return b;
}
fixed_t fixC() const
{
return c;
}
fixed_t fixD() const
{
return d;
}
fixed_t fixiC() const
{
return ic;
}
double fA() const double fA() const
{ {
return FIXED2FLOAT(a); return FIXED2DBL(a);
} }
double fB() const double fB() const
{ {
return FIXED2FLOAT(b); return FIXED2DBL(b);
} }
double fC() const double fC() const
{ {
return FIXED2FLOAT(c); return FIXED2DBL(c);
} }
double fD() const double fD() const
{ {
return FIXED2FLOAT(d); return FIXED2DBL(d);
} }
bool isSlope() const bool isSlope() const
@ -334,7 +396,7 @@ struct secplane_t
DVector3 Normal() const DVector3 Normal() const
{ {
return{ FIXED2FLOAT(a), FIXED2FLOAT(b), FIXED2FLOAT(c) }; return{ fA(), fB(), fC() };
} }
// Returns < 0 : behind; == 0 : on; > 0 : in front // Returns < 0 : behind; == 0 : on; > 0 : in front
@ -1653,10 +1715,10 @@ inline void AActor::ClearInterpolation()
inline bool FBoundingBox::inRange(const line_t *ld) const inline bool FBoundingBox::inRange(const line_t *ld) const
{ {
return (!(Left() > ld->bbox[BOXRIGHT] || return Left() < ld->bbox[BOXRIGHT] &&
Right() < ld->bbox[BOXLEFT] || Right() > ld->bbox[BOXLEFT] &&
Top() < ld->bbox[BOXBOTTOM] || Top() > ld->bbox[BOXBOTTOM] &&
Bottom() > ld->bbox[BOXTOP])); Bottom() < ld->bbox[BOXTOP];
} }

View file

@ -91,7 +91,7 @@ visplane_t *ceilingplane;
// Empirically verified to be fairly uniform: // Empirically verified to be fairly uniform:
#define visplane_hash(picnum,lightlevel,height) \ #define visplane_hash(picnum,lightlevel,height) \
((unsigned)((picnum)*3+(lightlevel)+((height).d)*7) & (MAXVISPLANES-1)) ((unsigned)((picnum)*3+(lightlevel)+((height).fixD())*7) & (MAXVISPLANES-1))
// These are copies of the main parameters used when drawing stacked sectors. // These are copies of the main parameters used when drawing stacked sectors.
// When you change the main parameters, you should copy them here too *unless* // When you change the main parameters, you should copy them here too *unless*
@ -601,13 +601,11 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
angle = 0; angle = 0;
alpha = 0; alpha = 0;
additive = false; additive = false;
plane.a = plane.b = plane.d = 0;
// [RH] Map floor skies and ceiling skies to separate visplanes. This isn't // [RH] Map floor skies and ceiling skies to separate visplanes. This isn't
// always necessary, but it is needed if a floor and ceiling sky are in the // always necessary, but it is needed if a floor and ceiling sky are in the
// same column but separated by a wall. If they both try to reside in the // same column but separated by a wall. If they both try to reside in the
// same visplane, then only the floor sky will be drawn. // same visplane, then only the floor sky will be drawn.
plane.c = height.c; plane.set(0, 0, height.fixC(), 0);
plane.ic = height.ic;
isskybox = skybox != NULL && !skybox->bInSkybox; isskybox = skybox != NULL && !skybox->bInSkybox;
} }
else if (skybox != NULL && skybox->bAlways && !skybox->bInSkybox) else if (skybox != NULL && skybox->bAlways && !skybox->bInSkybox)
@ -1144,7 +1142,7 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
basecolormap = pl->colormap; basecolormap = pl->colormap;
planeshade = LIGHT2SHADE(pl->lightlevel); planeshade = LIGHT2SHADE(pl->lightlevel);
if (r_drawflat || ((pl->height.a == 0 && pl->height.b == 0) && !tilt)) if (r_drawflat || (!pl->height.isSlope() && !tilt))
{ {
R_DrawNormalPlane (pl, alpha, additive, masked); R_DrawNormalPlane (pl, alpha, additive, masked);
} }
@ -1566,7 +1564,7 @@ void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
basexfrac = FixedMul (xscale, finecosine[planeang]) + x*xstepscale; basexfrac = FixedMul (xscale, finecosine[planeang]) + x*xstepscale;
baseyfrac = FixedMul (yscale, -finesine[planeang]) + x*ystepscale; baseyfrac = FixedMul (yscale, -finesine[planeang]) + x*ystepscale;
planeheight = abs (FixedMul (pl->height.d, -pl->height.ic) - viewz); planeheight = abs (FixedMul (pl->height.fixD(), -pl->height.fixiC()) - viewz);
GlobVis = FixedDiv (r_FloorVisibility, planeheight); GlobVis = FixedDiv (r_FloorVisibility, planeheight);
if (fixedlightlev >= 0) if (fixedlightlev >= 0)
@ -1722,7 +1720,7 @@ void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
planelightfloat = (r_TiltVisibility * lxscale * lyscale) / (fabs(pl->height.ZatPoint(FIXED2DBL(viewx), FIXED2DBL(viewy)) - FIXED2DBL(viewz))) / 65536.0; planelightfloat = (r_TiltVisibility * lxscale * lyscale) / (fabs(pl->height.ZatPoint(FIXED2DBL(viewx), FIXED2DBL(viewy)) - FIXED2DBL(viewz))) / 65536.0;
if (pl->height.c > 0) if (pl->height.fC() > 0)
planelightfloat = -planelightfloat; planelightfloat = -planelightfloat;
if (fixedlightlev >= 0) if (fixedlightlev >= 0)

View file

@ -708,9 +708,7 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2)
// visible? // visible?
passed = 0; passed = 0;
if (!(rover->flags & FF_RENDERSIDES) || if (!(rover->flags & FF_RENDERSIDES) || rover->top.plane->isSlope() || rover->bottom.plane->isSlope() ||
rover->top.plane->a || rover->top.plane->b ||
rover->bottom.plane->a || rover->bottom.plane->b ||
rover->top.plane->Zat0() <= sclipBottom || rover->top.plane->Zat0() <= sclipBottom ||
rover->bottom.plane->Zat0() >= ceilingheight || rover->bottom.plane->Zat0() >= ceilingheight ||
rover->top.plane->Zat0() <= floorheight) rover->top.plane->Zat0() <= floorheight)
@ -745,7 +743,7 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2)
if (!(fover->flags & FF_EXISTS)) continue; if (!(fover->flags & FF_EXISTS)) continue;
if (!(fover->flags & FF_RENDERSIDES)) continue; if (!(fover->flags & FF_RENDERSIDES)) continue;
// no sloped walls, it's bugged // no sloped walls, it's bugged
if (fover->top.plane->a || fover->top.plane->b || fover->bottom.plane->a || fover->bottom.plane->b) continue; if (fover->top.plane->isSlope() || fover->bottom.plane->isSlope()) continue;
// visible? // visible?
if (fover->top.plane->Zat0() <= sclipBottom) continue; // no if (fover->top.plane->Zat0() <= sclipBottom) continue; // no
@ -798,7 +796,7 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2)
if (!(fover->flags & FF_EXISTS)) continue; if (!(fover->flags & FF_EXISTS)) continue;
if (!(fover->flags & FF_RENDERSIDES)) continue; if (!(fover->flags & FF_RENDERSIDES)) continue;
// no sloped walls, it's bugged // no sloped walls, it's bugged
if (fover->top.plane->a || fover->top.plane->b || fover->bottom.plane->a || fover->bottom.plane->b) continue; if (fover->top.plane->isSlope() || fover->bottom.plane->isSlope()) continue;
// visible? // visible?
if (fover->top.plane->Zat0() <= sclipBottom) continue; // no if (fover->top.plane->Zat0() <= sclipBottom) continue; // no
@ -893,8 +891,7 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2)
// visible? // visible?
passed = 0; passed = 0;
if (!(rover->flags & FF_RENDERSIDES) || if (!(rover->flags & FF_RENDERSIDES) ||
rover->top.plane->a || rover->top.plane->b || rover->top.plane->isSlope() || rover->bottom.plane->isSlope() ||
rover->bottom.plane->a || rover->bottom.plane->b ||
rover->bottom.plane->Zat0() >= sclipTop || rover->bottom.plane->Zat0() >= sclipTop ||
rover->top.plane->Zat0() <= floorheight || rover->top.plane->Zat0() <= floorheight ||
rover->bottom.plane->Zat0() >= ceilingheight) rover->bottom.plane->Zat0() >= ceilingheight)
@ -923,7 +920,7 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2)
if (!(fover->flags & FF_EXISTS)) continue; if (!(fover->flags & FF_EXISTS)) continue;
if (!(fover->flags & FF_RENDERSIDES)) continue; if (!(fover->flags & FF_RENDERSIDES)) continue;
// no sloped walls, it's bugged // no sloped walls, it's bugged
if (fover->top.plane->a || fover->top.plane->b || fover->bottom.plane->a || fover->bottom.plane->b) continue; if (fover->top.plane->isSlope() || fover->bottom.plane->isSlope()) continue;
// visible? // visible?
if (fover->bottom.plane->Zat0() >= sclipTop) continue; // no if (fover->bottom.plane->Zat0() >= sclipTop) continue; // no
@ -975,7 +972,7 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2)
if (!(fover->flags & FF_EXISTS)) continue; if (!(fover->flags & FF_EXISTS)) continue;
if (!(fover->flags & FF_RENDERSIDES)) continue; if (!(fover->flags & FF_RENDERSIDES)) continue;
// no sloped walls, its bugged // no sloped walls, its bugged
if(fover->top.plane->a || fover->top.plane->b || fover->bottom.plane->a || fover->bottom.plane->b) continue; if (fover->top.plane->isSlope() || fover->bottom.plane->isSlope()) continue;
// visible? // visible?
if (fover->bottom.plane->Zat0() >= sclipTop) continue; // no if (fover->bottom.plane->Zat0() >= sclipTop) continue; // no
@ -2269,7 +2266,7 @@ void R_NewWall (bool needlights)
int planeside; int planeside;
planeside = frontsector->floorplane.PointOnSide(viewx, viewy, viewz); planeside = frontsector->floorplane.PointOnSide(viewx, viewy, viewz);
if (frontsector->floorplane.c < 0) // 3D floors have the floor backwards if (frontsector->floorplane.fixC() < 0) // 3D floors have the floor backwards
planeside = -planeside; planeside = -planeside;
if (planeside <= 0) // above view plane if (planeside <= 0) // above view plane
markfloor = false; markfloor = false;
@ -2277,7 +2274,7 @@ void R_NewWall (bool needlights)
if (frontsector->GetTexture(sector_t::ceiling) != skyflatnum) if (frontsector->GetTexture(sector_t::ceiling) != skyflatnum)
{ {
planeside = frontsector->ceilingplane.PointOnSide(viewx, viewy, viewz); planeside = frontsector->ceilingplane.PointOnSide(viewx, viewy, viewz);
if (frontsector->ceilingplane.c > 0) // 3D floors have the ceiling backwards if (frontsector->ceilingplane.fixC() > 0) // 3D floors have the ceiling backwards
planeside = -planeside; planeside = -planeside;
if (planeside <= 0) // below view plane if (planeside <= 0) // below view plane
markceiling = false; markceiling = false;
@ -2767,9 +2764,9 @@ int OWallMost (short *mostbuf, fixed_t z, const FWallCoords *wallc)
int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc) int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
{ {
if ((plane.a | plane.b) == 0) if (!plane.isSlope())
{ {
return OWallMost (mostbuf, ((plane.c < 0) ? plane.d : -plane.d) - viewz, wallc); return OWallMost (mostbuf, plane.Zat0() - viewz, wallc);
} }
fixed_t x, y, den, z1, z2, oz1, oz2; fixed_t x, y, den, z1, z2, oz1, oz2;

View file

@ -1254,12 +1254,12 @@ void R_AddSprites (sector_t *sec, int lightlevel, int fakeside)
if(!(rover->flags & FF_SOLID) || rover->alpha != 255) continue; if(!(rover->flags & FF_SOLID) || rover->alpha != 255) continue;
if(!fakefloor) if(!fakefloor)
{ {
if(!(rover->top.plane->a) && !(rover->top.plane->b)) if(!rover->top.plane->isSlope())
{ {
if(rover->top.plane->Zat0() <= thing->_f_Z()) fakefloor = rover; if(rover->top.plane->Zat0() <= thing->_f_Z()) fakefloor = rover;
} }
} }
if(!(rover->bottom.plane->a) && !(rover->bottom.plane->b)) if(!rover->bottom.plane->isSlope())
{ {
if(rover->bottom.plane->Zat0() >= thing->_f_Top()) fakeceiling = rover; if(rover->bottom.plane->Zat0() >= thing->_f_Top()) fakeceiling = rover;
} }

View file

@ -1107,7 +1107,7 @@ void R_SetupFrame (AActor *actor)
viewside = plane->PointOnSide(viewx, viewy, viewz); viewside = plane->PointOnSide(viewx, viewy, viewz);
// Reverse the direction of the test if the plane was downward facing. // Reverse the direction of the test if the plane was downward facing.
// We want to know if the view is above it, whatever its orientation may be. // We want to know if the view is above it, whatever its orientation may be.
if (plane->c < 0) if (plane->fC() < 0)
viewside = -viewside; viewside = -viewside;
if (viewside > 0) if (viewside > 0)
{ {