mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-01 00:21:43 +00:00
- Applied vertical SBARINFO inventory bar patch.
SVN r1809 (trunk)
This commit is contained in:
parent
465d52b766
commit
17a43e7753
4 changed files with 35 additions and 17 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
September 7, 2009
|
||||||
|
- Applied vertical SBARINFO inventory bar patch.
|
||||||
|
|
||||||
September 7, 2009 (Changes by Graf Zahl)
|
September 7, 2009 (Changes by Graf Zahl)
|
||||||
- moved definition of games' default armor icons into gameinfo definition.
|
- moved definition of games' default armor icons into gameinfo definition.
|
||||||
- fixed: The PNG loader for true color textures overwrote the IDAT size with
|
- fixed: The PNG loader for true color textures overwrote the IDAT size with
|
||||||
|
|
|
@ -270,6 +270,7 @@ enum //drawinventorybar flags
|
||||||
DRAWINVENTORYBAR_NOARROWS = 0x4,
|
DRAWINVENTORYBAR_NOARROWS = 0x4,
|
||||||
DRAWINVENTORYBAR_ALWAYSSHOWCOUNTER = 0x8,
|
DRAWINVENTORYBAR_ALWAYSSHOWCOUNTER = 0x8,
|
||||||
DRAWINVENTORYBAR_TRANSLUCENT = 0x10,
|
DRAWINVENTORYBAR_TRANSLUCENT = 0x10,
|
||||||
|
DRAWINVENTORYBAR_VERTICAL = 0x20,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum //drawgem flags
|
enum //drawgem flags
|
||||||
|
@ -404,7 +405,7 @@ private:
|
||||||
void DrawFace(const char *defaultFace, int accuracy, int stateflags, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets);
|
void DrawFace(const char *defaultFace, int accuracy, int stateflags, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets);
|
||||||
int updateState(bool xdth, bool animatedgodmode);
|
int updateState(bool xdth, bool animatedgodmode);
|
||||||
void DrawInventoryBar(int type, int num, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, bool alwaysshow,
|
void DrawInventoryBar(int type, int num, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, bool alwaysshow,
|
||||||
SBarInfoCoordinate counterx, SBarInfoCoordinate countery, EColorRange translation, bool drawArtiboxes, bool noArrows, bool alwaysshowcounter, int bgalpha);
|
SBarInfoCoordinate counterx, SBarInfoCoordinate countery, EColorRange translation, bool drawArtiboxes, bool noArrows, bool alwaysshowcounter, int bgalpha, bool vertical);
|
||||||
void DrawGem(FTexture* chain, FTexture* gem, int value, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, int padleft, int padright, int chainsize,
|
void DrawGem(FTexture* chain, FTexture* gem, int value, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, int padleft, int padright, int chainsize,
|
||||||
bool wiggle, bool translate);
|
bool wiggle, bool translate);
|
||||||
FRemapTable* getTranslation();
|
FRemapTable* getTranslation();
|
||||||
|
|
|
@ -765,6 +765,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
|
||||||
bool artibox = true;
|
bool artibox = true;
|
||||||
bool noarrows = false;
|
bool noarrows = false;
|
||||||
bool alwaysshowcounter = false;
|
bool alwaysshowcounter = false;
|
||||||
|
bool vertical = false;
|
||||||
int bgalpha = alpha;
|
int bgalpha = alpha;
|
||||||
if((cmd.flags & DRAWINVENTORYBAR_ALWAYSSHOW))
|
if((cmd.flags & DRAWINVENTORYBAR_ALWAYSSHOW))
|
||||||
alwaysshow = true;
|
alwaysshow = true;
|
||||||
|
@ -776,11 +777,13 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
|
||||||
alwaysshowcounter = true;
|
alwaysshowcounter = true;
|
||||||
if(cmd.flags & DRAWINVENTORYBAR_TRANSLUCENT)
|
if(cmd.flags & DRAWINVENTORYBAR_TRANSLUCENT)
|
||||||
bgalpha = fixed_t((((double) alpha / (double) FRACUNIT) * ((double) HX_SHADOW / (double) FRACUNIT)) * FRACUNIT);
|
bgalpha = fixed_t((((double) alpha / (double) FRACUNIT) * ((double) HX_SHADOW / (double) FRACUNIT)) * FRACUNIT);
|
||||||
|
if((cmd.flags & DRAWINVENTORYBAR_VERTICAL))
|
||||||
|
vertical = true;
|
||||||
if(drawingFont != cmd.font)
|
if(drawingFont != cmd.font)
|
||||||
{
|
{
|
||||||
drawingFont = cmd.font;
|
drawingFont = cmd.font;
|
||||||
}
|
}
|
||||||
DrawInventoryBar(cmd.special, cmd.value, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, alwaysshow, cmd.sbcoord2, cmd.sbcoord3, cmd.translation, artibox, noarrows, alwaysshowcounter, bgalpha);
|
DrawInventoryBar(cmd.special, cmd.value, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, alwaysshow, cmd.sbcoord2, cmd.sbcoord3, cmd.translation, artibox, noarrows, alwaysshowcounter, bgalpha, vertical);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SBARINFO_DRAWBAR:
|
case SBARINFO_DRAWBAR:
|
||||||
|
@ -1650,11 +1653,15 @@ void DSBarInfo::DrawFace(const char *defaultFace, int accuracy, int stateflags,
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSBarInfo::DrawInventoryBar(int type, int num, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, bool alwaysshow,
|
void DSBarInfo::DrawInventoryBar(int type, int num, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, bool alwaysshow,
|
||||||
SBarInfoCoordinate counterx, SBarInfoCoordinate countery, EColorRange translation, bool drawArtiboxes, bool noArrows, bool alwaysshowcounter, int bgalpha)
|
SBarInfoCoordinate counterx, SBarInfoCoordinate countery, EColorRange translation, bool drawArtiboxes, bool noArrows, bool alwaysshowcounter, int bgalpha, bool vertical)
|
||||||
{ //yes, there is some Copy & Paste here too
|
{ //yes, there is some Copy & Paste here too
|
||||||
AInventory *item;
|
AInventory *item;
|
||||||
int i;
|
int i;
|
||||||
int spacing = (type != GAME_Strife) ? Images[invBarOffset + imgARTIBOX]->GetScaledWidth() + 1 : Images[invBarOffset + imgCURSOR]->GetScaledWidth() - 1;
|
int spacing = 0;
|
||||||
|
if(!vertical)
|
||||||
|
spacing = (type != GAME_Strife) ? Images[invBarOffset + imgARTIBOX]->GetScaledWidth() + 1 : Images[invBarOffset + imgCURSOR]->GetScaledWidth() - 1;
|
||||||
|
else
|
||||||
|
spacing = (type != GAME_Strife) ? Images[invBarOffset + imgARTIBOX]->GetScaledHeight() + 1 : Images[invBarOffset + imgCURSOR]->GetScaledHeight() - 1;
|
||||||
|
|
||||||
// If the player has no artifacts, don't draw the bar
|
// If the player has no artifacts, don't draw the bar
|
||||||
CPlayer->mo->InvFirst = ValidateInvFirst(num);
|
CPlayer->mo->InvFirst = ValidateInvFirst(num);
|
||||||
|
@ -1662,54 +1669,57 @@ void DSBarInfo::DrawInventoryBar(int type, int num, SBarInfoCoordinate x, SBarIn
|
||||||
{
|
{
|
||||||
for(item = CPlayer->mo->InvFirst, i = 0; item != NULL && i < num; item = item->NextInv(), ++i)
|
for(item = CPlayer->mo->InvFirst, i = 0; item != NULL && i < num; item = item->NextInv(), ++i)
|
||||||
{
|
{
|
||||||
SBarInfoCoordinate rx = x + i*spacing;
|
SBarInfoCoordinate rx = x + (!vertical ? i*spacing : 0);
|
||||||
|
SBarInfoCoordinate ry = y + (vertical ? i*spacing : 0);
|
||||||
if(drawArtiboxes)
|
if(drawArtiboxes)
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[invBarOffset + imgARTIBOX], rx, y, xOffset, yOffset, bgalpha, fullScreenOffsets);
|
DrawGraphic(Images[invBarOffset + imgARTIBOX], rx, ry, xOffset, yOffset, bgalpha, fullScreenOffsets);
|
||||||
}
|
}
|
||||||
if(type != GAME_Strife) //Strife draws the cursor before the icons
|
if(type != GAME_Strife) //Strife draws the cursor before the icons
|
||||||
DrawGraphic(TexMan(item->Icon), rx, y, xOffset, yOffset, alpha, fullScreenOffsets, false, item->Amount <= 0);
|
DrawGraphic(TexMan(item->Icon), rx, ry, xOffset, yOffset, alpha, fullScreenOffsets, false, item->Amount <= 0);
|
||||||
if(item == CPlayer->mo->InvSel)
|
if(item == CPlayer->mo->InvSel)
|
||||||
{
|
{
|
||||||
if(type == GAME_Heretic)
|
if(type == GAME_Heretic)
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[invBarOffset + imgSELECTBOX], rx, y+29, xOffset, yOffset, alpha, fullScreenOffsets);
|
DrawGraphic(Images[invBarOffset + imgSELECTBOX], rx, ry+29, xOffset, yOffset, alpha, fullScreenOffsets);
|
||||||
}
|
}
|
||||||
else if(type == GAME_Hexen)
|
else if(type == GAME_Hexen)
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[invBarOffset + imgSELECTBOX], rx, y-1, xOffset, yOffset, alpha, fullScreenOffsets);
|
DrawGraphic(Images[invBarOffset + imgSELECTBOX], rx, ry-1, xOffset, yOffset, alpha, fullScreenOffsets);
|
||||||
}
|
}
|
||||||
else if(type == GAME_Strife)
|
else if(type == GAME_Strife)
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[invBarOffset + imgCURSOR], rx-6, y-2, xOffset, yOffset, alpha, fullScreenOffsets);
|
DrawGraphic(Images[invBarOffset + imgCURSOR], rx-6, ry-2, xOffset, yOffset, alpha, fullScreenOffsets);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[invBarOffset + imgSELECTBOX], rx, y, xOffset, yOffset, alpha, fullScreenOffsets);
|
DrawGraphic(Images[invBarOffset + imgSELECTBOX], rx, ry, xOffset, yOffset, alpha, fullScreenOffsets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(type == GAME_Strife)
|
if(type == GAME_Strife)
|
||||||
DrawGraphic(TexMan(item->Icon), rx, y, xOffset, yOffset, alpha, fullScreenOffsets, false, item->Amount <= 0);
|
DrawGraphic(TexMan(item->Icon), rx, ry, xOffset, yOffset, alpha, fullScreenOffsets, false, item->Amount <= 0);
|
||||||
if(alwaysshowcounter || item->Amount != 1)
|
if(alwaysshowcounter || item->Amount != 1)
|
||||||
{
|
{
|
||||||
DrawNumber(item->Amount, 3, counterx + (i*spacing), countery, xOffset, yOffset, alpha, fullScreenOffsets, translation);
|
DrawNumber(item->Amount, 3, counterx+(!vertical ? i*spacing : 0), countery+(vertical ? i*spacing : 0), xOffset, yOffset, alpha, fullScreenOffsets, translation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (; i < num && drawArtiboxes; ++i)
|
for (; i < num && drawArtiboxes; ++i)
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[invBarOffset + imgARTIBOX], x + (i*spacing), y, xOffset, yOffset, bgalpha, fullScreenOffsets);
|
DrawGraphic(Images[invBarOffset + imgARTIBOX], x + (!vertical ? (i*spacing) : 0), y + (vertical ? (i*spacing) : 0), xOffset, yOffset, bgalpha, fullScreenOffsets);
|
||||||
}
|
}
|
||||||
// Is there something to the left?
|
// Is there something to the left?
|
||||||
if (!noArrows && CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
|
if (!noArrows && CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
|
||||||
{
|
{
|
||||||
|
int offset = type != GAME_Strife ? -12 : 14;
|
||||||
DrawGraphic(Images[!(gametic & 4) ?
|
DrawGraphic(Images[!(gametic & 4) ?
|
||||||
invBarOffset + imgINVLFGEM1 : invBarOffset + imgINVLFGEM2], x + ((type != GAME_Strife) ? -12 : -14), y, xOffset, yOffset, alpha, fullScreenOffsets);
|
invBarOffset + imgINVLFGEM1 : invBarOffset + imgINVLFGEM2], x + (!vertical ? offset : 0), y + (vertical ? offset : 0), xOffset, yOffset, alpha, fullScreenOffsets);
|
||||||
}
|
}
|
||||||
// Is there something to the right?
|
// Is there something to the right?
|
||||||
if (!noArrows && item != NULL)
|
if (!noArrows && item != NULL)
|
||||||
{
|
{
|
||||||
|
int offset = type != GAME_Strife ? num*31+2 : num*35-4;
|
||||||
DrawGraphic(Images[!(gametic & 4) ?
|
DrawGraphic(Images[!(gametic & 4) ?
|
||||||
invBarOffset + imgINVRTGEM1 : invBarOffset + imgINVRTGEM2], x + ((type != GAME_Strife) ? num*31+2 : num*35-4), y, xOffset, yOffset, alpha, fullScreenOffsets);
|
invBarOffset + imgINVRTGEM1 : invBarOffset + imgINVRTGEM2], x + (!vertical ? offset : 0), y + (vertical ? offset : 0), xOffset, yOffset, alpha, fullScreenOffsets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -805,7 +805,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
|
||||||
else if(sc.Compare("Strife"))
|
else if(sc.Compare("Strife"))
|
||||||
cmd.special = GAME_Strife;
|
cmd.special = GAME_Strife;
|
||||||
else
|
else
|
||||||
sc.ScriptError("Unkown style '%s'.", sc.String);
|
sc.ScriptError("Unknown style '%s'.", sc.String);
|
||||||
|
|
||||||
sc.MustGetToken(',');
|
sc.MustGetToken(',');
|
||||||
while(sc.CheckToken(TK_Identifier))
|
while(sc.CheckToken(TK_Identifier))
|
||||||
|
@ -830,6 +830,10 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
|
||||||
{
|
{
|
||||||
cmd.flags |= DRAWINVENTORYBAR_TRANSLUCENT;
|
cmd.flags |= DRAWINVENTORYBAR_TRANSLUCENT;
|
||||||
}
|
}
|
||||||
|
else if(sc.Compare("vertical"))
|
||||||
|
{
|
||||||
|
cmd.flags |= DRAWINVENTORYBAR_VERTICAL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sc.ScriptError("Unknown flag '%s'.", sc.String);
|
sc.ScriptError("Unknown flag '%s'.", sc.String);
|
||||||
|
|
Loading…
Reference in a new issue