diff --git a/src/g_statusbar/sbarinfo.cpp b/src/g_statusbar/sbarinfo.cpp index c64dbef65..9f069b831 100644 --- a/src/g_statusbar/sbarinfo.cpp +++ b/src/g_statusbar/sbarinfo.cpp @@ -1003,11 +1003,6 @@ public: Images.Uninit(); } - void _SetScaled(bool scaled) - { - Scaled = scaled; - } - void _AttachToPlayer(player_t *player) { CPlayer = player; @@ -1039,7 +1034,7 @@ public: { if(script->huds[hud]->FullScreenOffsets()) wrapper->ForceHUDScale(true); - else if(!Scaled) + else if(!wrapper->Scaled) { scalingWasForced = true; wrapper->SetScaled(true, true); @@ -1208,7 +1203,7 @@ public: int barW = wrapper->HorizontalResolution, barH = wrapper->VerticalResolution; dx += wrapper->ST_X; - dy += wrapper->ST_Y - (Scaled ? barH : 200) + script->height; + dy += wrapper->ST_Y - (wrapper->Scaled ? barH : 200) + script->height; w = forceWidth < 0 ? texture->GetScaledWidthDouble() : forceWidth; h = forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight; double dcx = clip[0] == 0 ? 0 : dx + clip[0] - texture->GetScaledLeftOffsetDouble(); @@ -1216,7 +1211,7 @@ public: double dcr = clip[2] == 0 ? INT_MAX : dx + w - clip[2] - texture->GetScaledLeftOffsetDouble(); double dcb = clip[3] == 0 ? INT_MAX : dy + h - clip[3] - texture->GetScaledTopOffsetDouble(); - if(Scaled) + if(wrapper->Scaled) { if(clip[0] != 0 || clip[1] != 0) { @@ -1432,8 +1427,8 @@ public: int barW = wrapper->HorizontalResolution, barH = wrapper->VerticalResolution; rx += wrapper->ST_X; - ry += wrapper->ST_Y - (Scaled ? barH : 200) + script->height; - if(Scaled) + ry += wrapper->ST_Y - (wrapper->Scaled ? barH : 200) + script->height; + if(wrapper->Scaled) screen->VirtualToRealCoords(rx, ry, rw, rh, barW, barH, true); else { @@ -1497,7 +1492,6 @@ public: unsigned int invBarOffset; player_t *CPlayer = nullptr; DBaseStatusBar *wrapper; - bool Scaled; private: SBarInfo *script; @@ -1521,7 +1515,7 @@ void SBarInfoMainBlock::DrawAux(const SBarInfoMainBlock *block, DSBarInfo *statu rescale = true; statusBar->wrapper->ForceHUDScale(true); } - else if(!statusBar->Scaled) + else if(!statusBar->wrapper->Scaled) { rescale = true; statusBar->wrapper->SetScaled(true, true); @@ -1556,14 +1550,6 @@ DEFINE_ACTION_FUNCTION(DSBarInfo, Destroy) return 0; } -DEFINE_ACTION_FUNCTION(DSBarInfo, SetScaled) -{ - PARAM_SELF_STRUCT_PROLOGUE(DSBarInfo); - PARAM_BOOL(scale); - self->_SetScaled(scale); - return 0; -} - DEFINE_ACTION_FUNCTION(DSBarInfo, AttachToPlayer) { PARAM_SELF_STRUCT_PROLOGUE(DSBarInfo); @@ -1620,7 +1606,7 @@ DBaseStatusBar *CreateCustomStatusBar(int scriptno) auto core = new DSBarInfo(sbar, script); sbar->PointerVar("core") = core; sbar->SetSize(script->height, script->_resW, script->_resH); - core->_SetScaled(sbar->Scaled); + sbar->SetScaled(sbar->Scaled); sbar->CompleteBorder = script->completeBorder; return sbar; } diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 2a178a249..4b70717b1 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -8816,15 +8816,20 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) ArgList[i] = ArgList[i]->Resolve(ctx); // nust be resolved before the address is requested. if (ArgList[i] != nullptr && ArgList[i]->ValueType != TypeNullPtr) { - if (type != ArgList[i]->ValueType) + if (type == ArgList[i]->ValueType && type->IsA(RUNTIME_CLASS(PPointer)) && static_cast(type)->IsA(RUNTIME_CLASS(PStruct))) + { + // trying to pass a struct reference as a struct refg + } + else { ArgList[i]->RequestAddress(ctx, &writable); if (flag & VARF_Ref)ArgList[i]->ValueType = NewPointer(ArgList[i]->ValueType); } + // For a reference argument the types must match 100%. if (type != ArgList[i]->ValueType) { - ScriptPosition.Message(MSG_ERROR, "Type mismatch in reference argument %s: %s != %s", Function->SymbolName.GetChars(), type->DescriptiveName(), ArgList[i]->ValueType->DescriptiveName()); + ScriptPosition.Message(MSG_ERROR, "Type mismatch in reference argument %s", Function->SymbolName.GetChars()); x = nullptr; } else diff --git a/wadsrc/static/zscript/statusbar/sbarinfowrapper.txt b/wadsrc/static/zscript/statusbar/sbarinfowrapper.txt index 8c8c6bf53..7a7aaea4f 100644 --- a/wadsrc/static/zscript/statusbar/sbarinfowrapper.txt +++ b/wadsrc/static/zscript/statusbar/sbarinfowrapper.txt @@ -1,7 +1,6 @@ struct SBarInfo native ui { - native void SetScaled(bool scaled); native void Destroy(); native void AttachToPlayer(PlayerInfo player); native void Draw(int state); @@ -25,12 +24,6 @@ class SBarInfoWrapper : BaseStatusBar Super.OnDestroy(); } - override void SetScaled(bool scale, bool force) - { - Super.SetScaled(scale, force); - core.SetScaled(Scaled); - } - override void AttachToPlayer(PlayerInfo player) { Super.AttachToPlayer(player);