mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-30 16:01:49 +00:00
Merge pull request #323 from MajorCooke/jumpifhigherorlower
- Added A_JumpIfHigherOrLower.
This commit is contained in:
commit
9b128638ea
2 changed files with 38 additions and 0 deletions
|
@ -5844,6 +5844,43 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ResetHealth)
|
|||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// A_JumpIfHigherOrLower
|
||||
//
|
||||
// Jumps if a target, master, or tracer is higher or lower than the calling
|
||||
// actor. Can also specify how much higher/lower the actor needs to be than
|
||||
// itself. Can also take into account the height of the actor in question,
|
||||
// depending on which it's checking. This means adding height of the
|
||||
// calling actor's self if the pointer is higher, or height of the pointer
|
||||
// if its lower.
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower)
|
||||
{
|
||||
ACTION_PARAM_START(6);
|
||||
ACTION_PARAM_STATE(high, 0);
|
||||
ACTION_PARAM_STATE(low, 1);
|
||||
ACTION_PARAM_FIXED(offsethigh, 2);
|
||||
ACTION_PARAM_FIXED(offsetlow, 3);
|
||||
ACTION_PARAM_BOOL(includeHeight, 4);
|
||||
ACTION_PARAM_INT(ptr, 5);
|
||||
|
||||
AActor *mobj = COPY_AAPTR(self, ptr);
|
||||
|
||||
|
||||
if (!mobj || (mobj == self)) //AAPTR_DEFAULT is completely useless in this regard.
|
||||
{
|
||||
return;
|
||||
}
|
||||
ACTION_SET_RESULT(false); //No inventory jump chains please.
|
||||
|
||||
if ((high) && (mobj->z > ((includeHeight ? self->height : 0) + self->z + offsethigh)))
|
||||
ACTION_JUMP(high);
|
||||
else if ((low) && (mobj->z + (includeHeight ? mobj->height : 0)) < (self->z + offsetlow))
|
||||
ACTION_JUMP(low);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_SetRipperLevel(int level)
|
||||
|
|
|
@ -330,6 +330,7 @@ ACTOR Actor native //: Thinker
|
|||
action native A_SetFloatBobPhase(int bob);
|
||||
action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT);
|
||||
action native A_ResetHealth(int ptr = AAPTR_DEFAULT);
|
||||
action native A_JumpIfHigherOrLower(state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true, int ptr = AAPTR_TARGET);
|
||||
action native A_SetRipperLevel(int level);
|
||||
action native A_SetRipMin(int min);
|
||||
action native A_SetRipMax(int max);
|
||||
|
|
Loading…
Reference in a new issue