- 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 ----------------------------------------------
//extern DThinker *NextToThink;
// PUBLIC DATA DEFINITIONS -------------------------------------------------
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()
{
Gray = NULL;
for (auto func : markers) func();
// Mark soft roots.
if (SoftRoots != NULL)
{

View file

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

View file

@ -212,15 +212,6 @@ void PClass::StaticInit ()
((ClassReg *)*probe)->RegisterClass ();
}
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
// I'm not sure if this is really necessary to maintain any sort of sync.
@ -252,7 +243,6 @@ void PClass::StaticShutdown ()
{
*p = nullptr;
}
//ScriptUtil::Clear();
FunctionPtrList.Clear();
VMFunction::DeleteAll();
@ -264,13 +254,7 @@ void PClass::StaticShutdown ()
// This flags DObject::Destroy not to call any scripted OnDestroy methods anymore.
bVMOperational = false;
#if 0
for (auto &p : players)
{
p.PendingWeapon = nullptr;
}
Namespaces.ReleaseSymbols();
#endif
// 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.
@ -281,7 +265,6 @@ void PClass::StaticShutdown ()
TypeTable.Clear();
ClassDataAllocator.FreeAllBlocks();
AllClasses.Clear();
//PClassActor::AllActorClasses.Clear();
ClassMap.Clear();
FAutoSegIterator probe(CRegHead, CRegTail);
@ -392,12 +375,6 @@ void PClass::InsertIntoHash (bool native)
{
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
@ -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);
PClass *type;
@ -575,6 +542,7 @@ PClass *PClass::CreateDerivedClass(FName name, unsigned int size)
const PClass *existclass = FindClass(name);
if (newlycreated) *newlycreated = false;
if (existclass != nullptr)
{
// This is a placeholder so fill it in
@ -607,7 +575,7 @@ PClass *PClass::CreateDerivedClass(FName name, unsigned int size)
if (size != TentativeClass)
{
NewClassType(type);
type->InitializeDefaults();
if (newlycreated) *newlycreated = true;
type->Virtuals = Virtuals;
}
else

View file

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