- 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
parent 7ab48d2de6
commit acab6d9b30
22 changed files with 1095 additions and 650 deletions

View file

@ -1,3 +1,14 @@
June 4, 2008 (Changes by Graf Zahl)
- 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.
June 3, 2008 (Changes by Graf Zahl) June 3, 2008 (Changes by Graf Zahl)
- Fixed: MAPINFO's 'lookup' option should only work for actual strings but - Fixed: MAPINFO's 'lookup' option should only work for actual strings but
not for lump and file names. not for lump and file names.

View file

@ -26,6 +26,7 @@
#include "gi.h" #include "gi.h"
#include "p_local.h" #include "p_local.h"
#include "p_3dmidtex.h" #include "p_3dmidtex.h"
#include "r_interpolate.h"
IMPLEMENT_CLASS (DSectorEffect) IMPLEMENT_CLASS (DSectorEffect)
@ -41,12 +42,10 @@ void DSectorEffect::Destroy()
if (m_Sector->floordata == this) if (m_Sector->floordata == this)
{ {
m_Sector->floordata = NULL; m_Sector->floordata = NULL;
stopinterpolation (INTERP_SectorFloor, m_Sector);
} }
if (m_Sector->ceilingdata == this) if (m_Sector->ceilingdata == this)
{ {
m_Sector->ceilingdata = NULL; m_Sector->ceilingdata = NULL;
stopinterpolation (INTERP_SectorCeiling, m_Sector);
} }
if (m_Sector->lightingdata == this) if (m_Sector->lightingdata == this)
{ {
@ -67,7 +66,9 @@ void DSectorEffect::Serialize (FArchive &arc)
arc << m_Sector; arc << m_Sector;
} }
IMPLEMENT_CLASS (DMover) IMPLEMENT_POINTY_CLASS (DMover)
DECLARE_POINTER(interpolation)
END_POINTERS
DMover::DMover () DMover::DMover ()
{ {
@ -76,8 +77,32 @@ DMover::DMover ()
DMover::DMover (sector_t *sector) DMover::DMover (sector_t *sector)
: DSectorEffect (sector) : DSectorEffect (sector)
{ {
interpolation = NULL;
} }
void DMover::Destroy()
{
StopInterpolation();
Super::Destroy();
}
void DMover::Serialize (FArchive &arc)
{
Super::Serialize (arc);
arc << interpolation;
}
void DMover::StopInterpolation()
{
if (interpolation != NULL)
{
interpolation->DelRef();
interpolation = NULL;
}
}
IMPLEMENT_CLASS (DMovingFloor) IMPLEMENT_CLASS (DMovingFloor)
DMovingFloor::DMovingFloor () DMovingFloor::DMovingFloor ()
@ -88,7 +113,7 @@ DMovingFloor::DMovingFloor (sector_t *sector)
: DMover (sector) : DMover (sector)
{ {
sector->floordata = this; sector->floordata = this;
setinterpolation (INTERP_SectorFloor, sector); interpolation = sector->SetInterpolation(sector_t::FloorMove, true);
} }
IMPLEMENT_CLASS (DMovingCeiling) IMPLEMENT_CLASS (DMovingCeiling)
@ -101,7 +126,7 @@ DMovingCeiling::DMovingCeiling (sector_t *sector)
: DMover (sector) : DMover (sector)
{ {
sector->ceilingdata = this; sector->ceilingdata = this;
setinterpolation (INTERP_SectorCeiling, 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, fixed_t move, int floorOrCeiling, bool resetfailed)

View file

@ -24,15 +24,20 @@ protected:
class DMover : public DSectorEffect class DMover : public DSectorEffect
{ {
DECLARE_CLASS (DMover, DSectorEffect) DECLARE_CLASS (DMover, DSectorEffect)
HAS_OBJECT_POINTERS
public: public:
DMover (sector_t *sector); DMover (sector_t *sector);
protected: protected:
enum EResult { ok, crushed, pastdest }; enum EResult { ok, crushed, pastdest };
TObjPtr<DInterpolation> interpolation;
private: private:
bool MoveAttached(int crush, fixed_t move, int floorOrCeiling, bool resetfailed); 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); EResult MovePlane (fixed_t speed, fixed_t dest, int crush, int floorOrCeiling, int direction, bool hexencrush);
protected: protected:
DMover (); DMover ();
void Serialize (FArchive &arc);
void Destroy();
void StopInterpolation();
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

@ -2744,7 +2744,7 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
P_SerializePolyobjs (arc); P_SerializePolyobjs (arc);
P_SerializeSounds (arc); P_SerializeSounds (arc);
StatusBar->Serialize (arc); StatusBar->Serialize (arc);
SerializeInterpolations (arc); //SerializeInterpolations (arc);
arc << level.total_monsters << level.total_items << level.total_secrets; arc << level.total_monsters << level.total_items << level.total_secrets;

View file

@ -80,7 +80,7 @@ bool P_Scroll3dMidtex(sector_t *sector, int crush, fixed_t move, bool ceiling)
// //
//============================================================================ //============================================================================
void P_Start3dMidtexInterpolations(sector_t *sector, bool ceiling) void P_Start3dMidtexInterpolations(TArray<DInterpolation *> &list, sector_t *sector, bool ceiling)
{ {
extsector_t::midtex::plane &scrollplane = ceiling? sector->e->Midtex.Ceiling : sector->e->Midtex.Floor; extsector_t::midtex::plane &scrollplane = ceiling? sector->e->Midtex.Ceiling : sector->e->Midtex.Floor;
@ -88,30 +88,8 @@ void P_Start3dMidtexInterpolations(sector_t *sector, bool ceiling)
{ {
line_t *l = scrollplane.AttachedLines[i]; line_t *l = scrollplane.AttachedLines[i];
sides[l->sidenum[0]].SetInterpolation(side_t::mid); list.Push(sides[l->sidenum[0]].SetInterpolation(side_t::mid));
sides[l->sidenum[1]].SetInterpolation(side_t::mid); list.Push(sides[l->sidenum[1]].SetInterpolation(side_t::mid));
}
}
//============================================================================
//
// P_Stop3DMidtexInterpolations
//
// Stops interpolators for every sidedef that is being changed by moving
// this sector
//
//============================================================================
void P_Stop3dMidtexInterpolations(sector_t *sector, bool ceiling)
{
extsector_t::midtex::plane &scrollplane = ceiling? sector->e->Midtex.Ceiling : sector->e->Midtex.Floor;
for(unsigned i = 0; i < scrollplane.AttachedLines.Size(); i++)
{
line_t *l = scrollplane.AttachedLines[i];
sides[l->sidenum[0]].StopInterpolation(side_t::mid);
sides[l->sidenum[1]].StopInterpolation(side_t::mid);
} }
} }

View file

@ -8,16 +8,14 @@
class AActor; class AActor;
bool P_Scroll3dMidtex(sector_t *sector, int crush, fixed_t move, bool ceiling); bool P_Scroll3dMidtex(sector_t *sector, int crush, fixed_t move, bool ceiling);
void P_Start3dMidtexInterpolations(sector_t *sec, bool ceiling); void P_Start3dMidtexInterpolations(TArray<DInterpolation *> &list, sector_t *sec, bool ceiling);
void P_Stop3dMidtexInterpolations(sector_t *sec, bool ceiling);
void P_Attach3dMidtexLinesToSector(sector_t *dest, int lineid, int tag, bool ceiling); void P_Attach3dMidtexLinesToSector(sector_t *dest, int lineid, int tag, bool ceiling);
bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, fixed_t *ptexbot); bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, fixed_t *ptexbot);
bool P_Check3dMidSwitch(AActor *actor, line_t *line, int side); bool P_Check3dMidSwitch(AActor *actor, line_t *line, int side);
bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, fixed_t &opentop, fixed_t &openbottom); bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, fixed_t &opentop, fixed_t &openbottom);
bool P_MoveLinkedSectors(sector_t *sector, int crush, fixed_t move, bool ceiling); bool P_MoveLinkedSectors(sector_t *sector, int crush, fixed_t move, bool ceiling);
void P_StartLinkedSectorInterpolations(sector_t *sector, bool ceiling); void P_StartLinkedSectorInterpolations(TArray<DInterpolation *> &list, sector_t *sector, bool ceiling);
void P_StopLinkedSectorInterpolations(sector_t *sector, bool ceiling);
bool P_AddSectorLinks(sector_t *control, int tag, INTBOOL ceiling, int movetype); bool P_AddSectorLinks(sector_t *control, int tag, INTBOOL ceiling, int movetype);
void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling); void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling);

View file

@ -401,7 +401,7 @@ manual_ceiling:
} }
if (ceiling->m_Speed >= movedist) if (ceiling->m_Speed >= movedist)
{ {
stopinterpolation (INTERP_SectorCeiling, sec); ceiling->StopInterpolation();
} }
// set texture/type change properties // set texture/type change properties

View file

@ -138,7 +138,6 @@ void DDoor::Tick ()
case doorRaise: case doorRaise:
case doorClose: case doorClose:
m_Sector->ceilingdata = NULL; //jff 2/22/98 m_Sector->ceilingdata = NULL; //jff 2/22/98
stopinterpolation (INTERP_SectorCeiling, m_Sector);
Destroy (); // unlink and free Destroy (); // unlink and free
break; break;
@ -190,7 +189,6 @@ void DDoor::Tick ()
case doorCloseWaitOpen: case doorCloseWaitOpen:
case doorOpen: case doorOpen:
m_Sector->ceilingdata = NULL; //jff 2/22/98 m_Sector->ceilingdata = NULL; //jff 2/22/98
stopinterpolation (INTERP_SectorCeiling, m_Sector);
Destroy (); // unlink and free Destroy (); // unlink and free
break; break;
@ -697,7 +695,7 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay)
// The DMovingCeiling constructor automatically sets up an interpolation for us. // The DMovingCeiling constructor automatically sets up an interpolation for us.
// Stop it, since the ceiling is moving instantly here. // Stop it, since the ceiling is moving instantly here.
stopinterpolation (INTERP_SectorCeiling, sec); StopInterpolation();
m_WhichDoorIndex = P_FindSlidingDoorType (sides[line->sidenum[0]].GetTexture(side_t::top)); m_WhichDoorIndex = P_FindSlidingDoorType (sides[line->sidenum[0]].GetTexture(side_t::top));
if (m_WhichDoorIndex < 0) if (m_WhichDoorIndex < 0)
{ {

View file

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

View file

@ -207,7 +207,7 @@ bool P_MoveLinkedSectors(sector_t *sector, int crush, fixed_t move, bool ceiling
// //
//============================================================================ //============================================================================
void P_StartLinkedSectorInterpolations(sector_t *sector, bool ceiling) void P_StartLinkedSectorInterpolations(TArray<DInterpolation *> &list, sector_t *sector, bool ceiling)
{ {
extsector_t::linked::plane &scrollplane = ceiling? sector->e->Linked.Ceiling : sector->e->Linked.Floor; extsector_t::linked::plane &scrollplane = ceiling? sector->e->Linked.Ceiling : sector->e->Linked.Floor;
@ -215,43 +215,15 @@ void P_StartLinkedSectorInterpolations(sector_t *sector, bool ceiling)
{ {
if (scrollplane.Sectors[i].Type & LINK_FLOOR) if (scrollplane.Sectors[i].Type & LINK_FLOOR)
{ {
setinterpolation(INTERP_SectorFloor, scrollplane.Sectors[i].Sector, false); list.Push(scrollplane.Sectors[i].Sector->SetInterpolation(sector_t::FloorMove, false));
} }
if (scrollplane.Sectors[i].Type & LINK_CEILING) if (scrollplane.Sectors[i].Type & LINK_CEILING)
{ {
setinterpolation(INTERP_SectorCeiling, scrollplane.Sectors[i].Sector, false); list.Push(scrollplane.Sectors[i].Sector->SetInterpolation(sector_t::CeilingMove, false));
} }
} }
} }
//============================================================================
//
// P_StopLinkedSectorInterpolations
//
// Stops interpolators for every sector plane is being changed by moving
// this sector
//
//============================================================================
void P_StopLinkedSectorInterpolations(sector_t *sector, bool ceiling)
{
extsector_t::linked::plane &scrollplane = ceiling? sector->e->Linked.Ceiling : sector->e->Linked.Floor;
for(unsigned i = 0; i < scrollplane.Sectors.Size(); i++)
{
if (scrollplane.Sectors[i].Type & LINK_FLOOR)
{
stopinterpolation(INTERP_SectorFloor, scrollplane.Sectors[i].Sector, false);
}
if (scrollplane.Sectors[i].Type & LINK_CEILING)
{
stopinterpolation(INTERP_SectorCeiling, scrollplane.Sectors[i].Sector, false);
}
}
}
//============================================================================ //============================================================================
// //
// AddSingleSector // AddSingleSector

View file

@ -37,13 +37,32 @@
#include "p_spec.h" #include "p_spec.h"
#include "g_level.h" #include "g_level.h"
#include "s_sndseq.h" #include "s_sndseq.h"
#include "r_interpolate.h"
IMPLEMENT_CLASS (DPillar) IMPLEMENT_POINTY_CLASS (DPillar)
DECLARE_POINTER(m_Interp_Floor)
DECLARE_POINTER(m_Interp_Ceiling)
END_POINTERS
DPillar::DPillar () DPillar::DPillar ()
{ {
} }
void DPillar::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();
}
void DPillar::Serialize (FArchive &arc) void DPillar::Serialize (FArchive &arc)
{ {
Super::Serialize (arc); Super::Serialize (arc);
@ -53,7 +72,9 @@ void DPillar::Serialize (FArchive &arc)
<< m_FloorTarget << m_FloorTarget
<< m_CeilingTarget << m_CeilingTarget
<< m_Crush << m_Crush
<< m_Hexencrush; << m_Hexencrush
<< m_Interp_Floor
<< m_Interp_Ceiling;
} }
void DPillar::Tick () void DPillar::Tick ()
@ -101,8 +122,8 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
vertex_t *spot; vertex_t *spot;
sector->floordata = sector->ceilingdata = this; sector->floordata = sector->ceilingdata = this;
setinterpolation (INTERP_SectorFloor, sector); m_Interp_Floor = sector->SetInterpolation(sector_t::FloorMove, true);
setinterpolation (INTERP_SectorCeiling, sector); m_Interp_Ceiling = sector->SetInterpolation(sector_t::CeilingMove, true);
m_Type = type; m_Type = type;
m_Crush = crush; m_Crush = crush;

View file

@ -45,6 +45,7 @@
#include "s_sndseq.h" #include "s_sndseq.h"
#include "v_palette.h" #include "v_palette.h"
#include "a_sharedglobal.h" #include "a_sharedglobal.h"
#include "r_interpolate.h"
static void CopyPlayer (player_t *dst, player_t *src, const char *name); static void CopyPlayer (player_t *dst, player_t *src, const char *name);
static void ReadOnePlayer (FArchive &arc); static void ReadOnePlayer (FArchive &arc);
@ -333,7 +334,11 @@ void P_SerializeWorld (FArchive &arc)
<< sec->Flags << sec->Flags
<< sec->FloorSkyBox << sec->CeilingSkyBox << sec->FloorSkyBox << sec->CeilingSkyBox
<< sec->ZoneNumber << sec->ZoneNumber
<< sec->oldspecial; << sec->oldspecial
<< sec->interpolations[0]
<< sec->interpolations[1]
<< sec->interpolations[2]
<< sec->interpolations[3];
sec->e->Serialize(arc); sec->e->Serialize(arc);
if (arc.IsStoring ()) if (arc.IsStoring ())
@ -409,6 +414,21 @@ void extsector_t::Serialize(FArchive &arc)
<< Linked.Ceiling.Sectors; << Linked.Ceiling.Sectors;
} }
FArchive &operator<< (FArchive &arc, side_t::part &p)
{
arc << p.xoffset << p.yoffset << p.interpolation;// << p.Light;
if (arc.IsStoring ())
{
TexMan.WriteTexture (arc, p.texture);
}
else
{
p.texture = TexMan.ReadTexture (arc);
}
return arc;
}
// //
// Thinkers // Thinkers
// //
@ -468,7 +488,7 @@ void P_SerializePolyobjs (FArchive &arc)
for(i = 0, po = polyobjs; i < po_NumPolyobjs; i++, po++) for(i = 0, po = polyobjs; i < po_NumPolyobjs; i++, po++)
{ {
arc << po->tag << po->angle << po->startSpot[0] << arc << po->tag << po->angle << po->startSpot[0] <<
po->startSpot[1] << po->startSpot[2]; po->startSpot[1] << po->startSpot[2] << po->interpolation;
} }
} }
else else
@ -495,7 +515,7 @@ void P_SerializePolyobjs (FArchive &arc)
} }
arc << angle; arc << angle;
PO_RotatePolyobj (po->tag, angle); PO_RotatePolyobj (po->tag, angle);
arc << deltaX << deltaY << deltaZ; arc << deltaX << deltaY << deltaZ << po->interpolation;
deltaX -= po->startSpot[0]; deltaX -= po->startSpot[0];
deltaY -= po->startSpot[1]; deltaY -= po->startSpot[1];
deltaZ -= po->startSpot[2]; deltaZ -= po->startSpot[2];

View file

@ -60,6 +60,7 @@
#include "sbar.h" #include "sbar.h"
#include "p_setup.h" #include "p_setup.h"
#include "r_translate.h" #include "r_translate.h"
#include "r_interpolate.h"
void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt); void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt);
void P_SetSlopes (); void P_SetSlopes ();
@ -3194,7 +3195,7 @@ void P_SetupLevel (char *lumpname, int position)
// Free all level data from the previous map // Free all level data from the previous map
P_FreeLevelData (); P_FreeLevelData ();
clearinterpolations(); // [RH] Nothing to interpolate on a fresh level. interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
MapData * map = P_OpenMapData(lumpname); MapData * map = P_OpenMapData(lumpname);
if (map == NULL) if (map == NULL)

View file

@ -65,15 +65,18 @@
#include "c_console.h" #include "c_console.h"
// [RH] Needed for sky scrolling #include "r_interpolate.h"
#include "r_sky.h"
static FRandom pr_playerinspecialsector ("PlayerInSpecialSector"); static FRandom pr_playerinspecialsector ("PlayerInSpecialSector");
// [GrafZahl] Make this message changable by the user! ;) // [GrafZahl] Make this message changable by the user! ;)
CVAR(String, secretmessage, "A Secret is revealed!", CVAR_ARCHIVE) CVAR(String, secretmessage, "A Secret is revealed!", CVAR_ARCHIVE)
IMPLEMENT_CLASS (DScroller) IMPLEMENT_POINTY_CLASS (DScroller)
DECLARE_POINTER (m_Interpolations[0])
DECLARE_POINTER (m_Interpolations[1])
DECLARE_POINTER (m_Interpolations[2])
END_POINTERS
IMPLEMENT_POINTY_CLASS (DPusher) IMPLEMENT_POINTY_CLASS (DPusher)
DECLARE_POINTER (m_Source) DECLARE_POINTER (m_Source)
@ -93,7 +96,10 @@ void DScroller::Serialize (FArchive &arc)
<< m_LastHeight << m_LastHeight
<< m_vdx << m_vdy << m_vdx << m_vdy
<< m_Accel << m_Accel
<< m_Parts; << m_Parts
<< m_Interpolations[0]
<< m_Interpolations[1]
<< m_Interpolations[2];
} }
DPusher::DPusher () DPusher::DPusher ()
@ -1196,6 +1202,8 @@ DScroller::DScroller (EScrollType type, fixed_t dx, fixed_t dy,
m_LastHeight = m_LastHeight =
sectors[control].CenterFloor () + sectors[control].CenterCeiling (); sectors[control].CenterFloor () + sectors[control].CenterCeiling ();
m_Affectee = affectee; m_Affectee = affectee;
m_Interpolations[0] = m_Interpolations[1] = m_Interpolations[2] = NULL;
switch (type) switch (type)
{ {
case sc_carry: case sc_carry:
@ -1206,25 +1214,25 @@ DScroller::DScroller (EScrollType type, fixed_t dx, fixed_t dy,
sides[affectee].Flags |= WALLF_NOAUTODECALS; sides[affectee].Flags |= WALLF_NOAUTODECALS;
if (m_Parts & scw_top) if (m_Parts & scw_top)
{ {
sides[m_Affectee].SetInterpolation(side_t::top); m_Interpolations[0] = sides[m_Affectee].SetInterpolation(side_t::top);
} }
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL || if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL ||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX))) !(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX)))
{ {
sides[m_Affectee].SetInterpolation(side_t::mid); m_Interpolations[1] = sides[m_Affectee].SetInterpolation(side_t::mid);
} }
if (m_Parts & scw_bottom) if (m_Parts & scw_bottom)
{ {
sides[m_Affectee].SetInterpolation(side_t::bottom); m_Interpolations[2] = sides[m_Affectee].SetInterpolation(side_t::bottom);
} }
break; break;
case sc_floor: case sc_floor:
setinterpolation (INTERP_FloorPanning, &sectors[affectee]); m_Interpolations[0] = sectors[affectee].SetInterpolation(sector_t::FloorScroll, false);
break; break;
case sc_ceiling: case sc_ceiling:
setinterpolation (INTERP_CeilingPanning, &sectors[affectee]); m_Interpolations[0] = sectors[affectee].SetInterpolation(sector_t::CeilingScroll, false);
break; break;
default: default:
@ -1232,37 +1240,17 @@ DScroller::DScroller (EScrollType type, fixed_t dx, fixed_t dy,
} }
} }
DScroller::~DScroller () void DScroller::Destroy ()
{ {
switch (m_Type) for(int i=0;i<3;i++)
{ {
case sc_side: if (m_Interpolations[i] != NULL)
if (m_Parts & scw_top)
{ {
sides[m_Affectee].StopInterpolation(side_t::top); m_Interpolations[i]->DelRef();
m_Interpolations[i] = NULL;
} }
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL ||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX)))
{
sides[m_Affectee].StopInterpolation(side_t::mid);
}
if (m_Parts & scw_bottom)
{
sides[m_Affectee].StopInterpolation(side_t::bottom);
}
break;
case sc_floor:
stopinterpolation (INTERP_FloorPanning, &sectors[m_Affectee]);
break;
case sc_ceiling:
stopinterpolation (INTERP_CeilingPanning, &sectors[m_Affectee]);
break;
default:
break;
} }
Super::Destroy();
} }
// Adds wall scroller. Scroll amount is rotated with respect to wall's // Adds wall scroller. Scroll amount is rotated with respect to wall's
@ -1294,19 +1282,20 @@ DScroller::DScroller (fixed_t dx, fixed_t dy, const line_t *l,
m_LastHeight = sectors[control].CenterFloor() + sectors[control].CenterCeiling(); m_LastHeight = sectors[control].CenterFloor() + sectors[control].CenterCeiling();
m_Affectee = *l->sidenum; m_Affectee = *l->sidenum;
sides[m_Affectee].Flags |= WALLF_NOAUTODECALS; sides[m_Affectee].Flags |= WALLF_NOAUTODECALS;
m_Interpolations[0] = m_Interpolations[1] = m_Interpolations[2] = NULL;
if (m_Parts & scw_top) if (m_Parts & scw_top)
{ {
sides[m_Affectee].SetInterpolation(side_t::top); m_Interpolations[0] = sides[m_Affectee].SetInterpolation(side_t::top);
} }
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL || if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL ||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX))) !(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX)))
{ {
sides[m_Affectee].SetInterpolation(side_t::mid); m_Interpolations[1] = sides[m_Affectee].SetInterpolation(side_t::mid);
} }
if (m_Parts & scw_bottom) if (m_Parts & scw_bottom)
{ {
sides[m_Affectee].SetInterpolation(side_t::bottom); m_Interpolations[2] = sides[m_Affectee].SetInterpolation(side_t::bottom);
} }
} }

View file

@ -43,6 +43,7 @@ typedef enum
class DScroller : public DThinker class DScroller : public DThinker
{ {
DECLARE_CLASS (DScroller, DThinker) DECLARE_CLASS (DScroller, DThinker)
HAS_OBJECT_POINTERS
public: public:
enum EScrollType enum EScrollType
{ {
@ -62,7 +63,7 @@ public:
DScroller (EScrollType type, fixed_t dx, fixed_t dy, int control, int affectee, int accel, int scrollpos = scw_all); DScroller (EScrollType type, fixed_t dx, fixed_t dy, int control, int affectee, int accel, int scrollpos = scw_all);
DScroller (fixed_t dx, fixed_t dy, const line_t *l, int control, int accel, int scrollpos = scw_all); DScroller (fixed_t dx, fixed_t dy, const line_t *l, int control, int accel, int scrollpos = scw_all);
~DScroller (); void Destroy();
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Tick (); void Tick ();
@ -83,6 +84,7 @@ protected:
fixed_t m_vdx, m_vdy; // Accumulated velocity if accelerative fixed_t m_vdx, m_vdy; // Accumulated velocity if accelerative
int m_Accel; // Whether it's accelerative int m_Accel; // Whether it's accelerative
int m_Parts; // Which parts of a sidedef are being scrolled? int m_Parts; // Which parts of a sidedef are being scrolled?
TObjPtr<DInterpolation> m_Interpolations[3];
private: private:
DScroller (); DScroller ();
@ -490,6 +492,7 @@ inline FArchive &operator<< (FArchive &arc, DPlat::EPlatState &state)
class DPillar : public DMover class DPillar : public DMover
{ {
DECLARE_CLASS (DPillar, DMover) DECLARE_CLASS (DPillar, DMover)
HAS_OBJECT_POINTERS
public: public:
enum EPillar enum EPillar
{ {
@ -503,6 +506,7 @@ public:
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Tick (); void Tick ();
void Destroy();
protected: protected:
EPillar m_Type; EPillar m_Type;
@ -512,6 +516,8 @@ protected:
fixed_t m_CeilingTarget; fixed_t m_CeilingTarget;
int m_Crush; int m_Crush;
bool m_Hexencrush; bool m_Hexencrush;
TObjPtr<DInterpolation> m_Interp_Ceiling;
TObjPtr<DInterpolation> m_Interp_Floor;
private: private:
DPillar (); DPillar ();
@ -840,6 +846,7 @@ inline FArchive &operator<< (FArchive &arc, DFloor::EFloor &type)
class DElevator : public DMover class DElevator : public DMover
{ {
DECLARE_CLASS (DElevator, DMover) DECLARE_CLASS (DElevator, DMover)
HAS_OBJECT_POINTERS
public: public:
enum EElevator enum EElevator
{ {
@ -853,6 +860,7 @@ public:
DElevator (sector_t *sec); DElevator (sector_t *sec);
void Destroy();
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Tick (); void Tick ();
@ -862,6 +870,8 @@ protected:
fixed_t m_FloorDestDist; fixed_t m_FloorDestDist;
fixed_t m_CeilingDestDist; fixed_t m_CeilingDestDist;
fixed_t m_Speed; fixed_t m_Speed;
TObjPtr<DInterpolation> m_Interp_Ceiling;
TObjPtr<DInterpolation> m_Interp_Floor;
void StartFloorSound (); void StartFloorSound ();
@ -885,6 +895,7 @@ inline FArchive &operator<< (FArchive &arc, DElevator::EElevator &type)
class DWaggleBase : public DMover class DWaggleBase : public DMover
{ {
DECLARE_CLASS (DWaggleBase, DMover) DECLARE_CLASS (DWaggleBase, DMover)
HAS_OBJECT_POINTERS
public: public:
DWaggleBase (sector_t *sec); DWaggleBase (sector_t *sec);
@ -899,11 +910,13 @@ protected:
fixed_t m_ScaleDelta; fixed_t m_ScaleDelta;
int m_Ticker; int m_Ticker;
int m_State; int m_State;
TObjPtr<DInterpolation> m_Interpolation;
friend bool EV_StartWaggle (int tag, int height, int speed, friend bool EV_StartWaggle (int tag, int height, int speed,
int offset, int timer, bool ceiling); int offset, int timer, bool ceiling);
void DoWaggle (bool ceiling); void DoWaggle (bool ceiling);
void Destroy();
DWaggleBase (); DWaggleBase ();
}; };

View file

@ -30,6 +30,7 @@
#include "s_sound.h" #include "s_sound.h"
#include "doomstat.h" #include "doomstat.h"
#include "sbar.h" #include "sbar.h"
#include "r_interpolate.h"
extern gamestate_t wipegamestate; extern gamestate_t wipegamestate;
@ -68,7 +69,7 @@ void P_Ticker (void)
{ {
int i; int i;
updateinterpolations (); interpolator.UpdateInterpolations ();
r_NoInterpolate = true; r_NoInterpolate = true;
// run the tic // run the tic

View file

@ -24,6 +24,7 @@
#include "a_sharedglobal.h" #include "a_sharedglobal.h"
#include "r_main.h" #include "r_main.h"
#include "p_lnspec.h" #include "p_lnspec.h"
#include "r_interpolate.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -42,10 +43,11 @@ inline FArchive &operator<< (FArchive &arc, podoortype_t &type)
class DPolyAction : public DThinker class DPolyAction : public DThinker
{ {
DECLARE_CLASS (DPolyAction, DThinker) DECLARE_CLASS (DPolyAction, DThinker)
HAS_OBJECT_POINTERS
public: public:
DPolyAction (int polyNum); DPolyAction (int polyNum);
~DPolyAction ();
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Destroy();
void StopInterpolation (); void StopInterpolation ();
protected: protected:
@ -53,6 +55,7 @@ protected:
int m_PolyObj; int m_PolyObj;
int m_Speed; int m_Speed;
int m_Dist; int m_Dist;
TObjPtr<DInterpolation> m_Interpolation;
void SetInterpolation (); void SetInterpolation ();
@ -152,7 +155,10 @@ static TArray<SDWORD> KnownPolySegs;
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
IMPLEMENT_CLASS (DPolyAction) IMPLEMENT_POINTY_CLASS (DPolyAction)
DECLARE_POINTER(m_Interpolation)
END_POINTERS
IMPLEMENT_CLASS (DRotatePoly) IMPLEMENT_CLASS (DRotatePoly)
IMPLEMENT_CLASS (DMovePoly) IMPLEMENT_CLASS (DMovePoly)
IMPLEMENT_CLASS (DPolyDoor) IMPLEMENT_CLASS (DPolyDoor)
@ -164,7 +170,7 @@ DPolyAction::DPolyAction ()
void DPolyAction::Serialize (FArchive &arc) void DPolyAction::Serialize (FArchive &arc)
{ {
Super::Serialize (arc); Super::Serialize (arc);
arc << m_PolyObj << m_Speed << m_Dist; arc << m_PolyObj << m_Speed << m_Dist << m_Interpolation;
} }
DPolyAction::DPolyAction (int polyNum) DPolyAction::DPolyAction (int polyNum)
@ -175,32 +181,31 @@ DPolyAction::DPolyAction (int polyNum)
SetInterpolation (); SetInterpolation ();
} }
DPolyAction::~DPolyAction () void DPolyAction::Destroy()
{ {
FPolyObj *poly = GetPolyobj (m_PolyObj); FPolyObj *poly = GetPolyobj (m_PolyObj);
if (poly->specialdata == NULL || poly->specialdata == this) if (poly->specialdata == NULL || poly->specialdata == this)
{ {
poly->specialdata = NULL; poly->specialdata = NULL;
StopInterpolation ();
} }
StopInterpolation();
Super::Destroy();
} }
void DPolyAction::SetInterpolation () void DPolyAction::SetInterpolation ()
{ {
FPolyObj *poly = GetPolyobj (m_PolyObj); FPolyObj *poly = GetPolyobj (m_PolyObj);
for (int i = 0; i < poly->numvertices; ++i) m_Interpolation = poly->SetInterpolation();
{
setinterpolation (INTERP_Vertex, poly->vertices[i]);
}
} }
void DPolyAction::StopInterpolation () void DPolyAction::StopInterpolation ()
{ {
FPolyObj *poly = GetPolyobj (m_PolyObj); if (m_Interpolation != NULL)
for (int i = 0; i < poly->numvertices; ++i)
{ {
stopinterpolation (INTERP_Vertex, poly->vertices[i]); m_Interpolation->DelRef();
m_Interpolation = NULL;
} }
} }

View file

@ -35,9 +35,6 @@
#include "actor.h" #include "actor.h"
#include "dthinker.h" #include "dthinker.h"
#include "r_interpolate.h"
#define MAXWIDTH 2560 #define MAXWIDTH 2560
#define MAXHEIGHT 1600 #define MAXHEIGHT 1600
@ -88,6 +85,7 @@ class player_t;
class FScanner; class FScanner;
class FBitmap; class FBitmap;
struct FCopyInfo; struct FCopyInfo;
class DInterpolation;
// //
// The SECTORS record, at runtime. // The SECTORS record, at runtime.
@ -346,6 +344,9 @@ struct sector_t
void SetColor(int r, int g, int b, int desat); void SetColor(int r, int g, int b, int desat);
void SetFade(int r, int g, int b); void SetFade(int r, int g, int b);
DInterpolation *SetInterpolation(int position, bool attach);
void StopInterpolation(int position);
// Member variables // Member variables
fixed_t CenterFloor () const { return floorplane.ZatPoint (soundorg[0], soundorg[1]); } fixed_t CenterFloor () const { return floorplane.ZatPoint (soundorg[0], soundorg[1]); }
fixed_t CenterCeiling () const { return ceilingplane.ZatPoint (soundorg[0], soundorg[1]); } fixed_t CenterCeiling () const { return ceilingplane.ZatPoint (soundorg[0], soundorg[1]); }
@ -400,6 +401,15 @@ struct sector_t
TObjPtr<DSectorEffect> ceilingdata; // floors, ceilings, lighting, TObjPtr<DSectorEffect> ceilingdata; // floors, ceilings, lighting,
TObjPtr<DSectorEffect> lightingdata; // independent of one another TObjPtr<DSectorEffect> lightingdata; // independent of one another
enum
{
CeilingMove,
FloorMove,
CeilingScroll,
FloorScroll
};
TObjPtr<DInterpolation> interpolations[4];
// jff 2/26/98 lockout machinery for stairbuilding // jff 2/26/98 lockout machinery for stairbuilding
SBYTE stairlock; // -2 on first locked -1 after thinker done 0 normally SBYTE stairlock; // -2 on first locked -1 after thinker done 0 normally
SWORD prevsec; // -1 or number of sector for previous step SWORD prevsec; // -1 or number of sector for previous step
@ -479,6 +489,7 @@ struct side_t
fixed_t xoffset; fixed_t xoffset;
fixed_t yoffset; fixed_t yoffset;
int texture; int texture;
TObjPtr<DInterpolation> interpolation;
//int Light; //int Light;
}; };
@ -540,15 +551,8 @@ struct side_t
textures[which].yoffset += delta; textures[which].yoffset += delta;
} }
void SetInterpolation(int position) DInterpolation *SetInterpolation(int position);
{ void StopInterpolation(int position);
setinterpolation(EInterpType(INTERP_WallPanning_Top+position), this);
}
void StopInterpolation(int position)
{
stopinterpolation(EInterpType(INTERP_WallPanning_Top+position), this);
}
}; };
FArchive &operator<< (FArchive &arc, side_t::part &p); FArchive &operator<< (FArchive &arc, side_t::part &p);
@ -670,8 +674,12 @@ struct FPolyObj
int seqType; int seqType;
fixed_t size; // polyobj size (area of POLY_AREAUNIT == size of FRACUNIT) fixed_t size; // polyobj size (area of POLY_AREAUNIT == size of FRACUNIT)
DThinker *specialdata; // pointer to a thinker, if the poly is moving DThinker *specialdata; // pointer to a thinker, if the poly is moving
TObjPtr<DInterpolation> interpolation;
~FPolyObj(); ~FPolyObj();
DInterpolation *SetInterpolation();
void StopInterpolation();
}; };
// //

File diff suppressed because it is too large Load diff

View file

@ -1,156 +1,66 @@
#ifndef R_INTERPOLATE_H #ifndef R_INTERPOLATE_H
#define R_INTERPOLATE_H #define R_INTERPOLATE_H
#include "doomtype.h" //==========================================================================
#include "dobject.h" //
#include "r_defs.h" //
//
// BUILD stuff for interpolating between frames, but modified (rather a lot) //==========================================================================
#define INTERPOLATION_BUCKETS 107
#if 0
class DInterpolation : public DObject class DInterpolation : public DObject
{ {
friend struct FInterpolator;
DECLARE_ABSTRACT_CLASS(DInterpolation, DObject) DECLARE_ABSTRACT_CLASS(DInterpolation, DObject)
HAS_OBJECT_POINTERS
DInterpolation *Next; DInterpolation *Next;
DInterpolation **Prev;
int refcount;
protected: protected:
DInterpolation(); DInterpolation();
public: public:
int AddRef();
int DelRef();
virtual void Destroy(); virtual void Destroy();
virtual void CopyInterpToOld() = 0; virtual void UpdateInterpolation() = 0;
virtual void CopyBakToInterp() = 0; virtual void Restore() = 0;
virtual void DoAnInterpolation(fixed_t smoothratio) = 0; virtual void Interpolate(fixed_t smoothratio) = 0;
virtual void Serialize(FArchive &arc); virtual void Serialize(FArchive &arc);
}; };
class DSectorPlaneInterpolation : public DInterpolation //==========================================================================
{ //
DECLARE_CLASS(DSectorPlaneInterpolation, DInterpolation) //
//
sector_t *sector; //==========================================================================
fixed_t oldheight, oldtexz;
fixed_t bakheight, baktexz;
bool floor;
TArray<DInterpolation *> attached;
public:
DSectorPlaneInterpolation(sector_t *sector, int plane, bool attach);
void Destroy();
void CopyInterpToOld();
void CopyBakToInterp();
void DoAnInterpolation(fixed_t smoothratio);
void Serialize(FArchive &arc);
size_t PointerSubstitution (DObject *old, DObject *notOld);
size_t PropagateMark();
};
class DSectorScrollInterpolation : public DInterpolation
{
DECLARE_CLASS(DSectorScrollInterpolation, DInterpolation)
sector_t *sector;
fixed_t oldx, oldy;
fixed_t bakx, baky;
bool floor;
public:
DSectorScrollInterpolation(sector_t *sector, int plane);
void Destroy();
void CopyInterpToOld();
void CopyBakToInterp();
void DoAnInterpolation(fixed_t smoothratio);
void Serialize(FArchive &arc);
};
class DWallScrollInterpolation : public DInterpolation
{
DECLARE_CLASS(DWallScrollInterpolation, DInterpolation)
side_t *side;
side_t::ETexpart part;
fixed_t oldx, oldy;
fixed_t bakx, baky;
public:
DWallScrollInterpolation(side_t *side, side_t::ETexpart part);
void Destroy();
void CopyInterpToOld();
void CopyBakToInterp();
void DoAnInterpolation(fixed_t smoothratio);
void Serialize(FArchive &arc);
};
class DPolyobjInterpolation : public DInterpolation
{
DECLARE_CLASS(DPolyobjInterpolation, DInterpolation)
FPolyobj *poly;
vertex_t *oldverts, *bakverts;
public:
DPolyobjInterpolation(FPolyObj *poly);
void Destroy();
void CopyInterpToOld();
void CopyBakToInterp();
void DoAnInterpolation(fixed_t smoothratio);
void Serialize(FArchive &arc);
};
struct FInterpolator struct FInterpolator
{ {
DInterpolation *curiposhash[INTERPOLATION_BUCKETS]; DInterpolation *Head;
bool didInterp;
int CountInterpolations (); int CountInterpolations ();
int CountInterpolations (int *usedbuckets, int *minbucketfill, int *maxbucketfill);
private:
size_t HashKey(FName type, void *interptr, int param);
DInterpolation *FindInterpolation(const PClass *, void *interptr, int param, DInterpolation **&interp_p);
public: public:
DInterpolation *FindInterpolation(const PClass *, void *interptr, int param); FInterpolator()
{
Head = NULL;
didInterp = false;
}
void UpdateInterpolations(); void UpdateInterpolations();
void AddInterpolation(DInterpolation *); void AddInterpolation(DInterpolation *);
void RemoveInterpolation(DInterpolation *); void RemoveInterpolation(DInterpolation *);
void DoInterpolations(fixed_t smoothratio); void DoInterpolations(fixed_t smoothratio);
void RestoreInterpolations(); void RestoreInterpolations();
void ClearInterpolations();
}; };
#endif extern FInterpolator interpolator;
class FArchive;
enum EInterpType
{
INTERP_SectorFloor, // Pass a sector_t *
INTERP_SectorCeiling, // Pass a sector_t *
INTERP_Vertex, // Pass a vertex_t *
INTERP_FloorPanning, // Pass a sector_t *
INTERP_CeilingPanning, // Pass a sector_t *
INTERP_WallPanning_Top, // Pass a side_t *
INTERP_WallPanning_Mid,
INTERP_WallPanning_Bottom,
};
void updateinterpolations();
void setinterpolation(EInterpType, void *interptr, bool dolinks = true);
void stopinterpolation(EInterpType, void *interptr, bool dolinks = true);
void dointerpolations(fixed_t smoothratio);
void restoreinterpolations();
void clearinterpolations();
void SerializeInterpolations(FArchive &arc);
#endif #endif

View file

@ -48,6 +48,7 @@
#include "a_sharedglobal.h" #include "a_sharedglobal.h"
#include "r_translate.h" #include "r_translate.h"
#include "p_3dmidtex.h" #include "p_3dmidtex.h"
#include "r_interpolate.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -1126,7 +1127,7 @@ void R_SetupFrame (AActor *actor)
R_CopyStackedViewParameters(); R_CopyStackedViewParameters();
R_SetViewAngle (); R_SetViewAngle ();
dointerpolations (r_TicFrac); interpolator.DoInterpolations (r_TicFrac);
// Keep the view within the sector's floor and ceiling // Keep the view within the sector's floor and ceiling
fixed_t theZ = viewsector->ceilingplane.ZatPoint (viewx, viewy) - 4*FRACUNIT; fixed_t theZ = viewsector->ceilingplane.ZatPoint (viewx, viewy) - 4*FRACUNIT;
@ -1570,7 +1571,7 @@ void R_RenderActorView (AActor *actor, bool dontmaplines)
} }
WallMirrors.Clear (); WallMirrors.Clear ();
restoreinterpolations (); interpolator.RestoreInterpolations ();
// If there is vertical doubling, and the view window is not an even height, // If there is vertical doubling, and the view window is not an even height,
// draw a black line at the bottom of the view window. // draw a black line at the bottom of the view window.

View file

@ -1444,20 +1444,6 @@ int side_t::GetLightLevel (bool foggy, int baselight) const
return clamp(baselight, 0, 255); return clamp(baselight, 0, 255);
} }
FArchive &operator<< (FArchive &arc, side_t::part &p)
{
arc << p.xoffset << p.yoffset;// << p.Light;
if (arc.IsStoring ())
{
TexMan.WriteTexture (arc, p.texture);
}
else
{
p.texture = TexMan.ReadTexture (arc);
}
return arc;
}
// //