(SBARINfO update)

- Added: fullscreenoffsets flag for status bars.  This changes the coordinate
  system to be relative to the top left corner of the screen.  This is useful
  for full screen status bars.
- Changed: drawinventorybar will use the width of artibox or invcurs (strife)
  to determine the spacing.  Let me know if this breaks any released mods.
- Fixed: If a status bar height of 0 was specified in SBarInfo the wrong bar
  would be shown.
- Fixed: If a static inventory bar was used the user still had to press invuse
  in order to get rid of the "overlay".
- Fixed: forcescaled would not work if the height of the bar was 0.
- Added: keyslot to drawswitchableimage.
- Fixed: The transition effects for the log and keys popups were switched.


SVN r1116 (trunk)
This commit is contained in:
Christoph Oelckers 2008-08-06 07:38:21 +00:00
parent 3700fda0e8
commit 3908c71510
6 changed files with 236 additions and 114 deletions

View file

@ -1,3 +1,17 @@
August 6, 2008 (SBARINfO update)
- Added: fullscreenoffsets flag for status bars. This changes the coordinate
system to be relative to the top left corner of the screen. This is useful
for full screen status bars.
- Changed: drawinventorybar will use the width of artibox or invcurs (strife)
to determine the spacing. Let me know if this breaks any released mods.
- Fixed: If a status bar height of 0 was specified in SBarInfo the wrong bar
would be shown.
- Fixed: If a static inventory bar was used the user still had to press invuse
in order to get rid of the "overlay".
- Fixed: forcescaled would not work if the height of the bar was 0.
- Added: keyslot to drawswitchableimage.
- Fixed: The transition effects for the log and keys popups were switched.
August 5, 2008 (Changes by Graf Zahl)
- Converted Strife's Crusader, Inquisitor and spectral missiles to
DECORATE.

View file

@ -262,7 +262,7 @@ public:
DBaseStatusBar (int reltop);
void Destroy ();
void SetScaled (bool scale);
void SetScaled (bool scale, bool force=false);
void AttachMessage (DHUDMessage *msg, uint32 id=0);
DHUDMessage *DetachMessage (DHUDMessage *msg);

View file

@ -85,6 +85,7 @@ struct SBarInfoBlock
{
TArray<SBarInfoCommand> commands;
bool forceScaled;
bool fullScreenOffsets;
int alpha;
SBarInfoBlock();
@ -135,7 +136,7 @@ struct SBarInfo
void ParseSBarInfo(int lump);
void ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block);
void ParseMugShotBlock(FScanner &sc, FMugShotState &state);
void getCoordinates(FScanner &sc, SBarInfoCommand &cmd); //retrieves the next two arguments as x and y.
void getCoordinates(FScanner &sc, SBarInfoCommand &cmd, bool fullScreenOffsets); //retrieves the next two arguments as x and y.
int getSignedInteger(FScanner &sc); //returns a signed integer.
int newImage(const char* patchname);
void Init();
@ -150,11 +151,6 @@ extern SBarInfo *SBarInfoScript;
// Enums used between the parser and the display
enum //statusbar flags
{
STATUSBARFLAG_FORCESCALED = 1,
};
enum //gametype flags
{
GAMETYPE_SINGLEPLAYER = 1,
@ -165,18 +161,19 @@ enum //gametype flags
enum //drawimage flags
{
DRAWIMAGE_PLAYERICON = 1,
DRAWIMAGE_AMMO1 = 2,
DRAWIMAGE_AMMO2 = 4,
DRAWIMAGE_INVENTORYICON = 8,
DRAWIMAGE_TRANSLATABLE = 16,
DRAWIMAGE_WEAPONSLOT = 32,
DRAWIMAGE_SWITCHABLE_AND = 64,
DRAWIMAGE_INVULNERABILITY = 128,
DRAWIMAGE_OFFSET_CENTER = 256,
DRAWIMAGE_ARMOR = 512,
DRAWIMAGE_WEAPONICON = 1024,
DRAWIMAGE_SIGIL = 2048,
DRAWIMAGE_PLAYERICON = 0x1,
DRAWIMAGE_AMMO1 = 0x2,
DRAWIMAGE_AMMO2 = 0x4,
DRAWIMAGE_INVENTORYICON = 0x8,
DRAWIMAGE_TRANSLATABLE = 0x10,
DRAWIMAGE_WEAPONSLOT = 0x20,
DRAWIMAGE_SWITCHABLE_AND = 0x40,
DRAWIMAGE_INVULNERABILITY = 0x80,
DRAWIMAGE_OFFSET_CENTER = 0x100,
DRAWIMAGE_ARMOR = 0x200,
DRAWIMAGE_WEAPONICON = 0x400,
DRAWIMAGE_SIGIL = 0x800,
DRAWIMAGE_KEYSLOT = 0x1000,
};
enum //drawnumber flags
@ -344,14 +341,14 @@ public:
void SetMugShotState(const char* stateName, bool waitTillDone=false, bool reset=false);
private:
void doCommands(SBarInfoBlock &block, int xOffset=0, int yOffset=0, int alpha=FRACUNIT);
void DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yOffset, int alpha, bool translate=false, bool dim=false, bool center=false);
void DrawString(const char* str, int x, int y, int xOffset, int yOffset, int alpha, EColorRange translation, int spacing=0);
void DrawNumber(int num, int len, int x, int y, int xOffset, int yOffset, int alpha, EColorRange translation, int spacing=0, bool fillzeros=false);
void DrawFace(const char *defaultFace, int accuracy, bool xdth, bool animatedgodmode, int x, int y, int xOffset, int yOffset, int alpha);
void DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, bool translate=false, bool dim=false, bool center=false);
void DrawString(const char* str, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing=0);
void DrawNumber(int num, int len, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing=0, bool fillzeros=false);
void DrawFace(const char *defaultFace, int accuracy, bool xdth, bool animatedgodmode, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets);
int updateState(bool xdth, bool animatedgodmode);
void DrawInventoryBar(int type, int num, int x, int y, int xOffset, int yOffset, int alpha, bool alwaysshow,
void DrawInventoryBar(int type, int num, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, bool alwaysshow,
int counterx, int countery, EColorRange translation, bool drawArtiboxes, bool noArrows, bool alwaysshowcounter);
void DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y, int xOffset, int yOffset, int alpha, int padleft, int padright, int chainsize,
void DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, int padleft, int padright, int chainsize,
bool wiggle, bool translate);
FRemapTable* getTranslation();

View file

@ -226,17 +226,28 @@ void DSBarInfo::Draw (EHudState state)
}
if(SBarInfoScript->huds[hud].forceScaled) //scale the statusbar
{
SetScaled(true);
SetScaled(true, true);
setsizeneeded = true;
}
doCommands(SBarInfoScript->huds[hud], 0, 0, SBarInfoScript->huds[hud].alpha);
if(CPlayer->inventorytics > 0 && !(level.flags & LEVEL_NOINVENTORYBAR))
{
if(state == HUD_StatusBar)
{
// No overlay? Lets cancel it.
if(SBarInfoScript->huds[STBAR_INVENTORY].commands.Size() == 0)
CPlayer->inventorytics = 0;
else
doCommands(SBarInfoScript->huds[STBAR_INVENTORY], 0, 0, SBarInfoScript->huds[STBAR_INVENTORY].alpha);
}
else if(state == HUD_Fullscreen)
{
if(SBarInfoScript->huds[STBAR_INVENTORYFULLSCREEN].commands.Size() == 0)
CPlayer->inventorytics = 0;
else
doCommands(SBarInfoScript->huds[STBAR_INVENTORYFULLSCREEN], 0, 0, SBarInfoScript->huds[STBAR_INVENTORYFULLSCREEN].alpha);
}
}
if(currentPopup != POP_None)
{
int popbar = 0;
@ -385,6 +396,12 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
{
case SBARINFO_DRAWSWITCHABLEIMAGE: //draw the alt image if we don't have the item else this is like a normal drawimage
{
// DrawSwitchable image allows 2 or 4 images to be supplied.
// drawAlt toggles these:
// 1 = first image
// 2 = second image
// 3 = thrid image
// 0 = last image
int drawAlt = 0;
if((cmd.flags & DRAWIMAGE_WEAPONSLOT)) //weaponslots
{
@ -410,6 +427,40 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
drawAlt = 1;
}
}
else if(cmd.flags & DRAWIMAGE_KEYSLOT)
{
bool found1 = false;
bool found2 = false;
drawAlt = 1;
for(AInventory *item = CPlayer->mo->Inventory;item != NULL;item = item->Inventory)
{
if(item->IsKindOf(RUNTIME_CLASS(AKey)))
{
int keynum = static_cast<AKey *>(item)->KeyNumber;
if(keynum == cmd.value)
found1 = true;
if(cmd.flags & DRAWIMAGE_SWITCHABLE_AND && keynum == cmd.special4) // two keys
found2 = true;
}
}
if(cmd.flags & DRAWIMAGE_SWITCHABLE_AND)
{
if(found1 && found2)
drawAlt = 0;
else if(found1)
drawAlt = 2;
else if(found2)
drawAlt = 3;
}
else
{
if(found1)
drawAlt = 0;
}
}
else //check the inventory items and draw selected sprite
{
AInventory* item = CPlayer->mo->FindInventory(PClass::FindClass(cmd.string[0]));
@ -435,11 +486,11 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
if(drawAlt != 0) //draw 'off' image
{
if(cmd.special != -1 && drawAlt == 1)
DrawGraphic(Images[cmd.special], cmd.x, cmd.y, xOffset, yOffset, alpha, !!(cmd.flags & DRAWIMAGE_TRANSLATABLE), false, !!(cmd.flags & DRAWIMAGE_OFFSET_CENTER));
DrawGraphic(Images[cmd.special], cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, !!(cmd.flags & DRAWIMAGE_TRANSLATABLE), false, !!(cmd.flags & DRAWIMAGE_OFFSET_CENTER));
else if(cmd.special2 != -1 && drawAlt == 2)
DrawGraphic(Images[cmd.special2], cmd.x, cmd.y, xOffset, yOffset, alpha, !!(cmd.flags & DRAWIMAGE_TRANSLATABLE), false, !!(cmd.flags & DRAWIMAGE_OFFSET_CENTER));
DrawGraphic(Images[cmd.special2], cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, !!(cmd.flags & DRAWIMAGE_TRANSLATABLE), false, !!(cmd.flags & DRAWIMAGE_OFFSET_CENTER));
else if(cmd.special3 != -1 && drawAlt == 3)
DrawGraphic(Images[cmd.special3], cmd.x, cmd.y, xOffset, yOffset, alpha, !!(cmd.flags & DRAWIMAGE_TRANSLATABLE), false, !!(cmd.flags & DRAWIMAGE_OFFSET_CENTER));
DrawGraphic(Images[cmd.special3], cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, !!(cmd.flags & DRAWIMAGE_TRANSLATABLE), false, !!(cmd.flags & DRAWIMAGE_OFFSET_CENTER));
break;
}
}
@ -482,7 +533,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
else if(cmd.image_index >= 0)
texture = Images[cmd.image_index];
DrawGraphic(texture, cmd.x, cmd.y, xOffset, yOffset, alpha, !!(cmd.flags & DRAWIMAGE_TRANSLATABLE), false, !!(cmd.flags & DRAWIMAGE_OFFSET_CENTER));
DrawGraphic(texture, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, !!(cmd.flags & DRAWIMAGE_TRANSLATABLE), false, !!(cmd.flags & DRAWIMAGE_OFFSET_CENTER));
break;
}
case SBARINFO_DRAWNUMBER:
@ -609,7 +660,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
translation = cmd.translation3;
if((cmd.flags & DRAWNUMBER_WHENNOTZERO) && value == 0)
break;
DrawNumber(value, cmd.special, cmd.x, cmd.y, xOffset, yOffset, alpha, translation, cmd.special2, fillzeros);
DrawNumber(value, cmd.special, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, translation, cmd.special2, fillzeros);
break;
}
case SBARINFO_DRAWMUGSHOT:
@ -620,7 +671,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
xdth = true;
if(cmd.flags & DRAWMUGSHOT_ANIMATEDGODMODE)
animatedgodmode = true;
DrawFace(cmd.string[0], cmd.special, xdth, animatedgodmode, cmd.x, cmd.y, xOffset, yOffset, alpha);
DrawFace(cmd.string[0], cmd.special, xdth, animatedgodmode, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets);
break;
}
case SBARINFO_DRAWSELECTEDINVENTORY:
@ -628,11 +679,11 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
{
if((cmd.flags & DRAWSELECTEDINVENTORY_ARTIFLASH) && artiflash)
{
DrawGraphic(Images[ARTIFLASH_OFFSET+(4-artiflash)], cmd.x, cmd.y, xOffset, yOffset, alpha, false, CPlayer->mo->InvSel->Amount <= 0);
DrawGraphic(Images[ARTIFLASH_OFFSET+(4-artiflash)], cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, false, CPlayer->mo->InvSel->Amount <= 0);
}
else
{
DrawGraphic(TexMan(CPlayer->mo->InvSel->Icon), cmd.x, cmd.y, xOffset, yOffset, alpha, false, CPlayer->mo->InvSel->Amount <= 0);
DrawGraphic(TexMan(CPlayer->mo->InvSel->Icon), cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, false, CPlayer->mo->InvSel->Amount <= 0);
}
if((cmd.flags & DRAWSELECTEDINVENTORY_ALWAYSSHOWCOUNTER) || CPlayer->mo->InvSel->Amount != 1)
{
@ -640,7 +691,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
{
drawingFont = cmd.font;
}
DrawNumber(CPlayer->mo->InvSel->Amount, 3, cmd.special2, cmd.special3, xOffset, yOffset, alpha, cmd.translation, cmd.special4);
DrawNumber(CPlayer->mo->InvSel->Amount, 3, cmd.special2, cmd.special3, xOffset, yOffset, alpha, block.fullScreenOffsets, cmd.translation, cmd.special4);
}
}
else if((cmd.flags & DRAWSELECTEDINVENTORY_ALTERNATEONEMPTY))
@ -666,7 +717,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
{
drawingFont = cmd.font;
}
DrawInventoryBar(cmd.special, cmd.value, cmd.x, cmd.y, xOffset, yOffset, alpha, alwaysshow, cmd.special2, cmd.special3, cmd.translation, artibox, noarrows, alwaysshowcounter);
DrawInventoryBar(cmd.special, cmd.value, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, alwaysshow, cmd.special2, cmd.special3, cmd.translation, artibox, noarrows, alwaysshowcounter);
break;
}
case SBARINFO_DRAWBAR:
@ -956,7 +1007,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
{
wiggle = !!(cmd.flags & DRAWGEM_WIGGLE);
}
DrawGem(Images[cmd.special], Images[cmd.image_index], value, cmd.x, cmd.y, xOffset, yOffset, alpha, cmd.special2, cmd.special3, cmd.special4+1, wiggle, translate);
DrawGem(Images[cmd.special], Images[cmd.image_index], value, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, cmd.special2, cmd.special3, cmd.special4+1, wiggle, translate);
break;
}
case SBARINFO_DRAWSHADER:
@ -983,7 +1034,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
{
drawingFont = cmd.font;
}
DrawString(cmd.string[0], cmd.x - drawingFont->StringWidth(cmd.string[0]), cmd.y, xOffset, yOffset, alpha, cmd.translation, cmd.special);
DrawString(cmd.string[0], cmd.x - drawingFont->StringWidth(cmd.string[0]), cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets, cmd.translation, cmd.special);
break;
case SBARINFO_DRAWKEYBAR:
{
@ -1000,9 +1051,9 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
goto FinishDrawKeyBar;
}
if(!vertical)
DrawGraphic(TexMan[item->Icon], cmd.x+(cmd.special*i), cmd.y, xOffset, yOffset, alpha);
DrawGraphic(TexMan[item->Icon], cmd.x+(cmd.special*i), cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets);
else
DrawGraphic(TexMan[item->Icon], cmd.x, cmd.y+(cmd.special*i), xOffset, yOffset, alpha);
DrawGraphic(TexMan[item->Icon], cmd.x, cmd.y+(cmd.special*i), xOffset, yOffset, alpha, block.fullScreenOffsets);
item = item->Inventory;
if(item == NULL)
break;
@ -1156,7 +1207,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
}
//draws an image with the specified flags
void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yOffset, int alpha,
void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets,
bool translate, bool dim, bool center) //flags
{
if (texture == NULL)
@ -1168,6 +1219,8 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
y -= (texture->GetHeight()/2)-texture->TopOffset;
}
if(!fullScreenOffsets)
{
// I'll handle the conversion from fixed to int myself for more control
fixed_t fx = (x + ST_X + xOffset) << FRACBITS;
fixed_t fy = (y + ST_Y + yOffset) << FRACBITS;
@ -1187,9 +1240,21 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_Alpha, alpha,
TAG_DONE);
}
else
{
screen->DrawTexture(texture, x, y,
DTA_DestWidth, texture->GetScaledWidth(),
DTA_DestHeight, texture->GetScaledHeight(),
DTA_Translation, translate ? getTranslation() : 0,
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_Alpha, alpha,
DTA_HUDRules, HUD_Normal,
TAG_DONE);
}
}
void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffset, int alpha, EColorRange translation, int spacing)
void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing)
{
x += spacing;
while(*str != '\0')
@ -1213,6 +1278,8 @@ void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffs
}
if(SBarInfoScript->spacingCharacter == '\0') //If we are monospaced lets use the offset
x += (character->LeftOffset+1); //ignore x offsets since we adapt to character size
if(!fullScreenOffsets)
{
int rx = x + ST_X + xOffset;
int ry = y + ST_Y + yOffset;
int rw = character->GetScaledWidth();
@ -1225,6 +1292,17 @@ void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffs
DTA_Translation, drawingFont->GetColorTranslation(translation),
DTA_Alpha, alpha,
TAG_DONE);
}
else
{
screen->DrawTexture(character, x, y,
DTA_DestWidth, character->GetScaledWidth(),
DTA_DestHeight, character->GetScaledHeight(),
DTA_Translation, drawingFont->GetColorTranslation(translation),
DTA_Alpha, alpha,
DTA_HUDRules, HUD_Normal,
TAG_DONE);
}
if(SBarInfoScript->spacingCharacter == '\0')
x += width + spacing - (character->LeftOffset+1);
else //width gets changed at the call to GetChar()
@ -1234,7 +1312,7 @@ void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffs
}
//draws the specified number up to len digits
void DSBarInfo::DrawNumber(int num, int len, int x, int y, int xOffset, int yOffset, int alpha, EColorRange translation, int spacing, bool fillzeros)
void DSBarInfo::DrawNumber(int num, int len, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing, bool fillzeros)
{
FString value;
int maxval = (int) ceil(pow(10., len))-1;
@ -1259,25 +1337,25 @@ void DSBarInfo::DrawNumber(int num, int len, int x, int y, int xOffset, int yOff
x -= int(drawingFont->StringWidth(value)+(spacing * value.Len()));
else //monospaced, so just multiplay the character size
x -= int((drawingFont->GetCharWidth((int) SBarInfoScript->spacingCharacter) + spacing) * value.Len());
DrawString(value, x, y, xOffset, yOffset, alpha, translation, spacing);
DrawString(value, x, y, xOffset, yOffset, alpha, fullScreenOffsets, translation, spacing);
}
//draws the mug shot
void DSBarInfo::DrawFace(const char *defaultFace, int accuracy, bool xdth, bool animatedgodmode, int x, int y, int xOffset, int yOffset, int alpha)
void DSBarInfo::DrawFace(const char *defaultFace, int accuracy, bool xdth, bool animatedgodmode, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets)
{
FTexture *face = MugShot.GetFace(CPlayer, defaultFace, accuracy, xdth, animatedgodmode);
if (face != NULL)
{
DrawGraphic(face, x, y, xOffset, yOffset, alpha);
DrawGraphic(face, x, y, xOffset, yOffset, alpha, fullScreenOffsets);
}
}
void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, int xOffset, int yOffset, int alpha, bool alwaysshow,
void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, bool alwaysshow,
int counterx, int countery, EColorRange translation, bool drawArtiboxes, bool noArrows, bool alwaysshowcounter)
{ //yes, there is some Copy & Paste here too
AInventory *item;
int i;
int spacing = (type != GAME_Strife) ? 31 : 35;
int spacing = (type != GAME_Strife) ? Images[invBarOffset + imgARTIBOX]->GetScaledWidth() + 1 : Images[invBarOffset + imgCURSOR]->GetScaledWidth() - 1;
// If the player has no artifacts, don't draw the bar
CPlayer->mo->InvFirst = ValidateInvFirst(num);
@ -1287,7 +1365,7 @@ void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, int xOffset, i
{
if(drawArtiboxes)
{
DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*spacing, y, xOffset, yOffset, alpha);
DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*spacing, y, xOffset, yOffset, alpha, fullScreenOffsets);
}
if(type != GAME_Strife) //Strife draws the cursor before the icons
DrawGraphic(TexMan(item->Icon), x+i*spacing, y, xOffset, yOffset, alpha, false, item->Amount <= 0);
@ -1295,49 +1373,49 @@ void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, int xOffset, i
{
if(type == GAME_Heretic)
{
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*31, y+29, xOffset, yOffset, alpha);
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*spacing, y+29, xOffset, yOffset, alpha, fullScreenOffsets);
}
else if(type == GAME_Hexen)
{
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*31, y-1, xOffset, yOffset, alpha);
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*spacing, y-1, xOffset, yOffset, alpha, fullScreenOffsets);
}
else if(type == GAME_Strife)
{
DrawGraphic(Images[invBarOffset + imgCURSOR], x+i*35-6, y-2, xOffset, yOffset, alpha);
DrawGraphic(Images[invBarOffset + imgCURSOR], x+i*spacing-6, y-2, xOffset, yOffset, alpha, fullScreenOffsets);
}
else
{
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*31, y, xOffset, yOffset, alpha);
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*spacing, y, xOffset, yOffset, alpha, fullScreenOffsets);
}
}
if(type == GAME_Strife)
DrawGraphic(TexMan(item->Icon), x+i*spacing, y, xOffset, yOffset, alpha, false, item->Amount <= 0);
DrawGraphic(TexMan(item->Icon), x+i*spacing, y, xOffset, yOffset, alpha, fullScreenOffsets, false, item->Amount <= 0);
if(alwaysshowcounter || item->Amount != 1)
{
DrawNumber(item->Amount, 3, counterx+i*spacing, countery, xOffset, yOffset, alpha, translation);
DrawNumber(item->Amount, 3, counterx+i*spacing, countery, xOffset, yOffset, alpha, fullScreenOffsets, translation);
}
}
for (; i < num && drawArtiboxes; ++i)
{
DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*spacing, y, xOffset, yOffset, alpha);
DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*spacing, y, xOffset, yOffset, alpha, fullScreenOffsets);
}
// Is there something to the left?
if (!noArrows && CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
{
DrawGraphic(Images[!(gametic & 4) ?
invBarOffset + imgINVLFGEM1 : invBarOffset + imgINVLFGEM2], (type != GAME_Strife) ? x-12 : x-14, y, xOffset, yOffset, alpha);
invBarOffset + imgINVLFGEM1 : invBarOffset + imgINVLFGEM2], (type != GAME_Strife) ? x-12 : x-14, y, xOffset, yOffset, alpha, fullScreenOffsets);
}
// Is there something to the right?
if (!noArrows && item != NULL)
{
DrawGraphic(Images[!(gametic & 4) ?
invBarOffset + imgINVRTGEM1 : invBarOffset + imgINVRTGEM2], (type != GAME_Strife) ? x+num*31+2 : x+num*35-4, y, xOffset, yOffset, alpha);
invBarOffset + imgINVRTGEM1 : invBarOffset + imgINVRTGEM2], (type != GAME_Strife) ? x+num*31+2 : x+num*35-4, y, xOffset, yOffset, alpha, fullScreenOffsets);
}
}
}
//draws heretic/hexen style life gems
void DSBarInfo::DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y, int xOffset, int yOffset, int alpha, int padleft, int padright, int chainsize,
void DSBarInfo::DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, int padleft, int padright, int chainsize,
bool wiggle, bool translate)
{
if(chain == NULL)
@ -1350,9 +1428,9 @@ void DSBarInfo::DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y,
y += chainWiggle;
int chainWidth = chain->GetWidth();
int offset = (int) (((double) (chainWidth-padleft-padright)/100)*value);
DrawGraphic(chain, x+(offset%chainsize), y, xOffset, yOffset, alpha);
DrawGraphic(chain, x+(offset%chainsize), y, xOffset, yOffset, alpha, fullScreenOffsets);
if(gem != NULL)
DrawGraphic(gem, x+padleft+offset, y, xOffset, yOffset, alpha, translate);
DrawGraphic(gem, x+padleft+offset, y, xOffset, yOffset, alpha, fullScreenOffsets, translate);
}
FRemapTable* DSBarInfo::getTranslation()

View file

@ -264,6 +264,10 @@ void SBarInfo::ParseSBarInfo(int lump)
{
this->huds[barNum].forceScaled = true;
}
else if(sc.Compare("fullscreenoffsets"))
{
this->huds[barNum].fullScreenOffsets = true;
}
else
{
sc.ScriptError("Unkown flag '%s'.", sc.String);
@ -318,9 +322,9 @@ void SBarInfo::ParseSBarInfo(int lump)
{
int pop = 0;
sc.MustGetToken(TK_Identifier);
if(sc.Compare("keys"))
if(sc.Compare("log"))
pop = 0;
else if(sc.Compare("log"))
else if(sc.Compare("keys"))
pop = 1;
else if(sc.Compare("status"))
pop = 2;
@ -385,6 +389,12 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
{
cmd.flags = DRAWIMAGE_INVULNERABILITY;
}
else if(sc.Compare("keyslot"))
{
cmd.flags = DRAWIMAGE_KEYSLOT;
sc.MustGetToken(TK_IntConst);
cmd.value = sc.Number;
}
else
{
cmd.setString(sc, sc.String, 0);
@ -397,6 +407,13 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
if(sc.CheckToken(TK_AndAnd))
{
cmd.flags |= DRAWIMAGE_SWITCHABLE_AND;
if(cmd.flags & DRAWIMAGE_KEYSLOT)
{
sc.MustGetToken(TK_IntConst);
cmd.special4 = sc.Number;
}
else
{
sc.MustGetToken(TK_Identifier);
cmd.setString(sc, sc.String, 1);
const PClass* item = PClass::FindClass(sc.String);
@ -404,6 +421,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
{
sc.ScriptError("'%s' is not a type of inventory item.", sc.String);
}
}
sc.MustGetToken(',');
sc.MustGetToken(TK_StringConst);
cmd.special = newImage(sc.String);
@ -465,7 +483,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
cmd.sprite_index.SetInvalid();
}
sc.MustGetToken(',');
this->getCoordinates(sc, cmd);
this->getCoordinates(sc, cmd, block.fullScreenOffsets);
if(sc.CheckToken(','))
{
sc.MustGetToken(TK_Identifier);
@ -594,7 +612,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
if(!sc.CheckToken('|'))
sc.MustGetToken(',');
}
this->getCoordinates(sc, cmd);
this->getCoordinates(sc, cmd, block.fullScreenOffsets);
if(sc.CheckToken(','))
{
bool needsComma = false;
@ -644,7 +662,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
if(!sc.CheckToken('|'))
sc.MustGetToken(',');
}
this->getCoordinates(sc, cmd);
this->getCoordinates(sc, cmd, block.fullScreenOffsets);
sc.MustGetToken(';');
break;
case SBARINFO_DRAWSELECTEDINVENTORY:
@ -706,6 +724,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
if(alternateonempty)
{
sc.MustGetToken('{');
cmd.subBlock.fullScreenOffsets = block.fullScreenOffsets;
this->ParseSBarInfoBlock(sc, cmd.subBlock);
}
else
@ -762,7 +781,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.ScriptError("Unknown font '%s'.", sc.String);
sc.MustGetToken(',');
this->getCoordinates(sc, cmd);
this->getCoordinates(sc, cmd, block.fullScreenOffsets);
cmd.special2 = cmd.x + 26;
cmd.special3 = cmd.y + 22;
cmd.translation = CR_GOLD;
@ -885,7 +904,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
if(!sc.CheckToken('|'))
sc.MustGetToken(',');
}
this->getCoordinates(sc, cmd);
this->getCoordinates(sc, cmd, block.fullScreenOffsets);
if(sc.CheckToken(',')) //border
{
sc.MustGetToken(TK_IntConst);
@ -925,7 +944,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.ScriptError("Chain size must be a positive number.");
cmd.special4 = sc.Number;
sc.MustGetToken(',');
this->getCoordinates(sc, cmd);
this->getCoordinates(sc, cmd, block.fullScreenOffsets);
sc.MustGetToken(';');
break;
case SBARINFO_DRAWSHADER:
@ -954,7 +973,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
cmd.flags |= DRAWSHADER_REVERSE;
sc.MustGetToken(',');
}
this->getCoordinates(sc, cmd);
this->getCoordinates(sc, cmd, block.fullScreenOffsets);
sc.MustGetToken(';');
break;
case SBARINFO_DRAWSTRING:
@ -969,7 +988,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.MustGetToken(TK_StringConst);
cmd.setString(sc, sc.String, 0, -1, false);
sc.MustGetToken(',');
this->getCoordinates(sc, cmd);
this->getCoordinates(sc, cmd, block.fullScreenOffsets);
if(sc.CheckToken(',')) //spacing
{
sc.MustGetToken(TK_IntConst);
@ -990,7 +1009,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.MustGetToken(TK_IntConst);
cmd.special = sc.Number;
sc.MustGetToken(',');
this->getCoordinates(sc, cmd);
this->getCoordinates(sc, cmd, block.fullScreenOffsets);
sc.MustGetToken(';');
break;
case SBARINFO_GAMEMODE:
@ -1010,6 +1029,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
break;
sc.MustGetToken(',');
}
cmd.subBlock.fullScreenOffsets = block.fullScreenOffsets;
this->ParseSBarInfoBlock(sc, cmd.subBlock);
break;
case SBARINFO_PLAYERCLASS:
@ -1038,6 +1058,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.MustGetToken(',');
}
FinishPlayerClass:
cmd.subBlock.fullScreenOffsets = block.fullScreenOffsets;
this->ParseSBarInfoBlock(sc, cmd.subBlock);
break;
case SBARINFO_ASPECTRATIO:
@ -1053,6 +1074,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
else
sc.ScriptError("Unkown aspect ratio: %s", sc.String);
sc.MustGetToken('{');
cmd.subBlock.fullScreenOffsets = block.fullScreenOffsets;
this->ParseSBarInfoBlock(sc, cmd.subBlock);
break;
case SBARINFO_ISSELECTED:
@ -1080,6 +1102,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
break;
}
sc.MustGetToken('{');
cmd.subBlock.fullScreenOffsets = block.fullScreenOffsets;
this->ParseSBarInfoBlock(sc, cmd.subBlock);
break;
case SBARINFO_USESSECONDARYAMMO:
@ -1091,6 +1114,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.ScriptError("Exspected 'not' got '%s' instead.", sc.String);
}
sc.MustGetToken('{');
cmd.subBlock.fullScreenOffsets = block.fullScreenOffsets;
this->ParseSBarInfoBlock(sc, cmd.subBlock);
break;
case SBARINFO_HASWEAPONPIECE:
@ -1106,6 +1130,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.ScriptError("Weapon piece number can not be less than 1.");
cmd.value = sc.Number;
sc.MustGetToken('{');
cmd.subBlock.fullScreenOffsets = block.fullScreenOffsets;
this->ParseSBarInfoBlock(sc, cmd.subBlock);
break;
}
@ -1138,6 +1163,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
break;
}
sc.MustGetToken('{');
cmd.subBlock.fullScreenOffsets = block.fullScreenOffsets;
this->ParseSBarInfoBlock(sc, cmd.subBlock);
break;
case SBARINFO_ININVENTORY:
@ -1169,6 +1195,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
break;
}
sc.MustGetToken('{');
cmd.subBlock.fullScreenOffsets = block.fullScreenOffsets;
this->ParseSBarInfoBlock(sc, cmd.subBlock);
break;
}
@ -1202,7 +1229,7 @@ void SBarInfo::ParseMugShotBlock(FScanner &sc, FMugShotState &state)
}
}
void SBarInfo::getCoordinates(FScanner &sc, SBarInfoCommand &cmd)
void SBarInfo::getCoordinates(FScanner &sc, SBarInfoCommand &cmd, bool fullScreenOffsets)
{
bool negative = false;
negative = sc.CheckToken('-');
@ -1211,7 +1238,10 @@ void SBarInfo::getCoordinates(FScanner &sc, SBarInfoCommand &cmd)
sc.MustGetToken(',');
negative = sc.CheckToken('-');
sc.MustGetToken(TK_IntConst);
if(!fullScreenOffsets)
cmd.y = (negative ? -sc.Number : sc.Number) - (200 - this->height);
else
cmd.y = negative ? -sc.Number : sc.Number;
}
int SBarInfo::getSignedInteger(FScanner &sc)
@ -1338,6 +1368,7 @@ SBarInfoCommand::~SBarInfoCommand()
SBarInfoBlock::SBarInfoBlock()
{
forceScaled = false;
fullScreenOffsets = false;
alpha = FRACUNIT;
}

View file

@ -188,9 +188,11 @@ void DBaseStatusBar::Destroy ()
//
//---------------------------------------------------------------------------
void DBaseStatusBar::SetScaled (bool scale)
//[BL] Added force argument to have forcescaled mean forcescaled.
void DBaseStatusBar::SetScaled (bool scale, bool force)
{
Scaled = RelTop != 0 && (SCREENWIDTH != 320 && scale);
Scaled = (RelTop != 0 || force) && (SCREENWIDTH != 320 && scale);
if (!Scaled)
{
ST_X = (SCREENWIDTH - 320) / 2;