mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- Added a HexenStrict DrawInventoryBar style due to some alignment errors I noticed with the Hexen style.
SVN r2352 (trunk)
This commit is contained in:
parent
b8cb1f0cfb
commit
d29123c511
1 changed files with 35 additions and 20 deletions
|
@ -1596,7 +1596,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CommandDrawInventoryBar(SBarInfo *script) : SBarInfoCommand(script),
|
CommandDrawInventoryBar(SBarInfo *script) : SBarInfoCommand(script),
|
||||||
style(GAME_Doom), size(7), alwaysShow(false), noArtibox(false),
|
style(STYLE_Doom), size(7), alwaysShow(false), noArtibox(false),
|
||||||
noArrows(false), alwaysShowCounter(false), translucent(false),
|
noArrows(false), alwaysShowCounter(false), translucent(false),
|
||||||
vertical(false), counters(NULL), font(NULL), translation(CR_GOLD),
|
vertical(false), counters(NULL), font(NULL), translation(CR_GOLD),
|
||||||
fontSpacing(0)
|
fontSpacing(0)
|
||||||
|
@ -1616,9 +1616,9 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
{
|
{
|
||||||
int spacing = 0;
|
int spacing = 0;
|
||||||
if(!vertical)
|
if(!vertical)
|
||||||
spacing = (style != GAME_Strife) ? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]->GetScaledWidth() + 1 : statusBar->Images[statusBar->invBarOffset + imgCURSOR]->GetScaledWidth() - 1;
|
spacing = (style != STYLE_Strife) ? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]->GetScaledWidth() + 1 : statusBar->Images[statusBar->invBarOffset + imgCURSOR]->GetScaledWidth() - 1;
|
||||||
else
|
else
|
||||||
spacing = (style != GAME_Strife) ? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]->GetScaledHeight() + 1 : statusBar->Images[statusBar->invBarOffset + imgCURSOR]->GetScaledHeight() - 1;
|
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)
|
||||||
|
@ -1637,20 +1637,22 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
if(!noArtibox)
|
if(!noArtibox)
|
||||||
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgARTIBOX], rx, ry, block->XOffset(), block->YOffset(), bgalpha, block->FullScreenOffsets());
|
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgARTIBOX], rx, ry, block->XOffset(), block->YOffset(), bgalpha, block->FullScreenOffsets());
|
||||||
|
|
||||||
if(style != GAME_Strife) //Strife draws the cursor before the icons
|
if(style != STYLE_Strife) //Strife draws the cursor before the icons
|
||||||
statusBar->DrawGraphic(TexMan(item->Icon), rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->Amount <= 0);
|
statusBar->DrawGraphic(TexMan(item->Icon), rx - (style == STYLE_HexenStrict ? 2 : 0), ry - (style == STYLE_HexenStrict ? 1 : 0), block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->Amount <= 0);
|
||||||
if(item == statusBar->CPlayer->mo->InvSel)
|
if(item == statusBar->CPlayer->mo->InvSel)
|
||||||
{
|
{
|
||||||
if(style == GAME_Heretic)
|
if(style == STYLE_Heretic)
|
||||||
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgSELECTBOX], rx, ry+29, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgSELECTBOX], rx, ry+29, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
||||||
else if(style == GAME_Hexen)
|
else if(style == STYLE_Hexen)
|
||||||
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgSELECTBOX], rx, ry-1, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgSELECTBOX], rx, ry-1, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
||||||
else if(style == GAME_Strife)
|
else if(style == STYLE_HexenStrict)
|
||||||
|
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgSELECTBOX], rx-1, ry-1, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
||||||
|
else if(style == STYLE_Strife)
|
||||||
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgCURSOR], rx-6, ry-2, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgCURSOR], rx-6, ry-2, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
||||||
else
|
else
|
||||||
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgSELECTBOX], rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgSELECTBOX], rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
||||||
}
|
}
|
||||||
if(style == GAME_Strife)
|
if(style == STYLE_Strife)
|
||||||
statusBar->DrawGraphic(TexMan(item->Icon), rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->Amount <= 0);
|
statusBar->DrawGraphic(TexMan(item->Icon), rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->Amount <= 0);
|
||||||
if(counters != NULL && (alwaysShowCounter || item->Amount != 1))
|
if(counters != NULL && (alwaysShowCounter || item->Amount != 1))
|
||||||
{
|
{
|
||||||
|
@ -1664,16 +1666,18 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
// Is there something to the left?
|
// Is there something to the left?
|
||||||
if (!noArrows && statusBar->CPlayer->mo->FirstInv() != statusBar->CPlayer->mo->InvFirst)
|
if (!noArrows && statusBar->CPlayer->mo->FirstInv() != statusBar->CPlayer->mo->InvFirst)
|
||||||
{
|
{
|
||||||
int offset = style != GAME_Strife ? -12 : 14;
|
int offset = (style != STYLE_Strife ? (style != STYLE_HexenStrict ? -12 : -10) : 14);
|
||||||
|
int yOffset = style != STYLE_HexenStrict ? 0 : -1;
|
||||||
statusBar->DrawGraphic(statusBar->Images[!(gametic & 4) ?
|
statusBar->DrawGraphic(statusBar->Images[!(gametic & 4) ?
|
||||||
statusBar->invBarOffset + imgINVLFGEM1 : statusBar->invBarOffset + imgINVLFGEM2], x + (!vertical ? offset : 0), y + (vertical ? offset : 0), block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
statusBar->invBarOffset + imgINVLFGEM1 : statusBar->invBarOffset + imgINVLFGEM2], x + (!vertical ? offset : yOffset), y + (vertical ? offset : yOffset), block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
||||||
}
|
}
|
||||||
// Is there something to the right?
|
// Is there something to the right?
|
||||||
if (!noArrows && item != NULL)
|
if (!noArrows && item != NULL)
|
||||||
{
|
{
|
||||||
int offset = style != GAME_Strife ? size*31+2 : size*35-4;
|
int offset = (style != STYLE_Strife ? (style != STYLE_HexenStrict ? size*31+2 : size*31) : size*35-4);
|
||||||
|
int yOffset = style != STYLE_HexenStrict ? 0 : -1;
|
||||||
statusBar->DrawGraphic(statusBar->Images[!(gametic & 4) ?
|
statusBar->DrawGraphic(statusBar->Images[!(gametic & 4) ?
|
||||||
statusBar->invBarOffset + imgINVRTGEM1 : statusBar->invBarOffset + imgINVRTGEM2], x + (!vertical ? offset : 0), y + (vertical ? offset : 0), block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
statusBar->invBarOffset + imgINVRTGEM1 : statusBar->invBarOffset + imgINVRTGEM2], x + (!vertical ? offset : yOffset), y + (vertical ? offset : yOffset), block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1681,13 +1685,15 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
{
|
{
|
||||||
sc.MustGetToken(TK_Identifier);
|
sc.MustGetToken(TK_Identifier);
|
||||||
if(sc.Compare("Doom"))
|
if(sc.Compare("Doom"))
|
||||||
style = GAME_Doom;
|
style = STYLE_Doom;
|
||||||
else if(sc.Compare("Heretic"))
|
else if(sc.Compare("Heretic"))
|
||||||
style = GAME_Heretic;
|
style = STYLE_Heretic;
|
||||||
else if(sc.Compare("Hexen"))
|
else if(sc.Compare("Hexen"))
|
||||||
style = GAME_Hexen;
|
style = STYLE_Hexen;
|
||||||
|
else if(sc.Compare("HexenStrict"))
|
||||||
|
style = STYLE_HexenStrict;
|
||||||
else if(sc.Compare("Strife"))
|
else if(sc.Compare("Strife"))
|
||||||
style = GAME_Strife;
|
style = STYLE_Strife;
|
||||||
else
|
else
|
||||||
sc.ScriptError("Unknown style '%s'.", sc.String);
|
sc.ScriptError("Unknown style '%s'.", sc.String);
|
||||||
|
|
||||||
|
@ -1745,9 +1751,9 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
{
|
{
|
||||||
int spacing = 0;
|
int spacing = 0;
|
||||||
if(!vertical)
|
if(!vertical)
|
||||||
spacing = (style != GAME_Strife) ? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]->GetScaledWidth() + 1 : statusBar->Images[statusBar->invBarOffset + imgCURSOR]->GetScaledWidth() - 1;
|
spacing = (style != STYLE_Strife) ? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]->GetScaledWidth() + 1 : statusBar->Images[statusBar->invBarOffset + imgCURSOR]->GetScaledWidth() - 1;
|
||||||
else
|
else
|
||||||
spacing = (style != GAME_Strife) ? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]->GetScaledHeight() + 1 : statusBar->Images[statusBar->invBarOffset + imgCURSOR]->GetScaledHeight() - 1;
|
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++)
|
||||||
|
@ -1769,7 +1775,16 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
||||||
counters[i]->Tick(block, statusBar, hudChanged);
|
counters[i]->Tick(block, statusBar, hudChanged);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
int style;
|
enum Styles
|
||||||
|
{
|
||||||
|
STYLE_Doom,
|
||||||
|
STYLE_Heretic,
|
||||||
|
STYLE_Hexen,
|
||||||
|
STYLE_HexenStrict,
|
||||||
|
STYLE_Strife
|
||||||
|
};
|
||||||
|
|
||||||
|
Styles style;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
bool alwaysShow;
|
bool alwaysShow;
|
||||||
bool noArtibox;
|
bool noArtibox;
|
||||||
|
|
Loading…
Reference in a new issue