From d730b06da702239d36842eb01174b8212248e858 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Thu, 26 Nov 2015 01:33:02 -0600 Subject: [PATCH] Added A_CheckSpecies(state jump, name species, ptr = AAPTR_DEFAULT) - Performs a state jump if the defined species name for the pointed actor matches the criteria. --- src/thingdef/thingdef_codeptr.cpp | 25 +++++++++++++++++++++++++ wadsrc/static/actors/actor.txt | 1 + 2 files changed, 26 insertions(+) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 14440d884..dc9fc9a40 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5028,6 +5028,31 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) ACTION_SET_RESULT(given); } +//=========================================================================== +// +// A_CheckSpecies +// +//=========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSpecies) +{ + ACTION_PARAM_START(3); + ACTION_PARAM_STATE(jump, 0); + ACTION_PARAM_NAME(species, 1); + ACTION_PARAM_INT(ptr, 2); + + AActor *mobj = COPY_AAPTR(self, ptr); + + ACTION_SET_RESULT(false); + //Needs at least one state jump to work. + if (!mobj) + { + return; + } + + if (jump && mobj->GetSpecies() == species) + ACTION_JUMP(jump); +} + //========================================================================== // diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index be4b8b416..287840796 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -258,6 +258,7 @@ ACTOR Actor native //: Thinker action native A_GiveToTarget(class itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT); action native A_TakeFromTarget(class itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT); action native A_RadiusGive(class itemtype, int distance, int flags, int amount = 0, class filter = "None", name species = "None", int mindist = 0); + action native A_CheckSpecies(state jump, name species = "", int ptr = AAPTR_DEFAULT); action native A_CountdownArg(int argnum, state targstate = ""); action native A_CustomMeleeAttack(int damage = 0, sound meleesound = "", sound misssound = "", name damagetype = "none", bool bleed = true); action native A_CustomComboAttack(class missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true);