- SBARINFO fix:

- Fullscreen Doom HUD clamped the display of digits.

SVN r1606 (trunk)
This commit is contained in:
Randy Heit 2009-05-26 00:46:55 +00:00
parent 5245e8d4dd
commit e95be7eff7
2 changed files with 8 additions and 7 deletions

View File

@ -1610,11 +1610,12 @@ void DSBarInfo::DrawString(const char* str, SBarInfoCoordinate x, SBarInfoCoordi
void DSBarInfo::DrawNumber(int num, int len, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing, bool fillzeros, bool drawshadow)
{
FString value;
int maxval = (int) ceil(pow(10., len))-1;
// 10^9 is a largest we can hold in a 32-bit int. So if we go any larger we have to toss out the positions limit.
int maxval = len <= 9 ? (int) ceil(pow(10., len))-1 : INT_MAX;
if(!fillzeros || len == 1)
num = clamp(num, -maxval, maxval);
else //The community wanted negatives to take the last digit, but we can only do this if there is room
num = clamp(num, (int) -(ceil(pow(10., len-1))-1), maxval);
num = clamp(num, len <= 9 ? (int) -(ceil(pow(10., len-1))-1) : INT_MIN, maxval);
value.Format("%d", num);
if(fillzeros)
{

View File

@ -16,15 +16,15 @@ statusbar fullscreen, fullscreenoffsets // ZDoom HUD
{
//health
drawimage "MEDIA0", 20, -2, centerbottom;
drawnumber 3, HUDFONT_DOOM, untranslated, health, drawshadow, 82, -20;
drawnumber 2147483647, HUDFONT_DOOM, untranslated, health, drawshadow, 82, -20;
//armor
drawimage armoricon, 20, -24, centerbottom;
drawnumber 3, HUDFONT_DOOM, untranslated, armor, drawshadow, whennotzero, 82, -39;
drawnumber 2147483647, HUDFONT_DOOM, untranslated, armor, drawshadow, whennotzero, 82, -39;
//ammo
drawimage ammoicon1, -14, -4, centerbottom;
drawnumber 3, HUDFONT_DOOM, untranslated, ammo1, drawshadow, -25, -20;
drawnumber 2147483647, HUDFONT_DOOM, untranslated, ammo1, drawshadow, -25, -20;
usesammo
{
@ -32,7 +32,7 @@ statusbar fullscreen, fullscreenoffsets // ZDoom HUD
usessecondaryammo
{
drawimage ammoicon2, -14, -22, centerbottom;
drawnumber 3, HUDFONT_DOOM, untranslated, ammo2, drawshadow, -25, -38;
drawnumber 2147483647, HUDFONT_DOOM, untranslated, ammo2, drawshadow, -25, -38;
inventorybarnotvisible
{
drawselectedinventory centerbottom, drawshadow, alwaysshowcounter, HUDFONT_DOOM, -14, -39, -26, -56, untranslated;
@ -59,7 +59,7 @@ statusbar fullscreen, fullscreenoffsets // ZDoom HUD
gamemode deathmatch
{
drawnumber 2, HUDFONT_DOOM, untranslated, frags, drawshadow, -3, 1;
drawnumber 2147483647, HUDFONT_DOOM, untranslated, frags, drawshadow, -3, 1;
}
gamemode singleplayer, cooperative, teamgame
{