VarAction2: Fix calculated result groups being incorrectly pruned

This commit is contained in:
Jonathan G Rennison
2022-05-30 17:24:26 +01:00
parent d6015194c1
commit 994dc683a2
3 changed files with 11 additions and 2 deletions

View File

@@ -286,7 +286,7 @@ void DeterministicSpriteGroup::AnalyseCallbacks(AnalyseCallbackOperation &op) co
}
auto check_1A_range = [&]() -> bool {
if (this->adjusts.size() == 0 || (this->adjusts.size() == 1 && this->adjusts[0].variable == 0x1A && (this->adjusts[0].operation == DSGA_OP_ADD || this->adjusts[0].operation == DSGA_OP_RST))) {
if (this->GroupMayBeBypassed()) {
/* Not clear why some GRFs do this, perhaps a way of commenting out a branch */
uint32 value = (this->adjusts.size() == 1) ? EvaluateDeterministicSpriteGroupAdjust(this->size, this->adjusts[0], nullptr, 0, UINT_MAX) : 0;
for (const auto &range : this->ranges) {
@@ -442,6 +442,14 @@ void DeterministicSpriteGroup::AnalyseCallbacks(AnalyseCallbackOperation &op) co
}
}
bool DeterministicSpriteGroup::GroupMayBeBypassed() const
{
if (this->calculated_result) return false;
if (this->adjusts.size() == 0) return true;
if ((this->adjusts.size() == 1 && this->adjusts[0].variable == 0x1A && (this->adjusts[0].operation == DSGA_OP_ADD || this->adjusts[0].operation == DSGA_OP_RST))) return true;
return false;
}
void CallbackResultSpriteGroup::AnalyseCallbacks(AnalyseCallbackOperation &op) const
{
if (op.mode == ACOM_FIND_CB_RESULT) op.cb_result_found = true;