- redirect script access to the compatflags CVARs to their internal shadow variables.

This is needed so that MAPINFO settings for these flags don't get ignored.
This commit is contained in:
Christoph Oelckers 2018-06-08 22:55:44 +02:00
parent a312f5a7c1
commit 1fdcacc337

View file

@ -46,6 +46,7 @@
#include "codegen.h"
#include "v_text.h"
#include "w_wad.h"
#include "doomstat.h"
inline PClass *PObjectPointer::PointedClass() const { return static_cast<PClassType*>(PointedType)->Descriptor; }
@ -6855,8 +6856,13 @@ ExpEmit FxCVar::Emit(VMFunctionBuilder *build)
case CVAR_DummyBool:
{
int *pVal;
auto cv = static_cast<FFlagCVar *>(CVar);
build->Emit(OP_LKP, addr.RegNum, build->GetConstantAddress(&cv->ValueVar.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);
build->Emit(OP_AND_RK, dest.RegNum, dest.RegNum, build->GetConstantInt(1));