From df4a8e38c5ef4a1d1bc51ae3354b411973e23aaa Mon Sep 17 00:00:00 2001 From: yqco Date: Mon, 22 Aug 2016 01:21:38 -0600 Subject: [PATCH] Add CheckActorState ACS function bool CheckActorState(int tid, str statename, bool exact = false); - Same parameter order as SetActorState - Returns true if actor has the state; else returns false --- src/p_acs.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 01953cad9b..0762b3e294 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4438,8 +4438,7 @@ enum EACSFunctions ACSF_SpawnParticle, ACSF_SetMusicVolume, ACSF_CheckProximity, - // 1 more left... - + ACSF_CheckActorState, // 99 /* Zandronum's - these must be skipped when we reach 99! -100:ResetMap(0), -101 : PlayerIsSpectator(1), @@ -6017,6 +6016,18 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) return P_Thing_CheckProximity(actor, classname, distance, count, flags, ptr); } + case ACSF_CheckActorState: + { + actor = SingleActorFromTID(args[0], activator); + const char *statename = FBehavior::StaticLookupString(args[1]); + bool exact = (argCount > 2) ? !!args[2] : false; + if (actor && statename) + { + return (actor->GetClass()->FindStateByString(statename, exact) != nullptr); + } + return false; + } + default: break; }