- Fixed: Wall scrolling interpolations incremented their reference count twice.

- Fixed: Before a level's thinkers are loaded all previous interpolations must
  be cleared.
- Fixed: deleted interpolations didn't NULL the pointer in the interpolated
  object. Also added all interpolation pointers to DSectorMarker to ensure
  that they are properyl processed by the garbage collector.


SVN r1028 (trunk)
This commit is contained in:
Christoph Oelckers 2008-06-11 12:17:45 +00:00
parent 4e7a6c54ef
commit 1eb91fddcd
6 changed files with 129 additions and 25 deletions

View file

@ -1,3 +1,11 @@
June 11, 2008 (Changes by Graf Zahl)
- Fixed: Wall scrolling interpolations incremented their reference count twice.
- Fixed: Before a level's thinkers are loaded all previous interpolations must
be cleared.
- Fixed: deleted interpolations didn't NULL the pointer in the interpolated
object. Also added all interpolation pointers to DSectorMarker to ensure
that they are properyl processed by the garbage collector.
June 10, 2008 (Changes by Graf Zahl) June 10, 2008 (Changes by Graf Zahl)
- Added scaling to double size for idmypos display. - Added scaling to double size for idmypos display.
- Changed: Players don't telefrag when they are spawned now but after all - Changed: Players don't telefrag when they are spawned now but after all

View file

@ -93,6 +93,8 @@
// Number of sectors to mark for each step. // Number of sectors to mark for each step.
#define SECTORSTEPSIZE 32 #define SECTORSTEPSIZE 32
#define POLYSTEPSIZE 120
#define SIDEDEFSTEPSIZE 240
#define GCSTEPSIZE 1024u #define GCSTEPSIZE 1024u
#define GCSWEEPMAX 40 #define GCSWEEPMAX 40
@ -108,9 +110,11 @@ class DSectorMarker : public DObject
{ {
DECLARE_CLASS(DSectorMarker, DObject) DECLARE_CLASS(DSectorMarker, DObject)
public: public:
DSectorMarker() : SecNum(0) {} DSectorMarker() : SecNum(0),PolyNum(0),SideNum(0) {}
size_t PropagateMark(); size_t PropagateMark();
int SecNum; int SecNum;
int PolyNum;
int SideNum;
}; };
IMPLEMENT_CLASS(DSectorMarker) IMPLEMENT_CLASS(DSectorMarker)
@ -602,32 +606,66 @@ void DelSoftRoot(DObject *obj)
size_t DSectorMarker::PropagateMark() size_t DSectorMarker::PropagateMark()
{ {
int i; int i;
int marked = 0;
bool moretodo = false;
if (sectors == NULL) if (sectors != NULL)
{ {
return 0; for (i = 0; i < SECTORSTEPSIZE && SecNum + i < numsectors; ++i)
{
sector_t *sec = &sectors[SecNum + i];
GC::Mark(sec->SoundTarget);
GC::Mark(sec->CeilingSkyBox);
GC::Mark(sec->FloorSkyBox);
GC::Mark(sec->SecActTarget);
GC::Mark(sec->floordata);
GC::Mark(sec->ceilingdata);
GC::Mark(sec->lightingdata);
for(int j=0;j<4;j++) GC::Mark(sec->interpolations[j]);
}
marked += i * sizeof(sector_t);
if (SecNum + i < numsectors)
{
SecNum += i;
moretodo = true;
}
} }
for (i = 0; i < SECTORSTEPSIZE && SecNum + i < numsectors; ++i) if (!moretodo && polyobjs != NULL)
{ {
sector_t *sec = &sectors[SecNum + i]; for (i = 0; i < POLYSTEPSIZE && PolyNum + i < po_NumPolyobjs; ++i)
GC::Mark(sec->SoundTarget); {
GC::Mark(sec->CeilingSkyBox); GC::Mark(polyobjs[PolyNum + i].interpolation);
GC::Mark(sec->FloorSkyBox); }
GC::Mark(sec->SecActTarget); marked += i * sizeof(FPolyObj);
GC::Mark(sec->floordata); if (PolyNum + i < po_NumPolyobjs)
GC::Mark(sec->ceilingdata); {
GC::Mark(sec->lightingdata); PolyNum += i;
moretodo = true;
}
}
if (!moretodo && sides != NULL)
{
for (i = 0; i < SIDEDEFSTEPSIZE && SideNum + i < numsides; ++i)
{
side_t *side = &sides[SideNum + i];
for(int j=0;j<3;j++) GC::Mark(side->textures[j].interpolation);
}
marked += i * sizeof(side_t);
if (SideNum + i < numsides)
{
SideNum += i;
moretodo = true;
}
} }
// If there are more sectors to mark, put ourself back into the gray // If there are more sectors to mark, put ourself back into the gray
// list. // list.
if (SecNum + i < numsectors) if (moretodo)
{ {
SecNum += i;
Black2Gray(); Black2Gray();
GCNext = GC::Gray; GCNext = GC::Gray;
GC::Gray = this; GC::Gray = this;
} }
return i * sizeof(sector_t); return marked;
} }
//========================================================================== //==========================================================================

View file

@ -75,6 +75,7 @@
#include "sbarinfo.h" #include "sbarinfo.h"
#include "r_translate.h" #include "r_translate.h"
#include "p_lnspec.h" #include "p_lnspec.h"
#include "r_interpolate.h"
#include "gi.h" #include "gi.h"
@ -2740,6 +2741,7 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
} }
FBehavior::StaticSerializeModuleStates (arc); FBehavior::StaticSerializeModuleStates (arc);
if (arc.IsLoading()) interpolator.ClearInterpolations();
P_SerializeThinkers (arc, hubLoad); P_SerializeThinkers (arc, hubLoad);
P_SerializeWorld (arc); P_SerializeWorld (arc);
P_SerializePolyobjs (arc); P_SerializePolyobjs (arc);

View file

@ -88,6 +88,7 @@ public:
DSectorScrollInterpolation() {} DSectorScrollInterpolation() {}
DSectorScrollInterpolation(sector_t *sector, bool plane); DSectorScrollInterpolation(sector_t *sector, bool plane);
void Destroy();
void UpdateInterpolation(); void UpdateInterpolation();
void Restore(); void Restore();
void Interpolate(fixed_t smoothratio); void Interpolate(fixed_t smoothratio);
@ -114,6 +115,7 @@ public:
DWallScrollInterpolation() {} DWallScrollInterpolation() {}
DWallScrollInterpolation(side_t *side, int part); DWallScrollInterpolation(side_t *side, int part);
void Destroy();
void UpdateInterpolation(); void UpdateInterpolation();
void Restore(); void Restore();
void Interpolate(fixed_t smoothratio); void Interpolate(fixed_t smoothratio);
@ -137,6 +139,7 @@ public:
DPolyobjInterpolation() {} DPolyobjInterpolation() {}
DPolyobjInterpolation(FPolyObj *poly); DPolyobjInterpolation(FPolyObj *poly);
void Destroy();
void UpdateInterpolation(); void UpdateInterpolation();
void Restore(); void Restore();
void Interpolate(fixed_t smoothratio); void Interpolate(fixed_t smoothratio);
@ -180,14 +183,6 @@ FInterpolator interpolator;
int FInterpolator::CountInterpolations () int FInterpolator::CountInterpolations ()
{ {
int count = 0;
DInterpolation *probe = Head;
while (probe != NULL)
{
count++;
probe = probe->Next;
}
return count; return count;
} }
@ -217,6 +212,7 @@ void FInterpolator::AddInterpolation(DInterpolation *interp)
if (Head != NULL) Head->Prev = &interp->Next; if (Head != NULL) Head->Prev = &interp->Next;
Head = interp; Head = interp;
interp->Prev = &Head; interp->Prev = &Head;
count++;
} }
//========================================================================== //==========================================================================
@ -233,6 +229,7 @@ void FInterpolator::RemoveInterpolation(DInterpolation *interp)
if (interp->Next != NULL) interp->Next->Prev = interp->Prev; if (interp->Next != NULL) interp->Next->Prev = interp->Prev;
interp->Next = NULL; interp->Next = NULL;
interp->Prev = NULL; interp->Prev = NULL;
count--;
} }
} }
@ -403,6 +400,17 @@ DSectorPlaneInterpolation::DSectorPlaneInterpolation(sector_t *_sector, bool _pl
void DSectorPlaneInterpolation::Destroy() void DSectorPlaneInterpolation::Destroy()
{ {
if (ceiling)
{
assert(sector->interpolations[sector_t::CeilingMove] == this);
sector->interpolations[sector_t::CeilingMove] = NULL;
}
else
{
assert(sector->interpolations[sector_t::FloorMove] == this);
sector->interpolations[sector_t::FloorMove] = NULL;
}
for(unsigned i=0; i<attached.Size(); i++) for(unsigned i=0; i<attached.Size(); i++)
{ {
attached[i]->DelRef(); attached[i]->DelRef();
@ -552,6 +560,27 @@ DSectorScrollInterpolation::DSectorScrollInterpolation(sector_t *_sector, bool _
// //
//========================================================================== //==========================================================================
void DSectorScrollInterpolation::Destroy()
{
if (ceiling)
{
assert(sector->interpolations[sector_t::CeilingScroll] == this);
sector->interpolations[sector_t::CeilingScroll] = NULL;
}
else
{
assert(sector->interpolations[sector_t::FloorScroll] == this);
sector->interpolations[sector_t::FloorScroll] = NULL;
}
Super::Destroy();
}
//==========================================================================
//
//
//
//==========================================================================
void DSectorScrollInterpolation::UpdateInterpolation() void DSectorScrollInterpolation::UpdateInterpolation()
{ {
if (!ceiling) if (!ceiling)
@ -654,6 +683,19 @@ DWallScrollInterpolation::DWallScrollInterpolation(side_t *_side, int _part)
// //
//========================================================================== //==========================================================================
void DWallScrollInterpolation::Destroy()
{
assert(side->textures[part].interpolation == this);
side->textures[part].interpolation = NULL;
Super::Destroy();
}
//==========================================================================
//
//
//
//==========================================================================
void DWallScrollInterpolation::UpdateInterpolation() void DWallScrollInterpolation::UpdateInterpolation()
{ {
oldx = side->GetTextureXOffset(part); oldx = side->GetTextureXOffset(part);
@ -726,6 +768,19 @@ DPolyobjInterpolation::DPolyobjInterpolation(FPolyObj *po)
// //
//========================================================================== //==========================================================================
void DPolyobjInterpolation::Destroy()
{
assert(poly->interpolation == this);
poly->interpolation = NULL;
Super::Destroy();
}
//==========================================================================
//
//
//
//==========================================================================
void DPolyobjInterpolation::UpdateInterpolation() void DPolyobjInterpolation::UpdateInterpolation()
{ {
for(int i = 0; i < poly->numvertices; i++) for(int i = 0; i < poly->numvertices; i++)
@ -801,7 +856,6 @@ DInterpolation *side_t::SetInterpolation(int position)
if (textures[position].interpolation == NULL) if (textures[position].interpolation == NULL)
{ {
textures[position].interpolation = new DWallScrollInterpolation(this, position); textures[position].interpolation = new DWallScrollInterpolation(this, position);
textures[position].interpolation->AddRef();
} }
textures[position].interpolation->AddRef(); textures[position].interpolation->AddRef();
GC::WriteBarrier(textures[position].interpolation); GC::WriteBarrier(textures[position].interpolation);

View file

@ -41,6 +41,7 @@ struct FInterpolator
{ {
DInterpolation *Head; DInterpolation *Head;
bool didInterp; bool didInterp;
int count;
int CountInterpolations (); int CountInterpolations ();
@ -49,6 +50,7 @@ public:
{ {
Head = NULL; Head = NULL;
didInterp = false; didInterp = false;
count = 0;
} }
void UpdateInterpolations(); void UpdateInterpolations();
void AddInterpolation(DInterpolation *); void AddInterpolation(DInterpolation *);

View file

@ -75,7 +75,7 @@
// SAVESIG should match SAVEVER. // SAVESIG should match SAVEVER.
// MINSAVEVER is the minimum level snapshot version that can be loaded. // MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 1027 #define MINSAVEVER 1028
#if SVN_REVISION_NUMBER < MINSAVEVER #if SVN_REVISION_NUMBER < MINSAVEVER
// Never write a savegame with a version lower than what we need // Never write a savegame with a version lower than what we need