Calculate thing state only once

This commit is contained in:
Sally Coolatta 2023-03-10 17:45:48 -05:00
parent d7c80af490
commit f03d9f6dec

View file

@ -3165,21 +3165,21 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
case 425: // Calls P_SetMobjState on calling mobj
{
mobj_t *targetThing = NULL;
statenum_t state = stringargs[0] ? get_number(stringargs[0]) : S_NULL;
if (state < 0 || state >= NUMSTATES)
{
return false;
}
while ((targetThing = P_FindMobjFromTID(args[1], targetThing, mo)) != NULL)
{
statenum_t state = S_NULL;
if (targetThing->player != NULL)
{
continue;
}
state = stringargs[0] ? get_number(stringargs[0]) : S_NULL;
if (state >= 0 && state < NUMSTATES)
{
P_SetMobjState(targetThing, state);
}
P_SetMobjState(targetThing, state);
}
}
break;