mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
64dabc3c0b
2 changed files with 38 additions and 0 deletions
|
@ -250,6 +250,43 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, CountInv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// GetDistance
|
||||||
|
//
|
||||||
|
// NON-ACTION function to get the distance in double.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance)
|
||||||
|
{
|
||||||
|
if (numret > 0)
|
||||||
|
{
|
||||||
|
assert(ret != NULL);
|
||||||
|
PARAM_PROLOGUE;
|
||||||
|
PARAM_OBJECT(self, AActor);
|
||||||
|
PARAM_BOOL(checkz);
|
||||||
|
PARAM_INT_OPT(ptr) { ptr = AAPTR_TARGET; }
|
||||||
|
|
||||||
|
AActor *target = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
|
if (!target || target == self)
|
||||||
|
{
|
||||||
|
ret->SetFloat(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fixedvec3 diff = self->Vec3To(target);
|
||||||
|
if (checkz)
|
||||||
|
diff.z += (target->height - self->height) / 2;
|
||||||
|
|
||||||
|
const double length = TVector3<double>(FIXED2DBL(diff.x), FIXED2DBL(diff.y), (checkz) ? FIXED2DBL(diff.z) : 0).Length();
|
||||||
|
ret->SetFloat(length);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// A_RearrangePointers
|
// A_RearrangePointers
|
||||||
|
|
|
@ -41,6 +41,7 @@ ACTOR Actor native //: Thinker
|
||||||
native bool CheckClass(class<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false);
|
native bool CheckClass(class<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false);
|
||||||
native bool IsPointerEqual(int ptr_select1, int ptr_select2);
|
native bool IsPointerEqual(int ptr_select1, int ptr_select2);
|
||||||
native int CountInv(class<Inventory> itemtype, int ptr_select = AAPTR_DEFAULT);
|
native int CountInv(class<Inventory> itemtype, int ptr_select = AAPTR_DEFAULT);
|
||||||
|
native float GetDistance(bool checkz, int ptr = AAPTR_DEFAULT);
|
||||||
|
|
||||||
// Action functions
|
// Action functions
|
||||||
// Meh, MBF redundant functions. Only for DeHackEd support.
|
// Meh, MBF redundant functions. Only for DeHackEd support.
|
||||||
|
|
Loading…
Reference in a new issue