mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- added GetAngle(bool relative, int target) DECORATE function.
This commit is contained in:
parent
61b165ccc4
commit
f5afa30ee6
2 changed files with 35 additions and 0 deletions
|
@ -320,6 +320,40 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetAngle
|
||||
//
|
||||
// NON-ACTION function to get the angle in degrees (normalized to -180..180)
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetAngle)
|
||||
{
|
||||
if (numret > 0)
|
||||
{
|
||||
assert(ret != NULL);
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_BOOL(relative);
|
||||
PARAM_INT_OPT(ptr) { ptr = AAPTR_TARGET; }
|
||||
|
||||
AActor *target = COPY_AAPTR(self, ptr);
|
||||
|
||||
if (!target || target == self)
|
||||
{
|
||||
ret->SetFloat(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
DVector3 diff = self->Vec3To(target);
|
||||
DAngle angto = diff.Angle();
|
||||
if (relative) angto = deltaangle(self->Angles.Yaw, angto);
|
||||
ret->SetFloat(angto.Degrees);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetSpawnHealth
|
||||
|
|
|
@ -42,6 +42,7 @@ ACTOR Actor native //: Thinker
|
|||
native bool IsPointerEqual(int ptr_select1, int ptr_select2);
|
||||
native int CountInv(class<Inventory> itemtype, int ptr_select = AAPTR_DEFAULT);
|
||||
native float GetDistance(bool checkz, int ptr = AAPTR_DEFAULT);
|
||||
native float GetAngle(bool relative, int ptr = AAPTR_DEFAULT);
|
||||
native int GetSpawnHealth();
|
||||
native int GetGibHealth();
|
||||
|
||||
|
|
Loading…
Reference in a new issue