diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 9625d83ee..1ab720c35 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -2189,6 +2189,7 @@ ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build) { double val = static_cast(choices[i])->GetValue().GetFloat(); build->Emit(OP_PARAM, 0, REGT_FLOAT | REGT_KONST, build->GetConstantFloat(val)); + build->ParamChange(-1); // all params should use the same register here. } } else diff --git a/src/zscript/vmbuilder.h b/src/zscript/vmbuilder.h index b8b1df848..ee15e49cf 100644 --- a/src/zscript/vmbuilder.h +++ b/src/zscript/vmbuilder.h @@ -51,6 +51,9 @@ public: void FillAddressConstants(FVoidObj *konst, VM_ATAG *tags); void FillStringConstants(FString *strings); + // PARAM increases ActiveParam; CALL decreases it. + void ParamChange(int delta); + // Track available registers. RegAvailability Registers[4]; @@ -76,8 +79,6 @@ private: TArray Code; - // PARAM increases ActiveParam; CALL decreases it. - void ParamChange(int delta); }; #endif