Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MBF21/DSDehacked state marking/allocation #852

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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