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
This commit is contained in:
yqco 2016-08-22 01:21:38 -06:00
parent 5ff0abe568
commit df4a8e38c5

View file

@ -4438,8 +4438,7 @@ enum EACSFunctions
ACSF_SpawnParticle, ACSF_SpawnParticle,
ACSF_SetMusicVolume, ACSF_SetMusicVolume,
ACSF_CheckProximity, ACSF_CheckProximity,
// 1 more left... ACSF_CheckActorState, // 99
/* Zandronum's - these must be skipped when we reach 99! /* Zandronum's - these must be skipped when we reach 99!
-100:ResetMap(0), -100:ResetMap(0),
-101 : PlayerIsSpectator(1), -101 : PlayerIsSpectator(1),
@ -6017,6 +6016,18 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
return P_Thing_CheckProximity(actor, classname, distance, count, flags, ptr); 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: default:
break; break;
} }