- added property definitions to the ZScript parser. This will allow defining custom properties for the default block in custom base classes. See 'Health' for an example.
- support transient object member variables for information that does not need to be put in a savegame. - fixed: special initialization of objects needs to pass the proper defaults along, otherwise the parent classes will use their own, inappropriate one.
This commit is contained in:
parent
0c3aab794f
commit
179b6e1a39
21 changed files with 313 additions and 109 deletions
|
|
@ -566,3 +566,16 @@ DEFINE_ACTION_FUNCTION(DObject, GetClassName)
|
|||
PARAM_SELF_PROLOGUE(DObject);
|
||||
ACTION_RETURN_INT(self->GetClass()->TypeName);
|
||||
}
|
||||
|
||||
|
||||
void *DObject::ScriptVar(FName field, PType *type)
|
||||
{
|
||||
auto sym = dyn_cast<PField>(GetClass()->Symbols.FindSymbol(field, true));
|
||||
if (sym && sym->Type == type)
|
||||
{
|
||||
return (((char*)this) + sym->Offset);
|
||||
}
|
||||
// This is only for internal use so I_Error is fine.
|
||||
I_Error("Variable %s not found in %s\n", field.GetChars(), GetClass()->TypeName.GetChars());
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue