diff --git a/src/dobjtype.h b/src/dobjtype.h index c5d96972b1..f3e043bd92 100644 --- a/src/dobjtype.h +++ b/src/dobjtype.h @@ -574,7 +574,7 @@ class PField : public PSymbol public: PField(FName name, PType *type) : PSymbol(name), Offset(0), Type(type), Flags(0) {} PField(FName name, PType *type, DWORD flags) : PSymbol(name), Offset(0), Type(type), Flags(flags) {} - PField(FName name, PType *type, DWORD flags, unsigned offset) : PSymbol(name), Offset(offset), Type(type), Flags(flags) {} + PField(FName name, PType *type, DWORD flags, size_t offset) : PSymbol(name), Offset(unsigned(offset)), Type(type), Flags(flags) {} unsigned int Offset; PType *Type; diff --git a/src/namedef.h b/src/namedef.h index d512a79486..9735578744 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -437,6 +437,8 @@ xx(ScaleX) xx(ScaleY) xx(Floatbobphase) xx(Target) +xx(Master) +xx(Tracer) xx(Blocking) xx(Blockmonsters) diff --git a/src/scripting/codegeneration/codegen.cpp b/src/scripting/codegeneration/codegen.cpp index c4a466873a..c7cd6e524f 100644 --- a/src/scripting/codegeneration/codegen.cpp +++ b/src/scripting/codegeneration/codegen.cpp @@ -4975,6 +4975,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx) auto self = !(afd->Variants[0].Flags & VARF_Static) ? Self : nullptr; auto x = new FxVMFunctionCall(self, afd, ArgList, ScriptPosition, staticonly); ArgList = nullptr; + if (Self == self) Self = nullptr; delete this; return x->Resolve(ctx); } @@ -6226,6 +6227,7 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx) { FName clsname = static_cast(basex)->GetValue().GetName(); PClass *cls = NULL; + FxExpression *x; if (clsname != NAME_None) { @@ -6248,8 +6250,12 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx) } ScriptPosition.Message(MSG_DEBUG, "resolving '%s' as class name", clsname.GetChars()); } + x = new FxConstant(cls, ScriptPosition); + } + else + { + x = new FxConstant(ScriptPosition); // create a genuine null pointer to get past the type checks. } - FxExpression *x = new FxConstant(cls, ScriptPosition); delete this; return x; } diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 260cc64088..7e0668a0fc 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -677,4 +677,6 @@ void InitThingdef() symt.AddSymbol(new PField(NAME_VisibleEndAngle, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleEndAngle))); symt.AddSymbol(new PField(NAME_VisibleEndPitch, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleEndPitch))); symt.AddSymbol(new PField(NAME_Target, TypeActor, VARF_Native, myoffsetof(AActor, target))); + symt.AddSymbol(new PField(NAME_Master, TypeActor, VARF_Native, myoffsetof(AActor, master))); + symt.AddSymbol(new PField(NAME_Tracer, TypeActor, VARF_Native, myoffsetof(AActor, tracer))); } diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index e702f7d2a4..5d309bedc5 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -2381,7 +2381,11 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast) return new FxFunctionCall(static_cast(fcall->Function)->Identifier, NAME_None, ConvertNodeList(fcall->Parameters), *ast); case AST_ExprMemberAccess: - break; + { + auto ema = static_cast(fcall->Function); + Printf("Member call to %s\n", FName(ema->Right).GetChars()); + return new FxMemberFunctionCall(ConvertNode(ema->Left), ema->Right, ConvertNodeList(fcall->Parameters), *ast); + } case AST_ExprBinary: // Array syntax for randoms. They are internally stored as ExprBinary with both an identifier on the left and right side.