- Fixed: when using the border property of drawbar, interpolation didn't work quite right.

SVN r2705 (trunk)
This commit is contained in:
Braden Obrzut 2010-09-06 20:12:44 +00:00
parent e9211aaad3
commit 31754a582d
2 changed files with 7 additions and 8 deletions

View file

@ -1288,7 +1288,7 @@ public:
} }
if(clearDontDraw) if(clearDontDraw)
screen->Clear(static_cast<int>(rcx), static_cast<int>(rcy), static_cast<int>(MIN<double>(rcr, w)), static_cast<int>(MIN<double>(rcb, h)), GPalette.BlackIndex, 0); screen->Clear(static_cast<int>(rcx), static_cast<int>(rcy), static_cast<int>(MIN<double>(rcr, rcx+w)), static_cast<int>(MIN<double>(rcb, rcy+h)), GPalette.BlackIndex, 0);
else else
{ {
if(alphaMap) if(alphaMap)

View file

@ -2084,9 +2084,12 @@ class CommandDrawBar : public SBarInfoCommand
FTexture *fg = statusBar->Images[foreground]; FTexture *fg = statusBar->Images[foreground];
FTexture *bg = (background != -1) ? statusBar->Images[background] : NULL; FTexture *bg = (background != -1) ? statusBar->Images[background] : NULL;
fixed_t value = drawValue;
if(border != 0) if(border != 0)
{ {
value = FRACUNIT - value; //invert since the new drawing method requires drawing the bg on the fg.
//Draw the whole foreground //Draw the whole foreground
statusBar->DrawGraphic(fg, this->x, this->y, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets()); statusBar->DrawGraphic(fg, this->x, this->y, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
} }
@ -2103,7 +2106,7 @@ class CommandDrawBar : public SBarInfoCommand
fixed_t clip[4] = {0, 0, 0, 0}; fixed_t clip[4] = {0, 0, 0, 0};
fixed_t sizeOfImage = (horizontal ? fg->GetScaledWidth()-border*2 : fg->GetScaledHeight()-border*2)<<FRACBITS; fixed_t sizeOfImage = (horizontal ? fg->GetScaledWidth()-border*2 : fg->GetScaledHeight()-border*2)<<FRACBITS;
clip[(!horizontal)|((horizontal ? !reverse : reverse)<<1)] = sizeOfImage - FixedMul(sizeOfImage, drawValue); clip[(!horizontal)|((horizontal ? !reverse : reverse)<<1)] = sizeOfImage - FixedMul(sizeOfImage, value);
// Draw background // Draw background
if(border != 0) if(border != 0)
{ {
@ -2360,17 +2363,13 @@ class CommandDrawBar : public SBarInfoCommand
} }
default: return; default: return;
} }
if(border != 0)
value = max - value; //invert since the new drawing method requires drawing the bg on the fg.
if(max != 0 && value > 0) if(max != 0 && value > 0)
{ {
value = (value << FRACBITS) / max; value = (value << FRACBITS) / max;
if(value > FRACUNIT) if(value > FRACUNIT)
value = FRACUNIT; value = FRACUNIT;
} }
else if(border != 0 && max == 0 && value <= 0)
value = FRACUNIT;
else else
value = 0; value = 0;
if(interpolationSpeed != 0 && (!hudChanged || level.time == 1)) if(interpolationSpeed != 0 && (!hudChanged || level.time == 1))