VarAction2: Add a NOOP operator

This commit is contained in:
Jonathan G Rennison
2022-08-09 21:36:03 +01:00
parent 57de709309
commit 41f2e92f5c
2 changed files with 8 additions and 0 deletions

View File

@@ -217,6 +217,7 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust &adjust, ScopeResolver
case DSGA_OP_JNZ: return handle_jump(value != 0, value);
case DSGA_OP_JZ_LV: return handle_jump(last_value == 0, last_value);
case DSGA_OP_JNZ_LV: return handle_jump(last_value != 0, last_value);
case DSGA_OP_NOOP: return last_value;
default: return value;
}
}
@@ -708,6 +709,7 @@ static const char *_dsg_op_special_names[] {
"JNZ",
"JZ_LV",
"JNZ_LV",
"NOOP",
};
static_assert(lengthof(_dsg_op_special_names) == DSGA_OP_SPECIAL_END - DSGA_OP_TERNARY);
@@ -778,6 +780,11 @@ static char *DumpSpriteGroupAdjust(char *p, const char *last, const Deterministi
append_flags();
return p;
}
if (adjust.operation == DSGA_OP_NOOP) {
p += seprintf(p, last, "NOOP");
append_flags();
return p;
}
if (adjust.operation == DSGA_OP_JZ_LV || adjust.operation == DSGA_OP_JNZ_LV) {
p = GetAdjustOperationName(p, last, adjust.operation);
p += seprintf(p, last, " +%u", adjust.jump);

View File

@@ -210,6 +210,7 @@ enum DeterministicSpriteGroupAdjustOperation : uint8 {
DSGA_OP_JNZ, ///< jump forward fixed number of adjusts (to adjust after DSGAF_END_BLOCK marker (taking into account nesting)) if b is non-zero. return b if jumped, return a if not jumped
DSGA_OP_JZ_LV, ///< jump forward fixed number of adjusts (to adjust after DSGAF_END_BLOCK marker (taking into account nesting)) if a is zero. return a
DSGA_OP_JNZ_LV, ///< jump forward fixed number of adjusts (to adjust after DSGAF_END_BLOCK marker (taking into account nesting)) if a is non-zero. return a
DSGA_OP_NOOP, ///< a
DSGA_OP_SPECIAL_END,
};