- Fixed: FBaseStatusBar::DrBNumber() should behave like Doom's

STlib_drawNum(), and FDoomStatusBarTexture::DrawToBar() should add
  the textures left offset to the x coordinate before drawing.
  These fix Twice Risen's status bar.
- Changed: VPrintf now uses string.VFormat(), instead of vsprintf().


SVN r53 (trunk)
This commit is contained in:
Randy Heit 2006-04-18 06:07:09 +00:00
commit c3c22c9453
4 changed files with 63 additions and 71 deletions

View file

@ -513,76 +513,52 @@ void FBaseStatusBar::DrINumber (signed int val, int x, int y, int imgBase) const
void FBaseStatusBar::DrBNumber (signed int val, int x, int y, int size) const
{
int xpos;
int index;
int w, h;
bool neg;
int i;
int i, w;
int power;
FTexture *pic = Images[imgBNumbers+3];
FTexture *pic;
if (pic != NULL)
pic = Images[imgBNumbers];
w = (pic != NULL) ? pic->GetWidth() : 0;
if (val == 0)
{
w = pic->GetWidth ();
h = pic->GetHeight ();
}
else
{
w = h = 0;
if (pic != NULL)
{
DrawImage (pic, x - w, y);
}
return;
}
xpos = x + w/2 + w*size;
if ( (neg = val < 0) )
{
val = -val;
size--;
}
for (i = size-1, power = 10; i > 0; i--)
{
power *= 10;
}
if (val >= power)
{
val = power - 1;
}
if ( (neg = val < 0) )
{
if (size == 2 && val < -9)
{
val = -9;
}
else if (size == 3 && val < -99)
{
val = -99;
}
val = -val;
size--;
}
if (val == 0)
{
pic = Images[imgBNumbers];
if (pic != NULL)
{
DrawImage (pic, xpos - pic->GetWidth()/2 - w, y);
}
return;
}
while (val != 0 && size--)
{
xpos -= w;
int oldval = val;
x -= w;
pic = Images[imgBNumbers + val % 10];
val /= 10;
index = imgBNumbers + (oldval - val*10);
pic = Images[index];
if (pic != NULL)
{
DrawImage (pic, xpos - pic->GetWidth()/2, y);
DrawImage (pic, x, y);
}
}
if (neg)
{
xpos -= w;
pic = Images[imgBNEGATIVE];
if (pic != NULL)
{
DrawImage (pic, xpos - pic->GetWidth()/2, y);
DrawImage (pic, x - w, y);
}
}
}