From 77f2530236c11476b3813aa416d13991f6fbe2eb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 30 Mar 2016 09:41:46 +0200 Subject: [PATCH] - floatified the sector plane movers and removed some of the ZatPoint conversion cruft. --- src/b_func.cpp | 8 +- src/compatibility.cpp | 8 +- src/dsectoreffect.cpp | 24 ++--- src/dsectoreffect.h | 29 +++-- src/edata.cpp | 8 +- src/fragglescript/t_func.cpp | 66 ++++++------ src/g_heretic/a_hereticweaps.cpp | 6 +- src/g_strife/a_strifestuff.cpp | 2 +- src/g_strife/a_thingstoblowup.cpp | 6 +- src/p_3dfloors.cpp | 10 +- src/p_3dmidtex.cpp | 2 +- src/p_3dmidtex.h | 4 +- src/p_acs.cpp | 14 +-- src/p_ceiling.cpp | 18 ++-- src/p_doors.cpp | 54 +++++----- src/p_floor.cpp | 114 ++++++++++---------- src/p_linkedsectors.cpp | 6 +- src/p_lnspec.cpp | 94 ++++++++-------- src/p_local.h | 2 +- src/p_map.cpp | 16 +-- src/p_mobj.cpp | 42 ++++---- src/p_pillar.cpp | 32 +++--- src/p_plats.cpp | 60 +++++------ src/p_scroll.cpp | 6 +- src/p_sectors.cpp | 172 +++++++++++++++--------------- src/p_sight.cpp | 20 ++-- src/p_slopes.cpp | 4 +- src/p_spec.cpp | 6 +- src/p_spec.h | 132 +++++++++-------------- src/p_user.cpp | 2 +- src/po_man.cpp | 4 +- src/portal.cpp | 4 +- src/r_3dfloors.cpp | 4 +- src/r_bsp.cpp | 16 +-- src/r_defs.h | 111 ++++++++++--------- src/r_segs.cpp | 12 +-- 36 files changed, 552 insertions(+), 566 deletions(-) diff --git a/src/b_func.cpp b/src/b_func.cpp index e292fd67d0..ca9c0d7b27 100644 --- a/src/b_func.cpp +++ b/src/b_func.cpp @@ -34,13 +34,13 @@ bool DBot::Reachable (AActor *rtarget) if (player->mo == rtarget) return false; - if ((rtarget->Sector->ceilingplane.ZatPointF (rtarget) - - rtarget->Sector->floorplane.ZatPointF (rtarget)) + if ((rtarget->Sector->ceilingplane.ZatPoint (rtarget) - + rtarget->Sector->floorplane.ZatPoint (rtarget)) < player->mo->Height) //Where rtarget is, player->mo can't be. return false; 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); bool reachable = true; @@ -100,7 +100,7 @@ bool DBot::Reachable (AActor *rtarget) thing = in->d.thing; if (thing == player->mo) //Can't reach self in this case. 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; } diff --git a/src/compatibility.cpp b/src/compatibility.cpp index 8157506fd1..e7121da8b5 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -290,7 +290,7 @@ void ParseCompatibility() sc.MustGetNumber(); CompatParams.Push(sc.Number); sc.MustGetFloat(); - CompatParams.Push(FLOAT2FIXED(sc.Float)); + CompatParams.Push(int(sc.Float*65536.)); } else if (sc.Compare("setwallyscale")) { @@ -303,7 +303,7 @@ void ParseCompatibility() sc.MustGetString(); CompatParams.Push(sc.MustMatchString(WallTiers)); sc.MustGetFloat(); - CompatParams.Push(FLOAT2FIXED(sc.Float)); + CompatParams.Push(int(sc.Float*65536.)); } else if (sc.Compare("setthingz")) { @@ -522,7 +522,7 @@ void SetCompatibilityParams() { sector_t *sec = §ors[CompatParams[i+1]]; 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; break; @@ -534,7 +534,7 @@ void SetCompatibilityParams() side_t *side = lines[CompatParams[i+1]].sidedef[CompatParams[i+2]]; if (side != NULL) { - side->SetTextureYScale(CompatParams[i+3], CompatParams[i+4]); + side->SetTextureYScale(CompatParams[i+3], CompatParams[i+4] / 65536.); } } i += 5; diff --git a/src/dsectoreffect.cpp b/src/dsectoreffect.cpp index 2d0c029828..50909764f4 100644 --- a/src/dsectoreffect.cpp +++ b/src/dsectoreffect.cpp @@ -133,7 +133,7 @@ DMovingCeiling::DMovingCeiling (sector_t *sector) 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) { @@ -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) // 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) { bool flag; - fixed_t lastpos; - fixed_t movedest; - fixed_t move; - //fixed_t destheight; //jff 02/04/98 used to keep floors/ceilings + double lastpos; + double movedest; + double move; + //double destheight; //jff 02/04/98 used to keep floors/ceilings // from moving thru each other switch (floorOrCeiling) { case 0: // FLOOR - lastpos = m_Sector->floorplane.fixD(); + lastpos = m_Sector->floorplane.fD(); switch (direction) { 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 //destheight = (dest < m_Sector->ceilingheight) ? dest : m_Sector->ceilingheight; 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); @@ -282,7 +282,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, case 1: // CEILING - lastpos = m_Sector->ceilingplane.fixD(); + lastpos = m_Sector->ceilingplane.fD(); switch (direction) { 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 //destheight = (dest > m_Sector->floorheight) ? dest : m_Sector->floorheight; 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); if (movedest <= dest) diff --git a/src/dsectoreffect.h b/src/dsectoreffect.h index 9aa3ccb505..6e52d27422 100644 --- a/src/dsectoreffect.h +++ b/src/dsectoreffect.h @@ -30,26 +30,43 @@ protected: enum EResult { ok, crushed, pastdest }; TObjPtr interpolation; private: - bool MoveAttached(int crush, fixed_t move, int floorOrCeiling, bool resetfailed); - EResult MovePlane (fixed_t speed, fixed_t dest, int crush, int floorOrCeiling, int direction, bool hexencrush); + bool MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed); + EResult MovePlane (double speed, double dest, int crush, int floorOrCeiling, int direction, bool hexencrush); protected: DMover (); void Serialize (FArchive &arc); void Destroy(); 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); } - 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); } - 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); } - 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); } diff --git a/src/edata.cpp b/src/edata.cpp index da41400a8e..034c450868 100644 --- a/src/edata.cpp +++ b/src/edata.cpp @@ -105,7 +105,7 @@ struct EDLinedef int tag; int id; int args[5]; - fixed_t alpha; + double alpha; DWORD flags; DWORD activation; }; @@ -158,7 +158,7 @@ static void parseLinedef(FScanner &sc) bool argsset = false; memset(&ld, 0, sizeof(ld)); - ld.alpha = FRACUNIT; + ld.alpha = 1.; sc.MustGetStringName("{"); while (!sc.CheckString("}")) @@ -216,7 +216,7 @@ static void parseLinedef(FScanner &sc) { sc.CheckString("="); sc.MustGetFloat(); - ld.alpha = FLOAT2FIXED(sc.Float); + ld.alpha = sc.Float; } else if (sc.Compare("extflags")) { @@ -703,7 +703,7 @@ void ProcessEDLinedef(line_t *ld, int recordnum) ld->special = eld->special; ld->activation = eld->activation; ld->flags = (ld->flags&~fmask) | eld->flags; - ld->Alpha = eld->alpha; + ld->setAlpha(eld->alpha); memcpy(ld->args, eld->args, sizeof(ld->args)); tagManager.AddLineID(int(ld - lines), eld->tag); } diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 9a2522256e..163a6b73b2 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -1537,16 +1537,13 @@ void FParser::SF_StartSectorSound(void) /************* 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 { public: DFloorChanger(sector_t * 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); Destroy(); @@ -1569,8 +1566,8 @@ void FParser::SF_FloorHeight(void) { int tagnum; int secnum; - fixed_t dest; - int returnval = 1; // haleyjd: SoM's fixes + double dest; + double returnval = 1; // haleyjd: SoM's fixes if (CheckArgs(1)) { @@ -1582,7 +1579,7 @@ void FParser::SF_FloorHeight(void) int crush = (t_argc >= 3) ? intvalue(t_argv[2]) : false; i = -1; - dest = fixedvalue(t_argv[1]); + dest = floatvalue(t_argv[1]); // set all sectors with tag @@ -1593,8 +1590,8 @@ void FParser::SF_FloorHeight(void) DFloorChanger * f = new DFloorChanger(§ors[i]); if (!f->Move( - abs(dest - sectors[i].CenterFloor()), - sectors[i].floorplane.PointToDist (sectors[i]._f_centerspot(), dest), + fabs(dest - sectors[i].CenterFloor()), + sectors[i].floorplane.PointToDist (sectors[i].centerspot, dest), crush? 10:-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); return; } - returnval = sectors[secnum].CenterFloor() >> FRACBITS; + returnval = sectors[secnum].CenterFloor(); } // return floor height - - t_return.type = svt_int; - t_return.value.i = returnval; + t_return.setDouble(returnval); } } @@ -1628,7 +1623,7 @@ void FParser::SF_FloorHeight(void) class DMoveFloor : public DFloor { 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) { m_Type = floorRaiseByValue; @@ -1638,7 +1633,7 @@ public: m_FloorDestDist = moveheight; // 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) { StopInterpolation(true); @@ -1660,13 +1655,14 @@ void FParser::SF_MoveFloor(void) { int secnum = -1; sector_t *sec; - int tagnum, platspeed = 1, destheight, crush; + int tagnum, crush; + double platspeed = 1, destheight; if (CheckArgs(2)) { tagnum = intvalue(t_argv[0]); - destheight = intvalue(t_argv[1]) * FRACUNIT; - platspeed = t_argc > 2 ? fixedvalue(t_argv[2]) : FRACUNIT; + destheight = intvalue(t_argv[1]); + platspeed = t_argc > 2 ? floatvalue(t_argv[2]) : 1.; crush = (t_argc > 3 ? intvalue(t_argv[3]) : -1); // move all sectors with tag @@ -1678,8 +1674,8 @@ void FParser::SF_MoveFloor(void) // Don't start a second thinker on the same floor if (sec->floordata) continue; - new DMoveFloor(sec,sec->floorplane.PointToDist(sec->_f_centerspot(),destheight), - destheight < sec->CenterFloor() ? -1:1,crush,platspeed); + new DMoveFloor(sec, sec->floorplane.PointToDist(sec->centerspot, destheight), + destheight < sec->CenterFloor() ? -1 : 1, crush, platspeed); } } } @@ -1696,7 +1692,7 @@ public: DCeilingChanger(sector_t * 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); Destroy(); @@ -1716,10 +1712,10 @@ public: // ceiling height of sector void FParser::SF_CeilingHeight(void) { - fixed_t dest; + double dest; int secnum; int tagnum; - int returnval = 1; + double returnval = 1; if (CheckArgs(1)) { @@ -1731,7 +1727,7 @@ void FParser::SF_CeilingHeight(void) int crush = (t_argc >= 3) ? intvalue(t_argv[2]) : false; i = -1; - dest = fixedvalue(t_argv[1]); + dest = floatvalue(t_argv[1]); // set all sectors with tag FSSectorTagIterator itr(tagnum); @@ -1741,8 +1737,8 @@ void FParser::SF_CeilingHeight(void) DCeilingChanger * c = new DCeilingChanger(§ors[i]); if (!c->Move( - abs(dest - sectors[i].CenterCeiling()), - sectors[i].ceilingplane.PointToDist (sectors[i]._f_centerspot(), dest), + fabs(dest - sectors[i].CenterCeiling()), + sectors[i].ceilingplane.PointToDist (sectors[i].centerspot, dest), crush? 10:-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); return; } - returnval = sectors[secnum].CenterCeiling() >> FRACBITS; + returnval = sectors[secnum].CenterCeiling(); } // return ceiling height - t_return.type = svt_int; - t_return.value.i = returnval; + t_return.setDouble(returnval); } } @@ -1778,7 +1773,7 @@ class DMoveCeiling : public DCeiling { 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) { m_Crush = crush; @@ -1786,11 +1781,11 @@ public: m_Silent = silent; m_Type = DCeiling::ceilLowerByValue; // doesn't really matter as long as it's no special value 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; // 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) { StopInterpolation (true); @@ -1811,15 +1806,16 @@ void FParser::SF_MoveCeiling(void) { int secnum = -1; sector_t *sec; - int tagnum, platspeed = 1, destheight; + int tagnum; + double platspeed = 1, destheight; int crush; int silent; if (CheckArgs(2)) { tagnum = intvalue(t_argv[0]); - destheight = intvalue(t_argv[1]) * FRACUNIT; - platspeed = /*FLOORSPEED **/ (t_argc > 2 ? fixedvalue(t_argv[2]) : FRACUNIT); + destheight = intvalue(t_argv[1]); + platspeed = /*FLOORSPEED **/ (t_argc > 2 ? floatvalue(t_argv[2]) : 1); crush=t_argc>3 ? intvalue(t_argv[3]):-1; silent=t_argc>4 ? intvalue(t_argv[4]):1; diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 5927778c50..5043210619 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -1065,9 +1065,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm) return 0; } 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 - pos.Z = self->Sector->ceilingplane.ZatPointF(mo); + pos.Z = self->Sector->ceilingplane.ZatPoint(mo); int moceiling = P_Find3DFloor(NULL, pos, false, false, pos.Z); if (moceiling >= 0) mo->SetZ(pos.Z - mo->Height); 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]; 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->bouncecount = i; diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 7e59369727..097965e345 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -306,7 +306,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain) 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) { diff --git a/src/g_strife/a_thingstoblowup.cpp b/src/g_strife/a_thingstoblowup.cpp index ce31a6eab4..3644bb54c9 100644 --- a/src/g_strife/a_thingstoblowup.cpp +++ b/src/g_strife/a_thingstoblowup.cpp @@ -95,14 +95,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightGoesOut) AActor *foo; sector_t *sec = self->Sector; vertex_t *spot; - fixed_t newheight; + double newheight; sec->SetLightLevel(0); - fixed_t oldtheight = sec->floorplane.Zat0(); + double oldtheight = sec->floorplane.fD(); newheight = sec->FindLowestFloorSurrounding(&spot); 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->CheckPortalPlane(sector_t::floor); diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 6203f65171..04d12739e7 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -329,13 +329,13 @@ void P_PlayerOnSpecial3DFloor(player_t* player) if(rover->flags & FF_SOLID) { // 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 { //Water and DEATH FOG!!! heh - if (player->mo->Z() > rover->top.plane->ZatPointF(player->mo) || - player->mo->Top() < rover->bottom.plane->ZatPointF(player->mo)) + if (player->mo->Z() > rover->top.plane->ZatPoint(player->mo) || + player->mo->Top() < rover->bottom.plane->ZatPoint(player->mo)) continue; } @@ -366,7 +366,7 @@ bool P_CheckFor3DFloorHit(AActor * mo) 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); return true; @@ -392,7 +392,7 @@ bool P_CheckFor3DCeilingHit(AActor * mo) 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); return true; diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index fda17dc84c..4bb9ec4ba6 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -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; diff --git a/src/p_3dmidtex.h b/src/p_3dmidtex.h index 641e057ee3..a24daff832 100644 --- a/src/p_3dmidtex.h +++ b/src/p_3dmidtex.h @@ -9,14 +9,14 @@ struct sector_t; struct line_t; 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 &list, sector_t *sec, 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_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_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 &list, sector_t *sector, bool ceiling); bool P_AddSectorLinks(sector_t *control, int tag, INTBOOL ceiling, int movetype); void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 4eb26fce47..65165494b3 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1390,7 +1390,7 @@ public: void Serialize (FArchive &arc); private: sector_t *Sector; - fixed_t WatchD, LastD; + double WatchD, LastD; int Special, Arg0, Arg1, Arg2, Arg3, Arg4; TObjPtr Activator; line_t *Line; @@ -1426,9 +1426,9 @@ DPlaneWatcher::DPlaneWatcher (AActor *it, line_t *line, int lineSide, bool ceili { plane = Sector->floorplane; } - LastD = plane.fixD(); - plane.ChangeHeight (height << FRACBITS); - WatchD = plane.fixD(); + LastD = plane.fD(); + plane.ChangeHeight (height); + WatchD = plane.fD(); } else { @@ -1454,15 +1454,15 @@ void DPlaneWatcher::Tick () return; } - fixed_t newd; + double newd; if (bCeiling) { - newd = Sector->ceilingplane.fixD(); + newd = Sector->ceilingplane.fD(); } else { - newd = Sector->floorplane.fixD(); + newd = Sector->floorplane.fD(); } if ((LastD < WatchD && newd >= WatchD) || diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 96f773baee..096333bbbd 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -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) { 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, - fixed_t speed, fixed_t speed2, fixed_t height, + double speed, double speed2, double height, 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 (sec->PlaneMoving(sector_t::ceiling)) @@ -264,7 +264,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line, { case ceilCrushAndRaise: case ceilCrushRaiseAndStay: - ceiling->m_TopHeight = sec->ceilingplane.fixD(); + ceiling->m_TopHeight = sec->ceilingplane.fD(); case ceilLowerAndCrush: targheight = sec->FindHighestFloorPoint (&spot); targheight += height; @@ -292,7 +292,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line, case ceilMoveToValue: { - int diff = height - sec->ceilingplane.ZatPoint (spot); + double diff = height - sec->ceilingplane.ZatPoint (spot); targheight = height; 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. // Note for ZDoomGL: Check to make sure that you update the sector // after the ceiling moves, because it hasn't actually moved yet. - fixed_t movedist; + double movedist; if (ceiling->m_Direction < 0) { - movedist = sec->ceilingplane.fixD() - ceiling->m_BottomHeight; + movedist = sec->ceilingplane.fD() - ceiling->m_BottomHeight; } else { - movedist = ceiling->m_TopHeight - sec->ceilingplane.fixD(); + movedist = ceiling->m_TopHeight - sec->ceilingplane.fD(); } 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, - 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 secnum; diff --git a/src/p_doors.cpp b/src/p_doors.cpp index 6497254bc3..24af771942 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -82,14 +82,14 @@ void DDoor::Tick () { 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)) || !(barrier_cast(m_Sector->floordata))->IsLift()) { - m_OldFloorDist = m_Sector->floorplane.fixD(); - m_BotDist = m_Sector->ceilingplane.PointToDist (m_BotSpot, - m_Sector->floorplane.ZatPoint (m_BotSpot)); + m_OldFloorDist = m_Sector->floorplane.fD(); + m_BotDist = m_Sector->ceilingplane.PointToDist (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); // 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, - 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) @@ -186,10 +186,10 @@ void DDoor::Tick () res = MoveCeiling (m_Speed, m_TopDist, -1, m_Direction, false); // 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, - 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) @@ -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), m_Type (type), m_Speed (speed), m_TopWait (delay), m_TopCountdown(topcountdown), m_LightTag (lightTag) { vertex_t *spot; - fixed_t height; + double height; 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: m_Direction = -1; height = sec->FindLowestCeilingSurrounding (&spot); - m_TopDist = sec->ceilingplane.PointToDist (spot, height - 4*FRACUNIT); + m_TopDist = sec->ceilingplane.PointToDist (spot, height - 4); DoorSound (false); break; @@ -375,13 +375,13 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa case doorRaise: m_Direction = 1; height = sec->FindLowestCeilingSurrounding (&spot); - m_TopDist = sec->ceilingplane.PointToDist (spot, height - 4*FRACUNIT); - if (m_TopDist != sec->ceilingplane.fixD()) + m_TopDist = sec->ceilingplane.PointToDist (spot, height - 4); + if (m_TopDist != sec->ceilingplane.fD()) DoorSound (true); break; case doorCloseWaitOpen: - m_TopDist = sec->ceilingplane.fixD(); + m_TopDist = sec->ceilingplane.fD(); m_Direction = -1; DoorSound (false); break; @@ -389,7 +389,7 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa case doorWaitRaise: m_Direction = 2; height = sec->FindLowestCeilingSurrounding (&spot); - m_TopDist = sec->ceilingplane.PointToDist (spot, height - 4*FRACUNIT); + m_TopDist = sec->ceilingplane.PointToDist (spot, height - 4); break; case doorWaitClose: @@ -397,8 +397,8 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa m_Type = DDoor::doorRaise; height = sec->FindHighestFloorPoint (&m_BotSpot); m_BotDist = sec->ceilingplane.PointToDist (m_BotSpot, height); - m_OldFloorDist = sec->floorplane.fixD(); - m_TopDist = sec->ceilingplane.fixD(); + m_OldFloorDist = sec->floorplane.fD(); + m_TopDist = sec->ceilingplane.fD(); break; } @@ -414,7 +414,7 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa height = sec->FindLowestCeilingPoint(&m_BotSpot); 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, - 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; int secnum; @@ -559,13 +559,13 @@ bool DAnimatedDoor::StartClosing () return false; } - fixed_t topdist = m_Sector->ceilingplane.fixD(); - if (MoveCeiling (2048*FRACUNIT, m_BotDist, 0, -1, false) == crushed) + double topdist = m_Sector->ceilingplane.fD(); + if (MoveCeiling (2048., m_BotDist, 0, -1, false) == crushed) { return false; } - MoveCeiling (2048*FRACUNIT, topdist, 1); + MoveCeiling (2048., topdist, 1); m_Line1->flags |= ML_BLOCKING; m_Line2->flags |= ML_BLOCKING; @@ -650,7 +650,7 @@ void DAnimatedDoor::Tick () if (--m_Frame < 0) { // IF DOOR IS DONE CLOSING... - MoveCeiling (2048*FRACUNIT, m_BotDist, -1); + MoveCeiling (2048., m_BotDist, -1); m_Sector->ceilingdata = NULL; Destroy (); // 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) : DMovingCeiling (sec) { - fixed_t topdist; + double topdist; FTextureID picnum; // 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]; 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_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_Line1->flags |= ML_BLOCKING; m_Line2->flags |= ML_BLOCKING; - m_BotDist = m_Sector->ceilingplane.fixD(); - MoveCeiling (2048*FRACUNIT, topdist, 1); + m_BotDist = m_Sector->ceilingplane.fD(); + MoveCeiling (2048., topdist, 1); if (m_DoorAnim->OpenSound != NAME_None) { SN_StartSequence (m_Sector, CHAN_INTERIOR, m_DoorAnim->OpenSound, 1); diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 3b26eaf0cd..54b66a8a83 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -280,14 +280,14 @@ DFloor::DFloor (sector_t *sec) //========================================================================== 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; bool rtn; sector_t* sec; DFloor* floor; - fixed_t ceilingheight; - fixed_t newheight; + double ceilingheight; + double newheight; vertex_t *spot, *spot2; rtn = false; @@ -312,7 +312,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, floor->m_Hexencrush = hexencrush; floor->m_Speed = speed; floor->m_ResetCount = 0; // [RH] - floor->m_OrgDist = sec->floorplane.fixD(); // [RH] + floor->m_OrgDist = sec->floorplane.fD(); // [RH] 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); // [RH] DOOM's turboLower type did this. I've just extended it // 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); break; @@ -344,7 +344,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, case DFloor::floorLowerByValue: floor->m_Direction = -1; newheight = sec->CenterFloor() - height; - floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight); + floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight); break; case DFloor::floorRaiseInstant: @@ -352,13 +352,13 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, case DFloor::floorRaiseByValue: floor->m_Direction = 1; newheight = sec->CenterFloor() + height; - floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight); + floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight); break; case DFloor::floorMoveToValue: sec->FindHighestFloorPoint (&spot); 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; case DFloor::floorRaiseAndCrushDoom: @@ -366,12 +366,12 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, floor->m_Direction = 1; newheight = sec->FindLowestCeilingSurrounding (&spot); if (floortype == DFloor::floorRaiseAndCrushDoom) - newheight -= 8 * FRACUNIT; + newheight -= 8; ceilingheight = sec->FindLowestCeilingPoint (&spot2); floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight); if (sec->floorplane.ZatPointDist (spot2, floor->m_FloorDestDist) > ceilingheight) floor->m_FloorDestDist = sec->floorplane.PointToDist (spot2, - floortype == DFloor::floorRaiseAndCrushDoom ? ceilingheight - 8*FRACUNIT : ceilingheight); + floortype == DFloor::floorRaiseAndCrushDoom ? ceilingheight - 8 : ceilingheight); break; case DFloor::floorRaiseToHighest: @@ -394,7 +394,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, case DFloor::floorRaiseAndCrush: floor->m_Direction = 1; - newheight = sec->FindLowestCeilingPoint (&spot) - 8*FRACUNIT; + newheight = sec->FindLowestCeilingPoint (&spot) - 8; floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight); break; @@ -413,7 +413,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, case DFloor::floorLowerByTexture: floor->m_Direction = -1; 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; 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 // also had this function.) 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; case DFloor::floorRaiseAndChange: floor->m_Direction = 1; - newheight = sec->CenterFloor() + height; - floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight); + newheight = sec->_f_CenterFloor() + height; + floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight); if (line != NULL) { 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. bool silent = false; - if ((floor->m_Direction>0 && floor->m_FloorDestDist>sec->floorplane.fixD()) || // moving up but going down - (floor->m_Direction<0 && floor->m_FloorDestDistfloorplane.fixD()) || // moving down but going up - (floor->m_Speed >= abs(sec->floorplane.fixD() - floor->m_FloorDestDist))) // moving in one step + if ((floor->m_Direction>0 && floor->m_FloorDestDist>sec->floorplane.fD()) || // moving up but going down + (floor->m_Direction<0 && floor->m_FloorDestDistfloorplane.fD()) || // moving down but going up + (floor->m_Speed >= fabs(sec->floorplane.fD() - floor->m_FloorDestDist))) // moving in one step { floor->StopInterpolation(true); @@ -560,13 +560,13 @@ bool EV_FloorCrushStop (int tag) //========================================================================== 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 secnum = -1; int osecnum; //jff 3/4/98 save old loop index - int height; - fixed_t stairstep; + double height; + double stairstep; int i; int newsecnum = -1; FTextureID texture; @@ -583,7 +583,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, if (speed == 0) 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 FSectorTagIterator itr(tag, line); @@ -609,7 +609,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, stairstep = stairsize * floor->m_Direction; 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_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 floor->m_Delay = delay; floor->m_PauseTime = 0; @@ -620,7 +620,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, floor->m_Speed = speed; 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); 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->StartFloorSound (); 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 floor->m_Delay = delay; floor->m_PauseTime = 0; @@ -719,8 +719,8 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, if (usespecials & DFloor::stairSync) { // [RH] - fixed_t rise = height - sec->CenterFloor(); - floor->m_Speed = Scale (speed, rise, stairstep); + double rise = height - sec->CenterFloor(); + floor->m_Speed = speed * rise / stairstep; } 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 //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_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); // [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* s2; @@ -757,7 +757,7 @@ bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed) int i; DFloor* floor; vertex_t* spot; - fixed_t height; + double height; rtn = false; @@ -900,10 +900,10 @@ void DElevator::Tick () { EResult res; - fixed_t oldfloor, oldceiling; + double oldfloor, oldceiling; - oldfloor = m_Sector->floorplane.fixD(); - oldceiling = m_Sector->ceilingplane.fixD(); + oldfloor = m_Sector->floorplane.fD(); + oldceiling = m_Sector->ceilingplane.fD(); if (m_Direction < 0) // moving down { @@ -966,14 +966,14 @@ void DElevator::StartFloorSound () //========================================================================== 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; bool rtn; sector_t* sec; DElevator* elevator; - fixed_t floorheight, ceilingheight; - fixed_t newheight; + double floorheight, ceilingheight; + double newheight; vertex_t* spot; if (!line && (elevtype == DElevator::elevateCurrent)) @@ -1010,7 +1010,7 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype, elevator->m_Direction = -1; newheight = sec->FindNextLowestFloor (&spot); 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); break; @@ -1019,7 +1019,7 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype, elevator->m_Direction = 1; newheight = sec->FindNextHighestFloor (&spot); 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); break; @@ -1027,25 +1027,25 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype, case DElevator::elevateCurrent: newheight = line->frontsector->floorplane.ZatPoint (line->v1); 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_Direction = - elevator->m_FloorDestDist > sec->floorplane.fixD() ? -1 : 1; + elevator->m_FloorDestDist > sec->floorplane.fD() ? -1 : 1; break; // [RH] elevate up by a specific amount case DElevator::elevateRaise: elevator->m_Direction = 1; - elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), floorheight + height); - elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->_f_centerspot(), ceilingheight + height); + elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, floorheight + height); + elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->centerspot, ceilingheight + height); break; // [RH] elevate down by a specific amount case DElevator::elevateLower: elevator->m_Direction = -1; - elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), floorheight - height); - elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->_f_centerspot(), ceilingheight - height); + elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, floorheight - height); + elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->centerspot, ceilingheight - height); break; } } @@ -1178,7 +1178,7 @@ void DWaggleBase::DoWaggle (bool ceiling) { secplane_t *plane; int pos; - fixed_t dist; + double dist; if (ceiling) { @@ -1204,7 +1204,7 @@ void DWaggleBase::DoWaggle (bool ceiling) case WGLSTATE_REDUCE: if ((m_Scale -= m_ScaleDelta) <= 0) { // Remove - dist = FixedDiv (m_OriginalDist - plane->fixD(), plane->fixC()); + dist = (m_OriginalDist - plane->fD()) / plane->fC(); m_Sector->ChangePlaneTexZ(pos, -plane->HeightDiff (m_OriginalDist)); plane->setD(m_OriginalDist); P_ChangeSector (m_Sector, true, dist, ceiling, false); @@ -1233,11 +1233,8 @@ void DWaggleBase::DoWaggle (bool ceiling) } m_Accumulator += m_AccDelta; - - fixed_t mag = finesine[(m_Accumulator>>9)&8191]*8; - - dist = plane->fixD(); - plane->setD(m_OriginalDist + plane->PointToDist (0, 0, FixedMul (mag, m_Scale))); + dist = plane->fD(); + plane->setD(m_OriginalDist + plane->PointToDist (DVector2(0, 0), BobSin(m_Accumulator) *m_Scale)); m_Sector->ChangePlaneTexZ(pos, 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) { waggle = new DCeilingWaggle (sector); - waggle->m_OriginalDist = sector->ceilingplane.fixD(); + waggle->m_OriginalDist = sector->ceilingplane.fD(); } else { waggle = new DFloorWaggle (sector); - waggle->m_OriginalDist = sector->floorplane.fixD(); + waggle->m_OriginalDist = sector->floorplane.fD(); } - waggle->m_Accumulator = offset*FRACUNIT; - waggle->m_AccDelta = speed << (FRACBITS-6); + waggle->m_Accumulator = offset; + waggle->m_AccDelta = speed / 64.; waggle->m_Scale = 0; - waggle->m_TargetScale = height << (FRACBITS-6); - waggle->m_ScaleDelta = waggle->m_TargetScale - /(TICRATE+((3*TICRATE)*height)/255); + waggle->m_TargetScale = height / 64.; + waggle->m_ScaleDelta = waggle->m_TargetScale / (TICRATE + ((3 * TICRATE)*height) / 255); waggle->m_Ticker = timer ? timer*TICRATE : -1; waggle->m_State = WGLSTATE_EXPAND; } diff --git a/src/p_linkedsectors.cpp b/src/p_linkedsectors.cpp index d502372916..944a41aa92 100644 --- a/src/p_linkedsectors.cpp +++ b/src/p_linkedsectors.cpp @@ -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->ChangePlaneTexZ(sector_t::ceiling, move); @@ -107,7 +107,7 @@ static bool MoveCeiling(sector_t *sector, int crush, fixed_t move) 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->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; bool ok = true; diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index c608c102ff..802541f497 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -510,7 +510,7 @@ FUNC(LS_Floor_TransferNumeric) FUNC(LS_Floor_Donut) // 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) @@ -554,56 +554,56 @@ FUNC(LS_Stairs_BuildDown) // Stair_BuildDown (tag, speed, height, delay, reset) { 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) // Stairs_BuildUp (tag, speed, height, delay, reset) { 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) // Stairs_BuildDownSync (tag, speed, height, reset) { 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) // Stairs_BuildUpSync (tag, speed, height, reset) { 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) // Stairs_BuildUpDoom (tag, speed, height, delay, reset) { 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) // Stair_BuildDownDoom (tag, speed, height, delay, reset) { 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) // Stairs_BuildDownDoomSync (tag, speed, height, reset) { 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) // Stairs_BuildUpDoomSync (tag, speed, height, reset) { 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; 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) // Toggle direction of next activation of repeatable stairs @@ -624,61 +624,61 @@ FUNC(LS_Generic_Stairs) FUNC(LS_Pillar_Build) // 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) // 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) // 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) // 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) // 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) // 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) // 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) // 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) // 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) // 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) @@ -690,21 +690,21 @@ FUNC(LS_Ceiling_CrushStop) FUNC(LS_Ceiling_CrushRaiseAndStay) // 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) // Ceiling_MoveToValueTimes8 (tag, speed, height, negative, change) { 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) // Ceiling_MoveToValue (tag, speed, height, negative, change) { 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) @@ -716,13 +716,13 @@ FUNC(LS_Ceiling_LowerToHighestFloor) FUNC(LS_Ceiling_LowerInstant) // 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) // 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) @@ -746,7 +746,7 @@ FUNC(LS_Ceiling_CrushAndRaiseA) FUNC(LS_Ceiling_CrushAndRaiseDist) // 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) @@ -758,7 +758,7 @@ FUNC(LS_Ceiling_CrushAndRaiseSilentA) FUNC(LS_Ceiling_CrushAndRaiseSilentDist) // 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) @@ -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); } @@ -876,13 +876,13 @@ FUNC(LS_Generic_Crusher2) FUNC(LS_Plat_PerpetualRaise) // 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) // 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) @@ -895,7 +895,7 @@ FUNC(LS_Plat_Stop) FUNC(LS_Plat_DownWaitUpStay) // 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) @@ -903,31 +903,31 @@ FUNC(LS_Plat_DownWaitUpStayLip) { return EV_DoPlat (arg0, ln, arg4 ? DPlat::platDownWaitUpStayStone : DPlat::platDownWaitUpStay, - 0, _f_SPEED(arg1), TICS(arg2), arg3, 0); + 0, SPEED(arg1), TICS(arg2), arg3, 0); } FUNC(LS_Plat_DownByValue) // 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) // 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) // 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) // 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) @@ -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) // 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) @@ -988,7 +988,7 @@ FUNC(LS_Generic_Lift) 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) @@ -1943,13 +1943,13 @@ FUNC(LS_FS_Execute) FUNC(LS_FloorAndCeiling_LowerByValue) // 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) // 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) @@ -1962,7 +1962,7 @@ FUNC(LS_FloorAndCeiling_LowerRaise) // 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) { - 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; } @@ -1970,19 +1970,19 @@ FUNC(LS_FloorAndCeiling_LowerRaise) FUNC(LS_Elevator_MoveToFloor) // 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) // 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) // 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) @@ -2760,7 +2760,7 @@ enum PROP_FLIGHT, PROP_UNUSED1, PROP_UNUSED2, - PROP__f_SPEED, + PROP_SPEED, PROP_BUDDHA, }; @@ -2775,7 +2775,7 @@ FUNC(LS_SetPlayerProperty) return false; // 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] = { diff --git a/src/p_local.h b/src/p_local.h index 95df53116a..fec4a636db 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -45,7 +45,7 @@ struct FTranslatedLineTarget; #include -#define STEEPSLOPE 46342 // [RH] Minimum floorplane.fixC() value for walking +#define STEEPSLOPE (46342/65536.) // [RH] Minimum floorplane.c value for walking #define BONUSADD 6 diff --git a/src/p_map.cpp b/src/p_map.cpp index 4d00663042..bd19a228f7 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -526,8 +526,8 @@ double P_GetFriction(const AActor *mo, double *frictionfactor) if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_SWIMMABLE)) continue; - if (mo->Z() > rover->top.plane->ZatPointF(mo) || - mo->Z() < rover->bottom.plane->ZatPointF(mo)) + if (mo->Z() > rover->top.plane->ZatPoint(mo) || + mo->Z() < rover->bottom.plane->ZatPoint(mo)) continue; 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) && !(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 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; - double thisplanez = rover->top.plane->ZatPointF(actor); + double thisplanez = rover->top.plane->ZatPoint(actor); 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; 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) { sector_t *sec = node->m_sector; - if (sec->floorplane.fixC() >= STEEPSLOPE) + if (sec->floorplane.fC() >= STEEPSLOPE) { DVector3 pos = actor->PosRelative(sec) +move; @@ -3741,7 +3741,7 @@ struct aim_t { if (lastceilingplane) { - double ff_top = lastceilingplane->ZatPointF(th); + double ff_top = lastceilingplane->ZatPoint(th); DAngle pitch = -VecToAngle(dist, ff_top - shootz); // upper slope intersects with this 3d-floor if (pitch > toppitch) @@ -3751,7 +3751,7 @@ struct aim_t } if (lastfloorplane) { - double ff_bottom = lastfloorplane->ZatPointF(th); + double ff_bottom = lastfloorplane->ZatPoint(th); DAngle pitch = -VecToAngle(dist, ff_bottom - shootz); // lower slope intersects with this 3d-floor if (pitch < bottompitch) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 4876114493..a96194426e 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2175,7 +2175,7 @@ explode: { // 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 (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 { @@ -2186,7 +2186,7 @@ explode: // if the floor comes from one in the current sector stop sliding the corpse! F3DFloor * rover=mo->Sector->e->XFloor.ffloors[i]; 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()) return Oldfloorz; @@ -2427,8 +2427,8 @@ void P_ZMovement (AActor *mo, double oldfloorz) if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_SWIMMABLE)) continue; - if (mo->Z() >= rover->top.plane->ZatPointF(mo) || - mo->Center() < rover->bottom.plane->ZatPointF(mo)) + if (mo->Z() >= rover->top.plane->ZatPoint(mo) || + mo->Center() < rover->bottom.plane->ZatPoint(mo)) continue; friction = rover->model->GetFriction(rover->top.isceiling); @@ -2447,7 +2447,7 @@ void P_ZMovement (AActor *mo, double oldfloorz) { // Hit the floor if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) && 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 mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor); } @@ -2547,7 +2547,7 @@ void P_ZMovement (AActor *mo, double oldfloorz) { // hit the ceiling if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) && 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 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) { sector_t *hs = sec->heightsec; - double waterz = hs->floorplane.ZatPointF(mo); + double waterz = hs->floorplane.ZatPoint(mo); double newz; double viewheight; @@ -2637,7 +2637,7 @@ void P_CheckFakeFloorTriggers (AActor *mo, double oldz, bool oldz_has_viewheight if (!(hs->MoreFlags & SECF_FAKEFLOORONLY)) { - waterz = hs->ceilingplane.ZatPointF(mo); + waterz = hs->ceilingplane.ZatPoint(mo); if (oldz <= waterz && newz > waterz) { // View went above fake ceiling sec->SecActTarget->TriggerAction (mo, SECSPAC_EyesAboveC); @@ -3644,18 +3644,18 @@ void AActor::Tick () // Check 3D floors as well floorplane = P_FindFloorPlane(floorsector, PosAtZ(floorz)); - if (floorplane.fixC() < STEEPSLOPE && + if (floorplane.fC() < STEEPSLOPE && floorplane.ZatPoint (PosRelative(floorsector)) <= floorz) { const msecnode_t *node; bool dopush = true; - if (floorplane.fixC() > STEEPSLOPE*2/3) + if (floorplane.fC() > STEEPSLOPE*2/3) { for (node = touching_sectorlist; node; node = node->m_tnext) { 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) { @@ -3897,15 +3897,15 @@ void AActor::CheckSectorTransition(sector_t *oldsec) if (Sector->SecActTarget != NULL) { int act = SECSPAC_Enter; - if (Z() <= Sector->floorplane.ZatPointF(this)) + if (Z() <= Sector->floorplane.ZatPoint(this)) { act |= SECSPAC_HitFloor; } - if (Top() >= Sector->ceilingplane.ZatPointF(this)) + if (Top() >= Sector->ceilingplane.ZatPoint(this)) { 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; } @@ -3952,7 +3952,7 @@ bool AActor::UpdateWaterLevel (bool dosplash) const sector_t *hsec = Sector->GetHeightSec(); 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 (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; } @@ -3992,8 +3992,8 @@ bool AActor::UpdateWaterLevel (bool dosplash) if (!(rover->flags & FF_EXISTS)) continue; if(!(rover->flags & FF_SWIMMABLE) || rover->flags & FF_SOLID) continue; - double ff_bottom=rover->bottom.plane->ZatPointF(this); - double ff_top=rover->top.plane->ZatPointF(this); + double ff_bottom=rover->bottom.plane->ZatPoint(this); + double ff_top=rover->top.plane->ZatPoint(this); if(ff_top <= Z() || ff_bottom > (Center())) continue; @@ -4174,7 +4174,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t a } 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) @@ -4420,7 +4420,7 @@ void AActor::AdjustFloorClip () const msecnode_t *m; // 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 // If the sector has a deep water effect, then let that effect @@ -5522,7 +5522,7 @@ foundone: if (smallsplash && splash->SmallSplash) { mo = Spawn (splash->SmallSplash, pos, ALLOW_REPLACE); - if (mo) mo->Floorclip += FIXED2DBL(splash->SmallSplashClip); + if (mo) mo->Floorclip += splash->SmallSplashClip; } else { diff --git a/src/p_pillar.cpp b/src/p_pillar.cpp index e585702c6c..da939abb0b 100644 --- a/src/p_pillar.cpp +++ b/src/p_pillar.cpp @@ -89,10 +89,10 @@ void DPillar::Serialize (FArchive &arc) void DPillar::Tick () { int r, s; - fixed_t oldfloor, oldceiling; + double oldfloor, oldceiling; - oldfloor = m_Sector->floorplane.fixD(); - oldceiling = m_Sector->ceilingplane.fixD(); + oldfloor = m_Sector->floorplane.fD(); + oldceiling = m_Sector->ceilingplane.fD(); if (m_Type == pillarBuild) { @@ -123,11 +123,11 @@ void DPillar::Tick () } } -DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed, - fixed_t floordist, fixed_t ceilingdist, int crush, bool hexencrush) +DPillar::DPillar (sector_t *sector, EPillar type, double speed, + double floordist, double ceilingdist, int crush, bool hexencrush) : DMover (sector) { - fixed_t newheight; + double newheight; vertex_t *spot; sector->floordata = sector->ceilingdata = this; @@ -144,15 +144,15 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed, if (floordist == 0) { newheight = (sector->CenterFloor () + sector->CenterCeiling ()) / 2; - m_FloorTarget = sector->floorplane.PointToDist (sector->_f_centerspot(), newheight); - m_CeilingTarget = sector->ceilingplane.PointToDist (sector->_f_centerspot(), newheight); + m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight); + m_CeilingTarget = sector->ceilingplane.PointToDist (sector->centerspot, newheight); floordist = newheight - sector->CenterFloor (); } else { newheight = sector->CenterFloor () + floordist; - m_FloorTarget = sector->floorplane.PointToDist (sector->_f_centerspot(), newheight); - m_CeilingTarget = sector->ceilingplane.PointToDist (sector->_f_centerspot(), newheight); + m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight); + m_CeilingTarget = sector->ceilingplane.PointToDist (sector->centerspot, newheight); } ceilingdist = sector->CenterCeiling () - newheight; } @@ -169,7 +169,7 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed, else { newheight = sector->CenterFloor() - floordist; - m_FloorTarget = sector->floorplane.PointToDist (sector->_f_centerspot(), newheight); + m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight); } if (ceilingdist == 0) { @@ -180,7 +180,7 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed, else { 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) { m_FloorSpeed = speed; - m_CeilingSpeed = Scale (speed, ceilingdist, floordist); + m_CeilingSpeed = speed * ceilingdist / floordist; } else { m_CeilingSpeed = speed; - m_FloorSpeed = Scale (speed, floordist, ceilingdist); + m_FloorSpeed = speed * floordist / ceilingdist; } 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, - 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; 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)) continue; - fixed_t flor, ceil; + double flor, ceil; flor = sec->CenterFloor (); ceil = sec->CenterCeiling (); diff --git a/src/p_plats.cpp b/src/p_plats.cpp index 22d6b54edc..7d2754d2c7 100644 --- a/src/p_plats.cpp +++ b/src/p_plats.cpp @@ -198,7 +198,7 @@ void DPlat::Tick () case waiting: if (m_Count > 0 && !--m_Count) { - if (m_Sector->floorplane.fixD() == m_Low) + if (m_Sector->floorplane.fD() == m_Low) m_Status = up; else m_Status = down; @@ -225,15 +225,15 @@ DPlat::DPlat (sector_t *sector) // [RH] Changed amount to height and added delay, // lip, change, tag, and speed parameters. // -bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height, - int speed, int delay, int lip, int change) +bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, double height, + double speed, int delay, int lip, int change) { DPlat *plat; int secnum; sector_t *sec; bool rtn = false; bool manual = false; - fixed_t newheight = 0; + double newheight = 0; vertex_t *spot; 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 //going down forever -- default lower to plat height when triggered - plat->m_Low = sec->floorplane.fixD(); + plat->m_Low = sec->floorplane.fD(); if (change) { @@ -292,7 +292,7 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height, case DPlat::platRaiseAndStayLockout: newheight = sec->FindNextHighestFloor (&spot); 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->PlayPlatSound ("Floor"); sec->ClearSpecial(); @@ -300,30 +300,30 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height, case DPlat::platUpByValue: case DPlat::platUpByValueStay: - newheight = sec->floorplane.ZatPoint (0, 0) + height; - plat->m_High = sec->floorplane.PointToDist (0, 0, newheight); - plat->m_Low = sec->floorplane.fixD(); + newheight = sec->floorplane.ZatPoint (sec->centerspot) + height; + plat->m_High = sec->floorplane.PointToDist (sec->centerspot, newheight); + plat->m_Low = sec->floorplane.fD(); plat->m_Status = DPlat::up; plat->PlayPlatSound ("Floor"); break; case DPlat::platDownByValue: - newheight = sec->floorplane.ZatPoint (0, 0) - height; - plat->m_Low = sec->floorplane.PointToDist (0, 0, newheight); - plat->m_High = sec->floorplane.fixD(); + newheight = sec->floorplane.ZatPoint (sec->centerspot) - height; + plat->m_Low = sec->floorplane.PointToDist (sec->centerspot, newheight); + plat->m_High = sec->floorplane.fD(); plat->m_Status = DPlat::down; plat->PlayPlatSound ("Floor"); break; case DPlat::platDownWaitUpStay: case DPlat::platDownWaitUpStayStone: - newheight = sec->FindLowestFloorSurrounding (&spot) + lip*FRACUNIT; + newheight = sec->FindLowestFloorSurrounding (&spot) + lip; plat->m_Low = sec->floorplane.PointToDist (spot, newheight); - if (plat->m_Low < sec->floorplane.fixD()) - plat->m_Low = sec->floorplane.fixD(); + if (plat->m_Low < sec->floorplane.fD()) + plat->m_Low = sec->floorplane.fD(); - plat->m_High = sec->floorplane.fixD(); + plat->m_High = sec->floorplane.fD(); plat->m_Status = DPlat::down; plat->PlayPlatSound (type == DPlat::platDownWaitUpStay ? "Platform" : "Floor"); break; @@ -338,27 +338,27 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height, newheight = sec->FindHighestFloorSurrounding (&spot); } 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()) - plat->m_High = sec->floorplane.fixD(); + if (plat->m_High > sec->floorplane.fD()) + plat->m_High = sec->floorplane.fD(); plat->m_Status = DPlat::up; plat->PlayPlatSound ("Platform"); break; case DPlat::platPerpetualRaise: - newheight = sec->FindLowestFloorSurrounding (&spot) + lip*FRACUNIT; + newheight = sec->FindLowestFloorSurrounding (&spot) + lip; plat->m_Low = sec->floorplane.PointToDist (spot, newheight); - if (plat->m_Low < sec->floorplane.fixD()) - plat->m_Low = sec->floorplane.fixD(); + if (plat->m_Low < sec->floorplane.fD()) + plat->m_Low = sec->floorplane.fD(); newheight = sec->FindHighestFloorSurrounding (&spot); plat->m_High = sec->floorplane.PointToDist (spot, newheight); - if (plat->m_High > sec->floorplane.fixD()) - plat->m_High = sec->floorplane.fixD(); + if (plat->m_High > sec->floorplane.fD()) + plat->m_High = sec->floorplane.fD(); 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 newheight = sec->FindLowestCeilingPoint (&spot); 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; SN_StartSequence (sec, CHAN_FLOOR, "Silence", 0); break; case DPlat::platDownToNearestFloor: - newheight = sec->FindNextLowestFloor (&spot) + lip*FRACUNIT; + newheight = sec->FindNextLowestFloor (&spot) + lip; plat->m_Low = sec->floorplane.PointToDist (spot, newheight); plat->m_Status = DPlat::down; - plat->m_High = sec->floorplane.fixD(); + plat->m_High = sec->floorplane.fD(); plat->PlayPlatSound ("Platform"); break; case DPlat::platDownToLowestCeiling: newheight = sec->FindLowestCeilingSurrounding (&spot); 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()) - plat->m_Low = sec->floorplane.fixD(); + if (plat->m_Low < sec->floorplane.fD()) + plat->m_Low = sec->floorplane.fD(); plat->m_Status = DPlat::down; plat->PlayPlatSound ("Platform"); diff --git a/src/p_scroll.cpp b/src/p_scroll.cpp index aad56aa67e..01fbba3c5f 100644 --- a/src/p_scroll.cpp +++ b/src/p_scroll.cpp @@ -183,8 +183,8 @@ void DScroller::Tick () if (m_Control != -1) { // compute scroll amounts based on a sector's height changes - double height = sectors[m_Control].CenterFloorF () + - sectors[m_Control].CenterCeilingF (); + double height = sectors[m_Control].CenterFloor () + + sectors[m_Control].CenterCeiling (); double delta = height - m_LastHeight; m_LastHeight = height; dx *= delta; @@ -277,7 +277,7 @@ DScroller::DScroller (EScroll type, double dx, double dy, m_vdx = m_vdy = 0; if ((m_Control = control) != -1) m_LastHeight = - sectors[control].CenterFloorF () + sectors[control].CenterCeilingF (); + sectors[control].CenterFloor () + sectors[control].CenterCeiling (); m_Affectee = affectee; m_Interpolations[0] = m_Interpolations[1] = m_Interpolations[2] = NULL; diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 4533fb138f..b92c23de48 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -63,19 +63,19 @@ sector_t *sector_t::NextSpecialSector (int type, sector_t *nogood) const // P_FindLowestFloorSurrounding() // 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; sector_t *other; line_t *check; - fixed_t floor; - fixed_t ofloor; + double floor; + double ofloor; vertex_t *spot; - if (linecount == 0) return GetPlaneTexZ(sector_t::floor); + if (linecount == 0) return GetPlaneTexZF(sector_t::floor); spot = lines[0]->v1; - floor = floorplane.ZatPoint (spot); + floor = floorplane.ZatPoint(spot); for (i = 0; i < linecount; i++) { @@ -107,19 +107,19 @@ fixed_t sector_t::FindLowestFloorSurrounding (vertex_t **v) const // P_FindHighestFloorSurrounding() // 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; line_t *check; sector_t *other; - fixed_t floor; - fixed_t ofloor; + double floor; + double ofloor; vertex_t *spot; - if (linecount == 0) return GetPlaneTexZ(sector_t::floor); + if (linecount == 0) return GetPlaneTexZF(sector_t::floor); spot = lines[0]->v1; - floor = FIXED_MIN; + floor = -FLT_MAX; 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 // -fixed_t sector_t::FindNextHighestFloor (vertex_t **v) const +double sector_t::FindNextHighestFloor (vertex_t **v) const { - fixed_t height; - fixed_t heightdiff; - fixed_t ofloor, floor; + double height; + double heightdiff; + double ofloor, floor; sector_t *other; vertex_t *spot; line_t *check; int i; - if (linecount == 0) return GetPlaneTexZ(sector_t::floor); + if (linecount == 0) return GetPlaneTexZF(sector_t::floor); spot = lines[0]->v1; - height = floorplane.ZatPoint (spot); - heightdiff = FIXED_MAX; + height = floorplane.ZatPoint(spot); + heightdiff = FLT_MAX; 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 // -fixed_t sector_t::FindNextLowestFloor (vertex_t **v) const +double sector_t::FindNextLowestFloor (vertex_t **v) const { - fixed_t height; - fixed_t heightdiff; - fixed_t ofloor, floor; + double height; + double heightdiff; + double ofloor, floor; sector_t *other; vertex_t *spot; line_t *check; int i; - if (linecount == 0) return GetPlaneTexZ(sector_t::floor); + if (linecount == 0) return GetPlaneTexZF(sector_t::floor); spot = lines[0]->v1; height = floorplane.ZatPoint (spot); - heightdiff = FIXED_MAX; + heightdiff = FLT_MAX; for (i = 0; i < linecount; i++) { @@ -242,7 +242,7 @@ fixed_t sector_t::FindNextLowestFloor (vertex_t **v) const spot = check->v1; } 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)) { 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 // -fixed_t sector_t::FindNextLowestCeiling (vertex_t **v) const +double sector_t::FindNextLowestCeiling (vertex_t **v) const { - fixed_t height; - fixed_t heightdiff; - fixed_t oceil, ceil; + double height; + double heightdiff; + double oceil, ceil; sector_t *other; vertex_t *spot; line_t *check; int i; - if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); + if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); spot = lines[0]->v1; - height = ceilingplane.ZatPoint (spot); - heightdiff = FIXED_MAX; + height = ceilingplane.ZatPoint(spot); + heightdiff = FLT_MAX; for (i = 0; i < linecount; i++) { check = lines[i]; if (NULL != (other = getNextSector (check, this))) { - oceil = other->ceilingplane.ZatPoint (check->v1); - ceil = ceilingplane.ZatPoint (check->v1); + oceil = other->ceilingplane.ZatPoint(check->v1); + ceil = ceilingplane.ZatPoint(check->v1); if (oceil < ceil && ceil - oceil < heightdiff && !IsLinked(other, true)) { heightdiff = ceil - oceil; height = oceil; spot = check->v1; } - oceil = other->ceilingplane.ZatPoint (check->v2); - ceil = ceilingplane.ZatPoint (check->v2); + oceil = other->ceilingplane.ZatPoint(check->v2); + ceil = ceilingplane.ZatPoint(check->v2); if (oceil < ceil && ceil - oceil < heightdiff && !IsLinked(other, true)) { 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 // -fixed_t sector_t::FindNextHighestCeiling (vertex_t **v) const +double sector_t::FindNextHighestCeiling (vertex_t **v) const { - fixed_t height; - fixed_t heightdiff; - fixed_t oceil, ceil; + double height; + double heightdiff; + double oceil, ceil; sector_t *other; vertex_t *spot; line_t *check; int i; - if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); + if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); spot = lines[0]->v1; - height = ceilingplane.ZatPoint (spot); - heightdiff = FIXED_MAX; + height = ceilingplane.ZatPoint(spot); + heightdiff = FLT_MAX; for (i = 0; i < linecount; i++) { check = lines[i]; if (NULL != (other = getNextSector (check, this))) { - oceil = other->ceilingplane.ZatPoint (check->v1); - ceil = ceilingplane.ZatPoint (check->v1); + oceil = other->ceilingplane.ZatPoint(check->v1); + ceil = ceilingplane.ZatPoint(check->v1); if (oceil > ceil && oceil - ceil < heightdiff && !IsLinked(other, true)) { heightdiff = oceil - ceil; height = oceil; spot = check->v1; } - oceil = other->ceilingplane.ZatPoint (check->v2); - ceil = ceilingplane.ZatPoint (check->v2); + oceil = other->ceilingplane.ZatPoint(check->v2); + ceil = ceilingplane.ZatPoint(check->v2); if (oceil > ceil && oceil - ceil < heightdiff && !IsLinked(other, true)) { heightdiff = oceil - ceil; @@ -368,32 +368,32 @@ fixed_t sector_t::FindNextHighestCeiling (vertex_t **v) const // // 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; - fixed_t oceil; + double height; + double oceil; sector_t *other; vertex_t *spot; line_t *check; int i; - if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); + if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); spot = lines[0]->v1; - height = FIXED_MAX; + height = FLT_MAX; for (i = 0; i < linecount; i++) { check = lines[i]; if (NULL != (other = getNextSector (check, this))) { - oceil = other->ceilingplane.ZatPoint (check->v1); + oceil = other->ceilingplane.ZatPoint(check->v1); if (oceil < height) { height = oceil; spot = check->v1; } - oceil = other->ceilingplane.ZatPoint (check->v2); + oceil = other->ceilingplane.ZatPoint(check->v2); if (oceil < height) { height = oceil; @@ -410,32 +410,32 @@ fixed_t sector_t::FindLowestCeilingSurrounding (vertex_t **v) const // // 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; - fixed_t oceil; + double height; + double oceil; sector_t *other; vertex_t *spot; line_t *check; int i; - if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); + if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); spot = lines[0]->v1; - height = FIXED_MIN; + height = -FLT_MAX; for (i = 0; i < linecount; i++) { check = lines[i]; if (NULL != (other = getNextSector (check, this))) { - oceil = other->ceilingplane.ZatPoint (check->v1); + oceil = other->ceilingplane.ZatPoint(check->v1); if (oceil > height) { height = oceil; spot = check->v1; } - oceil = other->ceilingplane.ZatPoint (check->v2); + oceil = other->ceilingplane.ZatPoint(check->v2); if (oceil > height) { 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 // -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))) { FTexture *tex = TexMan[texnum]; if (tex != NULL) { - fixed_t h = tex->GetScaledHeight()<GetScaledHeight(); if (h < minsize) { 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++) { @@ -485,7 +485,7 @@ fixed_t sector_t::FindShortestTextureAround () const 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 // -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++) { @@ -511,7 +511,7 @@ fixed_t sector_t::FindShortestUpperAround () const 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 // 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; sector_t *sec; @@ -540,8 +540,8 @@ sector_t *sector_t::FindModelFloorSector (fixed_t floordestheight) const { sec = getNextSector (lines[i], this); if (sec != NULL && - (sec->floorplane.ZatPoint (lines[i]->v1) == floordestheight || - sec->floorplane.ZatPoint (lines[i]->v2) == floordestheight)) + (sec->floorplane.ZatPoint(lines[i]->v1) == floordestheight || + sec->floorplane.ZatPoint(lines[i]->v2) == floordestheight)) { 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 // 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; sector_t *sec; @@ -576,8 +576,8 @@ sector_t *sector_t::FindModelCeilingSector (fixed_t floordestheight) const { sec = getNextSector (lines[i], this); if (sec != NULL && - (sec->ceilingplane.ZatPoint (lines[i]->v1) == floordestheight || - sec->ceilingplane.ZatPoint (lines[i]->v2) == floordestheight)) + (sec->ceilingplane.ZatPoint(lines[i]->v1) == floordestheight || + sec->ceilingplane.ZatPoint(lines[i]->v2) == floordestheight)) { return sec; } @@ -609,12 +609,12 @@ int sector_t::FindMinSurroundingLight (int min) const // // 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; line_t *line; - fixed_t height = FIXED_MIN; - fixed_t probeheight; + double height = -FLT_MAX; + double probeheight; vertex_t *spot = NULL; if (!floorplane.isSlope()) @@ -624,19 +624,19 @@ fixed_t sector_t::FindHighestFloorPoint (vertex_t **v) const if (linecount == 0) *v = &vertexes[0]; else *v = lines[0]->v1; } - return floorplane.Zat0(); + return floorplane.fD(); } for (i = 0; i < linecount; i++) { line = lines[i]; - probeheight = floorplane.ZatPoint (line->v1); + probeheight = floorplane.ZatPoint(line->v1); if (probeheight > height) { height = probeheight; spot = line->v1; } - probeheight = floorplane.ZatPoint (line->v2); + probeheight = floorplane.ZatPoint(line->v2); if (probeheight > height) { 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 // -fixed_t sector_t::FindLowestCeilingPoint (vertex_t **v) const +double sector_t::FindLowestCeilingPoint (vertex_t **v) const { int i; line_t *line; - fixed_t height = FIXED_MAX; - fixed_t probeheight; + double height = FLT_MAX; + double probeheight; vertex_t *spot = NULL; if (!ceilingplane.isSlope()) @@ -666,19 +666,19 @@ fixed_t sector_t::FindLowestCeilingPoint (vertex_t **v) const if (linecount == 0) *v = &vertexes[0]; else *v = lines[0]->v1; } - return ceilingplane.fixD(); + return ceilingplane.fD(); } for (i = 0; i < linecount; i++) { line = lines[i]; - probeheight = ceilingplane.ZatPoint (line->v1); + probeheight = ceilingplane.ZatPoint(line->v1); if (probeheight < height) { height = probeheight; spot = line->v1; } - probeheight = ceilingplane.ZatPoint (line->v2); + probeheight = ceilingplane.ZatPoint(line->v2); if (probeheight < height) { height = probeheight; diff --git a/src/p_sight.cpp b/src/p_sight.cpp index b812e0f633..c29b4e6acc 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -561,8 +561,8 @@ bool SightCheck::P_SightTraverseIntercepts () if ((rover->flags & FF_SOLID) == myseethrough || !(rover->flags & FF_EXISTS)) continue; if ((Flags & SF_IGNOREWATERBOUNDARY) && (rover->flags & FF_SOLID) == 0) continue; - double ff_bottom = rover->bottom.plane->ZatPointF(seeingthing); - double ff_top = rover->top.plane->ZatPointF(seeingthing); + double ff_bottom = rover->bottom.plane->ZatPoint(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 (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 ((s1->GetHeightSec() && - ((t1->Top() <= s1->heightsec->floorplane.ZatPointF(t1) && - t2->Z() >= s1->heightsec->floorplane.ZatPointF(t2)) || - (t1->Z() >= s1->heightsec->ceilingplane.ZatPointF(t1) && - t2->Top() <= s1->heightsec->ceilingplane.ZatPointF(t2)))) + ((t1->Top() <= s1->heightsec->floorplane.ZatPoint(t1) && + t2->Z() >= s1->heightsec->floorplane.ZatPoint(t2)) || + (t1->Z() >= s1->heightsec->ceilingplane.ZatPoint(t1) && + t2->Top() <= s1->heightsec->ceilingplane.ZatPoint(t2)))) || (s2->GetHeightSec() && - ((t2->Top() <= s2->heightsec->floorplane.ZatPointF(t2) && - t1->Z() >= s2->heightsec->floorplane.ZatPointF(t1)) || - (t2->Z() >= s2->heightsec->ceilingplane.ZatPointF(t2) && - t1->Top() <= s2->heightsec->ceilingplane.ZatPointF(t1))))) + ((t2->Top() <= s2->heightsec->floorplane.ZatPoint(t2) && + t1->Z() >= s2->heightsec->floorplane.ZatPoint(t1)) || + (t2->Z() >= s2->heightsec->ceilingplane.ZatPoint(t2) && + t1->Top() <= s2->heightsec->ceilingplane.ZatPoint(t1))))) { res = false; goto done; diff --git a/src/p_slopes.cpp b/src/p_slopes.cpp index 49c9c5a358..f2dd4b7861 100644 --- a/src/p_slopes.cpp +++ b/src/p_slopes.cpp @@ -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[1] = line->v1->fY(); - p[2] = plane->ZatPointF (line->v1); + p[2] = plane->ZatPoint (line->v1); v1[0] = line->Delta().X; 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[1] = FIXED2DBL (y) - p[1]; v2[2] = FIXED2DBL (z) - p[2]; diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 3356def662..7eaab5dde2 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -453,7 +453,7 @@ static void DoSectorDamage(AActor *actor, sector_t *sec, int amount, FName type, if (!(flags & DAMAGE_PLAYERS) && actor->player != NULL) 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; if (protectClass != NULL) @@ -490,8 +490,8 @@ void P_SectorDamage(int tag, int amount, FName type, PClassActor *protectClass, { next = actor->snext; // Only affect actors touching the 3D floor - double z1 = sec->floorplane.ZatPointF(actor); - double z2 = sec->ceilingplane.ZatPointF(actor); + double z1 = sec->floorplane.ZatPoint(actor); + double z2 = sec->ceilingplane.ZatPoint(actor); if (z2 < z1) { // Account for Vavoom-style 3D floors diff --git a/src/p_spec.h b/src/p_spec.h index f5c4d49e03..bb7f1c64f8 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -357,9 +357,9 @@ public: protected: DPlat (sector_t *sector); - fixed_t m_Speed; - fixed_t m_Low; - fixed_t m_High; + double m_Speed; + double m_Low; + double m_High; int m_Wait; int m_Count; EPlatState m_Status; @@ -376,13 +376,13 @@ private: DPlat (); 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 P_ActivateInStasis (int tag); }; 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 P_ActivateInStasis (int tag); @@ -403,8 +403,8 @@ public: }; - DPillar (sector_t *sector, EPillar type, fixed_t speed, fixed_t height, - fixed_t height2, int crush, bool hexencrush); + DPillar (sector_t *sector, EPillar type, double speed, double height, + double height2, int crush, bool hexencrush); void Serialize (FArchive &arc); void Tick (); @@ -412,10 +412,10 @@ public: protected: EPillar m_Type; - fixed_t m_FloorSpeed; - fixed_t m_CeilingSpeed; - fixed_t m_FloorTarget; - fixed_t m_CeilingTarget; + double m_FloorSpeed; + double m_CeilingSpeed; + double m_FloorTarget; + double m_CeilingTarget; int m_Crush; bool m_Hexencrush; TObjPtr m_Interp_Ceiling; @@ -426,7 +426,7 @@ private: }; 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 @@ -446,16 +446,16 @@ public: }; 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 Tick (); protected: EVlDoor m_Type; - fixed_t m_TopDist; - fixed_t m_BotDist, m_OldFloorDist; + double m_TopDist; + double m_BotDist, m_OldFloorDist; vertex_t *m_BotSpot; - fixed_t m_Speed; + double m_Speed; // 1 = up, 0 = waiting at top, -1 = down int m_Direction; @@ -471,7 +471,7 @@ protected: void DoorSound (bool raise, class DSeqNode *curseq=NULL) const; 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); private: DDoor (); @@ -479,16 +479,9 @@ private: }; 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); -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 { @@ -506,7 +499,7 @@ protected: int m_Frame; FDoorAnimation *m_DoorAnim; int m_Timer; - fixed_t m_BotDist; + double m_BotDist; int m_Status; enum { @@ -575,22 +568,22 @@ public: 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 Tick (); 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); protected: ECeiling m_Type; - fixed_t m_BottomHeight; - fixed_t m_TopHeight; - fixed_t m_Speed; - fixed_t m_Speed1; // [RH] dnspeed of crushers - fixed_t m_Speed2; // [RH] upspeed of crushers + double m_BottomHeight; + double m_TopHeight; + double m_Speed; + double m_Speed1; // [RH] dnspeed of crushers + double m_Speed2; // [RH] upspeed of crushers int m_Crush; ECrushMode m_CrushMode; int m_Silent; @@ -614,23 +607,9 @@ private: }; 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); -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); void P_ActivateInStasisCeiling (int tag); @@ -701,19 +680,19 @@ public: void Serialize (FArchive &arc); void Tick (); -protected: +//protected: EFloor m_Type; int m_Crush; bool m_Hexencrush; int m_Direction; secspecial_t m_NewSpecial; FTextureID m_Texture; - fixed_t m_FloorDestDist; - fixed_t m_Speed; + double m_FloorDestDist; + double m_Speed; // [RH] New parameters used to reset and delay stairs + double m_OrgDist; int m_ResetCount; - int m_OrgDist; int m_Delay; int m_PauseTime; int m_StepTime; @@ -723,33 +702,24 @@ protected: void SetFloorChangeType (sector_t *sec, int change); 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); 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_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: DFloor (); }; 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); -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); -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< m_Interp_Ceiling; TObjPtr m_Interp_Floor; void StartFloorSound (); - friend bool EV_DoElevator (line_t *line, DElevator::EElevator type, fixed_t speed, - fixed_t height, int tag); + friend bool EV_DoElevator (line_t *line, DElevator::EElevator type, double speed, double height, int tag); private: DElevator (); }; -bool EV_DoElevator (line_t *line, DElevator::EElevator type, fixed_t speed, - fixed_t height, int tag); +bool EV_DoElevator (line_t *line, DElevator::EElevator type, double speed, double height, int tag); class DWaggleBase : public DMover { @@ -802,12 +770,12 @@ public: void Serialize (FArchive &arc); protected: - fixed_t m_OriginalDist; - fixed_t m_Accumulator; - fixed_t m_AccDelta; - fixed_t m_TargetScale; - fixed_t m_Scale; - fixed_t m_ScaleDelta; + double m_OriginalDist; + double m_Accumulator; + double m_AccDelta; + double m_TargetScale; + double m_Scale; + double m_ScaleDelta; int m_Ticker; int m_State; TObjPtr m_Interpolation; diff --git a/src/p_user.cpp b/src/p_user.cpp index 23223a3d31..9b8e5de8f3 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2609,7 +2609,7 @@ void P_PlayerThink (player_t *player) P_PlayerOnSpecial3DFloor (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 must be touching the floor diff --git a/src/po_man.cpp b/src/po_man.cpp index 5d397c7241..6e0563e13e 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -1239,8 +1239,8 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd) } // [BL] See if we hit below the floor/ceiling of the poly. else if(!performBlockingThrust && ( - mobj->_f_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->Z() < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) || + mobj->Top() > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj) )) { performBlockingThrust = true; diff --git a/src/portal.cpp b/src/portal.cpp index a4d46c5f02..882b4da526 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -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 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 fp = sectors[i].ceilingplane.Zat0(); + fixed_t cp = -sectors[i].ceilingplane.fixD(); + fixed_t fp = -sectors[i].ceilingplane.fixD(); if (cp < fp || fz == fp) { sectors[i].SkyBoxes[sector_t::ceiling] = NULL; diff --git a/src/r_3dfloors.cpp b/src/r_3dfloors.cpp index fbdc34edce..5f91fc6b6e 100644 --- a/src/r_3dfloors.cpp +++ b/src/r_3dfloors.cpp @@ -55,8 +55,8 @@ void R_3D_AddHeight(secplane_t *add, sector_t *sec) fixed_t height; height = add->ZatPoint(viewx, viewy); - if(height >= sec->CenterCeiling()) return; - if(height <= sec->CenterFloor()) return; + if(height >= sec->_f_CenterCeiling()) return; + if(height <= sec->_f_CenterFloor()) return; fakeActive = 1; diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index abfb5ce1c3..d6de05d552 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -426,7 +426,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, tempsec->floorplane = sec->floorplane; tempsec->ceilingplane = s->floorplane; tempsec->ceilingplane.FlipVert (); - tempsec->ceilingplane.ChangeHeight (-1); + tempsec->ceilingplane.ChangeHeight(-1 / 65536.); tempsec->ColorMap = s->ColorMap; } @@ -438,12 +438,12 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, tempsec->ceilingplane = s->floorplane; tempsec->ceilingplane.FlipVert (); - tempsec->ceilingplane.ChangeHeight (-1); + tempsec->ceilingplane.ChangeHeight (-1 / 65536.); if (s->GetTexture(sector_t::ceiling) == skyflatnum) { tempsec->floorplane = tempsec->ceilingplane; tempsec->floorplane.FlipVert (); - tempsec->floorplane.ChangeHeight (+1); + tempsec->floorplane.ChangeHeight (+1 / 65536.); tempsec->SetTexture(sector_t::ceiling, tempsec->GetTexture(sector_t::floor), false); 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->floorplane = s->ceilingplane; tempsec->floorplane.FlipVert (); - tempsec->floorplane.ChangeHeight (+1); + tempsec->floorplane.ChangeHeight (+1 / 65536.); tempsec->ColorMap = s->ColorMap; tempsec->ColorMap = s->ColorMap; @@ -1260,14 +1260,14 @@ void R_Subsector (subsector_t *sub) } else position = sector_t::ceiling; frontsector = &tempsec; - tempsec.ceilingplane.ChangeHeight(-1); + tempsec.ceilingplane.ChangeHeight(-1 / 65536.); if (fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size()) { light = P_GetPlaneLight(sub->sector, &frontsector->ceilingplane, false); basecolormap = light->extra_colormap; ceilinglightlevel = *light->p_lightlevel; } - tempsec.ceilingplane.ChangeHeight(1); + tempsec.ceilingplane.ChangeHeight(1 / 65536.); floorplane = NULL; ceilingplane = R_FindPlane(frontsector->ceilingplane, // killough 3/8/98 @@ -1345,11 +1345,11 @@ void R_Subsector (subsector_t *sub) fakeFloor->validcount = validcount; R_3D_NewClip(); } - if (frontsector->CenterFloor() >= backsector->CenterFloor()) + if (frontsector->_f_CenterFloor() >= backsector->_f_CenterFloor()) { fake3D |= FAKE3D_CLIPBOTFRONT; } - if (frontsector->CenterCeiling() <= backsector->CenterCeiling()) + if (frontsector->_f_CenterCeiling() <= backsector->_f_CenterCeiling()) { fake3D |= FAKE3D_CLIPTOPFRONT; } diff --git a/src/r_defs.h b/src/r_defs.h index ec7caebce9..cd77381830 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -357,6 +357,10 @@ public: { return FIXED2DBL(d); } + double fiC() const + { + return FIXED2DBL(ic); + } bool isSlope() const { @@ -390,11 +394,6 @@ public: 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) 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); } - // Returns the value of z at vertex v - 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 + double ZatPoint(const vertex_t *v) const { return FIXED2DBL(FixedMul(ic, -d - DMulScale16(a, v->fixX(), b, v->fixY()))); } - fixed_t ZatPoint (const AActor *ac) const - { - return FixedMul (ic, -d - DMulScale16 (a, ac->_f_X(), b, ac->_f_Y())); - } - - double ZatPointF(const AActor *ac) const + double ZatPoint(const AActor *ac) const { 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 - 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, // it will point down, and vice versa. void FlipVert () @@ -469,15 +450,15 @@ public: } // 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 - 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 @@ -487,9 +468,15 @@ public: } // 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 @@ -507,6 +494,16 @@ public: 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) { a = b = 0; @@ -684,22 +681,23 @@ struct sector_t { // Member functions bool IsLinked(sector_t *other, bool ceiling) const; - fixed_t FindLowestFloorSurrounding (vertex_t **v) const; - fixed_t FindHighestFloorSurrounding (vertex_t **v) const; - fixed_t FindNextHighestFloor (vertex_t **v) const; - fixed_t FindNextLowestFloor (vertex_t **v) const; - fixed_t FindLowestCeilingSurrounding (vertex_t **v) const; // jff 2/04/98 - fixed_t FindHighestCeilingSurrounding (vertex_t **v) const; // jff 2/04/98 - fixed_t FindNextLowestCeiling (vertex_t **v) const; // jff 2/04/98 - fixed_t FindNextHighestCeiling (vertex_t **v) const; // jff 2/04/98 - fixed_t FindShortestTextureAround () const; // jff 2/04/98 - fixed_t FindShortestUpperAround () const; // jff 2/04/98 - sector_t *FindModelFloorSector (fixed_t floordestheight) const; // jff 2/04/98 - sector_t *FindModelCeilingSector (fixed_t floordestheight) const; // jff 2/04/98 + double FindLowestFloorSurrounding(vertex_t **v) const; + double FindHighestFloorSurrounding(vertex_t **v) const; + double FindNextHighestFloor(vertex_t **v) const; + double FindNextLowestFloor(vertex_t **v) const; + double FindLowestCeilingSurrounding(vertex_t **v) const; // jff 2/04/98 + double FindHighestCeilingSurrounding(vertex_t **v) const; // jff 2/04/98 + double FindNextLowestCeiling(vertex_t **v) const; // jff 2/04/98 + double FindNextHighestCeiling(vertex_t **v) const; // jff 2/04/98 + double FindShortestTextureAround() const; // jff 2/04/98 + double FindShortestUpperAround() const; // jff 2/04/98 + sector_t *FindModelFloorSector(double floordestheight) const; // jff 2/04/98 + sector_t *FindModelCeilingSector(double floordestheight) const; // jff 2/04/98 int FindMinSurroundingLight (int max) const; sector_t *NextSpecialSector (int type, sector_t *prev) const; // [RH] - fixed_t FindLowestCeilingPoint (vertex_t **v) const; - fixed_t FindHighestFloorPoint (vertex_t **v) const; + double FindLowestCeilingPoint(vertex_t **v) const; + double FindHighestFloorPoint(vertex_t **v) const; + void AdjustFloorClip () const; void SetColor(int r, int g, int b, int desat); void SetFade(int r, int g, int b); @@ -1088,10 +1086,10 @@ struct sector_t } // Member variables - fixed_t CenterFloor () const { return floorplane.ZatPoint (_f_centerspot()); } - fixed_t CenterCeiling () const { return ceilingplane.ZatPoint (_f_centerspot()); } - double CenterFloorF() const { return floorplane.ZatPoint(centerspot); } - double CenterCeilingF() const { return ceilingplane.ZatPoint(centerspot); } + fixed_t _f_CenterFloor () const { return floorplane.ZatPoint (_f_centerspot()); } + fixed_t _f_CenterCeiling () const { return ceilingplane.ZatPoint (_f_centerspot()); } + double CenterFloor() const { return floorplane.ZatPoint(centerspot); } + double CenterCeiling() const { return ceilingplane.ZatPoint(centerspot); } // [RH] store floor and ceiling planes instead of heights secplane_t floorplane, ceilingplane; @@ -1335,6 +1333,12 @@ struct side_t { 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) { textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale == 0 ? FRACUNIT : scale; @@ -1416,6 +1420,11 @@ public: dy = FLOAT2FIXED(y); } + void setAlpha(double a) + { + Alpha = FLOAT2FIXED(a); + } + FLinePortal *getPortal() const { return portalindex >= linePortals.Size() ? (FLinePortal*)NULL : &linePortals[portalindex]; diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 8a1cf29149..e6d841df13 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -687,16 +687,16 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2) frontsector = sec; } - floorheight = backsector->CenterFloor(); - ceilingheight = backsector->CenterCeiling(); + floorheight = backsector->_f_CenterFloor(); + ceilingheight = backsector->_f_CenterCeiling(); // maybe fix clipheights if (!(fake3D & FAKE3D_CLIPBOTTOM)) sclipBottom = floorheight; if (!(fake3D & FAKE3D_CLIPTOP)) sclipTop = ceilingheight; // maybe not visible - if (sclipBottom >= frontsector->CenterCeiling()) return; - if (sclipTop <= frontsector->CenterFloor()) return; + if (sclipBottom >= frontsector->_f_CenterCeiling()) return; + if (sclipTop <= frontsector->_f_CenterFloor()) return; if (fake3D & FAKE3D_DOWN2UP) { // bottom to viewz @@ -2266,7 +2266,7 @@ void R_NewWall (bool needlights) int planeside; 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; if (planeside <= 0) // above view plane markfloor = false; @@ -2274,7 +2274,7 @@ void R_NewWall (bool needlights) if (frontsector->GetTexture(sector_t::ceiling) != skyflatnum) { 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; if (planeside <= 0) // below view plane markceiling = false;