- removed the FxDamageValue hack and implemented it properly using FxReturnStatement.
- added handling of damage functions for ZScript.
This commit is contained in:
parent
e50315bd31
commit
7c759f9fcf
8 changed files with 37 additions and 36 deletions
|
|
@ -184,6 +184,28 @@ PFunction *FindClassMemberFunction(PClass *selfcls, PClass *funccls, FName name,
|
|||
return funcsym;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CreateDamageFunction
|
||||
//
|
||||
// creates a damage function from the given expression
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void CreateDamageFunction(PClassActor *info, AActor *defaults, FxExpression *id, bool fromDecorate)
|
||||
{
|
||||
if (id == nullptr)
|
||||
{
|
||||
defaults->DamageFunc = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto dmg = new FxReturnStatement(new FxIntCast(id, true), id->ScriptPosition);
|
||||
auto funcsym = CreateAnonymousFunction(info, TypeSInt32, VARF_Method);
|
||||
defaults->DamageFunc = FunctionBuildList.AddFunction(funcsym, dmg, FStringf("%s.DamageFunction", info->TypeName.GetChars()), fromDecorate);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// LoadActors
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue