mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-06-04 19:10:59 +00:00
- disabled the scripted virtual function module after finding out that it only works if each single class that may serve as a parent for scripting is explicitly declared.
Needless to say, this is simply too volatile and would require constant active maintenance, not to mention a huge amount of work up front to get going. It also hid a nasty problem with the Destroy method. Due to the way the garbage collector works, Destroy cannot be exposed to scripts as-is. It may be called from scripts but it may not be overridden from scripts because the garbage collector can call this function after all data needed for calling a scripted override has already been destroyed because if that data is also being collected there is no guarantee that proper order of destruction is observed. So for now Destroy is just a normal native method to scripted classes
This commit is contained in:
parent
9ae272d753
commit
66d28a24b8
149 changed files with 727 additions and 759 deletions
|
@ -96,7 +96,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(AFakeInventory, false, false, false, false)
|
||||
IMPLEMENT_CLASS(AFakeInventory, false, false)
|
||||
|
||||
DEFINE_FIELD(AFakeInventory, Respawnable)
|
||||
|
||||
|
|
|
@ -667,7 +667,7 @@ public:
|
|||
bool Final = false; // cannot be overridden
|
||||
bool Unsafe = false; // Contains references to class fields that are unsafe for psp and item state calls.
|
||||
BYTE ImplicitArgs = 0; // either 0 for static, 1 for method or 3 for action
|
||||
int VirtualIndex = -1;
|
||||
unsigned VirtualIndex = ~0u;
|
||||
FName Name;
|
||||
TArray<VMValue> DefaultArgs;
|
||||
FString PrintableName; // so that the VM can print meaningful info if something in this function goes wrong.
|
||||
|
|
|
@ -34,15 +34,15 @@
|
|||
#include <new>
|
||||
#include "dobject.h"
|
||||
|
||||
IMPLEMENT_CLASS(VMException, false, false, false, false)
|
||||
IMPLEMENT_CLASS(VMFunction, true, true, false, false)
|
||||
IMPLEMENT_CLASS(VMException, false, false)
|
||||
IMPLEMENT_CLASS(VMFunction, true, true)
|
||||
|
||||
IMPLEMENT_POINTERS_START(VMFunction)
|
||||
IMPLEMENT_POINTER(Proto)
|
||||
IMPLEMENT_POINTERS_END
|
||||
|
||||
IMPLEMENT_CLASS(VMScriptFunction, false, false, false, false)
|
||||
IMPLEMENT_CLASS(VMNativeFunction, false, false, false, false)
|
||||
IMPLEMENT_CLASS(VMScriptFunction, false, false)
|
||||
IMPLEMENT_CLASS(VMNativeFunction, false, false)
|
||||
|
||||
VMScriptFunction::VMScriptFunction(FName name)
|
||||
{
|
||||
|
|
|
@ -51,8 +51,6 @@
|
|||
#include "codegeneration/codegen.h"
|
||||
#include "vmbuilder.h"
|
||||
|
||||
#define DEFAULTS_VMEXPORT ((BYTE *)(void *)1)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ZCCCompiler :: ProcessClass
|
||||
|
@ -505,26 +503,6 @@ void ZCCCompiler::CreateClassTypes()
|
|||
}
|
||||
else
|
||||
{
|
||||
// The parent was the last native class in the inheritance tree.
|
||||
// There is probably a better place for this somewhere else
|
||||
// TODO: Do this somewhere else or find a less hackish way to do it
|
||||
if (!parent->bRuntimeClass)
|
||||
{
|
||||
//assert(parent->VMExported != nullptr); // Ideally the macro would be used on all inheritable-native classes
|
||||
/**/ if (parent->VMExported != nullptr) { /**/ // remove the if condition when all done
|
||||
|
||||
parent = parent->VMExported;
|
||||
assert(parent->bRuntimeClass == false);
|
||||
|
||||
if (parent->Defaults == nullptr)
|
||||
{
|
||||
// We have to manually do that since zscript knows nothing about these
|
||||
parent->Defaults = DEFAULTS_VMEXPORT;
|
||||
}
|
||||
|
||||
/**/ } /**/
|
||||
}
|
||||
|
||||
// We will never get here if the name is a duplicate, so we can just do the assignment.
|
||||
try
|
||||
{
|
||||
|
@ -1980,15 +1958,6 @@ void ZCCCompiler::InitDefaults()
|
|||
// Copy the parent's defaults and meta data.
|
||||
auto ti = static_cast<PClassActor *>(c->Type());
|
||||
|
||||
// Hack for the DVMObjects as they weren't in the list originally
|
||||
// TODO: process them in a non hackish way obviously
|
||||
if (ti->ParentClass->Defaults == DEFAULTS_VMEXPORT)
|
||||
{
|
||||
ti->ParentClass->Defaults = nullptr;
|
||||
ti->ParentClass->InitializeDefaults();
|
||||
ti->ParentClass->ParentClass->DeriveData(ti->ParentClass);
|
||||
}
|
||||
|
||||
ti->InitializeDefaults();
|
||||
ti->ParentClass->DeriveData(ti);
|
||||
|
||||
|
@ -2400,11 +2369,6 @@ void ZCCCompiler::InitFunctions()
|
|||
// cannot be done earlier because it requires the parent class to be processed by this code, too.
|
||||
if (c->Type()->ParentClass != nullptr)
|
||||
{
|
||||
if (c->Type()->ParentClass->Virtuals.Size() == 0)
|
||||
{
|
||||
// This a VMClass which didn't get processed here.
|
||||
c->Type()->ParentClass->Virtuals = c->Type()->ParentClass->ParentClass->Virtuals;
|
||||
}
|
||||
c->Type()->Virtuals = c->Type()->ParentClass->Virtuals;
|
||||
}
|
||||
for (auto f : c->Functions)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue