From e95be7eff77a5686c0845e30b3da62123a08cdc2 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 26 May 2009 00:46:55 +0000 Subject: [PATCH] - SBARINFO fix: - Fullscreen Doom HUD clamped the display of digits. SVN r1606 (trunk) --- src/g_shared/sbarinfo_display.cpp | 5 +++-- wadsrc/static/sbarinfo/doom.txt | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/g_shared/sbarinfo_display.cpp b/src/g_shared/sbarinfo_display.cpp index c141d547b..c9d2b47f6 100644 --- a/src/g_shared/sbarinfo_display.cpp +++ b/src/g_shared/sbarinfo_display.cpp @@ -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) { diff --git a/wadsrc/static/sbarinfo/doom.txt b/wadsrc/static/sbarinfo/doom.txt index 0e49eae84..fc0784311 100644 --- a/wadsrc/static/sbarinfo/doom.txt +++ b/wadsrc/static/sbarinfo/doom.txt @@ -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 {