Extended Actor.CheckMove() with optional position information

https://forum.zdoom.org/viewtopic.php?t=58964
This commit is contained in:
alexey.lysiuk 2018-01-03 10:48:10 +02:00
parent 4a71493a54
commit 549a9d3cf0
2 changed files with 17 additions and 4 deletions

View File

@ -2784,9 +2784,8 @@ DEFINE_ACTION_FUNCTION(AActor, TryMove)
//
//==========================================================================
bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags)
static bool P_CheckMove(AActor *thing, const DVector2 &pos, FCheckPosition& tm, int flags)
{
FCheckPosition tm;
double newz = thing->Z();
auto f1 = thing->flags & MF_PICKUP;
@ -2879,14 +2878,28 @@ bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags)
return true;
}
bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags)
{
FCheckPosition tm;
return P_CheckMove(thing, pos, tm, flags);
}
DEFINE_ACTION_FUNCTION(AActor, CheckMove)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_INT_DEF(flags);
PARAM_POINTER_DEF(tm, FCheckPosition);
if (tm == nullptr)
{
ACTION_RETURN_BOOL(P_CheckMove(self, DVector2(x, y), flags));
}
else
{
ACTION_RETURN_BOOL(P_CheckMove(self, DVector2(x, y), *tm, flags));
}
}
//==========================================================================

View File

@ -624,7 +624,7 @@ class Actor : Thinker native
}
native bool TryMove(vector2 newpos, int dropoff, bool missilecheck = false, FCheckPosition tm = null);
native bool CheckMove(vector2 newpos, int flags = 0);
native bool CheckMove(vector2 newpos, int flags = 0, FCheckPosition tm = null);
native void NewChaseDir();
native void RandomChaseDir();
native bool CheckMissileRange();