From f9e70a82c6216c19075adcd9f3d9826ba52ef5db Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 24 Aug 2015 12:45:10 -0500 Subject: [PATCH 1/2] - Added A_SetSpecies(,). --- src/thingdef/thingdef_codeptr.cpp | 22 ++++++++++++++++++++++ wadsrc/static/actors/actor.txt | 1 + 2 files changed, 23 insertions(+) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index d09ad6d6ef..f6b7247478 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5764,6 +5764,28 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower) ACTION_JUMP(low); } +//=========================================================================== +// A_SetSpecies(str species, ptr) +// +// Sets the species of the calling actor('s pointer). +//=========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) +{ + ACTION_PARAM_START(2); + ACTION_PARAM_NAME(species, 0); + ACTION_PARAM_INT(ptr, 1); + AActor *mobj = COPY_AAPTR(self, ptr); + if (!mobj) + { + ACTION_SET_RESULT(false); + return; + } + + if (!stricmp(species, "None") || !stricmp(species, "")) + mobj->Species = NAME_None; + else + mobj->Species = species; +} //=========================================================================== // diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 6885ad2d6d..5e79d6b829 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -331,6 +331,7 @@ ACTOR Actor native //: Thinker 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_SetSpecies(name species, int ptr = AAPTR_DEFAULT); action native A_SetRipperLevel(int level); action native A_SetRipMin(int min); action native A_SetRipMax(int max); From 27316432009ab2a09c494fd4d72287b215caf241 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Tue, 25 Aug 2015 08:15:23 -0500 Subject: [PATCH 2/2] Removed stricmp checks, as they're not needed. --- src/thingdef/thingdef_codeptr.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index f6b7247478..377c4915b3 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5781,10 +5781,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) return; } - if (!stricmp(species, "None") || !stricmp(species, "")) - mobj->Species = NAME_None; - else - mobj->Species = species; + mobj->Species = species; } //===========================================================================