de-obfuscate largeammo value, properly initialize ammo widget in ST_createWidgets() (#1633)

This commit is contained in:
Fabian Greffrath 2024-04-02 16:50:03 +02:00 committed by GitHub
parent a1c804c064
commit 42d9bbfd17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 3 deletions

View File

@ -112,7 +112,7 @@ static void STlib_drawNum
}
// if non-number, do not draw it
if (num == 1994)
if (num == LARGENUMBER)
return;
//jff 2/16/98 add color translation to digit output

View File

@ -22,6 +22,8 @@
#include "doomtype.h"
#define LARGENUMBER 1994
// We are referring to patches.
struct patch_s;

View File

@ -730,9 +730,10 @@ int ST_BlinkKey(player_t* player, int index)
return -1;
}
static int largeammo = LARGENUMBER; // means "n/a"
void ST_updateWidgets(void)
{
static int largeammo = 1994; // means "n/a"
int i;
// must redirect the pointer if the ready weapon has changed.
@ -1221,6 +1222,9 @@ void ST_createWidgets(void)
// the last weapon type
w_ready.data = plyr->readyweapon;
if (weaponinfo[plyr->readyweapon].ammo == am_noammo)
w_ready.num = &largeammo;
// health percentage
STlib_initPercent(&w_health,
ST_HEALTHX - distributed_delta,

View File

@ -34,6 +34,7 @@
#include "mn_menu.h"
#include "r_defs.h"
#include "s_sound.h"
#include "st_lib.h"
#include "sounds.h"
#include "u_mapinfo.h"
#include "v_video.h"
@ -767,7 +768,7 @@ WI_drawNum
}
// if non-number, do not draw it
if (n == 1994)
if (n == LARGENUMBER)
return 0;
// draw the new number