- added proper definitions for all exported native fields.

- synthesize native fields for all declared flags, not just for AActor.
This commit is contained in:
Christoph Oelckers 2016-11-22 23:42:32 +01:00
commit 099b9970ef
23 changed files with 453 additions and 247 deletions

View file

@ -131,7 +131,7 @@ CVAR (Int, cl_bloodtype, 0, CVAR_ARCHIVE);
// CODE --------------------------------------------------------------------
IMPLEMENT_CLASS(AActor, false, true, true, true)
IMPLEMENT_CLASS(AActor, false, true, false, true)
IMPLEMENT_POINTERS_START(AActor)
IMPLEMENT_POINTER(target)
@ -310,24 +310,6 @@ DEFINE_FIELD(AActor, ConversationRoot)
DEFINE_FIELD(AActor, Conversation)
DEFINE_FIELD(AActor, DecalGenerator)
void AActor::InitNativeFields()
{
auto meta = RUNTIME_CLASS(AActor);
// needs to be done manually until it can be given a proper type.
meta->AddNativeField("DecalGenerator", NewPointer(TypeVoid), myoffsetof(AActor, DecalGenerator));
// synthesize a symbol for each flag from the flag name tables to avoid redundant declaration of them.
for (size_t i = 0; ActorFlagDefs[i].flagbit != 0xffffffff; i++)
{
meta->AddNativeField(FStringf("b%s", ActorFlagDefs[i].name), (ActorFlagDefs[i].fieldsize == 4? TypeSInt32 : TypeSInt16), ActorFlagDefs[i].structoffset, ActorFlagDefs[i].varflags, ActorFlagDefs[i].flagbit);
}
for (size_t i = 0; InternalActorFlagDefs[i].flagbit != 0xffffffff; i++)
{
meta->AddNativeField(FStringf("b%s", InternalActorFlagDefs[i].name), (InternalActorFlagDefs[i].fieldsize == 4 ? TypeSInt32 : TypeSInt16), InternalActorFlagDefs[i].structoffset, InternalActorFlagDefs[i].varflags, InternalActorFlagDefs[i].flagbit);
}
}
//==========================================================================
//
// AActor :: Serialize
@ -7183,18 +7165,13 @@ DEFINE_ACTION_FUNCTION(AActor, Vec3Offset)
IMPLEMENT_CLASS(DDropItem, false, true, true, false)
IMPLEMENT_POINTERS_START(DDropItem)
IMPLEMENT_POINTER(Next)
IMPLEMENT_POINTER(Next)
IMPLEMENT_POINTERS_END
void DDropItem::InitNativeFields()
{
auto meta = RUNTIME_CLASS(DDropItem);
PType *TypeDropItem = NewPointer(RUNTIME_CLASS(DDropItem));
meta->AddNativeField("Next", TypeDropItem, myoffsetof(DDropItem, Next), VARF_ReadOnly);
meta->AddNativeField("Name", TypeName, myoffsetof(DDropItem, Name), VARF_ReadOnly);
meta->AddNativeField("Probability", TypeSInt32, myoffsetof(DDropItem, Probability), VARF_ReadOnly);
meta->AddNativeField("Amount", TypeSInt32, myoffsetof(DDropItem, Amount));
}
DEFINE_FIELD(DDropItem, Next)
DEFINE_FIELD(DDropItem, Name)
DEFINE_FIELD(DDropItem, Probability)
DEFINE_FIELD(DDropItem, Amount)
void PrintMiscActorInfo(AActor *query)
{