mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
fix DSDHacked state creation.
Several problems here: * the crucial call did not override 'mustexist'. * once created an extended stare would not be looked at anymore. * extended states received no usage flags.
This commit is contained in:
parent
22e8bea91b
commit
3d6664c28e
1 changed files with 16 additions and 11 deletions
|
@ -557,7 +557,7 @@ static FState *FindState (int statenum, bool mustexist)
|
|||
{
|
||||
if (stateacc <= statenum && stateacc + StateMap[i].StateSpan > statenum)
|
||||
{
|
||||
if (StateMap[i].State != NULL)
|
||||
if (StateMap[i].State != nullptr)
|
||||
{
|
||||
if (StateMap[i].OwnerIsPickup)
|
||||
{
|
||||
|
@ -565,23 +565,28 @@ static FState *FindState (int statenum, bool mustexist)
|
|||
}
|
||||
return StateMap[i].State + statenum - stateacc;
|
||||
}
|
||||
else return NULL;
|
||||
else break;
|
||||
}
|
||||
stateacc += StateMap[i].StateSpan;
|
||||
}
|
||||
if (dsdhacked && !mustexist)
|
||||
if (dsdhacked)
|
||||
{
|
||||
auto p = dehExtStates.CheckKey(statenum);
|
||||
if (p) return *p;
|
||||
auto state = (FState*)ClassDataAllocator.Alloc(sizeof(FState));
|
||||
dehExtStates.Insert(statenum, state);
|
||||
memset(state, 0, sizeof(*state));
|
||||
state->Tics = -1;
|
||||
state->NextState = state;
|
||||
state->DehIndex = statenum;
|
||||
if (!mustexist)
|
||||
{
|
||||
auto state = (FState*)ClassDataAllocator.Alloc(sizeof(FState));
|
||||
dehExtStates.Insert(statenum, state);
|
||||
memset(state, 0, sizeof(*state));
|
||||
state->Tics = -1;
|
||||
state->NextState = state;
|
||||
state->DehIndex = statenum;
|
||||
state->UseFlags = SUF_ACTOR | SUF_OVERLAY | SUF_WEAPON | SUF_ITEM;
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int FindStyle (const char *namestr)
|
||||
|
@ -1832,7 +1837,7 @@ static int PatchFrame (int frameNum)
|
|||
int tics, misc1, frame;
|
||||
FState *info, dummy;
|
||||
|
||||
info = FindState (frameNum);
|
||||
info = FindState (frameNum, false);
|
||||
if (info)
|
||||
{
|
||||
DPrintf (DMSG_SPAMMY, "Frame %d\n", frameNum);
|
||||
|
|
Loading…
Reference in a new issue