- fixed: instant sector movement actions must actually delete the created interpolation right away and not wait until it deletes itself.

This commit is contained in:
Christoph Oelckers 2016-02-11 22:03:09 +01:00
parent c5c4ec83c2
commit bf03ea496e
8 changed files with 19 additions and 25 deletions

View file

@ -95,11 +95,11 @@ void DMover::Serialize (FArchive &arc)
arc << interpolation; arc << interpolation;
} }
void DMover::StopInterpolation() void DMover::StopInterpolation(bool force)
{ {
if (interpolation != NULL) if (interpolation != NULL)
{ {
interpolation->DelRef(); interpolation->DelRef(force);
interpolation = NULL; interpolation = NULL;
} }
} }

View file

@ -36,7 +36,7 @@ protected:
DMover (); DMover ();
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Destroy(); void Destroy();
void StopInterpolation(); 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 (speed, dest, crush, 0, direction, hexencrush); return MovePlane (speed, dest, crush, 0, direction, hexencrush);

View file

@ -1571,7 +1571,7 @@ public:
bool res = DMover::crushed != MoveFloor(speed, dest, crush, direction, false); bool res = DMover::crushed != MoveFloor(speed, dest, crush, direction, false);
Destroy(); Destroy();
m_Sector->floordata=NULL; m_Sector->floordata=NULL;
StopInterpolation(); StopInterpolation(true);
m_Sector=NULL; m_Sector=NULL;
return res; return res;
} }
@ -1656,6 +1656,14 @@ public:
m_Speed=movespeed; m_Speed=movespeed;
m_Direction = _m_Direction; m_Direction = _m_Direction;
m_FloorDestDist = moveheight; m_FloorDestDist = moveheight;
// Do not interpolate instant movement floors.
fixed_t movedist = abs(-sec->floorplane.d - moveheight);
if (m_Speed >= movedist)
{
StopInterpolation(true);
}
StartFloorSound(); StartFloorSound();
} }
}; };
@ -1713,7 +1721,7 @@ public:
bool res = DMover::crushed != MoveCeiling(speed, dest, crush, direction, false); bool res = DMover::crushed != MoveCeiling(speed, dest, crush, direction, false);
Destroy(); Destroy();
m_Sector->ceilingdata=NULL; m_Sector->ceilingdata=NULL;
StopInterpolation (); StopInterpolation (true);
m_Sector=NULL; m_Sector=NULL;
return res; return res;
} }
@ -1806,7 +1814,7 @@ public:
fixed_t movedist = abs(sec->ceilingplane.d - m_BottomHeight); fixed_t movedist = abs(sec->ceilingplane.d - m_BottomHeight);
if (m_Speed >= movedist) if (m_Speed >= movedist)
{ {
StopInterpolation (); StopInterpolation (true);
m_Silent=2; m_Silent=2;
} }
PlayCeilingSound(); PlayCeilingSound();

View file

@ -412,7 +412,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
} }
if (ceiling->m_Speed >= movedist) if (ceiling->m_Speed >= movedist)
{ {
ceiling->StopInterpolation(); ceiling->StopInterpolation(true);
} }
// set texture/type change properties // set texture/type change properties

View file

@ -478,7 +478,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
(floor->m_Direction<0 && floor->m_FloorDestDist<sec->floorplane.d) || // moving down but going up (floor->m_Direction<0 && floor->m_FloorDestDist<sec->floorplane.d) || // moving down but going up
(floor->m_Speed >= abs(sec->floorplane.d - floor->m_FloorDestDist))) // moving in one step (floor->m_Speed >= abs(sec->floorplane.d - floor->m_FloorDestDist))) // moving in one step
{ {
floor->StopInterpolation(); floor->StopInterpolation(true);
// [Graf Zahl] // [Graf Zahl]
// Don't make sounds for instant movement hacks but make an exception for // Don't make sounds for instant movement hacks but make an exception for

View file

@ -344,9 +344,10 @@ int DInterpolation::AddRef()
// //
//========================================================================== //==========================================================================
int DInterpolation::DelRef() int DInterpolation::DelRef(bool force)
{ {
if (refcount > 0) --refcount; if (refcount > 0) --refcount;
if (force && refcount == 0) Destroy();
return refcount; 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() DInterpolation *FPolyObj::SetInterpolation()
{ {
if (interpolation != NULL) if (interpolation != NULL)

View file

@ -25,7 +25,7 @@ protected:
public: public:
int AddRef(); int AddRef();
int DelRef(); int DelRef(bool force = false);
virtual void Destroy(); virtual void Destroy();
virtual void UpdateInterpolation() = 0; virtual void UpdateInterpolation() = 0;

View file

@ -504,7 +504,6 @@ struct sector_t
sector_t *GetHeightSec() const; sector_t *GetHeightSec() const;
DInterpolation *SetInterpolation(int position, bool attach); DInterpolation *SetInterpolation(int position, bool attach);
void StopInterpolation(int position);
ASkyViewpoint *GetSkyBox(int which); ASkyViewpoint *GetSkyBox(int which);