Skip to content

Commit

Permalink
Merge pull request #852 from edge-classic/dehacked-frame-fix
Browse files Browse the repository at this point in the history
Fix MBF21/DSDehacked state marking/allocation
  • Loading branch information
dashodanger authored Jan 20, 2025
2 parents 4b91ded + 0d1d86a commit 2d15fb3
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions source_files/dehacked/deh_frames.cc
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,27 @@ const State *frames::NewStateElseOld(int st_num)
{
if (new_states[st_num] != nullptr)
return new_states[st_num];
else if (st_num >= kTotalMBFStates)
{
State *entry = new State;
// these defaults follow the DSDehacked specs
entry->sprite = kSPR_TNT1;
entry->frame = 0;
entry->tics = -1;
entry->action = kA_NULL;
entry->next_state = st_num;
entry->arg_pointer = 0;
new_states[st_num] = entry;
return entry;
}
}
else if (patch::doom_ver == 21) // DSDehacked stuff has to exist I guess - Dasho
else
{
size_t to_add = st_num + 1 - new_states.size();
for (size_t i = 0; i < to_add; i++)
while ((int)new_states.size() < st_num + 1)
{
new_states.push_back(nullptr);
}
if (st_num >= kTotalMBFStates)
{
State *entry = new State;
// these defaults follow the DSDehacked specs
Expand All @@ -502,9 +518,9 @@ const State *frames::NewStateElseOld(int st_num)
entry->action = kA_NULL;
entry->next_state = st_num;
entry->arg_pointer = 0;
new_states.push_back(entry);
new_states[st_num] = entry;
return entry;
}
return new_states[st_num];
}

if (st_num < kTotalMBFStates)
Expand Down

0 comments on commit 2d15fb3

Please sign in to comment.