mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 22:33:17 +00:00
- Fixed: Crash when using an inventory bar with the Strife style but no INVCURS graphic.
SVN r3931 (trunk)
This commit is contained in:
parent
b3f68527cf
commit
aab12c6b0c
1 changed files with 26 additions and 10 deletions
|
@ -1960,11 +1960,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
|
|
||||||
void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar)
|
void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar)
|
||||||
{
|
{
|
||||||
int spacing = 0;
|
int spacing = GetCounterSpacing(statusBar);
|
||||||
if(!vertical)
|
|
||||||
spacing = (style != STYLE_Strife) ? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]->GetScaledWidth() + 1 : statusBar->Images[statusBar->invBarOffset + imgCURSOR]->GetScaledWidth() - 1;
|
|
||||||
else
|
|
||||||
spacing = (style != STYLE_Strife) ? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]->GetScaledHeight() + 1 : statusBar->Images[statusBar->invBarOffset + imgCURSOR]->GetScaledHeight() - 1;
|
|
||||||
|
|
||||||
int bgalpha = block->Alpha();
|
int bgalpha = block->Alpha();
|
||||||
if(translucent)
|
if(translucent)
|
||||||
|
@ -2107,16 +2103,36 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
}
|
}
|
||||||
sc.MustGetToken(';');
|
sc.MustGetToken(';');
|
||||||
}
|
}
|
||||||
|
int GetCounterSpacing(const DSBarInfo *statusBar) const
|
||||||
|
{
|
||||||
|
FTexture *box = (style != STYLE_Strife)
|
||||||
|
? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]
|
||||||
|
: statusBar->Images[statusBar->invBarOffset + imgCURSOR];
|
||||||
|
if (box == NULL)
|
||||||
|
{ // Don't crash without a graphic.
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int spacing;
|
||||||
|
if (!vertical)
|
||||||
|
{
|
||||||
|
spacing = box->GetScaledWidth();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spacing = box->GetScaledHeight();
|
||||||
|
}
|
||||||
|
return spacing + ((style != STYLE_Strife) ? 1 : -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged)
|
void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged)
|
||||||
{
|
{
|
||||||
// Make the counters if need be.
|
// Make the counters if need be.
|
||||||
if(counters == NULL)
|
if(counters == NULL)
|
||||||
{
|
{
|
||||||
int spacing = 0;
|
int spacing = GetCounterSpacing(statusBar);
|
||||||
if(!vertical)
|
|
||||||
spacing = (style != STYLE_Strife) ? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]->GetScaledWidth() + 1 : statusBar->Images[statusBar->invBarOffset + imgCURSOR]->GetScaledWidth() - 1;
|
|
||||||
else
|
|
||||||
spacing = (style != STYLE_Strife) ? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]->GetScaledHeight() + 1 : statusBar->Images[statusBar->invBarOffset + imgCURSOR]->GetScaledHeight() - 1;
|
|
||||||
counters = new CommandDrawNumber*[size];
|
counters = new CommandDrawNumber*[size];
|
||||||
|
|
||||||
for(unsigned int i = 0;i < size;i++)
|
for(unsigned int i = 0;i < size;i++)
|
||||||
|
|
Loading…
Reference in a new issue