mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- moved all coordinate adjustment for the status bar mode into one function and use this function in all places where status bar related coordinate adjustments need to be performed, also in SBARINFO.
- fixed unscaled status bar placement. - fixed inventory count display for Doom status bar.
This commit is contained in:
parent
914c829f79
commit
598523a1de
4 changed files with 33 additions and 53 deletions
|
@ -402,6 +402,7 @@ public:
|
||||||
void BeginStatusBar(int resW, int resH, int relTop, bool completeborder = false, bool forceScaled = false);
|
void BeginStatusBar(int resW, int resH, int relTop, bool completeborder = false, bool forceScaled = false);
|
||||||
void BeginHUD(int resW, int resH, double Alpha, bool forceScaled = false);
|
void BeginHUD(int resW, int resH, double Alpha, bool forceScaled = false);
|
||||||
void ForceHUDScale(bool on) { ForcedScale = on; } // This is for SBARINFO which should not use BeginStatusBar or BeginHUD.
|
void ForceHUDScale(bool on) { ForcedScale = on; } // This is for SBARINFO which should not use BeginStatusBar or BeginHUD.
|
||||||
|
void StatusbarToRealCoords(double &x, double &y, double &w, double &h) const;
|
||||||
|
|
||||||
//protected:
|
//protected:
|
||||||
void DrawPowerups ();
|
void DrawPowerups ();
|
||||||
|
@ -410,6 +411,7 @@ public:
|
||||||
void RefreshBackground () const;
|
void RefreshBackground () const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AInventory *ValidateInvFirst (int numVisible) const;
|
AInventory *ValidateInvFirst (int numVisible) const;
|
||||||
void DrawCrosshair ();
|
void DrawCrosshair ();
|
||||||
|
|
||||||
|
|
|
@ -1200,10 +1200,6 @@ public:
|
||||||
if(!fullScreenOffsets)
|
if(!fullScreenOffsets)
|
||||||
{
|
{
|
||||||
double tmp = 0;
|
double tmp = 0;
|
||||||
int barW = wrapper->HorizontalResolution, barH = wrapper->VerticalResolution;
|
|
||||||
|
|
||||||
dx += wrapper->ST_X;
|
|
||||||
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();
|
||||||
|
@ -1211,24 +1207,17 @@ 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(wrapper->Scaled)
|
if(clip[0] != 0 || clip[1] != 0)
|
||||||
{
|
{
|
||||||
if(clip[0] != 0 || clip[1] != 0)
|
wrapper->StatusbarToRealCoords(dcx, dcy, tmp, tmp);
|
||||||
{
|
if (clip[0] == 0) dcx = 0;
|
||||||
screen->VirtualToRealCoords(dcx, dcy, tmp, tmp, barW, barH, true);
|
if (clip[1] == 0) dcy = 0;
|
||||||
if (clip[0] == 0) dcx = 0;
|
|
||||||
if (clip[1] == 0) dcy = 0;
|
|
||||||
}
|
|
||||||
if(clip[2] != 0 || clip[3] != 0 || clearDontDraw)
|
|
||||||
screen->VirtualToRealCoords(dcr, dcb, tmp, tmp, barW, barH, true);
|
|
||||||
screen->VirtualToRealCoords(dx, dy, w, h, barW, barH, true);
|
|
||||||
}
|
}
|
||||||
else
|
if (clip[2] != 0 || clip[3] != 0 || clearDontDraw)
|
||||||
{
|
{
|
||||||
dy += 200 - barH;
|
wrapper->StatusbarToRealCoords(dcr, dcb, tmp, tmp);
|
||||||
dcy += 200 - barH;
|
|
||||||
dcb += 200 - barH;
|
|
||||||
}
|
}
|
||||||
|
wrapper->StatusbarToRealCoords(dx, dy, w, h);
|
||||||
|
|
||||||
if(clearDontDraw)
|
if(clearDontDraw)
|
||||||
screen->Clear(static_cast<int>(MAX<double>(dx, dcx)), static_cast<int>(MAX<double>(dy, dcy)), static_cast<int>(MIN<double>(dcr,w+MAX<double>(dx, dcx))), static_cast<int>(MIN<double>(dcb,MAX<double>(dy, dcy)+h)), GPalette.BlackIndex, 0);
|
screen->Clear(static_cast<int>(MAX<double>(dx, dcx)), static_cast<int>(MAX<double>(dy, dcy)), static_cast<int>(MIN<double>(dcr,w+MAX<double>(dx, dcx))), static_cast<int>(MIN<double>(dcb,MAX<double>(dy, dcy)+h)), GPalette.BlackIndex, 0);
|
||||||
|
@ -1424,16 +1413,7 @@ public:
|
||||||
|
|
||||||
if(!fullScreenOffsets)
|
if(!fullScreenOffsets)
|
||||||
{
|
{
|
||||||
|
wrapper->StatusbarToRealCoords(rx, ry, rw, rh);
|
||||||
int barW = wrapper->HorizontalResolution, barH = wrapper->VerticalResolution;
|
|
||||||
rx += wrapper->ST_X;
|
|
||||||
ry += wrapper->ST_Y - (wrapper->Scaled ? barH : 200) + script->height;
|
|
||||||
if(wrapper->Scaled)
|
|
||||||
screen->VirtualToRealCoords(rx, ry, rw, rh, barW, barH, true);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ry += (200 - barH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1564,6 +1564,25 @@ uint32_t DBaseStatusBar::GetTranslation() const
|
||||||
//
|
//
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
void DBaseStatusBar::StatusbarToRealCoords(double &x, double &y, double &w, double &h) const
|
||||||
|
{
|
||||||
|
if (Scaled)
|
||||||
|
{
|
||||||
|
screen->VirtualToRealCoords(x, y, w, h, HorizontalResolution, VerticalResolution, true, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x += ST_X;
|
||||||
|
y += screen->GetHeight() - VerticalResolution;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// draw stuff
|
||||||
|
//
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY)
|
void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY)
|
||||||
{
|
{
|
||||||
if (!texture.isValid())
|
if (!texture.isValid())
|
||||||
|
@ -1636,14 +1655,7 @@ void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int fla
|
||||||
|
|
||||||
if (!fullscreenOffsets)
|
if (!fullscreenOffsets)
|
||||||
{
|
{
|
||||||
x += ST_X;
|
StatusbarToRealCoords(x, y, boxwidth, boxheight);
|
||||||
//y += ST_Y;
|
|
||||||
|
|
||||||
// Todo: Allow other scaling values, too.
|
|
||||||
if (Scaled)
|
|
||||||
{
|
|
||||||
screen->VirtualToRealCoords(x, y, boxwidth, boxheight, HorizontalResolution, VerticalResolution, true, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1853,14 +1865,7 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
|
||||||
|
|
||||||
if (!fullscreenOffsets)
|
if (!fullscreenOffsets)
|
||||||
{
|
{
|
||||||
rx += ST_X;
|
StatusbarToRealCoords(rx, ry, rw, rh);
|
||||||
//ry += ST_Y;
|
|
||||||
|
|
||||||
// Todo: Allow other scaling values, too.
|
|
||||||
if (Scaled)
|
|
||||||
{
|
|
||||||
screen->VirtualToRealCoords(rx, ry, rw, rh, HorizontalResolution, VerticalResolution, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1963,14 +1968,7 @@ void DBaseStatusBar::Fill(PalEntry color, double x, double y, double w, double h
|
||||||
|
|
||||||
if (!fullscreenOffsets)
|
if (!fullscreenOffsets)
|
||||||
{
|
{
|
||||||
x += ST_X;
|
StatusbarToRealCoords(x, y, w, h);
|
||||||
//y += ST_Y;
|
|
||||||
|
|
||||||
// Todo: Allow other scaling values, too.
|
|
||||||
if (Scaled)
|
|
||||||
{
|
|
||||||
screen->VirtualToRealCoords(x, y, w, h, HorizontalResolution, VerticalResolution, true, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,7 +110,7 @@ class DoomStatusBar : BaseStatusBar
|
||||||
if (CPlayer.mo.InvSel != null && !level.NoInventoryBar)
|
if (CPlayer.mo.InvSel != null && !level.NoInventoryBar)
|
||||||
{
|
{
|
||||||
DrawInventoryIcon(CPlayer.mo.InvSel, (160, 198));
|
DrawInventoryIcon(CPlayer.mo.InvSel, (160, 198));
|
||||||
if (CPlayer.mo.InvSel.Amount > 0)
|
if (CPlayer.mo.InvSel.Amount > 1)
|
||||||
{
|
{
|
||||||
DrawString(mAmountFont, FormatNumber(CPlayer.mo.InvSel.Amount), (175, 198-mIndexFont.mFont.GetHeight()), DI_TEXT_ALIGN_RIGHT, Font.CR_GOLD);
|
DrawString(mAmountFont, FormatNumber(CPlayer.mo.InvSel.Amount), (175, 198-mIndexFont.mFont.GetHeight()), DI_TEXT_ALIGN_RIGHT, Font.CR_GOLD);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue