mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- added runtime checks for the state usage flags.
This commit is contained in:
parent
4f998fa879
commit
647e1399f1
4 changed files with 26 additions and 0 deletions
|
@ -128,6 +128,13 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState *state)
|
||||||
|
|
||||||
while (state != NULL)
|
while (state != NULL)
|
||||||
{
|
{
|
||||||
|
if (!(state->UseFlags & SUF_ITEM))
|
||||||
|
{
|
||||||
|
auto so = FState::StaticFindStateOwner(state);
|
||||||
|
Printf("State %s.%d not flagged for use in CustomInventory state chains.\n", so->TypeName.GetChars(), int(state - so->OwnedStates));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
this->state = state;
|
this->state = state;
|
||||||
nextstate = NULL; // assume no jump
|
nextstate = NULL; // assume no jump
|
||||||
|
|
||||||
|
|
|
@ -626,6 +626,14 @@ bool AActor::SetState (FState *newstate, bool nofunction)
|
||||||
{
|
{
|
||||||
prevsprite = -1;
|
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;
|
state = newstate;
|
||||||
tics = GetTics(newstate);
|
tics = GetTics(newstate);
|
||||||
renderflags = (renderflags & ~RF_FULLBRIGHT) | ActorRenderFlags::FromInt (newstate->GetFullbright());
|
renderflags = (renderflags & ~RF_FULLBRIGHT) | ActorRenderFlags::FromInt (newstate->GetFullbright());
|
||||||
|
|
|
@ -296,6 +296,16 @@ void DPSprite::SetState(FState *newstate, bool pending)
|
||||||
Destroy();
|
Destroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(newstate->UseFlags & (SUF_OVERLAY|SUF_WEAPON))) // Weapon and overlay are mostly the same, the main difference is that weapon states restrict the self pointer to class Actor.
|
||||||
|
{
|
||||||
|
auto so = FState::StaticFindStateOwner(newstate);
|
||||||
|
Printf("State %s.%d not flagged for use in overlays or weapons\n", so->TypeName.GetChars(), int(newstate - so->OwnedStates));
|
||||||
|
State = nullptr;
|
||||||
|
Destroy();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
State = newstate;
|
State = newstate;
|
||||||
|
|
||||||
if (newstate->sprite != SPR_FIXED)
|
if (newstate->sprite != SPR_FIXED)
|
||||||
|
|
|
@ -2437,6 +2437,7 @@ void ZCCCompiler::CompileStates()
|
||||||
auto sl = static_cast<ZCC_StateLine *>(st);
|
auto sl = static_cast<ZCC_StateLine *>(st);
|
||||||
FState state;
|
FState state;
|
||||||
memset(&state, 0, sizeof(state));
|
memset(&state, 0, sizeof(state));
|
||||||
|
state.UseFlags = flags;
|
||||||
if (sl->Sprite->Len() != 4)
|
if (sl->Sprite->Len() != 4)
|
||||||
{
|
{
|
||||||
Error(sl, "Sprite name must be exactly 4 characters. Found '%s'", sl->Sprite->GetChars());
|
Error(sl, "Sprite name must be exactly 4 characters. Found '%s'", sl->Sprite->GetChars());
|
||||||
|
|
Loading…
Reference in a new issue