VarAction2: Do not prune groups when this would break var 1C

pull/428/head
Jonathan G Rennison 2 years ago
parent ae746a1af4
commit b9c22a0b9e

@ -5705,13 +5705,18 @@ static const SpriteGroup *PruneTargetSpriteGroup(const SpriteGroup *result)
if (sg->GroupMayBeBypassed()) {
/* Deterministic sprite group can be trivially resolved, skip it */
uint32 value = (sg->adjusts.size() == 1) ? EvaluateDeterministicSpriteGroupAdjust(sg->size, sg->adjusts[0], nullptr, 0, UINT_MAX) : 0;
result = sg->default_group;
const SpriteGroup *candidate = sg->default_group;
for (const auto &range : sg->ranges) {
if (range.low <= value && value <= range.high) {
result = range.group;
candidate = range.group;
break;
}
}
if (candidate != nullptr && candidate->type == SGT_DETERMINISTIC && static_cast<const DeterministicSpriteGroup *>(candidate)->dsg_flags & DSGF_REQUIRES_VAR1C) {
/* Can't skip this group as the child group requires the result of this group for variable 1C */
return result;
}
result = candidate;
continue;
}
}

Loading…
Cancel
Save