- deprecated a few functions that depend on AAPTR_* to be useful.
This commit is contained in:
parent
b8c4a506a7
commit
de5ab0b4b6
4 changed files with 137 additions and 230 deletions
|
|
@ -98,7 +98,7 @@ FRandom pr_cajump("CustomJump");
|
|||
extern TArray<VMValue> actionParams; // this can use the same storage as CallAction
|
||||
|
||||
|
||||
static bool CallStateChain (AActor *self, AActor *actor, FState *state)
|
||||
static int CallStateChain (AActor *self, AActor *actor, FState *state)
|
||||
{
|
||||
INTBOOL result = false;
|
||||
int counter = 0;
|
||||
|
|
@ -235,7 +235,7 @@ static bool CallStateChain (AActor *self, AActor *actor, FState *state)
|
|||
return !!result;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(ACustomInventory, CallStateChain)
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(ACustomInventory, CallStateChain, CallStateChain)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_OBJECT(affectee, AActor);
|
||||
|
|
@ -243,226 +243,6 @@ DEFINE_ACTION_FUNCTION(ACustomInventory, CallStateChain)
|
|||
ACTION_RETURN_BOOL(CallStateChain(self, affectee, state));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CheckClass
|
||||
//
|
||||
// NON-ACTION function to check a pointer's class.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, CheckClass)
|
||||
{
|
||||
if (numret > 0)
|
||||
{
|
||||
assert(ret != NULL);
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_CLASS (checktype, AActor);
|
||||
PARAM_INT (pick_pointer);
|
||||
PARAM_BOOL (match_superclass);
|
||||
|
||||
self = COPY_AAPTR(self, pick_pointer);
|
||||
if (self == nullptr || checktype == nullptr)
|
||||
{
|
||||
ret->SetInt(false);
|
||||
}
|
||||
else if (match_superclass)
|
||||
{
|
||||
ret->SetInt(self->IsKindOf(checktype));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret->SetInt(self->GetClass() == checktype);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
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(pick_pointer);
|
||||
|
||||
self = COPY_AAPTR(self, pick_pointer);
|
||||
if (self == NULL)
|
||||
{
|
||||
ret->SetInt(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret->SetInt(self->GetMissileDamage(mask, add));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetDistance
|
||||
//
|
||||
// NON-ACTION function to get the distance in double.
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_ACTION_FUNCTION(AActor, GetDistance)
|
||||
{
|
||||
if (numret > 0)
|
||||
{
|
||||
assert(ret != NULL);
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_BOOL(checkz);
|
||||
PARAM_INT(ptr);
|
||||
|
||||
AActor *target = COPY_AAPTR(self, ptr);
|
||||
|
||||
if (!target || target == self)
|
||||
{
|
||||
ret->SetFloat(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
DVector3 diff = self->Vec3To(target);
|
||||
if (checkz)
|
||||
diff.Z += (target->Height - self->Height) / 2;
|
||||
else
|
||||
diff.Z = 0.;
|
||||
|
||||
ret->SetFloat(diff.Length());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetAngle
|
||||
//
|
||||
// NON-ACTION function to get the angle in degrees (normalized to -180..180)
|
||||
//
|
||||
//==========================================================================
|
||||
enum GAFlags
|
||||
{
|
||||
GAF_RELATIVE = 1,
|
||||
GAF_SWITCH = 1 << 1,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, GetAngle)
|
||||
{
|
||||
if (numret > 0)
|
||||
{
|
||||
assert(ret != NULL);
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_INT(flags);
|
||||
PARAM_INT(ptr)
|
||||
|
||||
AActor *target = COPY_AAPTR(self, ptr);
|
||||
|
||||
if (!target || target == self)
|
||||
{
|
||||
ret->SetFloat(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
DVector3 diff = (flags & GAF_SWITCH) ? target->Vec3To(self) : self->Vec3To(target);
|
||||
DAngle angto = diff.Angle();
|
||||
DAngle yaw = (flags & GAF_SWITCH) ? target->Angles.Yaw : self->Angles.Yaw;
|
||||
if (flags & GAF_RELATIVE) angto = deltaangle(yaw, angto);
|
||||
ret->SetFloat(angto.Degrees);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetSpawnHealth
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_ACTION_FUNCTION(AActor, GetSpawnHealth)
|
||||
{
|
||||
if (numret > 0)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
ret->SetInt(self->SpawnHealth());
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetSpriteAngle
|
||||
//
|
||||
// NON-ACTION function returns the sprite angle of a pointer.
|
||||
//==========================================================================
|
||||
DEFINE_ACTION_FUNCTION(AActor, GetSpriteAngle)
|
||||
{
|
||||
if (numret > 0)
|
||||
{
|
||||
assert(ret != NULL);
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_INT(ptr);
|
||||
|
||||
AActor *target = COPY_AAPTR(self, ptr);
|
||||
if (target == nullptr)
|
||||
{
|
||||
ret->SetFloat(0.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
const double ang = target->SpriteAngle.Degrees;
|
||||
ret->SetFloat(ang);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetSpriteRotation
|
||||
//
|
||||
// NON-ACTION function returns the sprite rotation of a pointer.
|
||||
//==========================================================================
|
||||
DEFINE_ACTION_FUNCTION(AActor, GetSpriteRotation)
|
||||
{
|
||||
if (numret > 0)
|
||||
{
|
||||
assert(ret != NULL);
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_INT(ptr);
|
||||
|
||||
AActor *target = COPY_AAPTR(self, ptr);
|
||||
if (target == nullptr)
|
||||
{
|
||||
ret->SetFloat(0.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
const double ang = target->SpriteRotation.Degrees;
|
||||
ret->SetFloat(ang);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetZAt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue