- added a GetMissileDamage function to DECORATE which can be used to properly retrieve an actor's damage value.

The damage property should be considered deprecated inside expressions from now on.
This commit is contained in:
Christoph Oelckers 2016-09-19 03:45:22 +02:00
parent f1ba19073f
commit 3eb1af6957
2 changed files with 33 additions and 0 deletions

View file

@ -231,6 +231,38 @@ DEFINE_ACTION_FUNCTION(AActor, CheckClass)
return 0; return 0;
} }
//==========================================================================
//
// CheckClass
//
// NON-ACTION function to calculate missile damage for the given actor
//
//==========================================================================
DEFINE_ACTION_FUNCTION(AActor, GetMissileDamage)
{
if (numret > 0)
{
assert(ret != NULL);
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(mask);
PARAM_INT(add)
PARAM_INT_OPT(pick_pointer) { pick_pointer = AAPTR_DEFAULT; }
self = COPY_AAPTR(self, pick_pointer);
if (self == NULL)
{
ret->SetInt(0);
}
else
{
ret->SetInt(self->GetMissileDamage(mask, add));
}
return 1;
}
return 0;
}
//========================================================================== //==========================================================================
// //
// IsPointerEqual // IsPointerEqual

View file

@ -53,6 +53,7 @@ ACTOR Actor native //: Thinker
native int CountProximity(class<Actor> classname, float distance, int flags = 0, int ptr = AAPTR_DEFAULT); native int CountProximity(class<Actor> classname, float distance, int flags = 0, int ptr = AAPTR_DEFAULT);
native float GetSpriteAngle(int ptr = AAPTR_DEFAULT); native float GetSpriteAngle(int ptr = AAPTR_DEFAULT);
native float GetSpriteRotation(int ptr = AAPTR_DEFAULT); native float GetSpriteRotation(int ptr = AAPTR_DEFAULT);
native int GetMissileDamage(int mask, int add, int ptr = AAPTR_DEFAULT);
// Action functions // Action functions
// Meh, MBF redundant functions. Only for DeHackEd support. // Meh, MBF redundant functions. Only for DeHackEd support.