- fixed: flag CVars in ZScript referenced wrong addresses

This commit is contained in:
alexey.lysiuk 2018-06-09 17:21:55 +03:00
parent 85f5f897d7
commit 4a1f36623b

View file

@ -6858,10 +6858,10 @@ ExpEmit FxCVar::Emit(VMFunctionBuilder *build)
{
int *pVal;
auto cv = static_cast<FFlagCVar *>(CVar);
auto &vcv = cv->ValueVar;
if (vcv == compatflags) pVal = &i_compatflags;
else if (vcv == compatflags2) pVal = &ii_compatflags2;
else pVal = &vcv.Value;
auto vcv = &cv->ValueVar;
if (vcv == &compatflags) pVal = &i_compatflags;
else if (vcv == &compatflags2) pVal = &ii_compatflags2;
else pVal = &vcv->Value;
build->Emit(OP_LKP, addr.RegNum, build->GetConstantAddress(pVal));
build->Emit(OP_LW, dest.RegNum, addr.RegNum, nul);
build->Emit(OP_SRL_RI, dest.RegNum, dest.RegNum, cv->BitNum);