- Fixed: DrawSelectedInventory set the wrong variable and thus always used CR_GOLD as its translation.

- Fixed: Draw(Switchable)Image didn't handle the alpha value properly.

SVN r2116 (trunk)
This commit is contained in:
Christoph Oelckers 2010-01-18 19:38:36 +00:00
parent a3ac7ee081
commit 7183a2f751

View file

@ -55,7 +55,12 @@ class CommandDrawImage : public SBarInfoCommand
if(texture == NULL) if(texture == NULL)
return; return;
statusBar->DrawGraphic(texture, imgx, imgy, block->XOffset(), block->YOffset(), alpha, block->FullScreenOffsets(), // We must calculate this per frame in order to prevent glitches with cl_capfps true.
fixed_t frameAlpha = block->Alpha();
if(alpha != FRACUNIT)
frameAlpha = fixed_t(((double) block->Alpha() / (double) FRACUNIT) * ((double) alpha / (double) OPAQUE) * FRACUNIT);
statusBar->DrawGraphic(texture, imgx, imgy, block->XOffset(), block->YOffset(), frameAlpha, block->FullScreenOffsets(),
translatable, false, offset); translatable, false, offset);
} }
void Parse(FScanner &sc, bool fullScreenOffsets) void Parse(FScanner &sc, bool fullScreenOffsets)
@ -132,7 +137,7 @@ class CommandDrawImage : public SBarInfoCommand
void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged) void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged)
{ {
texture = NULL; texture = NULL;
alpha = block->Alpha(); alpha = FRACUNIT;
if(type == PLAYERICON) if(type == PLAYERICON)
texture = TexMan[statusBar->CPlayer->mo->ScoreIcon]; texture = TexMan[statusBar->CPlayer->mo->ScoreIcon];
else if(type == AMMO1) else if(type == AMMO1)
@ -474,6 +479,10 @@ class CommandDrawSwitchableImage : public CommandDrawImage
if(drawAlt != 0) //draw 'off' image if(drawAlt != 0) //draw 'off' image
{ {
texture = statusBar->Images[conditionalImage[drawAlt-1]]; texture = statusBar->Images[conditionalImage[drawAlt-1]];
// Since we're not going to call our parent's tick() method,
// be sure to set the alpha value properly.
alpha = FRACUNIT;
return; return;
} }
CommandDrawImage::Tick(block, statusBar, hudChanged); CommandDrawImage::Tick(block, statusBar, hudChanged);
@ -1061,13 +1070,13 @@ class CommandDrawSelectedInventory : public SBarInfoCommandFlowControl, private
CommandDrawImage::GetCoordinates(sc, fullScreenOffsets, imgx, imgy); CommandDrawImage::GetCoordinates(sc, fullScreenOffsets, imgx, imgy);
startX = imgx + 30; startX = imgx + 30;
y = imgy + 24; y = imgy + 24;
translation = CR_GOLD; normalTranslation = CR_GOLD;
if(sc.CheckToken(',')) //more font information if(sc.CheckToken(',')) //more font information
{ {
CommandDrawNumber::GetCoordinates(sc, fullScreenOffsets, startX, y); CommandDrawNumber::GetCoordinates(sc, fullScreenOffsets, startX, y);
if(sc.CheckToken(',')) if(sc.CheckToken(','))
{ {
translation = CommandDrawNumber::GetTranslation(sc); normalTranslation = CommandDrawNumber::GetTranslation(sc);
if(sc.CheckToken(',')) if(sc.CheckToken(','))
{ {
sc.MustGetToken(TK_IntConst); sc.MustGetToken(TK_IntConst);