- While doing the interpolation rewrite I noticed that DScroller and DPolyAction

were doing some things in their destructor that needed to be done in the
  Destroy method.
- Rewrote the interpolation code. Interpolations are no longer some objects
  that are separate from the rest of the engine. Instead, they are owned by
  the thinkers starting them. Also, polyobjects only spawn a single interpolation
  for each polyobject instead of a single one for each vertex.
  Also, different types of interpolation objects are used for different types
  of interpolation so that they can do some additional work if eventually needed.


SVN r1018 (trunk)
This commit is contained in:
Christoph Oelckers 2008-06-04 17:53:15 +00:00
commit acab6d9b30
22 changed files with 1075 additions and 630 deletions

View file

@ -29,6 +29,7 @@
#include "doomstat.h"
#include "r_state.h"
#include "tables.h"
#include "r_interpolate.h"
//
// FLOORS
@ -59,7 +60,10 @@ void DFloor::Serialize (FArchive &arc)
<< m_Hexencrush;
}
IMPLEMENT_CLASS (DElevator)
IMPLEMENT_POINTY_CLASS (DElevator)
DECLARE_POINTER(m_Interp_Floor)
DECLARE_POINTER(m_Interp_Ceiling)
END_POINTERS
DElevator::DElevator ()
{
@ -72,10 +76,30 @@ void DElevator::Serialize (FArchive &arc)
<< m_Direction
<< m_FloorDestDist
<< m_CeilingDestDist
<< m_Speed;
<< m_Speed
<< m_Interp_Floor
<< m_Interp_Ceiling;
}
IMPLEMENT_CLASS (DWaggleBase)
void DElevator::Destroy()
{
if (m_Interp_Ceiling != NULL)
{
m_Interp_Ceiling->DelRef();
m_Interp_Ceiling = NULL;
}
if (m_Interp_Floor != NULL)
{
m_Interp_Floor->DelRef();
m_Interp_Floor = NULL;
}
Super::Destroy();
}
IMPLEMENT_POINTY_CLASS (DWaggleBase)
DECLARE_POINTER(m_Interpolation)
END_POINTERS
IMPLEMENT_CLASS (DFloorWaggle)
IMPLEMENT_CLASS (DCeilingWaggle)
@ -93,7 +117,8 @@ void DWaggleBase::Serialize (FArchive &arc)
<< m_Scale
<< m_ScaleDelta
<< m_Ticker
<< m_State;
<< m_State
<< m_Interpolation;
}
@ -181,7 +206,7 @@ void DFloor::Tick ()
}
m_Sector->floordata = NULL; //jff 2/22/98
stopinterpolation (INTERP_SectorFloor, m_Sector);
StopInterpolation();
//jff 2/26/98 implement stair retrigger lockout while still building
// note this only applies to the retriggerable generalized stairs
@ -268,8 +293,6 @@ void DElevator::Tick ()
m_Sector->floordata = NULL; //jff 2/22/98
m_Sector->ceilingdata = NULL; //jff 2/22/98
stopinterpolation (INTERP_SectorFloor, m_Sector);
stopinterpolation (INTERP_SectorCeiling, m_Sector);
Destroy (); // remove elevator from actives
}
}
@ -539,7 +562,7 @@ manual_floor:
(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
{
stopinterpolation (INTERP_SectorFloor, sec);
floor->StopInterpolation();
// [Graf Zahl]
// Don't make sounds for instant movement hacks but make an exception for
@ -959,8 +982,8 @@ DElevator::DElevator (sector_t *sec)
{
sec->floordata = this;
sec->ceilingdata = this;
setinterpolation (INTERP_SectorFloor, sec);
setinterpolation (INTERP_SectorCeiling, sec);
m_Interp_Floor = sec->SetInterpolation(sector_t::FloorMove, true);
m_Interp_Ceiling = sec->SetInterpolation(sector_t::CeilingMove, true);
}
//
@ -1074,6 +1097,16 @@ DWaggleBase::DWaggleBase (sector_t *sec)
{
}
void DWaggleBase::Destroy()
{
if (m_Interpolation != NULL)
{
m_Interpolation->DelRef();
m_Interpolation = NULL;
}
Super::Destroy();
}
void DWaggleBase::DoWaggle (bool ceiling)
{
secplane_t *plane;
@ -1111,12 +1144,10 @@ void DWaggleBase::DoWaggle (bool ceiling)
if (ceiling)
{
m_Sector->ceilingdata = NULL;
stopinterpolation (INTERP_SectorCeiling, m_Sector);
}
else
{
m_Sector->floordata = NULL;
stopinterpolation (INTERP_SectorFloor, m_Sector);
}
Destroy ();
return;
@ -1156,7 +1187,7 @@ DFloorWaggle::DFloorWaggle (sector_t *sec)
: Super (sec)
{
sec->floordata = this;
setinterpolation (INTERP_SectorFloor, sec);
m_Interpolation = sec->SetInterpolation(sector_t::FloorMove, false);
}
void DFloorWaggle::Tick ()
@ -1178,7 +1209,7 @@ DCeilingWaggle::DCeilingWaggle (sector_t *sec)
: Super (sec)
{
sec->ceilingdata = this;
setinterpolation (INTERP_SectorCeiling, sec);
m_Interpolation = sec->SetInterpolation(sector_t::CeilingMove, false);
}
void DCeilingWaggle::Tick ()