mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
Extended Actor.CheckMove() with optional position information
https://forum.zdoom.org/viewtopic.php?t=58964
This commit is contained in:
parent
4a71493a54
commit
549a9d3cf0
2 changed files with 17 additions and 4 deletions
|
@ -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,13 +2878,27 @@ 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);
|
||||
ACTION_RETURN_BOOL(P_CheckMove(self, DVector2(x, y), 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue