// // ACS_funcSetThingState // static void ACS_funcSetThingState(ACS_FUNCARG) { int32_t tid = args[0]; const char *statename = ACSVM::GetString(args[1]); statenum_t statenum = E_StateNumForName(statename); state_t *state; int32_t count = 0; Mobj *mo = NULL; while((mo = P_FindMobjFromTID(tid, mo, thread->trigger))) { // Look for the named state for that type. if((state = E_GetJumpInfo(mo->info, statename))) { P_SetMobjState(mo, state->index); ++count; } // Otherwise, fall back to the global name. else if(statenum >= 0) { P_SetMobjState(mo, statenum); ++count; } } *retn++ = count; }
// // E_SafeStateNameOrLabel // // haleyjd 07/19/14: Allows lookup of what may either be an EDF global state // name, DECORATE state label relative to a particular mobjinfo, or a state // DeHackEd number. // int E_SafeStateNameOrLabel(mobjinfo_t *mi, const char *name) { char *pos = nullptr; long num = strtol(name, &pos, 0); // Not a number? It is a state name. if(estrnonempty(pos)) { int statenum = NullStateNum; state_t *state = nullptr; // Try global resolution first. if((statenum = E_StateNumForName(name)) < 0) { // Try DECORATE state label resolution. if((state = E_GetJumpInfo(mi, name))) statenum = state->index; } return statenum; } else return E_SafeState((int)num); // DeHackEd number }