From 7183a2f7515b55fc10b53acf4036cf6d7cd7ee29 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 18 Jan 2010 19:38:36 +0000 Subject: [PATCH] - 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) --- src/g_shared/sbarinfo_commands.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index df6bd1b4a5..063f9ac3a0 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -55,7 +55,12 @@ class CommandDrawImage : public SBarInfoCommand if(texture == NULL) 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); } void Parse(FScanner &sc, bool fullScreenOffsets) @@ -132,7 +137,7 @@ class CommandDrawImage : public SBarInfoCommand void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged) { texture = NULL; - alpha = block->Alpha(); + alpha = FRACUNIT; if(type == PLAYERICON) texture = TexMan[statusBar->CPlayer->mo->ScoreIcon]; else if(type == AMMO1) @@ -474,6 +479,10 @@ class CommandDrawSwitchableImage : public CommandDrawImage if(drawAlt != 0) //draw 'off' image { 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; } CommandDrawImage::Tick(block, statusBar, hudChanged); @@ -1061,13 +1070,13 @@ class CommandDrawSelectedInventory : public SBarInfoCommandFlowControl, private CommandDrawImage::GetCoordinates(sc, fullScreenOffsets, imgx, imgy); startX = imgx + 30; y = imgy + 24; - translation = CR_GOLD; + normalTranslation = CR_GOLD; if(sc.CheckToken(',')) //more font information { CommandDrawNumber::GetCoordinates(sc, fullScreenOffsets, startX, y); if(sc.CheckToken(',')) { - translation = CommandDrawNumber::GetTranslation(sc); + normalTranslation = CommandDrawNumber::GetTranslation(sc); if(sc.CheckToken(',')) { sc.MustGetToken(TK_IntConst);