mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Added A_JumpIfTracerCloser and A_JumpIfMasterCloser, based on DavidPH's A_JumpIfCloser patch.
SVN r2324 (trunk)
This commit is contained in:
parent
2d4502018a
commit
5a71dea746
2 changed files with 34 additions and 16 deletions
|
@ -470,30 +470,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHealthLower)
|
|||
// State jump function
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfCloser)
|
||||
void DoJumpIfCloser(AActor *target, DECLARE_PARAMINFO)
|
||||
{
|
||||
ACTION_PARAM_START(2);
|
||||
ACTION_PARAM_FIXED(dist, 0);
|
||||
ACTION_PARAM_STATE(jump, 1);
|
||||
|
||||
AActor *target;
|
||||
|
||||
if (!self->player)
|
||||
{
|
||||
target=self->target;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Does the player aim at something that can be shot?
|
||||
P_BulletSlope(self, &target);
|
||||
}
|
||||
|
||||
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
||||
|
||||
// No target - no jump
|
||||
if (target==NULL) return;
|
||||
|
||||
if (P_AproxDistance(self->x-target->x, self->y-target->y) < dist &&
|
||||
if (target != NULL && P_AproxDistance(self->x-target->x, self->y-target->y) < dist &&
|
||||
( (self->z > target->z && self->z - (target->z + target->height) < dist) ||
|
||||
(self->z <=target->z && target->z - (self->z + self->height) < dist)
|
||||
)
|
||||
|
@ -503,6 +489,36 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfCloser)
|
|||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfCloser)
|
||||
{
|
||||
AActor *target;
|
||||
|
||||
if (!self->player)
|
||||
{
|
||||
target = self->target;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Does the player aim at something that can be shot?
|
||||
P_BulletSlope(self, &target);
|
||||
}
|
||||
DoJumpIfCloser(target, PUSH_PARAMINFO);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTracerCloser)
|
||||
{
|
||||
// Is there really any reason to limit this to seeker missiles?
|
||||
if (self->flags2 & MF2_SEEKERMISSILE)
|
||||
{
|
||||
DoJumpIfCloser(self->tracer, PUSH_PARAMINFO);
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfMasterCloser)
|
||||
{
|
||||
DoJumpIfCloser(self->master, PUSH_PARAMINFO);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// State jump function
|
||||
|
|
|
@ -188,6 +188,8 @@ ACTOR Actor native //: Thinker
|
|||
action native A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, bool aim = false, float maxdiff = 0, class<Actor> pufftype = "BulletPuff");
|
||||
action native A_JumpIfHealthLower(int health, state label);
|
||||
action native A_JumpIfCloser(float distance, state label);
|
||||
action native A_JumpIfTracerCloser(float distance, state label);
|
||||
action native A_JumpIfMasterCloser(float distance, state label);
|
||||
action native A_JumpIfInventory(class<Inventory> itemtype, int itemamount, state label);
|
||||
action native A_JumpIfArmorType(string Type, state label, int amount = 1);
|
||||
action native A_GiveInventory(class<Inventory> itemtype, int amount = 0);
|
||||
|
|
Loading…
Reference in a new issue