From 5b71ce6dcb631cbfa8b902e3c3eac658e22b1eb2 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Fri, 26 Sep 2014 11:48:20 -0500 Subject: [PATCH] - Added FDARI's A_JumpIfHealthLower patch. Now with pointer accessibility. --- src/thingdef/thingdef_codeptr.cpp | 12 ++++++++++-- wadsrc/static/actors/actor.txt | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 6c44fa79e8..608e1c605d 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -601,11 +601,19 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Jump) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHealthLower) { - ACTION_PARAM_START(2); + ACTION_PARAM_START(3); ACTION_PARAM_INT(health, 0); ACTION_PARAM_STATE(jump, 1); + ACTION_PARAM_INT(ptr_selector, 2); - if (self->health < health) ACTION_JUMP(jump); + AActor *measured; + + measured = COPY_AAPTR(self, ptr_selector); + + if (measured && measured->health < health) + { + ACTION_JUMP(jump); + } ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains! } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 448d83f097..d4c79c3de9 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -204,7 +204,7 @@ ACTOR Actor native //: Thinker action native A_CustomMissile(class missiletype, float spawnheight = 32, int spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0); action native A_CustomBulletAttack(float spread_xy, float spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", float range = 0, int flags = 0); action native A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, bool aim = false, float maxdiff = 0, class pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = "none", float spawnofs_z = 0); - action native A_JumpIfHealthLower(int health, state label); + action native A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT); action native A_JumpIfCloser(float distance, state label); action native A_JumpIfTracerCloser(float distance, state label); action native A_JumpIfMasterCloser(float distance, state label);