VarAction2: Add extra DSG flag for early exit when executing CBs

For when some branches of a non CB switch DSG contain CB switches,
but some don't and so would end up on the graphics chain, as there is
no further CB switch to exit at
This commit is contained in:
Jonathan G Rennison
2023-12-07 17:53:13 +00:00
parent 92d14ac980
commit f532970014
3 changed files with 12 additions and 1 deletions

View File

@@ -2647,7 +2647,7 @@ void OptimiseVarAction2DeterministicSpriteGroup(VarAction2OptimiseState &state,
}
}
if (sg != nullptr && sg->type == SGT_CALLBACK) {
if (!state.ignore_cb_handler) {
if (!state.ignore_cb_handler && static_cast<const CallbackResultSpriteGroup*>(sg)->result != CALLBACK_FAILED) {
group->dsg_flags |= DSGF_CB_RESULT;
state.have_cb_handler = true;
}
@@ -2698,6 +2698,10 @@ void OptimiseVarAction2DeterministicSpriteGroup(VarAction2OptimiseState &state,
}
if (possible_callback_handler) group->dsg_flags |= DSGF_CB_HANDLER;
if ((group->dsg_flags & (DSGF_CB_HANDLER | DSGF_CB_RESULT)) == 0) {
group->sg_flags |= SGF_SKIP_CB;
}
if (!HasGrfOptimiserFlag(NGOF_NO_OPT_VARACT2_GROUP_PRUNE) && group->ranges.empty() && !group->calculated_result && !seen_req_var1C) {
/* There is only one option, remove any redundant adjustments when the result will be ignored anyway */
while (!group->adjusts.empty()) {