From dbc595f886b833609125c2ca958639f959c3050b Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Sat, 18 Feb 2017 07:30:08 +0200 Subject: [PATCH] Marked DrawPowerup as ui, still compiles and somewhat works :D --- src/scripting/backend/codegen.cpp | 6 +++--- src/scripting/vm/vm.h | 2 +- src/scripting/zscript/zcc_compile.cpp | 12 ++++++------ wadsrc/static/zscript/inventory/inventory.txt | 2 +- wadsrc/static/zscript/inventory/powerups.txt | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 99b83ceae1..0ec7c13819 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -6750,7 +6750,7 @@ bool FxStructMember::RequestAddress(FCompileContext &ctx, bool *writable) if (ctx.Function) { outerflags = ctx.Function->Variants[0].Flags; - if ((outerflags & (VARF_VirtualScope | VARF_Virtual)) && ctx.Class) + if (((outerflags & (VARF_VirtualScope | VARF_Virtual)) == (VARF_VirtualScope | VARF_Virtual)) && ctx.Class) outerflags = FScopeBarrier::FlagsFromSide(FScopeBarrier::SideFromObjectFlags(ctx.Class->ObjectFlags)); } FScopeBarrier scopeBarrier(outerflags, FScopeBarrier::FlagsFromSide(BarrierSide), ""); @@ -6794,7 +6794,7 @@ FxExpression *FxStructMember::Resolve(FCompileContext &ctx) if (ctx.Function) { outerflags = ctx.Function->Variants[0].Flags; - if ((outerflags & (VARF_VirtualScope | VARF_Virtual)) && ctx.Class) + if (((outerflags & (VARF_VirtualScope | VARF_Virtual)) == (VARF_VirtualScope | VARF_Virtual)) && ctx.Class) outerflags = FScopeBarrier::FlagsFromSide(FScopeBarrier::SideFromObjectFlags(ctx.Class->ObjectFlags)); } FScopeBarrier scopeBarrier(outerflags, membervar->Flags, membervar->SymbolName.GetChars()); @@ -8065,7 +8065,7 @@ isresolved: if (ctx.Function) { outerflags = ctx.Function->Variants[0].Flags; - if ((outerflags & (VARF_VirtualScope | VARF_Virtual)) && ctx.Class) + if (((outerflags & (VARF_VirtualScope | VARF_Virtual)) == (VARF_VirtualScope | VARF_Virtual)) && ctx.Class) outerflags = FScopeBarrier::FlagsFromSide(FScopeBarrier::SideFromObjectFlags(ctx.Class->ObjectFlags)); } int innerflags = afd->Variants[0].Flags; diff --git a/src/scripting/vm/vm.h b/src/scripting/vm/vm.h index ba1db7aa93..b13f17777e 100644 --- a/src/scripting/vm/vm.h +++ b/src/scripting/vm/vm.h @@ -708,7 +708,7 @@ public: bool Final = false; // cannot be overridden bool Unsafe = false; // Contains references to class fields that are unsafe for psp and item state calls. bool FuncConst = false; // [ZZ] readonly function - int BarrierSide = -1; // [ZZ] FScopeBarrier::Side + int BarrierSide = 0; // [ZZ] FScopeBarrier::Side BYTE ImplicitArgs = 0; // either 0 for static, 1 for method or 3 for action unsigned VirtualIndex = ~0u; FName Name; diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index c19d14b1e4..0cfd2d66ac 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -1081,8 +1081,8 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray &Fiel // For structs only allow 'deprecated', for classes exclude function qualifiers. int notallowed = forstruct? - ZCC_Latent | ZCC_Final | ZCC_Action | ZCC_Static | ZCC_FuncConst | ZCC_Abstract | ZCC_Virtual | ZCC_Override | ZCC_Meta | ZCC_Extension : - ZCC_Latent | ZCC_Final | ZCC_Action | ZCC_Static | ZCC_FuncConst | ZCC_Abstract | ZCC_Virtual | ZCC_Override | ZCC_Extension; + ZCC_Latent | ZCC_Final | ZCC_Action | ZCC_Static | ZCC_FuncConst | ZCC_Abstract | ZCC_Virtual | ZCC_Override | ZCC_Meta | ZCC_Extension | ZCC_VirtualScope : + ZCC_Latent | ZCC_Final | ZCC_Action | ZCC_Static | ZCC_FuncConst | ZCC_Abstract | ZCC_Virtual | ZCC_Override | ZCC_Extension | ZCC_VirtualScope; if (field->Flags & notallowed) { @@ -1102,11 +1102,11 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray &Fiel if (type->ObjectFlags & OF_Play) varflags |= VARF_Play; if (field->Flags & ZCC_UIFlag) - varflags = (varflags&~VARF_Play) | VARF_UI; + varflags = FScopeBarrier::ChangeSideInFlags(varflags, FScopeBarrier::Side_UI); if (field->Flags & ZCC_Play) - varflags = (varflags&~VARF_UI) | VARF_Play; + varflags = FScopeBarrier::ChangeSideInFlags(varflags, FScopeBarrier::Side_Play); if (field->Flags & ZCC_ClearScope) - varflags = (varflags&~(VARF_UI | VARF_Play)); + varflags = FScopeBarrier::ChangeSideInFlags(varflags, FScopeBarrier::Side_PlainData); if (field->Flags & ZCC_Native) { @@ -2128,7 +2128,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool if (c->Type()->ObjectFlags & OF_Play) varflags |= VARF_Play; if (f->Flags & ZCC_FuncConst) - varflags = (varflags&~(VARF_Play | VARF_UI)); // const implies clearscope. this is checked a bit later to also not have ZCC_Play/ZCC_UIFlag. + varflags = FScopeBarrier::ChangeSideInFlags(varflags, FScopeBarrier::Side_PlainData); // const implies clearscope. this is checked a bit later to also not have ZCC_Play/ZCC_UIFlag. if (f->Flags & ZCC_UIFlag) varflags = FScopeBarrier::ChangeSideInFlags(varflags, FScopeBarrier::Side_UI); if (f->Flags & ZCC_Play) diff --git a/wadsrc/static/zscript/inventory/inventory.txt b/wadsrc/static/zscript/inventory/inventory.txt index 28b20cdd5d..f24a2de099 100644 --- a/wadsrc/static/zscript/inventory/inventory.txt +++ b/wadsrc/static/zscript/inventory/inventory.txt @@ -813,7 +813,7 @@ class Inventory : Actor native // //=========================================================================== - virtual bool DrawPowerup(int x, int y) { return false; } + virtual ui bool DrawPowerup(int x, int y) { return false; } //=========================================================================== // diff --git a/wadsrc/static/zscript/inventory/powerups.txt b/wadsrc/static/zscript/inventory/powerups.txt index d355a5e14f..df0812355c 100644 --- a/wadsrc/static/zscript/inventory/powerups.txt +++ b/wadsrc/static/zscript/inventory/powerups.txt @@ -934,7 +934,7 @@ class PowerFlight : Powerup +INVENTORY.HUBPOWER } - bool HitCenterFrame; + ui bool HitCenterFrame; //=========================================================================== //