mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 07:57:58 +00:00
- Fixed: Auxilery statusbars didn't respect the forcescaled flag.
SVN r3699 (trunk)
This commit is contained in:
parent
67e4d93395
commit
d652acb9e4
1 changed files with 60 additions and 7 deletions
|
@ -299,6 +299,8 @@ class SBarInfoMainBlock : public SBarInfoCommandFlowControl
|
||||||
}
|
}
|
||||||
|
|
||||||
int Alpha() const { return currentAlpha; }
|
int Alpha() const { return currentAlpha; }
|
||||||
|
// Same as Draw but takes into account ForceScaled and temporarily sets the scaling if needed.
|
||||||
|
void DrawAux(const SBarInfoMainBlock *block, DSBarInfo *statusBar, int xOffset, int yOffset, int alpha);
|
||||||
void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, int xOffset, int yOffset, int alpha)
|
void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, int xOffset, int yOffset, int alpha)
|
||||||
{
|
{
|
||||||
this->xOffset = xOffset;
|
this->xOffset = xOffset;
|
||||||
|
@ -953,7 +955,7 @@ public:
|
||||||
DSBarInfo (SBarInfo *script=NULL) : DBaseStatusBar(script->height, script->resW, script->resH),
|
DSBarInfo (SBarInfo *script=NULL) : DBaseStatusBar(script->height, script->resW, script->resH),
|
||||||
ammo1(NULL), ammo2(NULL), ammocount1(0), ammocount2(0), armor(NULL),
|
ammo1(NULL), ammo2(NULL), ammocount1(0), ammocount2(0), armor(NULL),
|
||||||
pendingPopup(POP_None), currentPopup(POP_None), lastHud(-1),
|
pendingPopup(POP_None), currentPopup(POP_None), lastHud(-1),
|
||||||
lastInventoryBar(NULL), lastPopup(NULL)
|
scalingWasForced(false), lastInventoryBar(NULL), lastPopup(NULL)
|
||||||
{
|
{
|
||||||
this->script = script;
|
this->script = script;
|
||||||
|
|
||||||
|
@ -1016,24 +1018,39 @@ public:
|
||||||
bool oldhud_scale = hud_scale;
|
bool oldhud_scale = hud_scale;
|
||||||
if(script->huds[hud]->ForceScaled()) //scale the statusbar
|
if(script->huds[hud]->ForceScaled()) //scale the statusbar
|
||||||
{
|
{
|
||||||
SetScaled(true, true);
|
|
||||||
setsizeneeded = true;
|
|
||||||
if(script->huds[hud]->FullScreenOffsets())
|
if(script->huds[hud]->FullScreenOffsets())
|
||||||
hud_scale = true;
|
hud_scale = true;
|
||||||
|
else if(!Scaled)
|
||||||
|
{
|
||||||
|
scalingWasForced = true;
|
||||||
|
SetScaled(true, true);
|
||||||
|
setsizeneeded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//prepare ammo counts
|
//prepare ammo counts
|
||||||
GetCurrentAmmo(ammo1, ammo2, ammocount1, ammocount2);
|
GetCurrentAmmo(ammo1, ammo2, ammocount1, ammocount2);
|
||||||
armor = CPlayer->mo->FindInventory<ABasicArmor>();
|
armor = CPlayer->mo->FindInventory<ABasicArmor>();
|
||||||
if(hud != lastHud)
|
if(hud != lastHud)
|
||||||
|
{
|
||||||
script->huds[hud]->Tick(NULL, this, true);
|
script->huds[hud]->Tick(NULL, this, true);
|
||||||
|
|
||||||
|
// Restore scaling if need be.
|
||||||
|
if(scalingWasForced)
|
||||||
|
{
|
||||||
|
scalingWasForced = false;
|
||||||
|
SetScaled(false);
|
||||||
|
setsizeneeded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(currentPopup != POP_None && !script->huds[hud]->FullScreenOffsets())
|
if(currentPopup != POP_None && !script->huds[hud]->FullScreenOffsets())
|
||||||
script->huds[hud]->Draw(NULL, this, script->popups[currentPopup-1].getXDisplacement(), script->popups[currentPopup-1].getYDisplacement(), FRACUNIT);
|
script->huds[hud]->Draw(NULL, this, script->popups[currentPopup-1].getXDisplacement(), script->popups[currentPopup-1].getYDisplacement(), FRACUNIT);
|
||||||
else
|
else
|
||||||
script->huds[hud]->Draw(NULL, this, 0, 0, FRACUNIT);
|
script->huds[hud]->Draw(NULL, this, 0, 0, FRACUNIT);
|
||||||
lastHud = hud;
|
lastHud = hud;
|
||||||
|
|
||||||
|
// Handle inventory bar drawing
|
||||||
if(CPlayer->inventorytics > 0 && !(level.flags & LEVEL_NOINVENTORYBAR) && (state == HUD_StatusBar || state == HUD_Fullscreen))
|
if(CPlayer->inventorytics > 0 && !(level.flags & LEVEL_NOINVENTORYBAR) && (state == HUD_StatusBar || state == HUD_Fullscreen))
|
||||||
{
|
{
|
||||||
SBarInfoMainBlock *inventoryBar = state == HUD_StatusBar ? script->huds[STBAR_INVENTORY] : script->huds[STBAR_INVENTORYFULLSCREEN];
|
SBarInfoMainBlock *inventoryBar = state == HUD_StatusBar ? script->huds[STBAR_INVENTORY] : script->huds[STBAR_INVENTORYFULLSCREEN];
|
||||||
|
@ -1044,8 +1061,10 @@ public:
|
||||||
if(inventoryBar->NumCommands() == 0)
|
if(inventoryBar->NumCommands() == 0)
|
||||||
CPlayer->inventorytics = 0;
|
CPlayer->inventorytics = 0;
|
||||||
else
|
else
|
||||||
inventoryBar->Draw(NULL, this, 0, 0, FRACUNIT);
|
inventoryBar->DrawAux(NULL, this, 0, 0, FRACUNIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle popups
|
||||||
if(currentPopup != POP_None)
|
if(currentPopup != POP_None)
|
||||||
{
|
{
|
||||||
int popbar = 0;
|
int popbar = 0;
|
||||||
|
@ -1061,12 +1080,13 @@ public:
|
||||||
lastPopup->Tick(NULL, this, true);
|
lastPopup->Tick(NULL, this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
script->huds[popbar]->Draw(NULL, this, script->popups[currentPopup-1].getXOffset(), script->popups[currentPopup-1].getYOffset(), script->popups[currentPopup-1].getAlpha());
|
script->huds[popbar]->DrawAux(NULL, this, script->popups[currentPopup-1].getXOffset(), script->popups[currentPopup-1].getYOffset(), script->popups[currentPopup-1].getAlpha());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lastPopup = NULL;
|
lastPopup = NULL;
|
||||||
if(script->huds[hud]->ForceScaled() && script->huds[hud]->FullScreenOffsets())
|
|
||||||
hud_scale = oldhud_scale;
|
// Reset hud_scale
|
||||||
|
hud_scale = oldhud_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewGame ()
|
void NewGame ()
|
||||||
|
@ -1485,6 +1505,7 @@ private:
|
||||||
int pendingPopup;
|
int pendingPopup;
|
||||||
int currentPopup;
|
int currentPopup;
|
||||||
int lastHud;
|
int lastHud;
|
||||||
|
bool scalingWasForced;
|
||||||
SBarInfoMainBlock *lastInventoryBar;
|
SBarInfoMainBlock *lastInventoryBar;
|
||||||
SBarInfoMainBlock *lastPopup;
|
SBarInfoMainBlock *lastPopup;
|
||||||
};
|
};
|
||||||
|
@ -1502,4 +1523,36 @@ DBaseStatusBar *CreateCustomStatusBar (int script)
|
||||||
return new DSBarInfo(SBarInfoScript[script]);
|
return new DSBarInfo(SBarInfoScript[script]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SBarInfoMainBlock::DrawAux(const SBarInfoMainBlock *block, DSBarInfo *statusBar, int xOffset, int yOffset, int alpha)
|
||||||
|
{
|
||||||
|
// Popups can also be forced to scale
|
||||||
|
bool rescale = false;
|
||||||
|
if(ForceScaled())
|
||||||
|
{
|
||||||
|
if(FullScreenOffsets())
|
||||||
|
{
|
||||||
|
if(!hud_scale)
|
||||||
|
{
|
||||||
|
rescale = true;
|
||||||
|
hud_scale = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!statusBar->Scaled)
|
||||||
|
{
|
||||||
|
rescale = true;
|
||||||
|
statusBar->SetScaled(true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw(block, statusBar, xOffset, yOffset, alpha);
|
||||||
|
|
||||||
|
if(rescale)
|
||||||
|
{
|
||||||
|
if(FullScreenOffsets())
|
||||||
|
hud_scale = false;
|
||||||
|
else
|
||||||
|
statusBar->SetScaled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "sbarinfo_commands.cpp"
|
#include "sbarinfo_commands.cpp"
|
||||||
|
|
Loading…
Reference in a new issue