mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
Added Distance(2/3)DSquared functions.
This commit is contained in:
parent
af14609de7
commit
7ac8b496f1
3 changed files with 22 additions and 0 deletions
|
@ -886,6 +886,12 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// a full 3D version of the above
|
// a full 3D version of the above
|
||||||
|
double Distance3DSquared(AActor *other, bool absolute = false)
|
||||||
|
{
|
||||||
|
DVector3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
||||||
|
return (Pos() - otherpos).LengthSquared();
|
||||||
|
}
|
||||||
|
|
||||||
double Distance3D(AActor *other, bool absolute = false)
|
double Distance3D(AActor *other, bool absolute = false)
|
||||||
{
|
{
|
||||||
DVector3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
DVector3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
||||||
|
|
|
@ -8127,6 +8127,20 @@ DEFINE_ACTION_FUNCTION(AActor, absangle) // should this be global?
|
||||||
ACTION_RETURN_FLOAT(absangle(DAngle(a1), DAngle(a2)).Degrees);
|
ACTION_RETURN_FLOAT(absangle(DAngle(a1), DAngle(a2)).Degrees);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(AActor, Distance2DSquared)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(AActor);
|
||||||
|
PARAM_OBJECT_NOT_NULL(other, AActor);
|
||||||
|
ACTION_RETURN_FLOAT(self->Distance2DSquared(other));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(AActor, Distance3DSquared)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(AActor);
|
||||||
|
PARAM_OBJECT_NOT_NULL(other, AActor);
|
||||||
|
ACTION_RETURN_FLOAT(self->Distance3DSquared(other));
|
||||||
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AActor, Distance2D)
|
DEFINE_ACTION_FUNCTION(AActor, Distance2D)
|
||||||
{
|
{
|
||||||
PARAM_SELF_PROLOGUE(AActor);
|
PARAM_SELF_PROLOGUE(AActor);
|
||||||
|
|
|
@ -580,6 +580,8 @@ class Actor : Thinker native
|
||||||
native void SetDamage(int dmg);
|
native void SetDamage(int dmg);
|
||||||
native clearscope double Distance2D(Actor other) const;
|
native clearscope double Distance2D(Actor other) const;
|
||||||
native clearscope double Distance3D(Actor other) const;
|
native clearscope double Distance3D(Actor other) const;
|
||||||
|
native clearscope double Distance2DSquared(Actor other) const;
|
||||||
|
native clearscope double Distance3DSquared(Actor other) const;
|
||||||
native void SetOrigin(vector3 newpos, bool moving);
|
native void SetOrigin(vector3 newpos, bool moving);
|
||||||
native void SetXYZ(vector3 newpos);
|
native void SetXYZ(vector3 newpos);
|
||||||
native Actor GetPointer(int aaptr);
|
native Actor GetPointer(int aaptr);
|
||||||
|
|
Loading…
Reference in a new issue