diff --git a/src/dsectoreffect.cpp b/src/dsectoreffect.cpp index 6732a19dc..7bc9fc400 100644 --- a/src/dsectoreffect.cpp +++ b/src/dsectoreffect.cpp @@ -95,11 +95,11 @@ void DMover::Serialize (FArchive &arc) arc << interpolation; } -void DMover::StopInterpolation() +void DMover::StopInterpolation(bool force) { if (interpolation != NULL) { - interpolation->DelRef(); + interpolation->DelRef(force); interpolation = NULL; } } diff --git a/src/dsectoreffect.h b/src/dsectoreffect.h index 95e1178aa..3788c6d88 100644 --- a/src/dsectoreffect.h +++ b/src/dsectoreffect.h @@ -36,7 +36,7 @@ protected: DMover (); void Serialize (FArchive &arc); void Destroy(); - void StopInterpolation(); + void StopInterpolation(bool force = false); inline EResult MoveFloor (fixed_t speed, fixed_t dest, int crush, int direction, bool hexencrush) { return MovePlane (speed, dest, crush, 0, direction, hexencrush); diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index e5803fb3e..444750e03 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -1571,7 +1571,7 @@ public: bool res = DMover::crushed != MoveFloor(speed, dest, crush, direction, false); Destroy(); m_Sector->floordata=NULL; - StopInterpolation(); + StopInterpolation(true); m_Sector=NULL; return res; } @@ -1656,6 +1656,14 @@ public: m_Speed=movespeed; m_Direction = _m_Direction; m_FloorDestDist = moveheight; + + // Do not interpolate instant movement floors. + fixed_t movedist = abs(-sec->floorplane.d - moveheight); + if (m_Speed >= movedist) + { + StopInterpolation(true); + } + StartFloorSound(); } }; @@ -1713,7 +1721,7 @@ public: bool res = DMover::crushed != MoveCeiling(speed, dest, crush, direction, false); Destroy(); m_Sector->ceilingdata=NULL; - StopInterpolation (); + StopInterpolation (true); m_Sector=NULL; return res; } @@ -1806,7 +1814,7 @@ public: fixed_t movedist = abs(sec->ceilingplane.d - m_BottomHeight); if (m_Speed >= movedist) { - StopInterpolation (); + StopInterpolation (true); m_Silent=2; } PlayCeilingSound(); diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 3203cf777..24ab121c4 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -412,7 +412,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line, } if (ceiling->m_Speed >= movedist) { - ceiling->StopInterpolation(); + ceiling->StopInterpolation(true); } // set texture/type change properties diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 35e527383..c632e8ba2 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -478,7 +478,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, (floor->m_Direction<0 && floor->m_FloorDestDistfloorplane.d) || // moving down but going up (floor->m_Speed >= abs(sec->floorplane.d - floor->m_FloorDestDist))) // moving in one step { - floor->StopInterpolation(); + floor->StopInterpolation(true); // [Graf Zahl] // Don't make sounds for instant movement hacks but make an exception for diff --git a/src/r_data/r_interpolate.cpp b/src/r_data/r_interpolate.cpp index 4ce3a3c7b..ed12cbf4e 100644 --- a/src/r_data/r_interpolate.cpp +++ b/src/r_data/r_interpolate.cpp @@ -344,9 +344,10 @@ int DInterpolation::AddRef() // //========================================================================== -int DInterpolation::DelRef() +int DInterpolation::DelRef(bool force) { if (refcount > 0) --refcount; + if (force && refcount == 0) Destroy(); return refcount; } @@ -943,20 +944,6 @@ DInterpolation *sector_t::SetInterpolation(int position, bool attach) // //========================================================================== -void sector_t::StopInterpolation(int position) -{ - if (interpolations[position] != NULL) - { - interpolations[position]->DelRef(); - } -} - -//========================================================================== -// -// -// -//========================================================================== - DInterpolation *FPolyObj::SetInterpolation() { if (interpolation != NULL) diff --git a/src/r_data/r_interpolate.h b/src/r_data/r_interpolate.h index 29e8a6171..92e74c3f2 100644 --- a/src/r_data/r_interpolate.h +++ b/src/r_data/r_interpolate.h @@ -25,7 +25,7 @@ protected: public: int AddRef(); - int DelRef(); + int DelRef(bool force = false); virtual void Destroy(); virtual void UpdateInterpolation() = 0; diff --git a/src/r_defs.h b/src/r_defs.h index fc9d522de..a9b09c9e6 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -504,7 +504,6 @@ struct sector_t sector_t *GetHeightSec() const; DInterpolation *SetInterpolation(int position, bool attach); - void StopInterpolation(int position); ASkyViewpoint *GetSkyBox(int which);