VarAction2: Delete provably zero adjustment operations

This commit is contained in:
Jonathan G Rennison
2022-05-24 23:40:29 +01:00
parent 502980ba61
commit e3df522111
2 changed files with 27 additions and 0 deletions

View File

@@ -5626,6 +5626,15 @@ static void NewSpriteGroup(ByteReader *buf)
} else {
adjust.add_val = 0;
adjust.divmod_val = 0;
if (group->adjusts.size() > 1) {
/* Not the first adjustment */
if (adjust.variable != 0x7E) {
if (adjust.and_mask == 0 && IsEvalAdjustWithZeroRemovable(adjust.operation)) {
/* Delete useless zero operations */
group->adjusts.pop_back();
}
}
}
}
/* Continue reading var adjusts while bit 5 is set. */