- added runtime checks for the state usage flags.

This commit is contained in:
Christoph Oelckers 2016-11-15 00:18:57 +01:00
commit 647e1399f1
4 changed files with 26 additions and 0 deletions

View file

@ -626,6 +626,14 @@ bool AActor::SetState (FState *newstate, bool nofunction)
{
prevsprite = -1;
}
if (!(newstate->UseFlags & SUF_ACTOR))
{
auto so = FState::StaticFindStateOwner(newstate);
Printf("State %s.%d in %s not flagged for use as an actor sprite\n", so->TypeName.GetChars(), int(newstate - so->OwnedStates), GetClass()->TypeName.GetChars());
state = nullptr;
Destroy();
return false;
}
state = newstate;
tics = GetTics(newstate);
renderflags = (renderflags & ~RF_FULLBRIGHT) | ActorRenderFlags::FromInt (newstate->GetFullbright());