mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- Added A_JumpIfHigherOrLower.
- (int ptr = AAPTR_TARGET, state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true) - Jumps if the pointer of the calling actor is higher or lower than itself, adding offsethigh or offsetlow depending on the circumstance. - includeHeight works twofold. - Includes the height of the calling actor if the pointer is higher to truly determine if they are completely above them or not. - Includes the height of the pointer if the pointer is lower. - Disable it to only check z differences without adding height.
This commit is contained in:
parent
033712d044
commit
492ef1b716
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_INT(ptr, 0);
|
||||||
|
ACTION_PARAM_STATE(high, 1);
|
||||||
|
ACTION_PARAM_STATE(low, 2);
|
||||||
|
ACTION_PARAM_FIXED(offsethigh, 3);
|
||||||
|
ACTION_PARAM_FIXED(offsetlow, 4);
|
||||||
|
ACTION_PARAM_BOOL(includeHeight, 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)
|
// A_SetRipperLevel(int level)
|
||||||
|
|
|
@ -330,6 +330,7 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_SetFloatBobPhase(int bob);
|
action native A_SetFloatBobPhase(int bob);
|
||||||
action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT);
|
action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT);
|
||||||
action native A_ResetHealth(int ptr = AAPTR_DEFAULT);
|
action native A_ResetHealth(int ptr = AAPTR_DEFAULT);
|
||||||
|
action native A_JumpIfHigherOrLower(int ptr = AAPTR_TARGET, state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true);
|
||||||
action native A_SetRipperLevel(int level);
|
action native A_SetRipperLevel(int level);
|
||||||
action native A_SetRipMin(int min);
|
action native A_SetRipMin(int min);
|
||||||
action native A_SetRipMax(int max);
|
action native A_SetRipMax(int max);
|
||||||
|
|
Loading…
Reference in a new issue