- 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();
}
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<DSBarInfo>("core") = core;
sbar->SetSize(script->height, script->_resW, script->_resH);
core->_SetScaled(sbar->Scaled);
sbar->SetScaled(sbar->Scaled);
sbar->CompleteBorder = script->completeBorder;
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.
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);
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

View file

@ -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);