- floatified the sector plane movers and removed some of the ZatPoint conversion cruft.

This commit is contained in:
Christoph Oelckers 2016-03-30 09:41:46 +02:00
parent ff0b371582
commit 77f2530236
36 changed files with 552 additions and 566 deletions

View file

@ -34,13 +34,13 @@ bool DBot::Reachable (AActor *rtarget)
if (player->mo == rtarget) if (player->mo == rtarget)
return false; return false;
if ((rtarget->Sector->ceilingplane.ZatPointF (rtarget) - if ((rtarget->Sector->ceilingplane.ZatPoint (rtarget) -
rtarget->Sector->floorplane.ZatPointF (rtarget)) rtarget->Sector->floorplane.ZatPoint (rtarget))
< player->mo->Height) //Where rtarget is, player->mo can't be. < player->mo->Height) //Where rtarget is, player->mo can't be.
return false; return false;
sector_t *last_s = player->mo->Sector; sector_t *last_s = player->mo->Sector;
double last_z = last_s->floorplane.ZatPointF (player->mo); double last_z = last_s->floorplane.ZatPoint (player->mo);
double estimated_dist = player->mo->Distance2D(rtarget); double estimated_dist = player->mo->Distance2D(rtarget);
bool reachable = true; bool reachable = true;
@ -100,7 +100,7 @@ bool DBot::Reachable (AActor *rtarget)
thing = in->d.thing; thing = in->d.thing;
if (thing == player->mo) //Can't reach self in this case. if (thing == player->mo) //Can't reach self in this case.
continue; continue;
if (thing == rtarget && (rtarget->Sector->floorplane.ZatPointF (rtarget) <= (last_z+MAXMOVEHEIGHT))) if (thing == rtarget && (rtarget->Sector->floorplane.ZatPoint (rtarget) <= (last_z+MAXMOVEHEIGHT)))
{ {
return true; return true;
} }

View file

@ -290,7 +290,7 @@ void ParseCompatibility()
sc.MustGetNumber(); sc.MustGetNumber();
CompatParams.Push(sc.Number); CompatParams.Push(sc.Number);
sc.MustGetFloat(); sc.MustGetFloat();
CompatParams.Push(FLOAT2FIXED(sc.Float)); CompatParams.Push(int(sc.Float*65536.));
} }
else if (sc.Compare("setwallyscale")) else if (sc.Compare("setwallyscale"))
{ {
@ -303,7 +303,7 @@ void ParseCompatibility()
sc.MustGetString(); sc.MustGetString();
CompatParams.Push(sc.MustMatchString(WallTiers)); CompatParams.Push(sc.MustMatchString(WallTiers));
sc.MustGetFloat(); sc.MustGetFloat();
CompatParams.Push(FLOAT2FIXED(sc.Float)); CompatParams.Push(int(sc.Float*65536.));
} }
else if (sc.Compare("setthingz")) else if (sc.Compare("setthingz"))
{ {
@ -522,7 +522,7 @@ void SetCompatibilityParams()
{ {
sector_t *sec = &sectors[CompatParams[i+1]]; sector_t *sec = &sectors[CompatParams[i+1]];
sec->floorplane.ChangeHeight(CompatParams[i+2]); sec->floorplane.ChangeHeight(CompatParams[i+2]);
sec->ChangePlaneTexZ(sector_t::floor, CompatParams[i+2]); sec->ChangePlaneTexZ(sector_t::floor, CompatParams[i+2] / 65536.);
} }
i += 3; i += 3;
break; break;
@ -534,7 +534,7 @@ void SetCompatibilityParams()
side_t *side = lines[CompatParams[i+1]].sidedef[CompatParams[i+2]]; side_t *side = lines[CompatParams[i+1]].sidedef[CompatParams[i+2]];
if (side != NULL) if (side != NULL)
{ {
side->SetTextureYScale(CompatParams[i+3], CompatParams[i+4]); side->SetTextureYScale(CompatParams[i+3], CompatParams[i+4] / 65536.);
} }
} }
i += 5; i += 5;

View file

@ -133,7 +133,7 @@ DMovingCeiling::DMovingCeiling (sector_t *sector)
interpolation = sector->SetInterpolation(sector_t::CeilingMove, true); interpolation = sector->SetInterpolation(sector_t::CeilingMove, true);
} }
bool DMover::MoveAttached(int crush, fixed_t move, int floorOrCeiling, bool resetfailed) bool DMover::MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed)
{ {
if (!P_Scroll3dMidtex(m_Sector, crush, move, !!floorOrCeiling) && resetfailed) if (!P_Scroll3dMidtex(m_Sector, crush, move, !!floorOrCeiling) && resetfailed)
{ {
@ -155,20 +155,20 @@ bool DMover::MoveAttached(int crush, fixed_t move, int floorOrCeiling, bool rese
// (Use -1 to prevent it from trying to crush) // (Use -1 to prevent it from trying to crush)
// dest is the desired d value for the plane // dest is the desired d value for the plane
// //
DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, DMover::EResult DMover::MovePlane (double speed, double dest, int crush,
int floorOrCeiling, int direction, bool hexencrush) int floorOrCeiling, int direction, bool hexencrush)
{ {
bool flag; bool flag;
fixed_t lastpos; double lastpos;
fixed_t movedest; double movedest;
fixed_t move; double move;
//fixed_t destheight; //jff 02/04/98 used to keep floors/ceilings //double destheight; //jff 02/04/98 used to keep floors/ceilings
// from moving thru each other // from moving thru each other
switch (floorOrCeiling) switch (floorOrCeiling)
{ {
case 0: case 0:
// FLOOR // FLOOR
lastpos = m_Sector->floorplane.fixD(); lastpos = m_Sector->floorplane.fD();
switch (direction) switch (direction)
{ {
case -1: case -1:
@ -223,9 +223,9 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
// [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.isSlope() && !m_Sector->floorplane.isSlope() && if (!m_Sector->ceilingplane.isSlope() && !m_Sector->floorplane.isSlope() &&
(!(i_compatflags2 & COMPATF2_FLOORMOVE) && -dest > m_Sector->ceilingplane.fixD())) (!(i_compatflags2 & COMPATF2_FLOORMOVE) && -dest > m_Sector->ceilingplane.fD()))
{ {
dest = -m_Sector->ceilingplane.fixD(); dest = -m_Sector->ceilingplane.fD();
} }
movedest = m_Sector->floorplane.GetChangedHeight (speed); movedest = m_Sector->floorplane.GetChangedHeight (speed);
@ -282,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.fixD(); lastpos = m_Sector->ceilingplane.fD();
switch (direction) switch (direction)
{ {
case -1: case -1:
@ -291,9 +291,9 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush,
// [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.isSlope() && !m_Sector->floorplane.isSlope() && if (!m_Sector->ceilingplane.isSlope() && !m_Sector->floorplane.isSlope() &&
(!(i_compatflags2 & COMPATF2_FLOORMOVE) && dest < -m_Sector->floorplane.fixD())) (!(i_compatflags2 & COMPATF2_FLOORMOVE) && dest < -m_Sector->floorplane.fD()))
{ {
dest = -m_Sector->floorplane.fixD(); dest = -m_Sector->floorplane.fD();
} }
movedest = m_Sector->ceilingplane.GetChangedHeight (-speed); movedest = m_Sector->ceilingplane.GetChangedHeight (-speed);
if (movedest <= dest) if (movedest <= dest)

View file

@ -30,26 +30,43 @@ protected:
enum EResult { ok, crushed, pastdest }; enum EResult { ok, crushed, pastdest };
TObjPtr<DInterpolation> interpolation; TObjPtr<DInterpolation> interpolation;
private: private:
bool MoveAttached(int crush, fixed_t move, int floorOrCeiling, bool resetfailed); bool MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed);
EResult MovePlane (fixed_t speed, fixed_t dest, int crush, int floorOrCeiling, int direction, bool hexencrush); EResult MovePlane (double speed, double dest, int crush, int floorOrCeiling, int direction, bool hexencrush);
protected: protected:
DMover (); DMover ();
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Destroy(); void Destroy();
void StopInterpolation(bool force = false); void StopInterpolation(bool force = false);
inline EResult MoveFloor (fixed_t speed, fixed_t dest, int crush, int direction, bool hexencrush) inline EResult MoveFloor(fixed_t speed, fixed_t dest, int crush, int direction, bool hexencrush)
{
return MovePlane(FIXED2DBL(speed), FIXED2DBL(dest), crush, 0, direction, hexencrush);
}
inline EResult MoveFloor(fixed_t speed, fixed_t dest, int direction)
{
return MovePlane(FIXED2DBL(speed), FIXED2DBL(dest), -1, 0, direction, false);
}
inline EResult MoveCeiling(fixed_t speed, fixed_t dest, int crush, int direction, bool hexencrush)
{
return MovePlane(FIXED2DBL(speed), FIXED2DBL(dest), crush, 1, direction, hexencrush);
}
inline EResult MoveCeiling(fixed_t speed, fixed_t dest, int direction)
{
return MovePlane(FIXED2DBL(speed), FIXED2DBL(dest), -1, 1, direction, false);
}
inline EResult MoveFloor (double speed, double dest, int crush, int direction, bool hexencrush)
{ {
return MovePlane (speed, dest, crush, 0, direction, hexencrush); return MovePlane (speed, dest, crush, 0, direction, hexencrush);
} }
inline EResult MoveFloor (fixed_t speed, fixed_t dest, int direction) inline EResult MoveFloor (double speed, double dest, int direction)
{ {
return MovePlane (speed, dest, -1, 0, direction, false); return MovePlane (speed, dest, -1, 0, direction, false);
} }
inline EResult MoveCeiling (fixed_t speed, fixed_t dest, int crush, int direction, bool hexencrush) inline EResult MoveCeiling (double speed, double dest, int crush, int direction, bool hexencrush)
{ {
return MovePlane (speed, dest, crush, 1, direction, hexencrush); return MovePlane (speed, dest, crush, 1, direction, hexencrush);
} }
inline EResult MoveCeiling (fixed_t speed, fixed_t dest, int direction) inline EResult MoveCeiling (double speed, double dest, int direction)
{ {
return MovePlane (speed, dest, -1, 1, direction, false); return MovePlane (speed, dest, -1, 1, direction, false);
} }

View file

@ -105,7 +105,7 @@ struct EDLinedef
int tag; int tag;
int id; int id;
int args[5]; int args[5];
fixed_t alpha; double alpha;
DWORD flags; DWORD flags;
DWORD activation; DWORD activation;
}; };
@ -158,7 +158,7 @@ static void parseLinedef(FScanner &sc)
bool argsset = false; bool argsset = false;
memset(&ld, 0, sizeof(ld)); memset(&ld, 0, sizeof(ld));
ld.alpha = FRACUNIT; ld.alpha = 1.;
sc.MustGetStringName("{"); sc.MustGetStringName("{");
while (!sc.CheckString("}")) while (!sc.CheckString("}"))
@ -216,7 +216,7 @@ static void parseLinedef(FScanner &sc)
{ {
sc.CheckString("="); sc.CheckString("=");
sc.MustGetFloat(); sc.MustGetFloat();
ld.alpha = FLOAT2FIXED(sc.Float); ld.alpha = sc.Float;
} }
else if (sc.Compare("extflags")) else if (sc.Compare("extflags"))
{ {
@ -703,7 +703,7 @@ void ProcessEDLinedef(line_t *ld, int recordnum)
ld->special = eld->special; ld->special = eld->special;
ld->activation = eld->activation; ld->activation = eld->activation;
ld->flags = (ld->flags&~fmask) | eld->flags; ld->flags = (ld->flags&~fmask) | eld->flags;
ld->Alpha = eld->alpha; ld->setAlpha(eld->alpha);
memcpy(ld->args, eld->args, sizeof(ld->args)); memcpy(ld->args, eld->args, sizeof(ld->args));
tagManager.AddLineID(int(ld - lines), eld->tag); tagManager.AddLineID(int(ld - lines), eld->tag);
} }

View file

@ -1537,16 +1537,13 @@ void FParser::SF_StartSectorSound(void)
/************* Sector functions ***************/ /************* Sector functions ***************/
//DMover::EResult P_MoveFloor (sector_t * m_Sector, fixed_t speed, fixed_t dest, int crush, int direction, int flags=0);
//DMover::EResult P_MoveCeiling (sector_t * m_Sector, fixed_t speed, fixed_t dest, int crush, int direction, int flags=0);
class DFloorChanger : public DFloor class DFloorChanger : public DFloor
{ {
public: public:
DFloorChanger(sector_t * sec) DFloorChanger(sector_t * sec)
: DFloor(sec) {} : DFloor(sec) {}
bool Move(fixed_t speed, fixed_t dest, int crush, int direction) bool Move(double speed, double dest, int crush, int direction)
{ {
bool res = DMover::crushed != MoveFloor(speed, dest, crush, direction, false); bool res = DMover::crushed != MoveFloor(speed, dest, crush, direction, false);
Destroy(); Destroy();
@ -1569,8 +1566,8 @@ void FParser::SF_FloorHeight(void)
{ {
int tagnum; int tagnum;
int secnum; int secnum;
fixed_t dest; double dest;
int returnval = 1; // haleyjd: SoM's fixes double returnval = 1; // haleyjd: SoM's fixes
if (CheckArgs(1)) if (CheckArgs(1))
{ {
@ -1582,7 +1579,7 @@ void FParser::SF_FloorHeight(void)
int crush = (t_argc >= 3) ? intvalue(t_argv[2]) : false; int crush = (t_argc >= 3) ? intvalue(t_argv[2]) : false;
i = -1; i = -1;
dest = fixedvalue(t_argv[1]); dest = floatvalue(t_argv[1]);
// set all sectors with tag // set all sectors with tag
@ -1593,8 +1590,8 @@ void FParser::SF_FloorHeight(void)
DFloorChanger * f = new DFloorChanger(&sectors[i]); DFloorChanger * f = new DFloorChanger(&sectors[i]);
if (!f->Move( if (!f->Move(
abs(dest - sectors[i].CenterFloor()), fabs(dest - sectors[i].CenterFloor()),
sectors[i].floorplane.PointToDist (sectors[i]._f_centerspot(), dest), sectors[i].floorplane.PointToDist (sectors[i].centerspot, dest),
crush? 10:-1, crush? 10:-1,
(dest > sectors[i].CenterFloor()) ? 1 : -1)) (dest > sectors[i].CenterFloor()) ? 1 : -1))
{ {
@ -1610,13 +1607,11 @@ void FParser::SF_FloorHeight(void)
script_error("sector not found with tagnum %i\n", tagnum); script_error("sector not found with tagnum %i\n", tagnum);
return; return;
} }
returnval = sectors[secnum].CenterFloor() >> FRACBITS; returnval = sectors[secnum].CenterFloor();
} }
// return floor height // return floor height
t_return.setDouble(returnval);
t_return.type = svt_int;
t_return.value.i = returnval;
} }
} }
@ -1628,7 +1623,7 @@ void FParser::SF_FloorHeight(void)
class DMoveFloor : public DFloor class DMoveFloor : public DFloor
{ {
public: public:
DMoveFloor(sector_t * sec,int moveheight,int _m_Direction,int crush,int movespeed) DMoveFloor(sector_t * sec,double moveheight,int _m_Direction,int crush,double movespeed)
: DFloor(sec) : DFloor(sec)
{ {
m_Type = floorRaiseByValue; m_Type = floorRaiseByValue;
@ -1638,7 +1633,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.fixD() - moveheight); double movedist = fabs(-sec->floorplane.fD() - moveheight);
if (m_Speed >= movedist) if (m_Speed >= movedist)
{ {
StopInterpolation(true); StopInterpolation(true);
@ -1660,13 +1655,14 @@ void FParser::SF_MoveFloor(void)
{ {
int secnum = -1; int secnum = -1;
sector_t *sec; sector_t *sec;
int tagnum, platspeed = 1, destheight, crush; int tagnum, crush;
double platspeed = 1, destheight;
if (CheckArgs(2)) if (CheckArgs(2))
{ {
tagnum = intvalue(t_argv[0]); tagnum = intvalue(t_argv[0]);
destheight = intvalue(t_argv[1]) * FRACUNIT; destheight = intvalue(t_argv[1]);
platspeed = t_argc > 2 ? fixedvalue(t_argv[2]) : FRACUNIT; platspeed = t_argc > 2 ? floatvalue(t_argv[2]) : 1.;
crush = (t_argc > 3 ? intvalue(t_argv[3]) : -1); crush = (t_argc > 3 ? intvalue(t_argv[3]) : -1);
// move all sectors with tag // move all sectors with tag
@ -1678,8 +1674,8 @@ void FParser::SF_MoveFloor(void)
// Don't start a second thinker on the same floor // Don't start a second thinker on the same floor
if (sec->floordata) continue; if (sec->floordata) continue;
new DMoveFloor(sec,sec->floorplane.PointToDist(sec->_f_centerspot(),destheight), new DMoveFloor(sec, sec->floorplane.PointToDist(sec->centerspot, destheight),
destheight < sec->CenterFloor() ? -1:1,crush,platspeed); destheight < sec->CenterFloor() ? -1 : 1, crush, platspeed);
} }
} }
} }
@ -1696,7 +1692,7 @@ public:
DCeilingChanger(sector_t * sec) DCeilingChanger(sector_t * sec)
: DCeiling(sec) {} : DCeiling(sec) {}
bool Move(fixed_t speed, fixed_t dest, int crush, int direction) bool Move(double speed, double dest, int crush, int direction)
{ {
bool res = DMover::crushed != MoveCeiling(speed, dest, crush, direction, false); bool res = DMover::crushed != MoveCeiling(speed, dest, crush, direction, false);
Destroy(); Destroy();
@ -1716,10 +1712,10 @@ public:
// ceiling height of sector // ceiling height of sector
void FParser::SF_CeilingHeight(void) void FParser::SF_CeilingHeight(void)
{ {
fixed_t dest; double dest;
int secnum; int secnum;
int tagnum; int tagnum;
int returnval = 1; double returnval = 1;
if (CheckArgs(1)) if (CheckArgs(1))
{ {
@ -1731,7 +1727,7 @@ void FParser::SF_CeilingHeight(void)
int crush = (t_argc >= 3) ? intvalue(t_argv[2]) : false; int crush = (t_argc >= 3) ? intvalue(t_argv[2]) : false;
i = -1; i = -1;
dest = fixedvalue(t_argv[1]); dest = floatvalue(t_argv[1]);
// set all sectors with tag // set all sectors with tag
FSSectorTagIterator itr(tagnum); FSSectorTagIterator itr(tagnum);
@ -1741,8 +1737,8 @@ void FParser::SF_CeilingHeight(void)
DCeilingChanger * c = new DCeilingChanger(&sectors[i]); DCeilingChanger * c = new DCeilingChanger(&sectors[i]);
if (!c->Move( if (!c->Move(
abs(dest - sectors[i].CenterCeiling()), fabs(dest - sectors[i].CenterCeiling()),
sectors[i].ceilingplane.PointToDist (sectors[i]._f_centerspot(), dest), sectors[i].ceilingplane.PointToDist (sectors[i].centerspot, dest),
crush? 10:-1, crush? 10:-1,
(dest > sectors[i].CenterCeiling()) ? 1 : -1)) (dest > sectors[i].CenterCeiling()) ? 1 : -1))
{ {
@ -1758,12 +1754,11 @@ void FParser::SF_CeilingHeight(void)
script_error("sector not found with tagnum %i\n", tagnum); script_error("sector not found with tagnum %i\n", tagnum);
return; return;
} }
returnval = sectors[secnum].CenterCeiling() >> FRACBITS; returnval = sectors[secnum].CenterCeiling();
} }
// return ceiling height // return ceiling height
t_return.type = svt_int; t_return.setDouble(returnval);
t_return.value.i = returnval;
} }
} }
@ -1778,7 +1773,7 @@ class DMoveCeiling : public DCeiling
{ {
public: public:
DMoveCeiling(sector_t * sec,int tag,fixed_t destheight,fixed_t speed,int silent,int crush) DMoveCeiling(sector_t * sec,int tag,double destheight,double speed,int silent,int crush)
: DCeiling(sec) : DCeiling(sec)
{ {
m_Crush = crush; m_Crush = crush;
@ -1786,11 +1781,11 @@ public:
m_Silent = silent; m_Silent = silent;
m_Type = DCeiling::ceilLowerByValue; // doesn't really matter as long as it's no special value m_Type = DCeiling::ceilLowerByValue; // doesn't really matter as long as it's no special value
m_Tag=tag; m_Tag=tag;
m_TopHeight=m_BottomHeight=sec->ceilingplane.PointToDist(sec->_f_centerspot(),destheight); m_TopHeight=m_BottomHeight=sec->ceilingplane.PointToDist(sec->centerspot,destheight);
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.fixD() - m_BottomHeight); double movedist = fabs(sec->ceilingplane.fD() - m_BottomHeight);
if (m_Speed >= movedist) if (m_Speed >= movedist)
{ {
StopInterpolation (true); StopInterpolation (true);
@ -1811,15 +1806,16 @@ void FParser::SF_MoveCeiling(void)
{ {
int secnum = -1; int secnum = -1;
sector_t *sec; sector_t *sec;
int tagnum, platspeed = 1, destheight; int tagnum;
double platspeed = 1, destheight;
int crush; int crush;
int silent; int silent;
if (CheckArgs(2)) if (CheckArgs(2))
{ {
tagnum = intvalue(t_argv[0]); tagnum = intvalue(t_argv[0]);
destheight = intvalue(t_argv[1]) * FRACUNIT; destheight = intvalue(t_argv[1]);
platspeed = /*FLOORSPEED **/ (t_argc > 2 ? fixedvalue(t_argv[2]) : FRACUNIT); platspeed = /*FLOORSPEED **/ (t_argc > 2 ? floatvalue(t_argv[2]) : 1);
crush=t_argc>3 ? intvalue(t_argv[3]):-1; crush=t_argc>3 ? intvalue(t_argv[3]):-1;
silent=t_argc>4 ? intvalue(t_argv[4]):1; silent=t_argc>4 ? intvalue(t_argv[4]):1;

View file

@ -1065,9 +1065,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
return 0; return 0;
} }
if (self->bouncecount >= 0 && (unsigned)self->bouncecount < self->Sector->e->XFloor.ffloors.Size()) if (self->bouncecount >= 0 && (unsigned)self->bouncecount < self->Sector->e->XFloor.ffloors.Size())
pos.Z = self->Sector->e->XFloor.ffloors[self->bouncecount]->bottom.plane->ZatPointF(mo); pos.Z = self->Sector->e->XFloor.ffloors[self->bouncecount]->bottom.plane->ZatPoint(mo);
else else
pos.Z = self->Sector->ceilingplane.ZatPointF(mo); pos.Z = self->Sector->ceilingplane.ZatPoint(mo);
int moceiling = P_Find3DFloor(NULL, pos, false, false, pos.Z); int moceiling = P_Find3DFloor(NULL, pos, false, false, pos.Z);
if (moceiling >= 0) mo->SetZ(pos.Z - mo->Height); if (moceiling >= 0) mo->SetZ(pos.Z - mo->Height);
mo->Translation = multiplayer ? TRANSLATION(TRANSLATION_RainPillar,self->special2) : 0; mo->Translation = multiplayer ? TRANSLATION(TRANSLATION_RainPillar,self->special2) : 0;
@ -1120,7 +1120,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling)
F3DFloor * rover = self->Sector->e->XFloor.ffloors[i]; F3DFloor * rover = self->Sector->e->XFloor.ffloors[i];
if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
if ((foo = rover->bottom.plane->ZatPointF(self)) >= self->Top()) if ((foo = rover->bottom.plane->ZatPoint(self)) >= self->Top())
{ {
self->SetZ(foo + 4, false); self->SetZ(foo + 4, false);
self->bouncecount = i; self->bouncecount = i;

View file

@ -306,7 +306,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain)
sector_t *sec = self->Sector; sector_t *sec = self->Sector;
if (self->Z() == sec->floorplane.ZatPointF(self) && sec->PortalBlocksMovement(sector_t::floor)) if (self->Z() == sec->floorplane.ZatPoint(self) && sec->PortalBlocksMovement(sector_t::floor))
{ {
if (sec->special == Damage_InstantDeath) if (sec->special == Damage_InstantDeath)
{ {

View file

@ -95,14 +95,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightGoesOut)
AActor *foo; AActor *foo;
sector_t *sec = self->Sector; sector_t *sec = self->Sector;
vertex_t *spot; vertex_t *spot;
fixed_t newheight; double newheight;
sec->SetLightLevel(0); sec->SetLightLevel(0);
fixed_t oldtheight = sec->floorplane.Zat0(); double oldtheight = sec->floorplane.fD();
newheight = sec->FindLowestFloorSurrounding(&spot); newheight = sec->FindLowestFloorSurrounding(&spot);
sec->floorplane.setD(sec->floorplane.PointToDist (spot, newheight)); sec->floorplane.setD(sec->floorplane.PointToDist (spot, newheight));
fixed_t newtheight = sec->floorplane.Zat0(); double newtheight = sec->floorplane.fD();
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

@ -329,13 +329,13 @@ void P_PlayerOnSpecial3DFloor(player_t* player)
if(rover->flags & FF_SOLID) if(rover->flags & FF_SOLID)
{ {
// Player must be on top of the floor to be affected... // Player must be on top of the floor to be affected...
if(player->mo->Z() != rover->top.plane->ZatPointF(player->mo)) continue; if(player->mo->Z() != rover->top.plane->ZatPoint(player->mo)) continue;
} }
else else
{ {
//Water and DEATH FOG!!! heh //Water and DEATH FOG!!! heh
if (player->mo->Z() > rover->top.plane->ZatPointF(player->mo) || if (player->mo->Z() > rover->top.plane->ZatPoint(player->mo) ||
player->mo->Top() < rover->bottom.plane->ZatPointF(player->mo)) player->mo->Top() < rover->bottom.plane->ZatPoint(player->mo))
continue; continue;
} }
@ -366,7 +366,7 @@ bool P_CheckFor3DFloorHit(AActor * mo)
if(rover->flags & FF_SOLID && rover->model->SecActTarget) if(rover->flags & FF_SOLID && rover->model->SecActTarget)
{ {
if(mo->Z() == rover->top.plane->ZatPointF(mo)) if(mo->Z() == rover->top.plane->ZatPoint(mo))
{ {
rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor); rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor);
return true; return true;
@ -392,7 +392,7 @@ bool P_CheckFor3DCeilingHit(AActor * mo)
if(rover->flags & FF_SOLID && rover->model->SecActTarget) if(rover->flags & FF_SOLID && rover->model->SecActTarget)
{ {
if(mo->Top() == rover->bottom.plane->ZatPointF(mo)) if(mo->Top() == rover->bottom.plane->ZatPoint(mo))
{ {
rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling); rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling);
return true; return true;

View file

@ -51,7 +51,7 @@
// //
//============================================================================ //============================================================================
bool P_Scroll3dMidtex(sector_t *sector, int crush, fixed_t move, bool ceiling) bool P_Scroll3dMidtex(sector_t *sector, int crush, double move, bool ceiling)
{ {
extsector_t::midtex::plane &scrollplane = ceiling? sector->e->Midtex.Ceiling : sector->e->Midtex.Floor; extsector_t::midtex::plane &scrollplane = ceiling? sector->e->Midtex.Ceiling : sector->e->Midtex.Floor;

View file

@ -9,14 +9,14 @@ struct sector_t;
struct line_t; struct line_t;
class AActor; class AActor;
bool P_Scroll3dMidtex(sector_t *sector, int crush, fixed_t move, bool ceiling); bool P_Scroll3dMidtex(sector_t *sector, int crush, double move, bool ceiling);
void P_Start3dMidtexInterpolations(TArray<DInterpolation *> &list, sector_t *sec, bool ceiling); void P_Start3dMidtexInterpolations(TArray<DInterpolation *> &list, sector_t *sec, bool ceiling);
void P_Attach3dMidtexLinesToSector(sector_t *dest, int lineid, int tag, bool ceiling); void P_Attach3dMidtexLinesToSector(sector_t *dest, int lineid, int tag, bool ceiling);
bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, double *ptexbot); bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, double *ptexbot);
bool P_Check3dMidSwitch(AActor *actor, line_t *line, int side); bool P_Check3dMidSwitch(AActor *actor, line_t *line, int side);
bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, struct FLineOpening &open, bool restrict=false); bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, struct FLineOpening &open, bool restrict=false);
bool P_MoveLinkedSectors(sector_t *sector, int crush, fixed_t move, bool ceiling); bool P_MoveLinkedSectors(sector_t *sector, int crush, double move, bool ceiling);
void P_StartLinkedSectorInterpolations(TArray<DInterpolation *> &list, sector_t *sector, bool ceiling); void P_StartLinkedSectorInterpolations(TArray<DInterpolation *> &list, sector_t *sector, bool ceiling);
bool P_AddSectorLinks(sector_t *control, int tag, INTBOOL ceiling, int movetype); bool P_AddSectorLinks(sector_t *control, int tag, INTBOOL ceiling, int movetype);
void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling); void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling);

View file

@ -1390,7 +1390,7 @@ public:
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
private: private:
sector_t *Sector; sector_t *Sector;
fixed_t WatchD, LastD; double WatchD, LastD;
int Special, Arg0, Arg1, Arg2, Arg3, Arg4; int Special, Arg0, Arg1, Arg2, Arg3, Arg4;
TObjPtr<AActor> Activator; TObjPtr<AActor> Activator;
line_t *Line; line_t *Line;
@ -1426,9 +1426,9 @@ DPlaneWatcher::DPlaneWatcher (AActor *it, line_t *line, int lineSide, bool ceili
{ {
plane = Sector->floorplane; plane = Sector->floorplane;
} }
LastD = plane.fixD(); LastD = plane.fD();
plane.ChangeHeight (height << FRACBITS); plane.ChangeHeight (height);
WatchD = plane.fixD(); WatchD = plane.fD();
} }
else else
{ {
@ -1454,15 +1454,15 @@ void DPlaneWatcher::Tick ()
return; return;
} }
fixed_t newd; double newd;
if (bCeiling) if (bCeiling)
{ {
newd = Sector->ceilingplane.fixD(); newd = Sector->ceilingplane.fD();
} }
else else
{ {
newd = Sector->floorplane.fixD(); newd = Sector->floorplane.fD();
} }
if ((LastD < WatchD && newd >= WatchD) || if ((LastD < WatchD && newd >= WatchD) ||

View file

@ -228,7 +228,7 @@ DCeiling::DCeiling (sector_t *sec)
{ {
} }
DCeiling::DCeiling (sector_t *sec, fixed_t speed1, fixed_t speed2, int silent) DCeiling::DCeiling (sector_t *sec, double speed1, double speed2, int silent)
: DMovingCeiling (sec) : DMovingCeiling (sec)
{ {
m_Crush = -1; m_Crush = -1;
@ -245,10 +245,10 @@ DCeiling::DCeiling (sector_t *sec, fixed_t speed1, fixed_t speed2, int silent)
//============================================================================ //============================================================================
DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag, DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag,
fixed_t speed, fixed_t speed2, fixed_t height, double speed, double speed2, double height,
int crush, int silent, int change, ECrushMode hexencrush) int crush, int silent, int change, ECrushMode hexencrush)
{ {
fixed_t targheight = 0; // Silence, GCC double targheight = 0; // Silence, GCC
// if ceiling already moving, don't start a second function on it // if ceiling already moving, don't start a second function on it
if (sec->PlaneMoving(sector_t::ceiling)) if (sec->PlaneMoving(sector_t::ceiling))
@ -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.fixD(); ceiling->m_TopHeight = sec->ceilingplane.fD();
case ceilLowerAndCrush: case ceilLowerAndCrush:
targheight = sec->FindHighestFloorPoint (&spot); targheight = sec->FindHighestFloorPoint (&spot);
targheight += height; targheight += height;
@ -292,7 +292,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
case ceilMoveToValue: case ceilMoveToValue:
{ {
int diff = height - sec->ceilingplane.ZatPoint (spot); double diff = height - sec->ceilingplane.ZatPoint (spot);
targheight = height; targheight = height;
if (diff < 0) if (diff < 0)
@ -400,15 +400,15 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
// Do not interpolate instant movement ceilings. // Do not interpolate instant movement ceilings.
// Note for ZDoomGL: Check to make sure that you update the sector // Note for ZDoomGL: Check to make sure that you update the sector
// after the ceiling moves, because it hasn't actually moved yet. // after the ceiling moves, because it hasn't actually moved yet.
fixed_t movedist; double movedist;
if (ceiling->m_Direction < 0) if (ceiling->m_Direction < 0)
{ {
movedist = sec->ceilingplane.fixD() - ceiling->m_BottomHeight; movedist = sec->ceilingplane.fD() - ceiling->m_BottomHeight;
} }
else else
{ {
movedist = ceiling->m_TopHeight - sec->ceilingplane.fixD(); movedist = ceiling->m_TopHeight - sec->ceilingplane.fD();
} }
if (ceiling->m_Speed >= movedist) if (ceiling->m_Speed >= movedist)
{ {
@ -483,7 +483,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
//============================================================================ //============================================================================
bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line,
int tag, fixed_t speed, fixed_t speed2, fixed_t height, int tag, double speed, double speed2, double height,
int crush, int silent, int change, DCeiling::ECrushMode hexencrush) int crush, int silent, int change, DCeiling::ECrushMode hexencrush)
{ {
int secnum; int secnum;

View file

@ -82,14 +82,14 @@ void DDoor::Tick ()
{ {
EResult res; EResult res;
if (m_Sector->floorplane.fixD() != m_OldFloorDist) // Adjust bottom height - but only if there isn't an active lift attached to the floor.
if (m_Sector->floorplane.fD() != 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.fixD(); m_OldFloorDist = m_Sector->floorplane.fD();
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.fixD()) if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD())
{ {
EV_LightTurnOnPartway (m_LightTag, EV_LightTurnOnPartway (m_LightTag,
FIXED2DBL(FixedDiv (m_Sector->ceilingplane.fixD() + m_Sector->floorplane.fixD(), m_TopDist + m_Sector->floorplane.fixD()))); (m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD()));
} }
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.fixD()) if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD())
{ {
EV_LightTurnOnPartway (m_LightTag, EV_LightTurnOnPartway (m_LightTag,
FIXED2DBL(FixedDiv (m_Sector->ceilingplane.fixD() + m_Sector->floorplane.fixD(), m_TopDist + m_Sector->floorplane.fixD()))); (m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD()));
} }
if (res == pastdest) if (res == pastdest)
@ -350,12 +350,12 @@ DDoor::DDoor (sector_t *sector)
// //
//============================================================================ //============================================================================
DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTag, int topcountdown) DDoor::DDoor (sector_t *sec, EVlDoor type, double speed, int delay, int lightTag, int topcountdown)
: DMovingCeiling (sec), : DMovingCeiling (sec),
m_Type (type), m_Speed (speed), m_TopWait (delay), m_TopCountdown(topcountdown), m_LightTag (lightTag) m_Type (type), m_Speed (speed), m_TopWait (delay), m_TopCountdown(topcountdown), m_LightTag (lightTag)
{ {
vertex_t *spot; vertex_t *spot;
fixed_t height; double height;
if (i_compatflags & COMPATF_NODOORLIGHT) if (i_compatflags & COMPATF_NODOORLIGHT)
{ {
@ -367,7 +367,7 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa
case doorClose: case doorClose:
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);
DoorSound (false); DoorSound (false);
break; break;
@ -375,13 +375,13 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa
case doorRaise: case doorRaise:
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);
if (m_TopDist != sec->ceilingplane.fixD()) if (m_TopDist != sec->ceilingplane.fD())
DoorSound (true); DoorSound (true);
break; break;
case doorCloseWaitOpen: case doorCloseWaitOpen:
m_TopDist = sec->ceilingplane.fixD(); m_TopDist = sec->ceilingplane.fD();
m_Direction = -1; m_Direction = -1;
DoorSound (false); DoorSound (false);
break; break;
@ -389,7 +389,7 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa
case doorWaitRaise: case doorWaitRaise:
m_Direction = 2; m_Direction = 2;
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);
break; break;
case doorWaitClose: case doorWaitClose:
@ -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.fixD(); m_OldFloorDist = sec->floorplane.fD();
m_TopDist = sec->ceilingplane.fixD(); m_TopDist = sec->ceilingplane.fD();
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.fixD(); m_OldFloorDist = sec->floorplane.fD();
} }
//============================================================================ //============================================================================
@ -425,7 +425,7 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa
//============================================================================ //============================================================================
bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing,
int tag, int speed, int delay, int lock, int lightTag, bool boomgen, int topcountdown) int tag, double speed, int delay, int lock, int lightTag, bool boomgen, int topcountdown)
{ {
bool rtn = false; bool rtn = false;
int secnum; int secnum;
@ -559,13 +559,13 @@ bool DAnimatedDoor::StartClosing ()
return false; return false;
} }
fixed_t topdist = m_Sector->ceilingplane.fixD(); double topdist = m_Sector->ceilingplane.fD();
if (MoveCeiling (2048*FRACUNIT, m_BotDist, 0, -1, false) == crushed) if (MoveCeiling (2048., m_BotDist, 0, -1, false) == crushed)
{ {
return false; return false;
} }
MoveCeiling (2048*FRACUNIT, topdist, 1); MoveCeiling (2048., topdist, 1);
m_Line1->flags |= ML_BLOCKING; m_Line1->flags |= ML_BLOCKING;
m_Line2->flags |= ML_BLOCKING; m_Line2->flags |= ML_BLOCKING;
@ -650,7 +650,7 @@ void DAnimatedDoor::Tick ()
if (--m_Frame < 0) if (--m_Frame < 0)
{ {
// IF DOOR IS DONE CLOSING... // IF DOOR IS DONE CLOSING...
MoveCeiling (2048*FRACUNIT, m_BotDist, -1); MoveCeiling (2048., m_BotDist, -1);
m_Sector->ceilingdata = NULL; m_Sector->ceilingdata = NULL;
Destroy (); Destroy ();
// Unset blocking flags on lines that didn't start with them. Since the // Unset blocking flags on lines that didn't start with them. Since the
@ -690,7 +690,7 @@ void DAnimatedDoor::Tick ()
DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim) DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim)
: DMovingCeiling (sec) : DMovingCeiling (sec)
{ {
fixed_t topdist; double topdist;
FTextureID picnum; FTextureID picnum;
// The DMovingCeiling constructor automatically sets up an interpolation for us. // The DMovingCeiling constructor automatically sets up an interpolation for us.
@ -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.fixD() - topdist * m_Sector->ceilingplane.fixC(); topdist = m_Sector->ceilingplane.fD() - topdist * m_Sector->ceilingplane.fC();
m_Status = Opening; m_Status = Opening;
m_Speed = speed; m_Speed = speed;
@ -733,8 +733,8 @@ 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.fixD(); m_BotDist = m_Sector->ceilingplane.fD();
MoveCeiling (2048*FRACUNIT, topdist, 1); MoveCeiling (2048., topdist, 1);
if (m_DoorAnim->OpenSound != NAME_None) if (m_DoorAnim->OpenSound != NAME_None)
{ {
SN_StartSequence (m_Sector, CHAN_INTERIOR, m_DoorAnim->OpenSound, 1); SN_StartSequence (m_Sector, CHAN_INTERIOR, m_DoorAnim->OpenSound, 1);

View file

@ -280,14 +280,14 @@ DFloor::DFloor (sector_t *sec)
//========================================================================== //==========================================================================
bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
fixed_t speed, fixed_t height, int crush, int change, bool hexencrush, bool hereticlower) double speed, double height, int crush, int change, bool hexencrush, bool hereticlower)
{ {
int secnum; int secnum;
bool rtn; bool rtn;
sector_t* sec; sector_t* sec;
DFloor* floor; DFloor* floor;
fixed_t ceilingheight; double ceilingheight;
fixed_t newheight; double newheight;
vertex_t *spot, *spot2; vertex_t *spot, *spot2;
rtn = false; rtn = false;
@ -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.fixD(); // [RH] floor->m_OrgDist = sec->floorplane.fD(); // [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.fixD()) if (hereticlower || floor->m_FloorDestDist != sec->floorplane.fD())
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight+height); floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight+height);
break; break;
@ -344,7 +344,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
case DFloor::floorLowerByValue: case DFloor::floorLowerByValue:
floor->m_Direction = -1; floor->m_Direction = -1;
newheight = sec->CenterFloor() - height; newheight = sec->CenterFloor() - height;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight); floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
break; break;
case DFloor::floorRaiseInstant: case DFloor::floorRaiseInstant:
@ -352,13 +352,13 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
case DFloor::floorRaiseByValue: case DFloor::floorRaiseByValue:
floor->m_Direction = 1; floor->m_Direction = 1;
newheight = sec->CenterFloor() + height; newheight = sec->CenterFloor() + height;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight); floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
break; break;
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.fixD()) ? -1 : 1; floor->m_Direction = (floor->m_FloorDestDist > sec->floorplane.fD()) ? -1 : 1;
break; break;
case DFloor::floorRaiseAndCrushDoom: case DFloor::floorRaiseAndCrushDoom:
@ -366,12 +366,12 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
floor->m_Direction = 1; floor->m_Direction = 1;
newheight = sec->FindLowestCeilingSurrounding (&spot); newheight = sec->FindLowestCeilingSurrounding (&spot);
if (floortype == DFloor::floorRaiseAndCrushDoom) if (floortype == DFloor::floorRaiseAndCrushDoom)
newheight -= 8 * FRACUNIT; newheight -= 8;
ceilingheight = sec->FindLowestCeilingPoint (&spot2); ceilingheight = sec->FindLowestCeilingPoint (&spot2);
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight); floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
if (sec->floorplane.ZatPointDist (spot2, floor->m_FloorDestDist) > ceilingheight) if (sec->floorplane.ZatPointDist (spot2, floor->m_FloorDestDist) > ceilingheight)
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot2, floor->m_FloorDestDist = sec->floorplane.PointToDist (spot2,
floortype == DFloor::floorRaiseAndCrushDoom ? ceilingheight - 8*FRACUNIT : ceilingheight); floortype == DFloor::floorRaiseAndCrushDoom ? ceilingheight - 8 : ceilingheight);
break; break;
case DFloor::floorRaiseToHighest: case DFloor::floorRaiseToHighest:
@ -394,7 +394,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
case DFloor::floorRaiseAndCrush: case DFloor::floorRaiseAndCrush:
floor->m_Direction = 1; floor->m_Direction = 1;
newheight = sec->FindLowestCeilingPoint (&spot) - 8*FRACUNIT; newheight = sec->FindLowestCeilingPoint (&spot) - 8;
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight); floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
break; break;
@ -413,7 +413,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
case DFloor::floorLowerByTexture: case DFloor::floorLowerByTexture:
floor->m_Direction = -1; floor->m_Direction = -1;
newheight = sec->CenterFloor() - sec->FindShortestTextureAround (); newheight = sec->CenterFloor() - sec->FindShortestTextureAround ();
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight); floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
break; break;
case DFloor::floorLowerToCeiling: case DFloor::floorLowerToCeiling:
@ -430,13 +430,13 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
// enough, BOOM preserved the code here even though it // enough, BOOM preserved the code here even though it
// also had this function.) // also had this function.)
newheight = sec->CenterFloor() + sec->FindShortestTextureAround (); newheight = sec->CenterFloor() + sec->FindShortestTextureAround ();
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight); floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
break; break;
case DFloor::floorRaiseAndChange: case DFloor::floorRaiseAndChange:
floor->m_Direction = 1; floor->m_Direction = 1;
newheight = sec->CenterFloor() + height; newheight = sec->_f_CenterFloor() + height;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight); floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
if (line != NULL) if (line != NULL)
{ {
FTextureID oldpic = sec->GetTexture(sector_t::floor); FTextureID oldpic = sec->GetTexture(sector_t::floor);
@ -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.fixD()) || // moving up but going down if ((floor->m_Direction>0 && floor->m_FloorDestDist>sec->floorplane.fD()) || // moving up but going down
(floor->m_Direction<0 && floor->m_FloorDestDist<sec->floorplane.fixD()) || // moving down but going up (floor->m_Direction<0 && floor->m_FloorDestDist<sec->floorplane.fD()) || // moving down but going up
(floor->m_Speed >= abs(sec->floorplane.fixD() - floor->m_FloorDestDist))) // moving in one step (floor->m_Speed >= fabs(sec->floorplane.fD() - floor->m_FloorDestDist))) // moving in one step
{ {
floor->StopInterpolation(true); floor->StopInterpolation(true);
@ -560,13 +560,13 @@ bool EV_FloorCrushStop (int tag)
//========================================================================== //==========================================================================
bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
fixed_t stairsize, fixed_t speed, int delay, int reset, int igntxt, double stairsize, double speed, int delay, int reset, int igntxt,
int usespecials) int usespecials)
{ {
int secnum = -1; int secnum = -1;
int osecnum; //jff 3/4/98 save old loop index int osecnum; //jff 3/4/98 save old loop index
int height; double height;
fixed_t stairstep; double stairstep;
int i; int i;
int newsecnum = -1; int newsecnum = -1;
FTextureID texture; FTextureID texture;
@ -583,7 +583,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
if (speed == 0) if (speed == 0)
return false; return false;
persteptime = FixedDiv (stairsize, speed) >> FRACBITS; persteptime = int(stairsize / speed);
// check if a manual trigger, if so do just the sector on the backside // check if a manual trigger, if so do just the sector on the backside
FSectorTagIterator itr(tag, line); FSectorTagIterator itr(tag, line);
@ -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.fixD(); // [RH] Height to reset to floor->m_OrgDist = sec->floorplane.fD(); // [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;
@ -620,7 +620,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
floor->m_Speed = speed; floor->m_Speed = speed;
height = sec->CenterFloor() + stairstep; height = sec->CenterFloor() + stairstep;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), height); floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, height);
texture = sec->GetTexture(sector_t::floor); texture = sec->GetTexture(sector_t::floor);
osecnum = secnum; //jff 3/4/98 preserve loop index osecnum = secnum; //jff 3/4/98 preserve loop index
@ -710,7 +710,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
floor = new DFloor (sec); floor = new DFloor (sec);
floor->StartFloorSound (); floor->StartFloorSound ();
floor->m_Direction = (type == DFloor::buildUp) ? 1 : -1; floor->m_Direction = (type == DFloor::buildUp) ? 1 : -1;
floor->m_FloorDestDist = sec->floorplane.PointToDist (0, 0, height); floor->m_FloorDestDist = sec->floorplane.PointToDist (DVector2(0, 0), height);
// [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;
@ -719,8 +719,8 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
if (usespecials & DFloor::stairSync) if (usespecials & DFloor::stairSync)
{ {
// [RH] // [RH]
fixed_t rise = height - sec->CenterFloor(); double rise = height - sec->CenterFloor();
floor->m_Speed = Scale (speed, rise, stairstep); floor->m_Speed = speed * rise / stairstep;
} }
else else
{ {
@ -728,10 +728,10 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
} }
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
//jff 2/27/98 fix uninitialized crush field //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_Crush = (!(usespecials & DFloor::stairUseSpecials) && speed == 4) ? 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.fixD(); // [RH] Height to reset to floor->m_OrgDist = sec->floorplane.fD(); // [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
@ -747,7 +747,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
// //
//========================================================================== //==========================================================================
bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed) bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed)
{ {
sector_t* s1; sector_t* s1;
sector_t* s2; sector_t* s2;
@ -757,7 +757,7 @@ bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed)
int i; int i;
DFloor* floor; DFloor* floor;
vertex_t* spot; vertex_t* spot;
fixed_t height; double height;
rtn = false; rtn = false;
@ -900,10 +900,10 @@ void DElevator::Tick ()
{ {
EResult res; EResult res;
fixed_t oldfloor, oldceiling; double oldfloor, oldceiling;
oldfloor = m_Sector->floorplane.fixD(); oldfloor = m_Sector->floorplane.fD();
oldceiling = m_Sector->ceilingplane.fixD(); oldceiling = m_Sector->ceilingplane.fD();
if (m_Direction < 0) // moving down if (m_Direction < 0) // moving down
{ {
@ -966,14 +966,14 @@ void DElevator::StartFloorSound ()
//========================================================================== //==========================================================================
bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype, bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype,
fixed_t speed, fixed_t height, int tag) double speed, double height, int tag)
{ {
int secnum; int secnum;
bool rtn; bool rtn;
sector_t* sec; sector_t* sec;
DElevator* elevator; DElevator* elevator;
fixed_t floorheight, ceilingheight; double floorheight, ceilingheight;
fixed_t newheight; double newheight;
vertex_t* spot; vertex_t* spot;
if (!line && (elevtype == DElevator::elevateCurrent)) if (!line && (elevtype == DElevator::elevateCurrent))
@ -1010,7 +1010,7 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype,
elevator->m_Direction = -1; elevator->m_Direction = -1;
newheight = sec->FindNextLowestFloor (&spot); newheight = sec->FindNextLowestFloor (&spot);
elevator->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight); elevator->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
newheight += sec->ceilingplane.ZatPoint (spot) - sec->floorplane.ZatPoint (spot); newheight += sec->ceilingplane.ZatPoint(spot) - sec->floorplane.ZatPoint(spot);
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (spot, newheight); elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (spot, newheight);
break; break;
@ -1019,7 +1019,7 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype,
elevator->m_Direction = 1; elevator->m_Direction = 1;
newheight = sec->FindNextHighestFloor (&spot); newheight = sec->FindNextHighestFloor (&spot);
elevator->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight); elevator->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
newheight += sec->ceilingplane.ZatPoint (spot) - sec->floorplane.ZatPoint (spot); newheight += sec->ceilingplane.ZatPoint(spot) - sec->floorplane.ZatPoint(spot);
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (spot, newheight); elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (spot, newheight);
break; break;
@ -1027,25 +1027,25 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype,
case DElevator::elevateCurrent: case DElevator::elevateCurrent:
newheight = line->frontsector->floorplane.ZatPoint (line->v1); newheight = line->frontsector->floorplane.ZatPoint (line->v1);
elevator->m_FloorDestDist = sec->floorplane.PointToDist (line->v1, newheight); elevator->m_FloorDestDist = sec->floorplane.PointToDist (line->v1, newheight);
newheight += sec->ceilingplane.ZatPoint (line->v1) - sec->floorplane.ZatPoint (line->v1); newheight += sec->ceilingplane.ZatPoint(line->v1) - sec->floorplane.ZatPoint(line->v1);
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.fixD() ? -1 : 1; elevator->m_FloorDestDist > sec->floorplane.fD() ? -1 : 1;
break; break;
// [RH] elevate up by a specific amount // [RH] elevate up by a specific amount
case DElevator::elevateRaise: case DElevator::elevateRaise:
elevator->m_Direction = 1; elevator->m_Direction = 1;
elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), floorheight + height); elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, floorheight + height);
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->_f_centerspot(), ceilingheight + height); elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->centerspot, ceilingheight + height);
break; break;
// [RH] elevate down by a specific amount // [RH] elevate down by a specific amount
case DElevator::elevateLower: case DElevator::elevateLower:
elevator->m_Direction = -1; elevator->m_Direction = -1;
elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), floorheight - height); elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, floorheight - height);
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->_f_centerspot(), ceilingheight - height); elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->centerspot, ceilingheight - height);
break; break;
} }
} }
@ -1178,7 +1178,7 @@ void DWaggleBase::DoWaggle (bool ceiling)
{ {
secplane_t *plane; secplane_t *plane;
int pos; int pos;
fixed_t dist; double dist;
if (ceiling) if (ceiling)
{ {
@ -1204,7 +1204,7 @@ 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 = FixedDiv (m_OriginalDist - plane->fixD(), plane->fixC()); dist = (m_OriginalDist - plane->fD()) / plane->fC();
m_Sector->ChangePlaneTexZ(pos, -plane->HeightDiff (m_OriginalDist)); m_Sector->ChangePlaneTexZ(pos, -plane->HeightDiff (m_OriginalDist));
plane->setD(m_OriginalDist); plane->setD(m_OriginalDist);
P_ChangeSector (m_Sector, true, dist, ceiling, false); P_ChangeSector (m_Sector, true, dist, ceiling, false);
@ -1233,11 +1233,8 @@ void DWaggleBase::DoWaggle (bool ceiling)
} }
m_Accumulator += m_AccDelta; m_Accumulator += m_AccDelta;
dist = plane->fD();
fixed_t mag = finesine[(m_Accumulator>>9)&8191]*8; plane->setD(m_OriginalDist + plane->PointToDist (DVector2(0, 0), BobSin(m_Accumulator) *m_Scale));
dist = plane->fixD();
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,19 +1319,18 @@ 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.fixD(); waggle->m_OriginalDist = sector->ceilingplane.fD();
} }
else else
{ {
waggle = new DFloorWaggle (sector); waggle = new DFloorWaggle (sector);
waggle->m_OriginalDist = sector->floorplane.fixD(); waggle->m_OriginalDist = sector->floorplane.fD();
} }
waggle->m_Accumulator = offset*FRACUNIT; waggle->m_Accumulator = offset;
waggle->m_AccDelta = speed << (FRACBITS-6); waggle->m_AccDelta = speed / 64.;
waggle->m_Scale = 0; waggle->m_Scale = 0;
waggle->m_TargetScale = height << (FRACBITS-6); waggle->m_TargetScale = height / 64.;
waggle->m_ScaleDelta = waggle->m_TargetScale waggle->m_ScaleDelta = waggle->m_TargetScale / (TICRATE + ((3 * TICRATE)*height) / 255);
/(TICRATE+((3*TICRATE)*height)/255);
waggle->m_Ticker = timer ? timer*TICRATE : -1; waggle->m_Ticker = timer ? timer*TICRATE : -1;
waggle->m_State = WGLSTATE_EXPAND; waggle->m_State = WGLSTATE_EXPAND;
} }

View file

@ -93,7 +93,7 @@ bool sector_t::IsLinked(sector_t *other, bool ceiling) const
// //
//============================================================================ //============================================================================
static bool MoveCeiling(sector_t *sector, int crush, fixed_t move) static bool MoveCeiling(sector_t *sector, int crush, double move)
{ {
sector->ceilingplane.ChangeHeight (move); sector->ceilingplane.ChangeHeight (move);
sector->ChangePlaneTexZ(sector_t::ceiling, move); sector->ChangePlaneTexZ(sector_t::ceiling, move);
@ -107,7 +107,7 @@ static bool MoveCeiling(sector_t *sector, int crush, fixed_t move)
return true; return true;
} }
static bool MoveFloor(sector_t *sector, int crush, fixed_t move) static bool MoveFloor(sector_t *sector, int crush, double move)
{ {
sector->floorplane.ChangeHeight (move); sector->floorplane.ChangeHeight (move);
sector->ChangePlaneTexZ(sector_t::floor, move); sector->ChangePlaneTexZ(sector_t::floor, move);
@ -131,7 +131,7 @@ static bool MoveFloor(sector_t *sector, int crush, fixed_t move)
// //
//============================================================================ //============================================================================
bool P_MoveLinkedSectors(sector_t *sector, int crush, fixed_t move, bool ceiling) bool P_MoveLinkedSectors(sector_t *sector, int crush, double move, bool ceiling)
{ {
extsector_t::linked::plane &scrollplane = ceiling? sector->e->Linked.Ceiling : sector->e->Linked.Floor; extsector_t::linked::plane &scrollplane = ceiling? sector->e->Linked.Ceiling : sector->e->Linked.Floor;
bool ok = true; bool ok = true;

View file

@ -510,7 +510,7 @@ FUNC(LS_Floor_TransferNumeric)
FUNC(LS_Floor_Donut) FUNC(LS_Floor_Donut)
// Floor_Donut (pillartag, pillarspeed, slimespeed) // Floor_Donut (pillartag, pillarspeed, slimespeed)
{ {
return EV_DoDonut (arg0, ln, _f_SPEED(arg1), _f_SPEED(arg2)); return EV_DoDonut (arg0, ln, SPEED(arg1), SPEED(arg2));
} }
FUNC(LS_Generic_Floor) FUNC(LS_Generic_Floor)
@ -554,56 +554,56 @@ FUNC(LS_Stairs_BuildDown)
// Stair_BuildDown (tag, speed, height, delay, reset) // Stair_BuildDown (tag, speed, height, delay, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildDown, ln, return EV_BuildStairs (arg0, DFloor::buildDown, ln,
arg2 * FRACUNIT, _f_SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials); arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials);
} }
FUNC(LS_Stairs_BuildUp) FUNC(LS_Stairs_BuildUp)
// Stairs_BuildUp (tag, speed, height, delay, reset) // Stairs_BuildUp (tag, speed, height, delay, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildUp, ln, return EV_BuildStairs (arg0, DFloor::buildUp, ln,
arg2 * FRACUNIT, _f_SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials); arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials);
} }
FUNC(LS_Stairs_BuildDownSync) FUNC(LS_Stairs_BuildDownSync)
// Stairs_BuildDownSync (tag, speed, height, reset) // Stairs_BuildDownSync (tag, speed, height, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildDown, ln, return EV_BuildStairs (arg0, DFloor::buildDown, ln,
arg2 * FRACUNIT, _f_SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync); arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync);
} }
FUNC(LS_Stairs_BuildUpSync) FUNC(LS_Stairs_BuildUpSync)
// Stairs_BuildUpSync (tag, speed, height, reset) // Stairs_BuildUpSync (tag, speed, height, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildUp, ln, return EV_BuildStairs (arg0, DFloor::buildUp, ln,
arg2 * FRACUNIT, _f_SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync); arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync);
} }
FUNC(LS_Stairs_BuildUpDoom) FUNC(LS_Stairs_BuildUpDoom)
// Stairs_BuildUpDoom (tag, speed, height, delay, reset) // Stairs_BuildUpDoom (tag, speed, height, delay, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildUp, ln, return EV_BuildStairs (arg0, DFloor::buildUp, ln,
arg2 * FRACUNIT, _f_SPEED(arg1), TICS(arg3), arg4, 0, 0); arg2, SPEED(arg1), TICS(arg3), arg4, 0, 0);
} }
FUNC(LS_Stairs_BuildDownDoom) FUNC(LS_Stairs_BuildDownDoom)
// Stair_BuildDownDoom (tag, speed, height, delay, reset) // Stair_BuildDownDoom (tag, speed, height, delay, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildDown, ln, return EV_BuildStairs (arg0, DFloor::buildDown, ln,
arg2 * FRACUNIT, _f_SPEED(arg1), TICS(arg3), arg4, 0, 0); arg2, SPEED(arg1), TICS(arg3), arg4, 0, 0);
} }
FUNC(LS_Stairs_BuildDownDoomSync) FUNC(LS_Stairs_BuildDownDoomSync)
// Stairs_BuildDownDoomSync (tag, speed, height, reset) // Stairs_BuildDownDoomSync (tag, speed, height, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildDown, ln, return EV_BuildStairs (arg0, DFloor::buildDown, ln,
arg2 * FRACUNIT, _f_SPEED(arg1), 0, arg3, 0, DFloor::stairSync); arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairSync);
} }
FUNC(LS_Stairs_BuildUpDoomSync) FUNC(LS_Stairs_BuildUpDoomSync)
// Stairs_BuildUpDoomSync (tag, speed, height, reset) // Stairs_BuildUpDoomSync (tag, speed, height, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildUp, ln, return EV_BuildStairs (arg0, DFloor::buildUp, ln,
arg2 * FRACUNIT, _f_SPEED(arg1), 0, arg3, 0, DFloor::stairSync); arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairSync);
} }
@ -612,7 +612,7 @@ FUNC(LS_Generic_Stairs)
{ {
DFloor::EStair type = (arg3 & 1) ? DFloor::buildUp : DFloor::buildDown; DFloor::EStair type = (arg3 & 1) ? DFloor::buildUp : DFloor::buildDown;
bool res = EV_BuildStairs (arg0, type, ln, bool res = EV_BuildStairs (arg0, type, ln,
arg2 * FRACUNIT, _f_SPEED(arg1), 0, arg4, arg3 & 2, 0); arg2, SPEED(arg1), 0, arg4, arg3 & 2, 0);
if (res && ln && (ln->flags & ML_REPEAT_SPECIAL) && ln->special == Generic_Stairs) if (res && ln && (ln->flags & ML_REPEAT_SPECIAL) && ln->special == Generic_Stairs)
// Toggle direction of next activation of repeatable stairs // Toggle direction of next activation of repeatable stairs
@ -624,61 +624,61 @@ FUNC(LS_Generic_Stairs)
FUNC(LS_Pillar_Build) FUNC(LS_Pillar_Build)
// Pillar_Build (tag, speed, height) // Pillar_Build (tag, speed, height)
{ {
return EV_DoPillar (DPillar::pillarBuild, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, 0, -1, false); return EV_DoPillar (DPillar::pillarBuild, ln, arg0, SPEED(arg1), arg2, 0, -1, false);
} }
FUNC(LS_Pillar_BuildAndCrush) FUNC(LS_Pillar_BuildAndCrush)
// Pillar_BuildAndCrush (tag, speed, height, crush, crushtype) // Pillar_BuildAndCrush (tag, speed, height, crush, crushtype)
{ {
return EV_DoPillar (DPillar::pillarBuild, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, 0, arg3, CRUSHTYPE(arg4)); return EV_DoPillar (DPillar::pillarBuild, ln, arg0, SPEED(arg1), arg2, 0, arg3, CRUSHTYPE(arg4));
} }
FUNC(LS_Pillar_Open) FUNC(LS_Pillar_Open)
// Pillar_Open (tag, speed, f_height, c_height) // Pillar_Open (tag, speed, f_height, c_height)
{ {
return EV_DoPillar (DPillar::pillarOpen, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, arg3*FRACUNIT, -1, false); return EV_DoPillar (DPillar::pillarOpen, ln, arg0, SPEED(arg1), arg2, arg3, -1, false);
} }
FUNC(LS_Ceiling_LowerByValue) FUNC(LS_Ceiling_LowerByValue)
// Ceiling_LowerByValue (tag, speed, height, change, crush) // Ceiling_LowerByValue (tag, speed, height, change, crush)
{ {
return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2*FRACUNIT, CRUSH(arg4), 0, CHANGE(arg3)); return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2, CRUSH(arg4), 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_RaiseByValue) FUNC(LS_Ceiling_RaiseByValue)
// Ceiling_RaiseByValue (tag, speed, height, change) // Ceiling_RaiseByValue (tag, speed, height, change)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2*FRACUNIT, CRUSH(arg4), 0, CHANGE(arg3)); return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2, CRUSH(arg4), 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_LowerByValueTimes8) FUNC(LS_Ceiling_LowerByValueTimes8)
// Ceiling_LowerByValueTimes8 (tag, speed, height, change, crush) // Ceiling_LowerByValueTimes8 (tag, speed, height, change, crush)
{ {
return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2*FRACUNIT*8, -1, 0, CHANGE(arg3)); return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2*8, -1, 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_RaiseByValueTimes8) FUNC(LS_Ceiling_RaiseByValueTimes8)
// Ceiling_RaiseByValueTimes8 (tag, speed, height, change) // Ceiling_RaiseByValueTimes8 (tag, speed, height, change)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2*FRACUNIT*8, -1, 0, CHANGE(arg3)); return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2*8, -1, 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_CrushAndRaise) FUNC(LS_Ceiling_CrushAndRaise)
// Ceiling_CrushAndRaise (tag, speed, crush, crushtype) // Ceiling_CrushAndRaise (tag, speed, crush, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg3, false)); return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8, arg2, 0, 0, CRUSHTYPE(arg3, false));
} }
FUNC(LS_Ceiling_LowerAndCrush) FUNC(LS_Ceiling_LowerAndCrush)
// Ceiling_LowerAndCrush (tag, speed, crush, crushtype) // Ceiling_LowerAndCrush (tag, speed, crush, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), 8*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg3, arg1 == 8)); return EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), 8, arg2, 0, 0, CRUSHTYPE(arg3, arg1 == 8));
} }
FUNC(LS_Ceiling_LowerAndCrushDist) FUNC(LS_Ceiling_LowerAndCrushDist)
// Ceiling_LowerAndCrush (tag, speed, crush, dist, crushtype) // Ceiling_LowerAndCrush (tag, speed, crush, dist, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), arg3*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg4, arg1 == 8)); return EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), arg3, arg2, 0, 0, CRUSHTYPE(arg4, arg1 == 8));
} }
FUNC(LS_Ceiling_CrushStop) FUNC(LS_Ceiling_CrushStop)
@ -690,21 +690,21 @@ FUNC(LS_Ceiling_CrushStop)
FUNC(LS_Ceiling_CrushRaiseAndStay) FUNC(LS_Ceiling_CrushRaiseAndStay)
// Ceiling_CrushRaiseAndStay (tag, speed, crush, crushtype) // Ceiling_CrushRaiseAndStay (tag, speed, crush, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg3, false)); return EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8, arg2, 0, 0, CRUSHTYPE(arg3, false));
} }
FUNC(LS_Ceiling_MoveToValueTimes8) FUNC(LS_Ceiling_MoveToValueTimes8)
// Ceiling_MoveToValueTimes8 (tag, speed, height, negative, change) // Ceiling_MoveToValueTimes8 (tag, speed, height, negative, change)
{ {
return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0,
arg2*FRACUNIT*8*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4)); arg2*8*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4));
} }
FUNC(LS_Ceiling_MoveToValue) FUNC(LS_Ceiling_MoveToValue)
// Ceiling_MoveToValue (tag, speed, height, negative, change) // Ceiling_MoveToValue (tag, speed, height, negative, change)
{ {
return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0,
arg2*FRACUNIT*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4)); arg2*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4));
} }
FUNC(LS_Ceiling_LowerToHighestFloor) FUNC(LS_Ceiling_LowerToHighestFloor)
@ -716,13 +716,13 @@ FUNC(LS_Ceiling_LowerToHighestFloor)
FUNC(LS_Ceiling_LowerInstant) FUNC(LS_Ceiling_LowerInstant)
// Ceiling_LowerInstant (tag, unused, height, change, crush) // Ceiling_LowerInstant (tag, unused, height, change, crush)
{ {
return EV_DoCeiling (DCeiling::ceilLowerInstant, ln, arg0, 0, 0, arg2*FRACUNIT*8, CRUSH(arg4), 0, CHANGE(arg3)); return EV_DoCeiling (DCeiling::ceilLowerInstant, ln, arg0, 0, 0, arg2*8, CRUSH(arg4), 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_RaiseInstant) FUNC(LS_Ceiling_RaiseInstant)
// Ceiling_RaiseInstant (tag, unused, height, change) // Ceiling_RaiseInstant (tag, unused, height, change)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseInstant, ln, arg0, 0, 0, arg2*FRACUNIT*8, -1, 0, CHANGE(arg3)); return EV_DoCeiling (DCeiling::ceilRaiseInstant, ln, arg0, 0, 0, arg2*8, -1, 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_CrushRaiseAndStayA) FUNC(LS_Ceiling_CrushRaiseAndStayA)
@ -746,7 +746,7 @@ FUNC(LS_Ceiling_CrushAndRaiseA)
FUNC(LS_Ceiling_CrushAndRaiseDist) FUNC(LS_Ceiling_CrushAndRaiseDist)
// Ceiling_CrushAndRaiseDist (tag, dist, speed, damage, crushtype) // Ceiling_CrushAndRaiseDist (tag, dist, speed, damage, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1*FRACUNIT, arg3, 0, 0, CRUSHTYPE(arg4, arg2 == 8)); return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1, arg3, 0, 0, CRUSHTYPE(arg4, arg2 == 8));
} }
FUNC(LS_Ceiling_CrushAndRaiseSilentA) FUNC(LS_Ceiling_CrushAndRaiseSilentA)
@ -758,7 +758,7 @@ FUNC(LS_Ceiling_CrushAndRaiseSilentA)
FUNC(LS_Ceiling_CrushAndRaiseSilentDist) FUNC(LS_Ceiling_CrushAndRaiseSilentDist)
// Ceiling_CrushAndRaiseSilentDist (tag, dist, upspeed, damage, crushtype) // Ceiling_CrushAndRaiseSilentDist (tag, dist, upspeed, damage, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1*FRACUNIT, arg3, 1, 0, CRUSHTYPE(arg4, arg2 == 8)); return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1, arg3, 1, 0, CRUSHTYPE(arg4, arg2 == 8));
} }
FUNC(LS_Ceiling_RaiseToNearest) FUNC(LS_Ceiling_RaiseToNearest)
@ -854,7 +854,7 @@ FUNC(LS_Generic_Ceiling)
} }
} }
return EV_DoCeiling (type, ln, arg0, SPEED(arg1), SPEED(arg1), arg2*FRACUNIT, return EV_DoCeiling (type, ln, arg0, SPEED(arg1), SPEED(arg1), arg2,
(arg4 & 16) ? 20 : -1, 0, arg4 & 7); (arg4 & 16) ? 20 : -1, 0, arg4 & 7);
} }
@ -876,13 +876,13 @@ FUNC(LS_Generic_Crusher2)
FUNC(LS_Plat_PerpetualRaise) FUNC(LS_Plat_PerpetualRaise)
// Plat_PerpetualRaise (tag, speed, delay) // Plat_PerpetualRaise (tag, speed, delay)
{ {
return EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, _f_SPEED(arg1), TICS(arg2), 8, 0); return EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, SPEED(arg1), TICS(arg2), 8, 0);
} }
FUNC(LS_Plat_PerpetualRaiseLip) FUNC(LS_Plat_PerpetualRaiseLip)
// Plat_PerpetualRaiseLip (tag, speed, delay, lip) // Plat_PerpetualRaiseLip (tag, speed, delay, lip)
{ {
return EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, _f_SPEED(arg1), TICS(arg2), arg3, 0); return EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, SPEED(arg1), TICS(arg2), arg3, 0);
} }
FUNC(LS_Plat_Stop) FUNC(LS_Plat_Stop)
@ -895,7 +895,7 @@ FUNC(LS_Plat_Stop)
FUNC(LS_Plat_DownWaitUpStay) FUNC(LS_Plat_DownWaitUpStay)
// Plat_DownWaitUpStay (tag, speed, delay) // Plat_DownWaitUpStay (tag, speed, delay)
{ {
return EV_DoPlat (arg0, ln, DPlat::platDownWaitUpStay, 0, _f_SPEED(arg1), TICS(arg2), 8, 0); return EV_DoPlat (arg0, ln, DPlat::platDownWaitUpStay, 0, SPEED(arg1), TICS(arg2), 8, 0);
} }
FUNC(LS_Plat_DownWaitUpStayLip) FUNC(LS_Plat_DownWaitUpStayLip)
@ -903,31 +903,31 @@ FUNC(LS_Plat_DownWaitUpStayLip)
{ {
return EV_DoPlat (arg0, ln, return EV_DoPlat (arg0, ln,
arg4 ? DPlat::platDownWaitUpStayStone : DPlat::platDownWaitUpStay, arg4 ? DPlat::platDownWaitUpStayStone : DPlat::platDownWaitUpStay,
0, _f_SPEED(arg1), TICS(arg2), arg3, 0); 0, SPEED(arg1), TICS(arg2), arg3, 0);
} }
FUNC(LS_Plat_DownByValue) FUNC(LS_Plat_DownByValue)
// Plat_DownByValue (tag, speed, delay, height) // Plat_DownByValue (tag, speed, delay, height)
{ {
return EV_DoPlat (arg0, ln, DPlat::platDownByValue, FRACUNIT*arg3*8, _f_SPEED(arg1), TICS(arg2), 0, 0); return EV_DoPlat (arg0, ln, DPlat::platDownByValue, arg3*8, SPEED(arg1), TICS(arg2), 0, 0);
} }
FUNC(LS_Plat_UpByValue) FUNC(LS_Plat_UpByValue)
// Plat_UpByValue (tag, speed, delay, height) // Plat_UpByValue (tag, speed, delay, height)
{ {
return EV_DoPlat (arg0, ln, DPlat::platUpByValue, FRACUNIT*arg3*8, _f_SPEED(arg1), TICS(arg2), 0, 0); return EV_DoPlat (arg0, ln, DPlat::platUpByValue, arg3*8, SPEED(arg1), TICS(arg2), 0, 0);
} }
FUNC(LS_Plat_UpWaitDownStay) FUNC(LS_Plat_UpWaitDownStay)
// Plat_UpWaitDownStay (tag, speed, delay) // Plat_UpWaitDownStay (tag, speed, delay)
{ {
return EV_DoPlat (arg0, ln, DPlat::platUpWaitDownStay, 0, _f_SPEED(arg1), TICS(arg2), 0, 0); return EV_DoPlat (arg0, ln, DPlat::platUpWaitDownStay, 0, SPEED(arg1), TICS(arg2), 0, 0);
} }
FUNC(LS_Plat_UpNearestWaitDownStay) FUNC(LS_Plat_UpNearestWaitDownStay)
// Plat_UpNearestWaitDownStay (tag, speed, delay) // Plat_UpNearestWaitDownStay (tag, speed, delay)
{ {
return EV_DoPlat (arg0, ln, DPlat::platUpNearestWaitDownStay, 0, _f_SPEED(arg1), TICS(arg2), 0, 0); return EV_DoPlat (arg0, ln, DPlat::platUpNearestWaitDownStay, 0, SPEED(arg1), TICS(arg2), 0, 0);
} }
FUNC(LS_Plat_RaiseAndStayTx0) FUNC(LS_Plat_RaiseAndStayTx0)
@ -949,13 +949,13 @@ FUNC(LS_Plat_RaiseAndStayTx0)
} }
return EV_DoPlat (arg0, ln, type, 0, _f_SPEED(arg1), 0, 0, 1); return EV_DoPlat (arg0, ln, type, 0, SPEED(arg1), 0, 0, 1);
} }
FUNC(LS_Plat_UpByValueStayTx) FUNC(LS_Plat_UpByValueStayTx)
// Plat_UpByValueStayTx (tag, speed, height) // Plat_UpByValueStayTx (tag, speed, height)
{ {
return EV_DoPlat (arg0, ln, DPlat::platUpByValueStay, FRACUNIT*arg2*8, _f_SPEED(arg1), 0, 0, 2); return EV_DoPlat (arg0, ln, DPlat::platUpByValueStay, arg2*8, SPEED(arg1), 0, 0, 2);
} }
FUNC(LS_Plat_ToggleCeiling) FUNC(LS_Plat_ToggleCeiling)
@ -988,7 +988,7 @@ FUNC(LS_Generic_Lift)
break; break;
} }
return EV_DoPlat (arg0, ln, type, arg4*8*FRACUNIT, _f_SPEED(arg1), OCTICS(arg2), 0, 0); return EV_DoPlat (arg0, ln, type, arg4*8, SPEED(arg1), OCTICS(arg2), 0, 0);
} }
FUNC(LS_Exit_Normal) FUNC(LS_Exit_Normal)
@ -1943,13 +1943,13 @@ FUNC(LS_FS_Execute)
FUNC(LS_FloorAndCeiling_LowerByValue) FUNC(LS_FloorAndCeiling_LowerByValue)
// FloorAndCeiling_LowerByValue (tag, speed, height) // FloorAndCeiling_LowerByValue (tag, speed, height)
{ {
return EV_DoElevator (ln, DElevator::elevateLower, _f_SPEED(arg1), arg2*FRACUNIT, arg0); return EV_DoElevator (ln, DElevator::elevateLower, SPEED(arg1), arg2, arg0);
} }
FUNC(LS_FloorAndCeiling_RaiseByValue) FUNC(LS_FloorAndCeiling_RaiseByValue)
// FloorAndCeiling_RaiseByValue (tag, speed, height) // FloorAndCeiling_RaiseByValue (tag, speed, height)
{ {
return EV_DoElevator (ln, DElevator::elevateRaise, _f_SPEED(arg1), arg2*FRACUNIT, arg0); return EV_DoElevator (ln, DElevator::elevateRaise, SPEED(arg1), arg2, arg0);
} }
FUNC(LS_FloorAndCeiling_LowerRaise) FUNC(LS_FloorAndCeiling_LowerRaise)
@ -1962,7 +1962,7 @@ FUNC(LS_FloorAndCeiling_LowerRaise)
// more or less unintuitive value for the fourth arg to trigger Boom's broken behavior // more or less unintuitive value for the fourth arg to trigger Boom's broken behavior
if (arg3 != 1998 || !res) // (1998 for the year in which Boom was released... :P) if (arg3 != 1998 || !res) // (1998 for the year in which Boom was released... :P)
{ {
res |= EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, _f_SPEED(arg1), 0, -1, 0, false); res |= EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, SPEED(arg1), 0, -1, 0, false);
} }
return res; return res;
} }
@ -1970,19 +1970,19 @@ FUNC(LS_FloorAndCeiling_LowerRaise)
FUNC(LS_Elevator_MoveToFloor) FUNC(LS_Elevator_MoveToFloor)
// Elevator_MoveToFloor (tag, speed) // Elevator_MoveToFloor (tag, speed)
{ {
return EV_DoElevator (ln, DElevator::elevateCurrent, _f_SPEED(arg1), 0, arg0); return EV_DoElevator (ln, DElevator::elevateCurrent, SPEED(arg1), 0, arg0);
} }
FUNC(LS_Elevator_RaiseToNearest) FUNC(LS_Elevator_RaiseToNearest)
// Elevator_RaiseToNearest (tag, speed) // Elevator_RaiseToNearest (tag, speed)
{ {
return EV_DoElevator (ln, DElevator::elevateUp, _f_SPEED(arg1), 0, arg0); return EV_DoElevator (ln, DElevator::elevateUp, SPEED(arg1), 0, arg0);
} }
FUNC(LS_Elevator_LowerToNearest) FUNC(LS_Elevator_LowerToNearest)
// Elevator_LowerToNearest (tag, speed) // Elevator_LowerToNearest (tag, speed)
{ {
return EV_DoElevator (ln, DElevator::elevateDown, _f_SPEED(arg1), 0, arg0); return EV_DoElevator (ln, DElevator::elevateDown, SPEED(arg1), 0, arg0);
} }
FUNC(LS_Light_ForceLightning) FUNC(LS_Light_ForceLightning)
@ -2760,7 +2760,7 @@ enum
PROP_FLIGHT, PROP_FLIGHT,
PROP_UNUSED1, PROP_UNUSED1,
PROP_UNUSED2, PROP_UNUSED2,
PROP__f_SPEED, PROP_SPEED,
PROP_BUDDHA, PROP_BUDDHA,
}; };
@ -2775,7 +2775,7 @@ FUNC(LS_SetPlayerProperty)
return false; return false;
// Add or remove a power // Add or remove a power
if (arg2 >= PROP_INVULNERABILITY && arg2 <= PROP__f_SPEED) if (arg2 >= PROP_INVULNERABILITY && arg2 <= PROP_SPEED)
{ {
static PClass * const *powers[11] = static PClass * const *powers[11] =
{ {

View file

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

View file

@ -526,8 +526,8 @@ double P_GetFriction(const AActor *mo, double *frictionfactor)
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_SWIMMABLE)) continue; if (!(rover->flags & FF_SWIMMABLE)) continue;
if (mo->Z() > rover->top.plane->ZatPointF(mo) || if (mo->Z() > rover->top.plane->ZatPoint(mo) ||
mo->Z() < rover->bottom.plane->ZatPointF(mo)) mo->Z() < rover->bottom.plane->ZatPoint(mo))
continue; continue;
newfriction = rover->model->GetFriction(rover->top.isceiling, &newmf); newfriction = rover->model->GetFriction(rover->top.isceiling, &newmf);
@ -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.fixC() < STEEPSLOPE) != (open.backfloorplane.fixC() < STEEPSLOPE)) if ((open.frontfloorplane.fC() < STEEPSLOPE) != (open.backfloorplane.fC() < STEEPSLOPE))
{ {
// on the boundary of a steep slope // on the boundary of a steep slope
return false; return false;
@ -2913,7 +2913,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
{ {
if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
double thisplanez = rover->top.plane->ZatPointF(actor); double thisplanez = rover->top.plane->ZatPoint(actor);
if (thisplanez > planezhere && thisplanez <= actor->Z() + actor->MaxStepHeight) if (thisplanez > planezhere && thisplanez <= actor->Z() + actor->MaxStepHeight)
{ {
@ -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->fixC() > STEEPSLOPE * 2 / 3) if (plane->fC() > 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.fixC() >= STEEPSLOPE) if (sec->floorplane.fC() >= STEEPSLOPE)
{ {
DVector3 pos = actor->PosRelative(sec) +move; DVector3 pos = actor->PosRelative(sec) +move;
@ -3741,7 +3741,7 @@ struct aim_t
{ {
if (lastceilingplane) if (lastceilingplane)
{ {
double ff_top = lastceilingplane->ZatPointF(th); double ff_top = lastceilingplane->ZatPoint(th);
DAngle pitch = -VecToAngle(dist, ff_top - shootz); DAngle pitch = -VecToAngle(dist, ff_top - shootz);
// upper slope intersects with this 3d-floor // upper slope intersects with this 3d-floor
if (pitch > toppitch) if (pitch > toppitch)
@ -3751,7 +3751,7 @@ struct aim_t
} }
if (lastfloorplane) if (lastfloorplane)
{ {
double ff_bottom = lastfloorplane->ZatPointF(th); double ff_bottom = lastfloorplane->ZatPoint(th);
DAngle pitch = -VecToAngle(dist, ff_bottom - shootz); DAngle pitch = -VecToAngle(dist, ff_bottom - shootz);
// lower slope intersects with this 3d-floor // lower slope intersects with this 3d-floor
if (pitch < bottompitch) if (pitch < bottompitch)

View file

@ -2175,7 +2175,7 @@ explode:
{ // Don't stop sliding if halfway off a step with some velocity { // Don't stop sliding if halfway off a step with some velocity
if (fabs(mo->Vel.X) > 0.25 || fabs(mo->Vel.Y) > 0.25) if (fabs(mo->Vel.X) > 0.25 || fabs(mo->Vel.Y) > 0.25)
{ {
if (mo->floorz > mo->Sector->floorplane.ZatPointF(mo)) if (mo->floorz > mo->Sector->floorplane.ZatPoint(mo))
{ {
if (mo->dropoffz != mo->floorz) // 3DMidtex or other special cases that must be excluded if (mo->dropoffz != mo->floorz) // 3DMidtex or other special cases that must be excluded
{ {
@ -2186,7 +2186,7 @@ explode:
// if the floor comes from one in the current sector stop sliding the corpse! // if the floor comes from one in the current sector stop sliding the corpse!
F3DFloor * rover=mo->Sector->e->XFloor.ffloors[i]; F3DFloor * rover=mo->Sector->e->XFloor.ffloors[i];
if (!(rover->flags&FF_EXISTS)) continue; if (!(rover->flags&FF_EXISTS)) continue;
if (rover->flags&FF_SOLID && rover->top.plane->ZatPointF(mo) == mo->floorz) break; if (rover->flags&FF_SOLID && rover->top.plane->ZatPoint(mo) == mo->floorz) break;
} }
if (i==mo->Sector->e->XFloor.ffloors.Size()) if (i==mo->Sector->e->XFloor.ffloors.Size())
return Oldfloorz; return Oldfloorz;
@ -2427,8 +2427,8 @@ void P_ZMovement (AActor *mo, double oldfloorz)
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_SWIMMABLE)) continue; if (!(rover->flags & FF_SWIMMABLE)) continue;
if (mo->Z() >= rover->top.plane->ZatPointF(mo) || if (mo->Z() >= rover->top.plane->ZatPoint(mo) ||
mo->Center() < rover->bottom.plane->ZatPointF(mo)) mo->Center() < rover->bottom.plane->ZatPoint(mo))
continue; continue;
friction = rover->model->GetFriction(rover->top.isceiling); friction = rover->model->GetFriction(rover->top.isceiling);
@ -2447,7 +2447,7 @@ void P_ZMovement (AActor *mo, double oldfloorz)
{ // Hit the floor { // Hit the floor
if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) && if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) &&
mo->Sector->SecActTarget != NULL && mo->Sector->SecActTarget != NULL &&
mo->Sector->floorplane.ZatPointF(mo) == mo->floorz) mo->Sector->floorplane.ZatPoint(mo) == mo->floorz)
{ // [RH] Let the sector do something to the actor { // [RH] Let the sector do something to the actor
mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor); mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor);
} }
@ -2547,7 +2547,7 @@ void P_ZMovement (AActor *mo, double oldfloorz)
{ // hit the ceiling { // hit the ceiling
if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) && if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) &&
mo->Sector->SecActTarget != NULL && mo->Sector->SecActTarget != NULL &&
mo->Sector->ceilingplane.ZatPointF(mo) == mo->ceilingz) mo->Sector->ceilingplane.ZatPoint(mo) == mo->ceilingz)
{ // [RH] Let the sector do something to the actor { // [RH] Let the sector do something to the actor
mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling); mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling);
} }
@ -2602,7 +2602,7 @@ void P_CheckFakeFloorTriggers (AActor *mo, double oldz, bool oldz_has_viewheight
if (sec->heightsec != NULL && sec->SecActTarget != NULL) if (sec->heightsec != NULL && sec->SecActTarget != NULL)
{ {
sector_t *hs = sec->heightsec; sector_t *hs = sec->heightsec;
double waterz = hs->floorplane.ZatPointF(mo); double waterz = hs->floorplane.ZatPoint(mo);
double newz; double newz;
double viewheight; double viewheight;
@ -2637,7 +2637,7 @@ void P_CheckFakeFloorTriggers (AActor *mo, double oldz, bool oldz_has_viewheight
if (!(hs->MoreFlags & SECF_FAKEFLOORONLY)) if (!(hs->MoreFlags & SECF_FAKEFLOORONLY))
{ {
waterz = hs->ceilingplane.ZatPointF(mo); waterz = hs->ceilingplane.ZatPoint(mo);
if (oldz <= waterz && newz > waterz) if (oldz <= waterz && newz > waterz)
{ // View went above fake ceiling { // View went above fake ceiling
sec->SecActTarget->TriggerAction (mo, SECSPAC_EyesAboveC); sec->SecActTarget->TriggerAction (mo, SECSPAC_EyesAboveC);
@ -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.fixC() < STEEPSLOPE && if (floorplane.fC() < 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.fixC() > STEEPSLOPE*2/3) if (floorplane.fC() > 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.fixC() >= STEEPSLOPE) if (sec->floorplane.fC() >= STEEPSLOPE)
{ {
if (floorplane.ZatPoint(PosRelative(node->m_sector)) >= Z() - MaxStepHeight) if (floorplane.ZatPoint(PosRelative(node->m_sector)) >= Z() - MaxStepHeight)
{ {
@ -3897,15 +3897,15 @@ void AActor::CheckSectorTransition(sector_t *oldsec)
if (Sector->SecActTarget != NULL) if (Sector->SecActTarget != NULL)
{ {
int act = SECSPAC_Enter; int act = SECSPAC_Enter;
if (Z() <= Sector->floorplane.ZatPointF(this)) if (Z() <= Sector->floorplane.ZatPoint(this))
{ {
act |= SECSPAC_HitFloor; act |= SECSPAC_HitFloor;
} }
if (Top() >= Sector->ceilingplane.ZatPointF(this)) if (Top() >= Sector->ceilingplane.ZatPoint(this))
{ {
act |= SECSPAC_HitCeiling; act |= SECSPAC_HitCeiling;
} }
if (Sector->heightsec != NULL && Z() == Sector->heightsec->floorplane.ZatPointF(this)) if (Sector->heightsec != NULL && Z() == Sector->heightsec->floorplane.ZatPoint(this))
{ {
act |= SECSPAC_HitFakeFloor; act |= SECSPAC_HitFakeFloor;
} }
@ -3952,7 +3952,7 @@ bool AActor::UpdateWaterLevel (bool dosplash)
const sector_t *hsec = Sector->GetHeightSec(); const sector_t *hsec = Sector->GetHeightSec();
if (hsec != NULL) if (hsec != NULL)
{ {
fh = hsec->floorplane.ZatPointF (this); fh = hsec->floorplane.ZatPoint (this);
//if (hsec->MoreFlags & SECF_UNDERWATERMASK) // also check Boom-style non-swimmable sectors //if (hsec->MoreFlags & SECF_UNDERWATERMASK) // also check Boom-style non-swimmable sectors
{ {
if (Z() < fh) if (Z() < fh)
@ -3968,7 +3968,7 @@ bool AActor::UpdateWaterLevel (bool dosplash)
} }
} }
} }
else if (!(hsec->MoreFlags & SECF_FAKEFLOORONLY) && (Top() > hsec->ceilingplane.ZatPointF (this))) else if (!(hsec->MoreFlags & SECF_FAKEFLOORONLY) && (Top() > hsec->ceilingplane.ZatPoint (this)))
{ {
waterlevel = 3; waterlevel = 3;
} }
@ -3992,8 +3992,8 @@ bool AActor::UpdateWaterLevel (bool dosplash)
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
if(!(rover->flags & FF_SWIMMABLE) || rover->flags & FF_SOLID) continue; if(!(rover->flags & FF_SWIMMABLE) || rover->flags & FF_SOLID) continue;
double ff_bottom=rover->bottom.plane->ZatPointF(this); double ff_bottom=rover->bottom.plane->ZatPoint(this);
double ff_top=rover->top.plane->ZatPointF(this); double ff_top=rover->top.plane->ZatPoint(this);
if(ff_top <= Z() || ff_bottom > (Center())) continue; if(ff_top <= Z() || ff_bottom > (Center())) continue;
@ -4174,7 +4174,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t a
} }
else else
{ {
actor->SpawnPoint.Z = (actor->Z() - actor->Sector->floorplane.ZatPointF(actor)); actor->SpawnPoint.Z = (actor->Z() - actor->Sector->floorplane.ZatPoint(actor));
} }
if (actor->FloatBobPhase == (BYTE)-1) actor->FloatBobPhase = rng(); // Don't make everything bob in sync (unless deliberately told to do) if (actor->FloatBobPhase == (BYTE)-1) actor->FloatBobPhase = rng(); // Don't make everything bob in sync (unless deliberately told to do)
@ -4420,7 +4420,7 @@ void AActor::AdjustFloorClip ()
const msecnode_t *m; const msecnode_t *m;
// possibly standing on a 3D-floor // possibly standing on a 3D-floor
if (Sector->e->XFloor.ffloors.Size() && Z() > Sector->floorplane.ZatPointF(this)) Floorclip = 0; if (Sector->e->XFloor.ffloors.Size() && Z() > Sector->floorplane.ZatPoint(this)) Floorclip = 0;
// [RH] clip based on shallowest floor player is standing on // [RH] clip based on shallowest floor player is standing on
// If the sector has a deep water effect, then let that effect // If the sector has a deep water effect, then let that effect
@ -5522,7 +5522,7 @@ foundone:
if (smallsplash && splash->SmallSplash) if (smallsplash && splash->SmallSplash)
{ {
mo = Spawn (splash->SmallSplash, pos, ALLOW_REPLACE); mo = Spawn (splash->SmallSplash, pos, ALLOW_REPLACE);
if (mo) mo->Floorclip += FIXED2DBL(splash->SmallSplashClip); if (mo) mo->Floorclip += splash->SmallSplashClip;
} }
else else
{ {

View file

@ -89,10 +89,10 @@ void DPillar::Serialize (FArchive &arc)
void DPillar::Tick () void DPillar::Tick ()
{ {
int r, s; int r, s;
fixed_t oldfloor, oldceiling; double oldfloor, oldceiling;
oldfloor = m_Sector->floorplane.fixD(); oldfloor = m_Sector->floorplane.fD();
oldceiling = m_Sector->ceilingplane.fixD(); oldceiling = m_Sector->ceilingplane.fD();
if (m_Type == pillarBuild) if (m_Type == pillarBuild)
{ {
@ -123,11 +123,11 @@ void DPillar::Tick ()
} }
} }
DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed, DPillar::DPillar (sector_t *sector, EPillar type, double speed,
fixed_t floordist, fixed_t ceilingdist, int crush, bool hexencrush) double floordist, double ceilingdist, int crush, bool hexencrush)
: DMover (sector) : DMover (sector)
{ {
fixed_t newheight; double newheight;
vertex_t *spot; vertex_t *spot;
sector->floordata = sector->ceilingdata = this; sector->floordata = sector->ceilingdata = this;
@ -144,15 +144,15 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
if (floordist == 0) if (floordist == 0)
{ {
newheight = (sector->CenterFloor () + sector->CenterCeiling ()) / 2; newheight = (sector->CenterFloor () + sector->CenterCeiling ()) / 2;
m_FloorTarget = sector->floorplane.PointToDist (sector->_f_centerspot(), newheight); m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight);
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->_f_centerspot(), newheight); m_CeilingTarget = sector->ceilingplane.PointToDist (sector->centerspot, newheight);
floordist = newheight - sector->CenterFloor (); floordist = newheight - sector->CenterFloor ();
} }
else else
{ {
newheight = sector->CenterFloor () + floordist; newheight = sector->CenterFloor () + floordist;
m_FloorTarget = sector->floorplane.PointToDist (sector->_f_centerspot(), newheight); m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight);
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->_f_centerspot(), newheight); m_CeilingTarget = sector->ceilingplane.PointToDist (sector->centerspot, newheight);
} }
ceilingdist = sector->CenterCeiling () - newheight; ceilingdist = sector->CenterCeiling () - newheight;
} }
@ -169,7 +169,7 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
else else
{ {
newheight = sector->CenterFloor() - floordist; newheight = sector->CenterFloor() - floordist;
m_FloorTarget = sector->floorplane.PointToDist (sector->_f_centerspot(), newheight); m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight);
} }
if (ceilingdist == 0) if (ceilingdist == 0)
{ {
@ -180,7 +180,7 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
else else
{ {
newheight = sector->CenterCeiling() + ceilingdist; newheight = sector->CenterCeiling() + ceilingdist;
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->_f_centerspot(), newheight); m_CeilingTarget = sector->ceilingplane.PointToDist (sector->centerspot, newheight);
} }
} }
@ -190,12 +190,12 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
if (floordist > ceilingdist) if (floordist > ceilingdist)
{ {
m_FloorSpeed = speed; m_FloorSpeed = speed;
m_CeilingSpeed = Scale (speed, ceilingdist, floordist); m_CeilingSpeed = speed * ceilingdist / floordist;
} }
else else
{ {
m_CeilingSpeed = speed; m_CeilingSpeed = speed;
m_FloorSpeed = Scale (speed, floordist, ceilingdist); m_FloorSpeed = speed * floordist / ceilingdist;
} }
if (!(m_Sector->Flags & SECF_SILENTMOVE)) if (!(m_Sector->Flags & SECF_SILENTMOVE))
@ -216,7 +216,7 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
} }
bool EV_DoPillar (DPillar::EPillar type, line_t *line, int tag, bool EV_DoPillar (DPillar::EPillar type, line_t *line, int tag,
fixed_t speed, fixed_t height, fixed_t height2, int crush, bool hexencrush) double speed, double height, double height2, int crush, bool hexencrush)
{ {
int secnum; int secnum;
sector_t *sec; sector_t *sec;
@ -231,7 +231,7 @@ bool EV_DoPillar (DPillar::EPillar type, line_t *line, int tag,
if (sec->PlaneMoving(sector_t::floor) || sec->PlaneMoving(sector_t::ceiling)) if (sec->PlaneMoving(sector_t::floor) || sec->PlaneMoving(sector_t::ceiling))
continue; continue;
fixed_t flor, ceil; double flor, ceil;
flor = sec->CenterFloor (); flor = sec->CenterFloor ();
ceil = sec->CenterCeiling (); ceil = sec->CenterCeiling ();

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.fixD() == m_Low) if (m_Sector->floorplane.fD() == m_Low)
m_Status = up; m_Status = up;
else else
m_Status = down; m_Status = down;
@ -225,15 +225,15 @@ DPlat::DPlat (sector_t *sector)
// [RH] Changed amount to height and added delay, // [RH] Changed amount to height and added delay,
// lip, change, tag, and speed parameters. // lip, change, tag, and speed parameters.
// //
bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height, bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, double height,
int speed, int delay, int lip, int change) double speed, int delay, int lip, int change)
{ {
DPlat *plat; DPlat *plat;
int secnum; int secnum;
sector_t *sec; sector_t *sec;
bool rtn = false; bool rtn = false;
bool manual = false; bool manual = false;
fixed_t newheight = 0; double newheight = 0;
vertex_t *spot; vertex_t *spot;
if (tag != 0) if (tag != 0)
@ -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.fixD(); plat->m_Low = sec->floorplane.fD();
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.fixD(); plat->m_Low = sec->floorplane.fD();
plat->m_Status = DPlat::up; plat->m_Status = DPlat::up;
plat->PlayPlatSound ("Floor"); plat->PlayPlatSound ("Floor");
sec->ClearSpecial(); sec->ClearSpecial();
@ -300,30 +300,30 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height,
case DPlat::platUpByValue: case DPlat::platUpByValue:
case DPlat::platUpByValueStay: case DPlat::platUpByValueStay:
newheight = sec->floorplane.ZatPoint (0, 0) + height; newheight = sec->floorplane.ZatPoint (sec->centerspot) + height;
plat->m_High = sec->floorplane.PointToDist (0, 0, newheight); plat->m_High = sec->floorplane.PointToDist (sec->centerspot, newheight);
plat->m_Low = sec->floorplane.fixD(); plat->m_Low = sec->floorplane.fD();
plat->m_Status = DPlat::up; plat->m_Status = DPlat::up;
plat->PlayPlatSound ("Floor"); plat->PlayPlatSound ("Floor");
break; break;
case DPlat::platDownByValue: case DPlat::platDownByValue:
newheight = sec->floorplane.ZatPoint (0, 0) - height; newheight = sec->floorplane.ZatPoint (sec->centerspot) - height;
plat->m_Low = sec->floorplane.PointToDist (0, 0, newheight); plat->m_Low = sec->floorplane.PointToDist (sec->centerspot, newheight);
plat->m_High = sec->floorplane.fixD(); plat->m_High = sec->floorplane.fD();
plat->m_Status = DPlat::down; plat->m_Status = DPlat::down;
plat->PlayPlatSound ("Floor"); plat->PlayPlatSound ("Floor");
break; break;
case DPlat::platDownWaitUpStay: case DPlat::platDownWaitUpStay:
case DPlat::platDownWaitUpStayStone: case DPlat::platDownWaitUpStayStone:
newheight = sec->FindLowestFloorSurrounding (&spot) + lip*FRACUNIT; newheight = sec->FindLowestFloorSurrounding (&spot) + lip;
plat->m_Low = sec->floorplane.PointToDist (spot, newheight); plat->m_Low = sec->floorplane.PointToDist (spot, newheight);
if (plat->m_Low < sec->floorplane.fixD()) if (plat->m_Low < sec->floorplane.fD())
plat->m_Low = sec->floorplane.fixD(); plat->m_Low = sec->floorplane.fD();
plat->m_High = sec->floorplane.fixD(); plat->m_High = sec->floorplane.fD();
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,27 +338,27 @@ 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.fixD(); plat->m_Low = sec->floorplane.fD();
if (plat->m_High > sec->floorplane.fixD()) if (plat->m_High > sec->floorplane.fD())
plat->m_High = sec->floorplane.fixD(); plat->m_High = sec->floorplane.fD();
plat->m_Status = DPlat::up; plat->m_Status = DPlat::up;
plat->PlayPlatSound ("Platform"); plat->PlayPlatSound ("Platform");
break; break;
case DPlat::platPerpetualRaise: case DPlat::platPerpetualRaise:
newheight = sec->FindLowestFloorSurrounding (&spot) + lip*FRACUNIT; newheight = sec->FindLowestFloorSurrounding (&spot) + lip;
plat->m_Low = sec->floorplane.PointToDist (spot, newheight); plat->m_Low = sec->floorplane.PointToDist (spot, newheight);
if (plat->m_Low < sec->floorplane.fixD()) if (plat->m_Low < sec->floorplane.fD())
plat->m_Low = sec->floorplane.fixD(); plat->m_Low = sec->floorplane.fD();
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.fixD()) if (plat->m_High > sec->floorplane.fD())
plat->m_High = sec->floorplane.fixD(); plat->m_High = sec->floorplane.fD();
plat->m_Status = pr_doplat() & 1 ? DPlat::up : DPlat::down; plat->m_Status = pr_doplat() & 1 ? DPlat::up : DPlat::down;
@ -371,26 +371,26 @@ 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.fixD(); plat->m_High = sec->floorplane.fD();
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;
case DPlat::platDownToNearestFloor: case DPlat::platDownToNearestFloor:
newheight = sec->FindNextLowestFloor (&spot) + lip*FRACUNIT; newheight = sec->FindNextLowestFloor (&spot) + lip;
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.fixD(); plat->m_High = sec->floorplane.fD();
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.fixD(); plat->m_High = sec->floorplane.fD();
if (plat->m_Low < sec->floorplane.fixD()) if (plat->m_Low < sec->floorplane.fD())
plat->m_Low = sec->floorplane.fixD(); plat->m_Low = sec->floorplane.fD();
plat->m_Status = DPlat::down; plat->m_Status = DPlat::down;
plat->PlayPlatSound ("Platform"); plat->PlayPlatSound ("Platform");

View file

@ -183,8 +183,8 @@ void DScroller::Tick ()
if (m_Control != -1) if (m_Control != -1)
{ // compute scroll amounts based on a sector's height changes { // compute scroll amounts based on a sector's height changes
double height = sectors[m_Control].CenterFloorF () + double height = sectors[m_Control].CenterFloor () +
sectors[m_Control].CenterCeilingF (); sectors[m_Control].CenterCeiling ();
double delta = height - m_LastHeight; double delta = height - m_LastHeight;
m_LastHeight = height; m_LastHeight = height;
dx *= delta; dx *= delta;
@ -277,7 +277,7 @@ DScroller::DScroller (EScroll type, double dx, double dy,
m_vdx = m_vdy = 0; m_vdx = m_vdy = 0;
if ((m_Control = control) != -1) if ((m_Control = control) != -1)
m_LastHeight = m_LastHeight =
sectors[control].CenterFloorF () + sectors[control].CenterCeilingF (); sectors[control].CenterFloor () + sectors[control].CenterCeiling ();
m_Affectee = affectee; m_Affectee = affectee;
m_Interpolations[0] = m_Interpolations[1] = m_Interpolations[2] = NULL; m_Interpolations[0] = m_Interpolations[1] = m_Interpolations[2] = NULL;

View file

@ -63,19 +63,19 @@ sector_t *sector_t::NextSpecialSector (int type, sector_t *nogood) const
// P_FindLowestFloorSurrounding() // P_FindLowestFloorSurrounding()
// FIND LOWEST FLOOR HEIGHT IN SURROUNDING SECTORS // FIND LOWEST FLOOR HEIGHT IN SURROUNDING SECTORS
// //
fixed_t sector_t::FindLowestFloorSurrounding (vertex_t **v) const double sector_t::FindLowestFloorSurrounding (vertex_t **v) const
{ {
int i; int i;
sector_t *other; sector_t *other;
line_t *check; line_t *check;
fixed_t floor; double floor;
fixed_t ofloor; double ofloor;
vertex_t *spot; vertex_t *spot;
if (linecount == 0) return GetPlaneTexZ(sector_t::floor); if (linecount == 0) return GetPlaneTexZF(sector_t::floor);
spot = lines[0]->v1; spot = lines[0]->v1;
floor = floorplane.ZatPoint (spot); floor = floorplane.ZatPoint(spot);
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)
{ {
@ -107,19 +107,19 @@ fixed_t sector_t::FindLowestFloorSurrounding (vertex_t **v) const
// P_FindHighestFloorSurrounding() // P_FindHighestFloorSurrounding()
// FIND HIGHEST FLOOR HEIGHT IN SURROUNDING SECTORS // FIND HIGHEST FLOOR HEIGHT IN SURROUNDING SECTORS
// //
fixed_t sector_t::FindHighestFloorSurrounding (vertex_t **v) const double sector_t::FindHighestFloorSurrounding (vertex_t **v) const
{ {
int i; int i;
line_t *check; line_t *check;
sector_t *other; sector_t *other;
fixed_t floor; double floor;
fixed_t ofloor; double ofloor;
vertex_t *spot; vertex_t *spot;
if (linecount == 0) return GetPlaneTexZ(sector_t::floor); if (linecount == 0) return GetPlaneTexZF(sector_t::floor);
spot = lines[0]->v1; spot = lines[0]->v1;
floor = FIXED_MIN; floor = -FLT_MAX;
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)
{ {
@ -157,21 +157,21 @@ fixed_t sector_t::FindHighestFloorSurrounding (vertex_t **v) const
// //
// Rewritten by Lee Killough to avoid fixed array and to be faster // Rewritten by Lee Killough to avoid fixed array and to be faster
// //
fixed_t sector_t::FindNextHighestFloor (vertex_t **v) const double sector_t::FindNextHighestFloor (vertex_t **v) const
{ {
fixed_t height; double height;
fixed_t heightdiff; double heightdiff;
fixed_t ofloor, floor; double ofloor, floor;
sector_t *other; sector_t *other;
vertex_t *spot; vertex_t *spot;
line_t *check; line_t *check;
int i; int i;
if (linecount == 0) return GetPlaneTexZ(sector_t::floor); if (linecount == 0) return GetPlaneTexZF(sector_t::floor);
spot = lines[0]->v1; spot = lines[0]->v1;
height = floorplane.ZatPoint (spot); height = floorplane.ZatPoint(spot);
heightdiff = FIXED_MAX; heightdiff = FLT_MAX;
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)
{ {
@ -212,21 +212,21 @@ fixed_t sector_t::FindNextHighestFloor (vertex_t **v) const
// //
// jff 02/03/98 Twiddled Lee's P_FindNextHighestFloor to make this // jff 02/03/98 Twiddled Lee's P_FindNextHighestFloor to make this
// //
fixed_t sector_t::FindNextLowestFloor (vertex_t **v) const double sector_t::FindNextLowestFloor (vertex_t **v) const
{ {
fixed_t height; double height;
fixed_t heightdiff; double heightdiff;
fixed_t ofloor, floor; double ofloor, floor;
sector_t *other; sector_t *other;
vertex_t *spot; vertex_t *spot;
line_t *check; line_t *check;
int i; int i;
if (linecount == 0) return GetPlaneTexZ(sector_t::floor); if (linecount == 0) return GetPlaneTexZF(sector_t::floor);
spot = lines[0]->v1; spot = lines[0]->v1;
height = floorplane.ZatPoint (spot); height = floorplane.ZatPoint (spot);
heightdiff = FIXED_MAX; heightdiff = FLT_MAX;
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)
{ {
@ -242,7 +242,7 @@ fixed_t sector_t::FindNextLowestFloor (vertex_t **v) const
spot = check->v1; spot = check->v1;
} }
ofloor = other->floorplane.ZatPoint (check->v2); ofloor = other->floorplane.ZatPoint (check->v2);
floor = floorplane.ZatPoint (check->v2); floor = floorplane.ZatPoint(check->v2);
if (ofloor < floor && floor - ofloor < heightdiff && !IsLinked(other, false)) if (ofloor < floor && floor - ofloor < heightdiff && !IsLinked(other, false))
{ {
heightdiff = floor - ofloor; heightdiff = floor - ofloor;
@ -266,38 +266,38 @@ fixed_t sector_t::FindNextLowestFloor (vertex_t **v) const
// //
// jff 02/03/98 Twiddled Lee's P_FindNextHighestFloor to make this // jff 02/03/98 Twiddled Lee's P_FindNextHighestFloor to make this
// //
fixed_t sector_t::FindNextLowestCeiling (vertex_t **v) const double sector_t::FindNextLowestCeiling (vertex_t **v) const
{ {
fixed_t height; double height;
fixed_t heightdiff; double heightdiff;
fixed_t oceil, ceil; double oceil, ceil;
sector_t *other; sector_t *other;
vertex_t *spot; vertex_t *spot;
line_t *check; line_t *check;
int i; int i;
if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling);
spot = lines[0]->v1; spot = lines[0]->v1;
height = ceilingplane.ZatPoint (spot); height = ceilingplane.ZatPoint(spot);
heightdiff = FIXED_MAX; heightdiff = FLT_MAX;
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)
{ {
check = lines[i]; check = lines[i];
if (NULL != (other = getNextSector (check, this))) if (NULL != (other = getNextSector (check, this)))
{ {
oceil = other->ceilingplane.ZatPoint (check->v1); oceil = other->ceilingplane.ZatPoint(check->v1);
ceil = ceilingplane.ZatPoint (check->v1); ceil = ceilingplane.ZatPoint(check->v1);
if (oceil < ceil && ceil - oceil < heightdiff && !IsLinked(other, true)) if (oceil < ceil && ceil - oceil < heightdiff && !IsLinked(other, true))
{ {
heightdiff = ceil - oceil; heightdiff = ceil - oceil;
height = oceil; height = oceil;
spot = check->v1; spot = check->v1;
} }
oceil = other->ceilingplane.ZatPoint (check->v2); oceil = other->ceilingplane.ZatPoint(check->v2);
ceil = ceilingplane.ZatPoint (check->v2); ceil = ceilingplane.ZatPoint(check->v2);
if (oceil < ceil && ceil - oceil < heightdiff && !IsLinked(other, true)) if (oceil < ceil && ceil - oceil < heightdiff && !IsLinked(other, true))
{ {
heightdiff = ceil - oceil; heightdiff = ceil - oceil;
@ -321,37 +321,37 @@ fixed_t sector_t::FindNextLowestCeiling (vertex_t **v) const
// //
// jff 02/03/98 Twiddled Lee's P_FindNextHighestFloor to make this // jff 02/03/98 Twiddled Lee's P_FindNextHighestFloor to make this
// //
fixed_t sector_t::FindNextHighestCeiling (vertex_t **v) const double sector_t::FindNextHighestCeiling (vertex_t **v) const
{ {
fixed_t height; double height;
fixed_t heightdiff; double heightdiff;
fixed_t oceil, ceil; double oceil, ceil;
sector_t *other; sector_t *other;
vertex_t *spot; vertex_t *spot;
line_t *check; line_t *check;
int i; int i;
if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling);
spot = lines[0]->v1; spot = lines[0]->v1;
height = ceilingplane.ZatPoint (spot); height = ceilingplane.ZatPoint(spot);
heightdiff = FIXED_MAX; heightdiff = FLT_MAX;
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)
{ {
check = lines[i]; check = lines[i];
if (NULL != (other = getNextSector (check, this))) if (NULL != (other = getNextSector (check, this)))
{ {
oceil = other->ceilingplane.ZatPoint (check->v1); oceil = other->ceilingplane.ZatPoint(check->v1);
ceil = ceilingplane.ZatPoint (check->v1); ceil = ceilingplane.ZatPoint(check->v1);
if (oceil > ceil && oceil - ceil < heightdiff && !IsLinked(other, true)) if (oceil > ceil && oceil - ceil < heightdiff && !IsLinked(other, true))
{ {
heightdiff = oceil - ceil; heightdiff = oceil - ceil;
height = oceil; height = oceil;
spot = check->v1; spot = check->v1;
} }
oceil = other->ceilingplane.ZatPoint (check->v2); oceil = other->ceilingplane.ZatPoint(check->v2);
ceil = ceilingplane.ZatPoint (check->v2); ceil = ceilingplane.ZatPoint(check->v2);
if (oceil > ceil && oceil - ceil < heightdiff && !IsLinked(other, true)) if (oceil > ceil && oceil - ceil < heightdiff && !IsLinked(other, true))
{ {
heightdiff = oceil - ceil; heightdiff = oceil - ceil;
@ -368,32 +368,32 @@ fixed_t sector_t::FindNextHighestCeiling (vertex_t **v) const
// //
// FIND LOWEST CEILING IN THE SURROUNDING SECTORS // FIND LOWEST CEILING IN THE SURROUNDING SECTORS
// //
fixed_t sector_t::FindLowestCeilingSurrounding (vertex_t **v) const double sector_t::FindLowestCeilingSurrounding (vertex_t **v) const
{ {
fixed_t height; double height;
fixed_t oceil; double oceil;
sector_t *other; sector_t *other;
vertex_t *spot; vertex_t *spot;
line_t *check; line_t *check;
int i; int i;
if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling);
spot = lines[0]->v1; spot = lines[0]->v1;
height = FIXED_MAX; height = FLT_MAX;
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)
{ {
check = lines[i]; check = lines[i];
if (NULL != (other = getNextSector (check, this))) if (NULL != (other = getNextSector (check, this)))
{ {
oceil = other->ceilingplane.ZatPoint (check->v1); oceil = other->ceilingplane.ZatPoint(check->v1);
if (oceil < height) if (oceil < height)
{ {
height = oceil; height = oceil;
spot = check->v1; spot = check->v1;
} }
oceil = other->ceilingplane.ZatPoint (check->v2); oceil = other->ceilingplane.ZatPoint(check->v2);
if (oceil < height) if (oceil < height)
{ {
height = oceil; height = oceil;
@ -410,32 +410,32 @@ fixed_t sector_t::FindLowestCeilingSurrounding (vertex_t **v) const
// //
// FIND HIGHEST CEILING IN THE SURROUNDING SECTORS // FIND HIGHEST CEILING IN THE SURROUNDING SECTORS
// //
fixed_t sector_t::FindHighestCeilingSurrounding (vertex_t **v) const double sector_t::FindHighestCeilingSurrounding (vertex_t **v) const
{ {
fixed_t height; double height;
fixed_t oceil; double oceil;
sector_t *other; sector_t *other;
vertex_t *spot; vertex_t *spot;
line_t *check; line_t *check;
int i; int i;
if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling);
spot = lines[0]->v1; spot = lines[0]->v1;
height = FIXED_MIN; height = -FLT_MAX;
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)
{ {
check = lines[i]; check = lines[i];
if (NULL != (other = getNextSector (check, this))) if (NULL != (other = getNextSector (check, this)))
{ {
oceil = other->ceilingplane.ZatPoint (check->v1); oceil = other->ceilingplane.ZatPoint(check->v1);
if (oceil > height) if (oceil > height)
{ {
height = oceil; height = oceil;
spot = check->v1; spot = check->v1;
} }
oceil = other->ceilingplane.ZatPoint (check->v2); oceil = other->ceilingplane.ZatPoint(check->v2);
if (oceil > height) if (oceil > height)
{ {
height = oceil; height = oceil;
@ -457,14 +457,14 @@ fixed_t sector_t::FindHighestCeilingSurrounding (vertex_t **v) const
// jff 02/03/98 Add routine to find shortest lower texture // jff 02/03/98 Add routine to find shortest lower texture
// //
static inline void CheckShortestTex (FTextureID texnum, fixed_t &minsize) static inline void CheckShortestTex (FTextureID texnum, double &minsize)
{ {
if (texnum.isValid() || (texnum.isNull() && (i_compatflags & COMPATF_SHORTTEX))) if (texnum.isValid() || (texnum.isNull() && (i_compatflags & COMPATF_SHORTTEX)))
{ {
FTexture *tex = TexMan[texnum]; FTexture *tex = TexMan[texnum];
if (tex != NULL) if (tex != NULL)
{ {
fixed_t h = tex->GetScaledHeight()<<FRACBITS; double h = tex->GetScaledHeight();
if (h < minsize) if (h < minsize)
{ {
minsize = h; minsize = h;
@ -473,9 +473,9 @@ static inline void CheckShortestTex (FTextureID texnum, fixed_t &minsize)
} }
} }
fixed_t sector_t::FindShortestTextureAround () const double sector_t::FindShortestTextureAround () const
{ {
fixed_t minsize = FIXED_MAX; double minsize = FLT_MAX;
for (int i = 0; i < linecount; i++) for (int i = 0; i < linecount; i++)
{ {
@ -485,7 +485,7 @@ fixed_t sector_t::FindShortestTextureAround () const
CheckShortestTex (lines[i]->sidedef[1]->GetTexture(side_t::bottom), minsize); CheckShortestTex (lines[i]->sidedef[1]->GetTexture(side_t::bottom), minsize);
} }
} }
return minsize < FIXED_MAX ? minsize : TexMan[0]->GetHeight() * FRACUNIT; return minsize < FLT_MAX ? minsize : TexMan[0]->GetHeight();
} }
@ -499,9 +499,9 @@ fixed_t sector_t::FindShortestTextureAround () const
// //
// jff 03/20/98 Add routine to find shortest upper texture // jff 03/20/98 Add routine to find shortest upper texture
// //
fixed_t sector_t::FindShortestUpperAround () const double sector_t::FindShortestUpperAround () const
{ {
fixed_t minsize = FIXED_MAX; double minsize = FLT_MAX;
for (int i = 0; i < linecount; i++) for (int i = 0; i < linecount; i++)
{ {
@ -511,7 +511,7 @@ fixed_t sector_t::FindShortestUpperAround () const
CheckShortestTex (lines[i]->sidedef[1]->GetTexture(side_t::top), minsize); CheckShortestTex (lines[i]->sidedef[1]->GetTexture(side_t::top), minsize);
} }
} }
return minsize < FIXED_MAX ? minsize : TexMan[0]->GetHeight() * FRACUNIT; return minsize < FLT_MAX ? minsize : TexMan[0]->GetHeight();
} }
@ -529,7 +529,7 @@ fixed_t sector_t::FindShortestUpperAround () const
// jff 3/14/98 change first parameter to plain height to allow call // jff 3/14/98 change first parameter to plain height to allow call
// from routine not using floormove_t // from routine not using floormove_t
// //
sector_t *sector_t::FindModelFloorSector (fixed_t floordestheight) const sector_t *sector_t::FindModelFloorSector (double floordestheight) const
{ {
int i; int i;
sector_t *sec; sector_t *sec;
@ -540,8 +540,8 @@ sector_t *sector_t::FindModelFloorSector (fixed_t floordestheight) const
{ {
sec = getNextSector (lines[i], this); sec = getNextSector (lines[i], this);
if (sec != NULL && if (sec != NULL &&
(sec->floorplane.ZatPoint (lines[i]->v1) == floordestheight || (sec->floorplane.ZatPoint(lines[i]->v1) == floordestheight ||
sec->floorplane.ZatPoint (lines[i]->v2) == floordestheight)) sec->floorplane.ZatPoint(lines[i]->v2) == floordestheight))
{ {
return sec; return sec;
} }
@ -565,7 +565,7 @@ sector_t *sector_t::FindModelFloorSector (fixed_t floordestheight) const
// jff 3/14/98 change first parameter to plain height to allow call // jff 3/14/98 change first parameter to plain height to allow call
// from routine not using ceiling_t // from routine not using ceiling_t
// //
sector_t *sector_t::FindModelCeilingSector (fixed_t floordestheight) const sector_t *sector_t::FindModelCeilingSector (double floordestheight) const
{ {
int i; int i;
sector_t *sec; sector_t *sec;
@ -576,8 +576,8 @@ sector_t *sector_t::FindModelCeilingSector (fixed_t floordestheight) const
{ {
sec = getNextSector (lines[i], this); sec = getNextSector (lines[i], this);
if (sec != NULL && if (sec != NULL &&
(sec->ceilingplane.ZatPoint (lines[i]->v1) == floordestheight || (sec->ceilingplane.ZatPoint(lines[i]->v1) == floordestheight ||
sec->ceilingplane.ZatPoint (lines[i]->v2) == floordestheight)) sec->ceilingplane.ZatPoint(lines[i]->v2) == floordestheight))
{ {
return sec; return sec;
} }
@ -609,12 +609,12 @@ int sector_t::FindMinSurroundingLight (int min) const
// //
// Find the highest point on the floor of the sector // Find the highest point on the floor of the sector
// //
fixed_t sector_t::FindHighestFloorPoint (vertex_t **v) const double sector_t::FindHighestFloorPoint (vertex_t **v) const
{ {
int i; int i;
line_t *line; line_t *line;
fixed_t height = FIXED_MIN; double height = -FLT_MAX;
fixed_t probeheight; double probeheight;
vertex_t *spot = NULL; vertex_t *spot = NULL;
if (!floorplane.isSlope()) if (!floorplane.isSlope())
@ -624,19 +624,19 @@ fixed_t sector_t::FindHighestFloorPoint (vertex_t **v) const
if (linecount == 0) *v = &vertexes[0]; if (linecount == 0) *v = &vertexes[0];
else *v = lines[0]->v1; else *v = lines[0]->v1;
} }
return floorplane.Zat0(); return floorplane.fD();
} }
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)
{ {
line = lines[i]; line = lines[i];
probeheight = floorplane.ZatPoint (line->v1); probeheight = floorplane.ZatPoint(line->v1);
if (probeheight > height) if (probeheight > height)
{ {
height = probeheight; height = probeheight;
spot = line->v1; spot = line->v1;
} }
probeheight = floorplane.ZatPoint (line->v2); probeheight = floorplane.ZatPoint(line->v2);
if (probeheight > height) if (probeheight > height)
{ {
height = probeheight; height = probeheight;
@ -651,12 +651,12 @@ fixed_t sector_t::FindHighestFloorPoint (vertex_t **v) const
// //
// Find the lowest point on the ceiling of the sector // Find the lowest point on the ceiling of the sector
// //
fixed_t sector_t::FindLowestCeilingPoint (vertex_t **v) const double sector_t::FindLowestCeilingPoint (vertex_t **v) const
{ {
int i; int i;
line_t *line; line_t *line;
fixed_t height = FIXED_MAX; double height = FLT_MAX;
fixed_t probeheight; double probeheight;
vertex_t *spot = NULL; vertex_t *spot = NULL;
if (!ceilingplane.isSlope()) if (!ceilingplane.isSlope())
@ -666,19 +666,19 @@ fixed_t sector_t::FindLowestCeilingPoint (vertex_t **v) const
if (linecount == 0) *v = &vertexes[0]; if (linecount == 0) *v = &vertexes[0];
else *v = lines[0]->v1; else *v = lines[0]->v1;
} }
return ceilingplane.fixD(); return ceilingplane.fD();
} }
for (i = 0; i < linecount; i++) for (i = 0; i < linecount; i++)
{ {
line = lines[i]; line = lines[i];
probeheight = ceilingplane.ZatPoint (line->v1); probeheight = ceilingplane.ZatPoint(line->v1);
if (probeheight < height) if (probeheight < height)
{ {
height = probeheight; height = probeheight;
spot = line->v1; spot = line->v1;
} }
probeheight = ceilingplane.ZatPoint (line->v2); probeheight = ceilingplane.ZatPoint(line->v2);
if (probeheight < height) if (probeheight < height)
{ {
height = probeheight; height = probeheight;

View file

@ -561,8 +561,8 @@ bool SightCheck::P_SightTraverseIntercepts ()
if ((rover->flags & FF_SOLID) == myseethrough || !(rover->flags & FF_EXISTS)) continue; if ((rover->flags & FF_SOLID) == myseethrough || !(rover->flags & FF_EXISTS)) continue;
if ((Flags & SF_IGNOREWATERBOUNDARY) && (rover->flags & FF_SOLID) == 0) continue; if ((Flags & SF_IGNOREWATERBOUNDARY) && (rover->flags & FF_SOLID) == 0) continue;
double ff_bottom = rover->bottom.plane->ZatPointF(seeingthing); double ff_bottom = rover->bottom.plane->ZatPoint(seeingthing);
double ff_top = rover->top.plane->ZatPointF(seeingthing); double ff_top = rover->top.plane->ZatPoint(seeingthing);
if (Lastztop <= ff_bottom && topz > ff_bottom && Lastzbottom <= ff_bottom && bottomz > ff_bottom) return false; if (Lastztop <= ff_bottom && topz > ff_bottom && Lastzbottom <= ff_bottom && bottomz > ff_bottom) return false;
if (Lastzbottom >= ff_top && bottomz < ff_top && Lastztop >= ff_top && topz < ff_top) return false; if (Lastzbottom >= ff_top && bottomz < ff_top && Lastztop >= ff_top && topz < ff_top) return false;
@ -849,16 +849,16 @@ sightcounts[0]++;
if (!(flags & SF_IGNOREWATERBOUNDARY)) if (!(flags & SF_IGNOREWATERBOUNDARY))
{ {
if ((s1->GetHeightSec() && if ((s1->GetHeightSec() &&
((t1->Top() <= s1->heightsec->floorplane.ZatPointF(t1) && ((t1->Top() <= s1->heightsec->floorplane.ZatPoint(t1) &&
t2->Z() >= s1->heightsec->floorplane.ZatPointF(t2)) || t2->Z() >= s1->heightsec->floorplane.ZatPoint(t2)) ||
(t1->Z() >= s1->heightsec->ceilingplane.ZatPointF(t1) && (t1->Z() >= s1->heightsec->ceilingplane.ZatPoint(t1) &&
t2->Top() <= s1->heightsec->ceilingplane.ZatPointF(t2)))) t2->Top() <= s1->heightsec->ceilingplane.ZatPoint(t2))))
|| ||
(s2->GetHeightSec() && (s2->GetHeightSec() &&
((t2->Top() <= s2->heightsec->floorplane.ZatPointF(t2) && ((t2->Top() <= s2->heightsec->floorplane.ZatPoint(t2) &&
t1->Z() >= s2->heightsec->floorplane.ZatPointF(t1)) || t1->Z() >= s2->heightsec->floorplane.ZatPoint(t1)) ||
(t2->Z() >= s2->heightsec->ceilingplane.ZatPointF(t2) && (t2->Z() >= s2->heightsec->ceilingplane.ZatPoint(t2) &&
t1->Top() <= s2->heightsec->ceilingplane.ZatPointF(t1))))) t1->Top() <= s2->heightsec->ceilingplane.ZatPoint(t1)))))
{ {
res = false; res = false;
goto done; goto done;

View file

@ -81,10 +81,10 @@ static void P_SlopeLineToPoint (int lineid, fixed_t x, fixed_t y, fixed_t z, boo
p[0] = line->v1->fX(); p[0] = line->v1->fX();
p[1] = line->v1->fY(); p[1] = line->v1->fY();
p[2] = plane->ZatPointF (line->v1); p[2] = plane->ZatPoint (line->v1);
v1[0] = line->Delta().X; v1[0] = line->Delta().X;
v1[1] = line->Delta().Y; v1[1] = line->Delta().Y;
v1[2] = plane->ZatPointF (line->v2) - p[2]; v1[2] = plane->ZatPoint (line->v2) - p[2];
v2[0] = FIXED2DBL (x) - p[0]; v2[0] = FIXED2DBL (x) - p[0];
v2[1] = FIXED2DBL (y) - p[1]; v2[1] = FIXED2DBL (y) - p[1];
v2[2] = FIXED2DBL (z) - p[2]; v2[2] = FIXED2DBL (z) - p[2];

View file

@ -453,7 +453,7 @@ static void DoSectorDamage(AActor *actor, sector_t *sec, int amount, FName type,
if (!(flags & DAMAGE_PLAYERS) && actor->player != NULL) if (!(flags & DAMAGE_PLAYERS) && actor->player != NULL)
return; return;
if (!(flags & DAMAGE_IN_AIR) && !actor->isAtZ(sec->floorplane.ZatPointF(actor)) && !actor->waterlevel) if (!(flags & DAMAGE_IN_AIR) && !actor->isAtZ(sec->floorplane.ZatPoint(actor)) && !actor->waterlevel)
return; return;
if (protectClass != NULL) if (protectClass != NULL)
@ -490,8 +490,8 @@ void P_SectorDamage(int tag, int amount, FName type, PClassActor *protectClass,
{ {
next = actor->snext; next = actor->snext;
// Only affect actors touching the 3D floor // Only affect actors touching the 3D floor
double z1 = sec->floorplane.ZatPointF(actor); double z1 = sec->floorplane.ZatPoint(actor);
double z2 = sec->ceilingplane.ZatPointF(actor); double z2 = sec->ceilingplane.ZatPoint(actor);
if (z2 < z1) if (z2 < z1)
{ {
// Account for Vavoom-style 3D floors // Account for Vavoom-style 3D floors

View file

@ -357,9 +357,9 @@ public:
protected: protected:
DPlat (sector_t *sector); DPlat (sector_t *sector);
fixed_t m_Speed; double m_Speed;
fixed_t m_Low; double m_Low;
fixed_t m_High; double m_High;
int m_Wait; int m_Wait;
int m_Count; int m_Count;
EPlatState m_Status; EPlatState m_Status;
@ -376,13 +376,13 @@ private:
DPlat (); DPlat ();
friend bool EV_DoPlat (int tag, line_t *line, EPlatType type, friend bool EV_DoPlat (int tag, line_t *line, EPlatType type,
int height, int speed, int delay, int lip, int change); double height, double speed, int delay, int lip, int change);
friend void EV_StopPlat (int tag); friend void EV_StopPlat (int tag);
friend void P_ActivateInStasis (int tag); friend void P_ActivateInStasis (int tag);
}; };
bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type,
int height, int speed, int delay, int lip, int change); double height, double speed, int delay, int lip, int change);
void EV_StopPlat (int tag); void EV_StopPlat (int tag);
void P_ActivateInStasis (int tag); void P_ActivateInStasis (int tag);
@ -403,8 +403,8 @@ public:
}; };
DPillar (sector_t *sector, EPillar type, fixed_t speed, fixed_t height, DPillar (sector_t *sector, EPillar type, double speed, double height,
fixed_t height2, int crush, bool hexencrush); double height2, int crush, bool hexencrush);
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Tick (); void Tick ();
@ -412,10 +412,10 @@ public:
protected: protected:
EPillar m_Type; EPillar m_Type;
fixed_t m_FloorSpeed; double m_FloorSpeed;
fixed_t m_CeilingSpeed; double m_CeilingSpeed;
fixed_t m_FloorTarget; double m_FloorTarget;
fixed_t m_CeilingTarget; double m_CeilingTarget;
int m_Crush; int m_Crush;
bool m_Hexencrush; bool m_Hexencrush;
TObjPtr<DInterpolation> m_Interp_Ceiling; TObjPtr<DInterpolation> m_Interp_Ceiling;
@ -426,7 +426,7 @@ private:
}; };
bool EV_DoPillar (DPillar::EPillar type, line_t *line, int tag, bool EV_DoPillar (DPillar::EPillar type, line_t *line, int tag,
fixed_t speed, fixed_t height, fixed_t height2, int crush, bool hexencrush); double speed, double height, double height2, int crush, bool hexencrush);
// //
// P_DOORS // P_DOORS
@ -446,16 +446,16 @@ public:
}; };
DDoor (sector_t *sector); DDoor (sector_t *sector);
DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTag, int topcountdown); DDoor (sector_t *sec, EVlDoor type, double speed, int delay, int lightTag, int topcountdown);
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Tick (); void Tick ();
protected: protected:
EVlDoor m_Type; EVlDoor m_Type;
fixed_t m_TopDist; double m_TopDist;
fixed_t m_BotDist, m_OldFloorDist; double m_BotDist, m_OldFloorDist;
vertex_t *m_BotSpot; vertex_t *m_BotSpot;
fixed_t m_Speed; double m_Speed;
// 1 = up, 0 = waiting at top, -1 = down // 1 = up, 0 = waiting at top, -1 = down
int m_Direction; int m_Direction;
@ -471,7 +471,7 @@ protected:
void DoorSound (bool raise, class DSeqNode *curseq=NULL) const; void DoorSound (bool raise, class DSeqNode *curseq=NULL) const;
friend bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, friend bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing,
int tag, int speed, int delay, int lock, int tag, double speed, int delay, int lock,
int lightTag, bool boomgen, int topcountdown); int lightTag, bool boomgen, int topcountdown);
private: private:
DDoor (); DDoor ();
@ -479,16 +479,9 @@ private:
}; };
bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing,
int tag, int speed, int delay, int lock, int tag, double speed, int delay, int lock,
int lightTag, bool boomgen = false, int topcountdown = 0); int lightTag, bool boomgen = false, int topcountdown = 0);
inline bool EV_DoDoor(DDoor::EVlDoor type, line_t *line, AActor *thing,
int tag, double speed, int delay, int lock,
int lightTag, bool boomgen = false, int topcountdown = 0)
{
return EV_DoDoor(type, line, thing, tag, FLOAT2FIXED(speed), delay, lock, lightTag, boomgen, topcountdown);
}
class DAnimatedDoor : public DMovingCeiling class DAnimatedDoor : public DMovingCeiling
{ {
@ -506,7 +499,7 @@ protected:
int m_Frame; int m_Frame;
FDoorAnimation *m_DoorAnim; FDoorAnimation *m_DoorAnim;
int m_Timer; int m_Timer;
fixed_t m_BotDist; double m_BotDist;
int m_Status; int m_Status;
enum enum
{ {
@ -575,22 +568,22 @@ public:
DCeiling (sector_t *sec); DCeiling (sector_t *sec);
DCeiling (sector_t *sec, fixed_t speed1, fixed_t speed2, int silent); DCeiling (sector_t *sec, double speed1, double speed2, int silent);
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Tick (); void Tick ();
static DCeiling *Create(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag, static DCeiling *Create(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag,
fixed_t speed, fixed_t speed2, fixed_t height, double speed, double speed2, double height,
int crush, int silent, int change, ECrushMode hexencrush); int crush, int silent, int change, ECrushMode hexencrush);
protected: protected:
ECeiling m_Type; ECeiling m_Type;
fixed_t m_BottomHeight; double m_BottomHeight;
fixed_t m_TopHeight; double m_TopHeight;
fixed_t m_Speed; double m_Speed;
fixed_t m_Speed1; // [RH] dnspeed of crushers double m_Speed1; // [RH] dnspeed of crushers
fixed_t m_Speed2; // [RH] upspeed of crushers double m_Speed2; // [RH] upspeed of crushers
int m_Crush; int m_Crush;
ECrushMode m_CrushMode; ECrushMode m_CrushMode;
int m_Silent; int m_Silent;
@ -614,23 +607,9 @@ private:
}; };
bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line,
int tag, fixed_t speed, fixed_t speed2, fixed_t height, int tag, double speed, double speed2, double height,
int crush, int silent, int change, DCeiling::ECrushMode hexencrush = DCeiling::ECrushMode::crushDoom); int crush, int silent, int change, DCeiling::ECrushMode hexencrush = DCeiling::ECrushMode::crushDoom);
inline bool EV_DoCeiling(DCeiling::ECeiling type, line_t *line,
int tag, double speed, double speed2, fixed_t height,
int crush, int silent, int change, DCeiling::ECrushMode hexencrush = DCeiling::ECrushMode::crushDoom)
{
return EV_DoCeiling(type, line, tag, FLOAT2FIXED(speed), FLOAT2FIXED(speed2), height, crush, silent, change, hexencrush);
}
inline bool EV_DoCeiling(DCeiling::ECeiling type, line_t *line,
int tag, double speed, int speed2, fixed_t height,
int crush, int silent, int change, DCeiling::ECrushMode hexencrush = DCeiling::ECrushMode::crushDoom)
{
return EV_DoCeiling(type, line, tag, FLOAT2FIXED(speed), speed2, height, crush, silent, change, hexencrush);
}
bool EV_CeilingCrushStop (int tag); bool EV_CeilingCrushStop (int tag);
void P_ActivateInStasisCeiling (int tag); void P_ActivateInStasisCeiling (int tag);
@ -701,19 +680,19 @@ public:
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Tick (); void Tick ();
protected: //protected:
EFloor m_Type; EFloor m_Type;
int m_Crush; int m_Crush;
bool m_Hexencrush; bool m_Hexencrush;
int m_Direction; int m_Direction;
secspecial_t m_NewSpecial; secspecial_t m_NewSpecial;
FTextureID m_Texture; FTextureID m_Texture;
fixed_t m_FloorDestDist; double m_FloorDestDist;
fixed_t m_Speed; double m_Speed;
// [RH] New parameters used to reset and delay stairs // [RH] New parameters used to reset and delay stairs
double m_OrgDist;
int m_ResetCount; int m_ResetCount;
int m_OrgDist;
int m_Delay; int m_Delay;
int m_PauseTime; int m_PauseTime;
int m_StepTime; int m_StepTime;
@ -723,33 +702,24 @@ protected:
void SetFloorChangeType (sector_t *sec, int change); void SetFloorChangeType (sector_t *sec, int change);
friend bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, friend bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
fixed_t stairsize, fixed_t speed, int delay, int reset, int igntxt, double stairsize, double speed, int delay, int reset, int igntxt,
int usespecials); int usespecials);
friend bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, friend bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
fixed_t speed, fixed_t height, int crush, int change, bool hexencrush, bool hereticlower); double speed, double height, int crush, int change, bool hexencrush, bool hereticlower);
friend bool EV_FloorCrushStop (int tag); friend bool EV_FloorCrushStop (int tag);
friend bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed); friend bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed);
private: private:
DFloor (); DFloor ();
}; };
bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
fixed_t stairsize, fixed_t speed, int delay, int reset, int igntxt, double stairsize, double speed, int delay, int reset, int igntxt,
int usespecials); int usespecials);
bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, bool EV_DoFloor(DFloor::EFloor floortype, line_t *line, int tag,
fixed_t speed, fixed_t height, int crush, int change, bool hexencrush, bool hereticlower=false); double speed, double height, int crush, int change, bool hexencrush, bool hereticlower = false);
inline bool EV_DoFloor(DFloor::EFloor floortype, line_t *line, int tag,
double speed, double height, int crush, int change, bool hexencrush, bool hereticlower = false)
{
return EV_DoFloor(floortype, line, tag, FLOAT2FIXED(speed), FLOAT2FIXED(height), crush, change, hexencrush, hereticlower);
}
inline bool EV_DoFloor(DFloor::EFloor floortype, line_t *line, int tag,
double speed, int height, int crush, int change, bool hexencrush, bool hereticlower = false)
{
return EV_DoFloor(floortype, line, tag, FLOAT2FIXED(speed), height<<FRACBITS, crush, change, hexencrush, hereticlower);
}
bool EV_FloorCrushStop (int tag); bool EV_FloorCrushStop (int tag);
bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed); bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed);
class DElevator : public DMover class DElevator : public DMover
{ {
@ -775,22 +745,20 @@ public:
protected: protected:
EElevator m_Type; EElevator m_Type;
int m_Direction; int m_Direction;
fixed_t m_FloorDestDist; double m_FloorDestDist;
fixed_t m_CeilingDestDist; double m_CeilingDestDist;
fixed_t m_Speed; double m_Speed;
TObjPtr<DInterpolation> m_Interp_Ceiling; TObjPtr<DInterpolation> m_Interp_Ceiling;
TObjPtr<DInterpolation> m_Interp_Floor; TObjPtr<DInterpolation> m_Interp_Floor;
void StartFloorSound (); void StartFloorSound ();
friend bool EV_DoElevator (line_t *line, DElevator::EElevator type, fixed_t speed, friend bool EV_DoElevator (line_t *line, DElevator::EElevator type, double speed, double height, int tag);
fixed_t height, int tag);
private: private:
DElevator (); DElevator ();
}; };
bool EV_DoElevator (line_t *line, DElevator::EElevator type, fixed_t speed, bool EV_DoElevator (line_t *line, DElevator::EElevator type, double speed, double height, int tag);
fixed_t height, int tag);
class DWaggleBase : public DMover class DWaggleBase : public DMover
{ {
@ -802,12 +770,12 @@ public:
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
protected: protected:
fixed_t m_OriginalDist; double m_OriginalDist;
fixed_t m_Accumulator; double m_Accumulator;
fixed_t m_AccDelta; double m_AccDelta;
fixed_t m_TargetScale; double m_TargetScale;
fixed_t m_Scale; double m_Scale;
fixed_t m_ScaleDelta; double m_ScaleDelta;
int m_Ticker; int m_Ticker;
int m_State; int m_State;
TObjPtr<DInterpolation> m_Interpolation; TObjPtr<DInterpolation> m_Interpolation;

View file

@ -2609,7 +2609,7 @@ void P_PlayerThink (player_t *player)
P_PlayerOnSpecial3DFloor (player); P_PlayerOnSpecial3DFloor (player);
P_PlayerInSpecialSector (player); P_PlayerInSpecialSector (player);
if (!player->mo->isAbove(player->mo->Sector->floorplane.ZatPointF(player->mo)) || if (!player->mo->isAbove(player->mo->Sector->floorplane.ZatPoint(player->mo)) ||
player->mo->waterlevel) player->mo->waterlevel)
{ {
// Player must be touching the floor // Player must be touching the floor

View file

@ -1239,8 +1239,8 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
} }
// [BL] See if we hit below the floor/ceiling of the poly. // [BL] See if we hit below the floor/ceiling of the poly.
else if(!performBlockingThrust && ( else if(!performBlockingThrust && (
mobj->_f_Z() < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) || mobj->Z() < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) ||
mobj->_f_Top() > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj) mobj->Top() > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj)
)) ))
{ {
performBlockingThrust = true; performBlockingThrust = true;

View file

@ -1096,8 +1096,8 @@ void P_CreateLinkedPortals()
{ {
// This is a fatal condition. We have to remove one of the two portals. Choose the one that doesn't match the current plane // This is a fatal condition. We have to remove one of the two portals. Choose the one that doesn't match the current plane
Printf("Error in sector %d: Ceiling portal at z=%d is below floor portal at z=%d\n", i, cz, fz); Printf("Error in sector %d: Ceiling portal at z=%d is below floor portal at z=%d\n", i, cz, fz);
fixed_t cp = sectors[i].ceilingplane.Zat0(); fixed_t cp = -sectors[i].ceilingplane.fixD();
fixed_t fp = sectors[i].ceilingplane.Zat0(); fixed_t fp = -sectors[i].ceilingplane.fixD();
if (cp < fp || fz == fp) if (cp < fp || fz == fp)
{ {
sectors[i].SkyBoxes[sector_t::ceiling] = NULL; sectors[i].SkyBoxes[sector_t::ceiling] = NULL;

View file

@ -55,8 +55,8 @@ void R_3D_AddHeight(secplane_t *add, sector_t *sec)
fixed_t height; fixed_t height;
height = add->ZatPoint(viewx, viewy); height = add->ZatPoint(viewx, viewy);
if(height >= sec->CenterCeiling()) return; if(height >= sec->_f_CenterCeiling()) return;
if(height <= sec->CenterFloor()) return; if(height <= sec->_f_CenterFloor()) return;
fakeActive = 1; fakeActive = 1;

View file

@ -426,7 +426,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
tempsec->floorplane = sec->floorplane; tempsec->floorplane = sec->floorplane;
tempsec->ceilingplane = s->floorplane; tempsec->ceilingplane = s->floorplane;
tempsec->ceilingplane.FlipVert (); tempsec->ceilingplane.FlipVert ();
tempsec->ceilingplane.ChangeHeight (-1); tempsec->ceilingplane.ChangeHeight(-1 / 65536.);
tempsec->ColorMap = s->ColorMap; tempsec->ColorMap = s->ColorMap;
} }
@ -438,12 +438,12 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
tempsec->ceilingplane = s->floorplane; tempsec->ceilingplane = s->floorplane;
tempsec->ceilingplane.FlipVert (); tempsec->ceilingplane.FlipVert ();
tempsec->ceilingplane.ChangeHeight (-1); tempsec->ceilingplane.ChangeHeight (-1 / 65536.);
if (s->GetTexture(sector_t::ceiling) == skyflatnum) if (s->GetTexture(sector_t::ceiling) == skyflatnum)
{ {
tempsec->floorplane = tempsec->ceilingplane; tempsec->floorplane = tempsec->ceilingplane;
tempsec->floorplane.FlipVert (); tempsec->floorplane.FlipVert ();
tempsec->floorplane.ChangeHeight (+1); tempsec->floorplane.ChangeHeight (+1 / 65536.);
tempsec->SetTexture(sector_t::ceiling, tempsec->GetTexture(sector_t::floor), false); tempsec->SetTexture(sector_t::ceiling, tempsec->GetTexture(sector_t::floor), false);
tempsec->planes[sector_t::ceiling].xform = tempsec->planes[sector_t::floor].xform; tempsec->planes[sector_t::ceiling].xform = tempsec->planes[sector_t::floor].xform;
} }
@ -475,7 +475,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
tempsec->ceilingplane = s->ceilingplane; tempsec->ceilingplane = s->ceilingplane;
tempsec->floorplane = s->ceilingplane; tempsec->floorplane = s->ceilingplane;
tempsec->floorplane.FlipVert (); tempsec->floorplane.FlipVert ();
tempsec->floorplane.ChangeHeight (+1); tempsec->floorplane.ChangeHeight (+1 / 65536.);
tempsec->ColorMap = s->ColorMap; tempsec->ColorMap = s->ColorMap;
tempsec->ColorMap = s->ColorMap; tempsec->ColorMap = s->ColorMap;
@ -1260,14 +1260,14 @@ void R_Subsector (subsector_t *sub)
} else position = sector_t::ceiling; } else position = sector_t::ceiling;
frontsector = &tempsec; frontsector = &tempsec;
tempsec.ceilingplane.ChangeHeight(-1); tempsec.ceilingplane.ChangeHeight(-1 / 65536.);
if (fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size()) if (fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
{ {
light = P_GetPlaneLight(sub->sector, &frontsector->ceilingplane, false); light = P_GetPlaneLight(sub->sector, &frontsector->ceilingplane, false);
basecolormap = light->extra_colormap; basecolormap = light->extra_colormap;
ceilinglightlevel = *light->p_lightlevel; ceilinglightlevel = *light->p_lightlevel;
} }
tempsec.ceilingplane.ChangeHeight(1); tempsec.ceilingplane.ChangeHeight(1 / 65536.);
floorplane = NULL; floorplane = NULL;
ceilingplane = R_FindPlane(frontsector->ceilingplane, // killough 3/8/98 ceilingplane = R_FindPlane(frontsector->ceilingplane, // killough 3/8/98
@ -1345,11 +1345,11 @@ void R_Subsector (subsector_t *sub)
fakeFloor->validcount = validcount; fakeFloor->validcount = validcount;
R_3D_NewClip(); R_3D_NewClip();
} }
if (frontsector->CenterFloor() >= backsector->CenterFloor()) if (frontsector->_f_CenterFloor() >= backsector->_f_CenterFloor())
{ {
fake3D |= FAKE3D_CLIPBOTFRONT; fake3D |= FAKE3D_CLIPBOTFRONT;
} }
if (frontsector->CenterCeiling() <= backsector->CenterCeiling()) if (frontsector->_f_CenterCeiling() <= backsector->_f_CenterCeiling())
{ {
fake3D |= FAKE3D_CLIPTOPFRONT; fake3D |= FAKE3D_CLIPTOPFRONT;
} }

View file

@ -357,6 +357,10 @@ public:
{ {
return FIXED2DBL(d); return FIXED2DBL(d);
} }
double fiC() const
{
return FIXED2DBL(ic);
}
bool isSlope() const bool isSlope() const
{ {
@ -390,11 +394,6 @@ public:
return FixedMul(ic, -d - DMulScale16(a, spot.x, b, spot.y)); return FixedMul(ic, -d - DMulScale16(a, spot.x, b, spot.y));
} }
double ZatPointF(const fixedvec3 &spot) const
{
return FIXED2DBL(FixedMul(ic, -d - DMulScale16(a, spot.x, b, spot.y)));
}
// Returns the value of z at (x,y) // Returns the value of z at (x,y)
fixed_t ZatPoint (fixed_t x, fixed_t y) const fixed_t ZatPoint (fixed_t x, fixed_t y) const
{ {
@ -412,39 +411,21 @@ public:
return (d + a*pos.X + b*pos.Y) * ic / (-65536.0 * 65536.0); return (d + a*pos.X + b*pos.Y) * ic / (-65536.0 * 65536.0);
} }
// Returns the value of z at vertex v double ZatPoint(const vertex_t *v) const
fixed_t ZatPoint (const vertex_t *v) const
{
return FixedMul (ic, -d - DMulScale16 (a, v->fixX(), b, v->fixY()));
}
double ZatPointF(const vertex_t *v) const
{ {
return FIXED2DBL(FixedMul(ic, -d - DMulScale16(a, v->fixX(), b, v->fixY()))); return FIXED2DBL(FixedMul(ic, -d - DMulScale16(a, v->fixX(), b, v->fixY())));
} }
fixed_t ZatPoint (const AActor *ac) const double ZatPoint(const AActor *ac) const
{
return FixedMul (ic, -d - DMulScale16 (a, ac->_f_X(), b, ac->_f_Y()));
}
double ZatPointF(const AActor *ac) const
{ {
return (d + a*ac->X() + b*ac->Y()) * ic / (-65536.0 * 65536.0); return (d + a*ac->X() + b*ac->Y()) * ic / (-65536.0 * 65536.0);
} }
// Returns the value of z at (x,y) if d is equal to dist
fixed_t ZatPointDist (fixed_t x, fixed_t y, fixed_t dist) const
{
return FixedMul (ic, -dist - DMulScale16 (a, x, b, y));
}
// Returns the value of z at vertex v if d is equal to dist // Returns the value of z at vertex v if d is equal to dist
fixed_t ZatPointDist (const vertex_t *v, fixed_t dist) double ZatPointDist(const vertex_t *v, double dist)
{ {
return FixedMul (ic, -dist - DMulScale16 (a, v->fixX(), b, v->fixY())); return FIXED2DBL(FixedMul(ic, -FLOAT2FIXED(dist) - DMulScale16(a, v->fixX(), b, v->fixY())));
} }
// Flips the plane's vertical orientiation, so that if it pointed up, // Flips the plane's vertical orientiation, so that if it pointed up,
// it will point down, and vice versa. // it will point down, and vice versa.
void FlipVert () void FlipVert ()
@ -469,15 +450,15 @@ public:
} }
// Moves a plane up/down by hdiff units // Moves a plane up/down by hdiff units
void ChangeHeight (fixed_t hdiff) void ChangeHeight(double hdiff)
{ {
d = d - FixedMul (hdiff, c); d = d - fixed_t(hdiff * c);
} }
// Moves a plane up/down by hdiff units // Moves a plane up/down by hdiff units
fixed_t GetChangedHeight (fixed_t hdiff) double GetChangedHeight(double hdiff)
{ {
return d - FixedMul (hdiff, c); return fD() - hdiff * fC();
} }
// Returns how much this plane's height would change if d were set to oldd // Returns how much this plane's height would change if d were set to oldd
@ -487,9 +468,15 @@ public:
} }
// Returns how much this plane's height would change if d were set to oldd // Returns how much this plane's height would change if d were set to oldd
fixed_t HeightDiff (fixed_t oldd, fixed_t newd) const double HeightDiff(double oldd) const
{ {
return FixedMul (oldd - newd, ic); return (oldd - fD()) * fiC();
}
// Returns how much this plane's height would change if d were set to oldd
double HeightDiff(double oldd, double newd) const
{
return (oldd - newd) * fiC();
} }
fixed_t PointToDist (fixed_t x, fixed_t y, fixed_t z) const fixed_t PointToDist (fixed_t x, fixed_t y, fixed_t z) const
@ -507,6 +494,16 @@ public:
return -TMulScale16 (a, v->fixX(), b, v->fixY(), z, c); return -TMulScale16 (a, v->fixX(), b, v->fixY(), z, c);
} }
double PointToDist(const DVector2 &xy, double z) const
{
return -(a * xy.X + b * xy.Y + c * z) / 65536.;
}
double PointToDist(const vertex_t *v, double z) const
{
return -(a * v->fX() + b * v->fY() + c * z) / 65536.;
}
void SetAtHeight(fixed_t height, int ceiling) void SetAtHeight(fixed_t height, int ceiling)
{ {
a = b = 0; a = b = 0;
@ -684,22 +681,23 @@ struct sector_t
{ {
// Member functions // Member functions
bool IsLinked(sector_t *other, bool ceiling) const; bool IsLinked(sector_t *other, bool ceiling) const;
fixed_t FindLowestFloorSurrounding (vertex_t **v) const; double FindLowestFloorSurrounding(vertex_t **v) const;
fixed_t FindHighestFloorSurrounding (vertex_t **v) const; double FindHighestFloorSurrounding(vertex_t **v) const;
fixed_t FindNextHighestFloor (vertex_t **v) const; double FindNextHighestFloor(vertex_t **v) const;
fixed_t FindNextLowestFloor (vertex_t **v) const; double FindNextLowestFloor(vertex_t **v) const;
fixed_t FindLowestCeilingSurrounding (vertex_t **v) const; // jff 2/04/98 double FindLowestCeilingSurrounding(vertex_t **v) const; // jff 2/04/98
fixed_t FindHighestCeilingSurrounding (vertex_t **v) const; // jff 2/04/98 double FindHighestCeilingSurrounding(vertex_t **v) const; // jff 2/04/98
fixed_t FindNextLowestCeiling (vertex_t **v) const; // jff 2/04/98 double FindNextLowestCeiling(vertex_t **v) const; // jff 2/04/98
fixed_t FindNextHighestCeiling (vertex_t **v) const; // jff 2/04/98 double FindNextHighestCeiling(vertex_t **v) const; // jff 2/04/98
fixed_t FindShortestTextureAround () const; // jff 2/04/98 double FindShortestTextureAround() const; // jff 2/04/98
fixed_t FindShortestUpperAround () const; // jff 2/04/98 double FindShortestUpperAround() const; // jff 2/04/98
sector_t *FindModelFloorSector (fixed_t floordestheight) const; // jff 2/04/98 sector_t *FindModelFloorSector(double floordestheight) const; // jff 2/04/98
sector_t *FindModelCeilingSector (fixed_t floordestheight) const; // jff 2/04/98 sector_t *FindModelCeilingSector(double floordestheight) const; // jff 2/04/98
int FindMinSurroundingLight (int max) const; int FindMinSurroundingLight (int max) const;
sector_t *NextSpecialSector (int type, sector_t *prev) const; // [RH] sector_t *NextSpecialSector (int type, sector_t *prev) const; // [RH]
fixed_t FindLowestCeilingPoint (vertex_t **v) const; double FindLowestCeilingPoint(vertex_t **v) const;
fixed_t FindHighestFloorPoint (vertex_t **v) const; double FindHighestFloorPoint(vertex_t **v) const;
void AdjustFloorClip () const; void AdjustFloorClip () const;
void SetColor(int r, int g, int b, int desat); void SetColor(int r, int g, int b, int desat);
void SetFade(int r, int g, int b); void SetFade(int r, int g, int b);
@ -1088,10 +1086,10 @@ struct sector_t
} }
// Member variables // Member variables
fixed_t CenterFloor () const { return floorplane.ZatPoint (_f_centerspot()); } fixed_t _f_CenterFloor () const { return floorplane.ZatPoint (_f_centerspot()); }
fixed_t CenterCeiling () const { return ceilingplane.ZatPoint (_f_centerspot()); } fixed_t _f_CenterCeiling () const { return ceilingplane.ZatPoint (_f_centerspot()); }
double CenterFloorF() const { return floorplane.ZatPoint(centerspot); } double CenterFloor() const { return floorplane.ZatPoint(centerspot); }
double CenterCeilingF() const { return ceilingplane.ZatPoint(centerspot); } double CenterCeiling() const { return ceilingplane.ZatPoint(centerspot); }
// [RH] store floor and ceiling planes instead of heights // [RH] store floor and ceiling planes instead of heights
secplane_t floorplane, ceilingplane; secplane_t floorplane, ceilingplane;
@ -1335,6 +1333,12 @@ struct side_t
{ {
textures[which].yscale = scale == 0 ? FRACUNIT : scale; textures[which].yscale = scale == 0 ? FRACUNIT : scale;
} }
void SetTextureYScale(int which, double scale)
{
textures[which].yscale = scale == 0 ? FRACUNIT : FLOAT2FIXED(scale);
}
void SetTextureYScale(fixed_t scale) void SetTextureYScale(fixed_t scale)
{ {
textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale == 0 ? FRACUNIT : scale; textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale == 0 ? FRACUNIT : scale;
@ -1416,6 +1420,11 @@ public:
dy = FLOAT2FIXED(y); dy = FLOAT2FIXED(y);
} }
void setAlpha(double a)
{
Alpha = FLOAT2FIXED(a);
}
FLinePortal *getPortal() const FLinePortal *getPortal() const
{ {
return portalindex >= linePortals.Size() ? (FLinePortal*)NULL : &linePortals[portalindex]; return portalindex >= linePortals.Size() ? (FLinePortal*)NULL : &linePortals[portalindex];

View file

@ -687,16 +687,16 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2)
frontsector = sec; frontsector = sec;
} }
floorheight = backsector->CenterFloor(); floorheight = backsector->_f_CenterFloor();
ceilingheight = backsector->CenterCeiling(); ceilingheight = backsector->_f_CenterCeiling();
// maybe fix clipheights // maybe fix clipheights
if (!(fake3D & FAKE3D_CLIPBOTTOM)) sclipBottom = floorheight; if (!(fake3D & FAKE3D_CLIPBOTTOM)) sclipBottom = floorheight;
if (!(fake3D & FAKE3D_CLIPTOP)) sclipTop = ceilingheight; if (!(fake3D & FAKE3D_CLIPTOP)) sclipTop = ceilingheight;
// maybe not visible // maybe not visible
if (sclipBottom >= frontsector->CenterCeiling()) return; if (sclipBottom >= frontsector->_f_CenterCeiling()) return;
if (sclipTop <= frontsector->CenterFloor()) return; if (sclipTop <= frontsector->_f_CenterFloor()) return;
if (fake3D & FAKE3D_DOWN2UP) if (fake3D & FAKE3D_DOWN2UP)
{ // bottom to viewz { // bottom to viewz
@ -2266,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.fixC() < 0) // 3D floors have the floor backwards if (frontsector->floorplane.fC() < 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;
@ -2274,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.fixC() > 0) // 3D floors have the ceiling backwards if (frontsector->ceilingplane.fC() > 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;