- removed DSBarInfo::Scaled because it tended to disagree with StatusBar->Scaled.

This commit is contained in:
Christoph Oelckers 2017-03-29 00:35:35 +02:00
parent 2d1641f0cd
commit 19e7d60275
3 changed files with 14 additions and 30 deletions

View file

@ -1003,11 +1003,6 @@ public:
Images.Uninit(); Images.Uninit();
} }
void _SetScaled(bool scaled)
{
Scaled = scaled;
}
void _AttachToPlayer(player_t *player) void _AttachToPlayer(player_t *player)
{ {
CPlayer = player; CPlayer = player;
@ -1039,7 +1034,7 @@ public:
{ {
if(script->huds[hud]->FullScreenOffsets()) if(script->huds[hud]->FullScreenOffsets())
wrapper->ForceHUDScale(true); wrapper->ForceHUDScale(true);
else if(!Scaled) else if(!wrapper->Scaled)
{ {
scalingWasForced = true; scalingWasForced = true;
wrapper->SetScaled(true, true); wrapper->SetScaled(true, true);
@ -1208,7 +1203,7 @@ public:
int barW = wrapper->HorizontalResolution, barH = wrapper->VerticalResolution; int barW = wrapper->HorizontalResolution, barH = wrapper->VerticalResolution;
dx += wrapper->ST_X; 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; w = forceWidth < 0 ? texture->GetScaledWidthDouble() : forceWidth;
h = forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight; h = forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight;
double dcx = clip[0] == 0 ? 0 : dx + clip[0] - texture->GetScaledLeftOffsetDouble(); 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 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(); 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) if(clip[0] != 0 || clip[1] != 0)
{ {
@ -1432,8 +1427,8 @@ public:
int barW = wrapper->HorizontalResolution, barH = wrapper->VerticalResolution; int barW = wrapper->HorizontalResolution, barH = wrapper->VerticalResolution;
rx += wrapper->ST_X; rx += wrapper->ST_X;
ry += wrapper->ST_Y - (Scaled ? barH : 200) + script->height; ry += wrapper->ST_Y - (wrapper->Scaled ? barH : 200) + script->height;
if(Scaled) if(wrapper->Scaled)
screen->VirtualToRealCoords(rx, ry, rw, rh, barW, barH, true); screen->VirtualToRealCoords(rx, ry, rw, rh, barW, barH, true);
else else
{ {
@ -1497,7 +1492,6 @@ public:
unsigned int invBarOffset; unsigned int invBarOffset;
player_t *CPlayer = nullptr; player_t *CPlayer = nullptr;
DBaseStatusBar *wrapper; DBaseStatusBar *wrapper;
bool Scaled;
private: private:
SBarInfo *script; SBarInfo *script;
@ -1521,7 +1515,7 @@ void SBarInfoMainBlock::DrawAux(const SBarInfoMainBlock *block, DSBarInfo *statu
rescale = true; rescale = true;
statusBar->wrapper->ForceHUDScale(true); statusBar->wrapper->ForceHUDScale(true);
} }
else if(!statusBar->Scaled) else if(!statusBar->wrapper->Scaled)
{ {
rescale = true; rescale = true;
statusBar->wrapper->SetScaled(true, true); statusBar->wrapper->SetScaled(true, true);
@ -1556,14 +1550,6 @@ DEFINE_ACTION_FUNCTION(DSBarInfo, Destroy)
return 0; 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) DEFINE_ACTION_FUNCTION(DSBarInfo, AttachToPlayer)
{ {
PARAM_SELF_STRUCT_PROLOGUE(DSBarInfo); PARAM_SELF_STRUCT_PROLOGUE(DSBarInfo);
@ -1620,7 +1606,7 @@ DBaseStatusBar *CreateCustomStatusBar(int scriptno)
auto core = new DSBarInfo(sbar, script); auto core = new DSBarInfo(sbar, script);
sbar->PointerVar<DSBarInfo>("core") = core; sbar->PointerVar<DSBarInfo>("core") = core;
sbar->SetSize(script->height, script->_resW, script->_resH); sbar->SetSize(script->height, script->_resW, script->_resH);
core->_SetScaled(sbar->Scaled); sbar->SetScaled(sbar->Scaled);
sbar->CompleteBorder = script->completeBorder; sbar->CompleteBorder = script->completeBorder;
return sbar; return sbar;
} }

View file

@ -8816,15 +8816,20 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
ArgList[i] = ArgList[i]->Resolve(ctx); // nust be resolved before the address is requested. ArgList[i] = ArgList[i]->Resolve(ctx); // nust be resolved before the address is requested.
if (ArgList[i] != nullptr && ArgList[i]->ValueType != TypeNullPtr) 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<PPointer*>(type)->IsA(RUNTIME_CLASS(PStruct)))
{
// trying to pass a struct reference as a struct refg
}
else
{ {
ArgList[i]->RequestAddress(ctx, &writable); ArgList[i]->RequestAddress(ctx, &writable);
if (flag & VARF_Ref)ArgList[i]->ValueType = NewPointer(ArgList[i]->ValueType); if (flag & VARF_Ref)ArgList[i]->ValueType = NewPointer(ArgList[i]->ValueType);
} }
// For a reference argument the types must match 100%. // For a reference argument the types must match 100%.
if (type != ArgList[i]->ValueType) 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; x = nullptr;
} }
else else

View file

@ -1,7 +1,6 @@
struct SBarInfo native ui struct SBarInfo native ui
{ {
native void SetScaled(bool scaled);
native void Destroy(); native void Destroy();
native void AttachToPlayer(PlayerInfo player); native void AttachToPlayer(PlayerInfo player);
native void Draw(int state); native void Draw(int state);
@ -25,12 +24,6 @@ class SBarInfoWrapper : BaseStatusBar
Super.OnDestroy(); Super.OnDestroy();
} }
override void SetScaled(bool scale, bool force)
{
Super.SetScaled(scale, force);
core.SetScaled(Scaled);
}
override void AttachToPlayer(PlayerInfo player) override void AttachToPlayer(PlayerInfo player)
{ {
Super.AttachToPlayer(player); Super.AttachToPlayer(player);