- cleaned out all Doom dependencies from the DObject system.

This commit is contained in:
Christoph Oelckers 2020-04-07 00:35:53 +02:00
parent bb9a077424
commit 920f9a3f3f
4 changed files with 19 additions and 40 deletions

View file

@ -100,8 +100,6 @@
// EXTERNAL DATA DECLARATIONS ---------------------------------------------- // EXTERNAL DATA DECLARATIONS ----------------------------------------------
//extern DThinker *NextToThink;
// PUBLIC DATA DEFINITIONS ------------------------------------------------- // PUBLIC DATA DEFINITIONS -------------------------------------------------
namespace GC namespace GC
@ -262,9 +260,19 @@ void MarkArray(DObject **obj, size_t count)
// //
//========================================================================== //==========================================================================
TArray<GCMarkerFunc> markers;
void AddMarkerFunc(GCMarkerFunc func)
{
if (markers.Find(func) == markers.Size())
markers.Push(func);
}
static void MarkRoot() static void MarkRoot()
{ {
Gray = NULL; Gray = NULL;
for (auto func : markers) func();
// Mark soft roots. // Mark soft roots.
if (SoftRoots != NULL) if (SoftRoots != NULL)
{ {

View file

@ -154,6 +154,10 @@ namespace GC
{ {
MarkArray(&arr[0], arr.Size()); MarkArray(&arr[0], arr.Size());
} }
using GCMarkerFunc = void(*)();
void AddMarkerFunc(GCMarkerFunc func);
} }
// A template class to help with handling read barriers. It does not // A template class to help with handling read barriers. It does not

View file

@ -212,15 +212,6 @@ void PClass::StaticInit ()
((ClassReg *)*probe)->RegisterClass (); ((ClassReg *)*probe)->RegisterClass ();
} }
probe.Reset(); probe.Reset();
#if 0
for(auto cls : AllClasses)
{
if (cls->IsDescendantOf(RUNTIME_CLASS(AActor)))
{
PClassActor::AllActorClasses.Push(static_cast<PClassActor*>(cls));
}
}
#endif
// Keep built-in classes in consistant order. I did this before, though // Keep built-in classes in consistant order. I did this before, though
// I'm not sure if this is really necessary to maintain any sort of sync. // I'm not sure if this is really necessary to maintain any sort of sync.
@ -252,7 +243,6 @@ void PClass::StaticShutdown ()
{ {
*p = nullptr; *p = nullptr;
} }
//ScriptUtil::Clear();
FunctionPtrList.Clear(); FunctionPtrList.Clear();
VMFunction::DeleteAll(); VMFunction::DeleteAll();
@ -264,13 +254,7 @@ void PClass::StaticShutdown ()
// This flags DObject::Destroy not to call any scripted OnDestroy methods anymore. // This flags DObject::Destroy not to call any scripted OnDestroy methods anymore.
bVMOperational = false; bVMOperational = false;
#if 0
for (auto &p : players)
{
p.PendingWeapon = nullptr;
}
Namespaces.ReleaseSymbols(); Namespaces.ReleaseSymbols();
#endif
// This must be done in two steps because the native classes are not ordered by inheritance, // This must be done in two steps because the native classes are not ordered by inheritance,
// so all meta data must be gone before deleting the actual class objects. // so all meta data must be gone before deleting the actual class objects.
@ -281,7 +265,6 @@ void PClass::StaticShutdown ()
TypeTable.Clear(); TypeTable.Clear();
ClassDataAllocator.FreeAllBlocks(); ClassDataAllocator.FreeAllBlocks();
AllClasses.Clear(); AllClasses.Clear();
//PClassActor::AllActorClasses.Clear();
ClassMap.Clear(); ClassMap.Clear();
FAutoSegIterator probe(CRegHead, CRegTail); FAutoSegIterator probe(CRegHead, CRegTail);
@ -392,12 +375,6 @@ void PClass::InsertIntoHash (bool native)
{ {
ClassMap[TypeName] = this; ClassMap[TypeName] = this;
} }
#if 0
if (!native && IsDescendantOf(RUNTIME_CLASS(AActor)))
{
PClassActor::AllActorClasses.Push(static_cast<PClassActor*>(this));
}
#endif
} }
//========================================================================== //==========================================================================
@ -549,16 +526,6 @@ void PClass::Derive(PClass *newclass, FName name)
} }
//==========================================================================
//
// PClassActor :: InitializeNativeDefaults
//
//==========================================================================
void PClass::InitializeDefaults()
{
}
//========================================================================== //==========================================================================
// //
// PClass :: CreateDerivedClass // PClass :: CreateDerivedClass
@ -567,7 +534,7 @@ void PClass::InitializeDefaults()
// //
//========================================================================== //==========================================================================
PClass *PClass::CreateDerivedClass(FName name, unsigned int size) PClass *PClass::CreateDerivedClass(FName name, unsigned int size, bool *newlycreated)
{ {
assert(size >= Size); assert(size >= Size);
PClass *type; PClass *type;
@ -575,6 +542,7 @@ PClass *PClass::CreateDerivedClass(FName name, unsigned int size)
const PClass *existclass = FindClass(name); const PClass *existclass = FindClass(name);
if (newlycreated) *newlycreated = false;
if (existclass != nullptr) if (existclass != nullptr)
{ {
// This is a placeholder so fill it in // This is a placeholder so fill it in
@ -607,7 +575,7 @@ PClass *PClass::CreateDerivedClass(FName name, unsigned int size)
if (size != TentativeClass) if (size != TentativeClass)
{ {
NewClassType(type); NewClassType(type);
type->InitializeDefaults(); if (newlycreated) *newlycreated = true;
type->Virtuals = Virtuals; type->Virtuals = Virtuals;
} }
else else

View file

@ -36,12 +36,11 @@ class PClass
{ {
protected: protected:
void Derive(PClass *newclass, FName name); void Derive(PClass *newclass, FName name);
void InitializeSpecials(void *addr, void *defaults, TArray<FTypeAndOffset> PClass::*Inits);
void SetSuper(); void SetSuper();
public: public:
void InitializeSpecials(void* addr, void* defaults, TArray<FTypeAndOffset> PClass::* Inits);
void WriteAllFields(FSerializer &ar, const void *addr) const; void WriteAllFields(FSerializer &ar, const void *addr) const;
bool ReadAllFields(FSerializer &ar, void *addr) const; bool ReadAllFields(FSerializer &ar, void *addr) const;
void InitializeDefaults();
int FindVirtualIndex(FName name, PFunction::Variant *variant, PFunction *parentfunc); int FindVirtualIndex(FName name, PFunction::Variant *variant, PFunction *parentfunc);
PSymbol *FindSymbol(FName symname, bool searchparents) const; PSymbol *FindSymbol(FName symname, bool searchparents) const;
PField *AddField(FName name, PType *type, uint32_t flags); PField *AddField(FName name, PType *type, uint32_t flags);
@ -77,7 +76,7 @@ public:
~PClass(); ~PClass();
void InsertIntoHash(bool native); void InsertIntoHash(bool native);
DObject *CreateNew(); DObject *CreateNew();
PClass *CreateDerivedClass(FName name, unsigned int size); PClass *CreateDerivedClass(FName name, unsigned int size, bool *newlycreated = nullptr);
void InitializeActorInfo(); void InitializeActorInfo();
void BuildFlatPointers(); void BuildFlatPointers();