additional widget colors options (#405)

* additional widget colors options

 * backpack changes thresholds (fixes #399)
 * color of armor depends on type

* consistent wording
This commit is contained in:
Fabian Greffrath 2022-01-07 12:58:16 +01:00 committed by GitHub
parent b1611a3469
commit 09e5254105
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 4 deletions

View File

@ -984,6 +984,10 @@ void HU_Drawer(void)
hud_ammostr[i] = '\0';
strcat(hud_ammostr,ammostr);
// backpack changes thresholds (ammo widget)
if (plr->backpack && !hud_backpack_thresholds && fullammo)
ammopct = (100*ammo)/(fullammo/2);
// set the display color from the percentage of total ammo held
if (ammopct<ammo_red)
w_ammo.cr = colrngs[CR_RED];
@ -1089,11 +1093,21 @@ void HU_Drawer(void)
hud_armorstr[i] = '\0';
strcat(hud_armorstr,armorstr);
// color of armor depends on type
if (hud_armor_type)
{
w_armor.cr =
(!plr->armortype) ? colrngs[CR_RED] :
(plr->armortype == 1) ? colrngs[CR_GREEN] : colrngs[CR_BLUE];
}
else
{
// set the display color from the amount of armor posessed
w_armor.cr =
armor<armor_red ? colrngs[CR_RED] :
armor<armor_yellow ? colrngs[CR_GOLD] :
armor<=armor_green ? colrngs[CR_GREEN] : colrngs[CR_BLUE];
}
// transfer the init string to the widget
s = hud_armorstr;
@ -1143,6 +1157,10 @@ void HU_Drawer(void)
ammopct = fullammo? (100*ammo)/fullammo : 100;
// backpack changes thresholds (weapon widget)
if (plr->backpack && !hud_backpack_thresholds && fullammo)
ammopct = (100*ammo)/(fullammo/2);
// display each weapon number in a color related to the ammo for it
hud_weapstr[i++] = '\x1b'; //jff 3/26/98 use ESC not '\' for paths
if (weaponinfo[w].ammo==am_noammo) //jff 3/14/98 show berserk on HUD

View File

@ -3076,10 +3076,12 @@ void M_DrawWeapons(void)
// Screen table definitions
setup_menu_t stat_settings1[];
setup_menu_t stat_settings2[];
setup_menu_t* stat_settings[] =
{
stat_settings1,
stat_settings2,
NULL
};
@ -3102,12 +3104,30 @@ setup_menu_t stat_settings1[] = // Status Bar and HUD Settings screen
{"ARMOR GOOD/EXTRA" ,S_NUM ,m_null,ST_X,ST_Y+13*8, {"armor_green"}},
{"AMMO LOW/OK" ,S_NUM ,m_null,ST_X,ST_Y+14*8, {"ammo_red"}},
{"AMMO OK/GOOD" ,S_NUM ,m_null,ST_X,ST_Y+15*8, {"ammo_yellow"}},
{"\"A SECRET IS REVEALED!\" MESSAGE",S_YESNO,m_null,ST_X,ST_Y+17*8, {"hud_secret_message"}},
{"SHOW TIME/STS ABOVE STATUS BAR",S_YESNO,m_null,ST_X,ST_Y+18*8, {"hud_timests"}},
// Button for resetting to defaults
{0,S_RESET,m_null,X_BUTTON,Y_BUTTON},
{"NEXT ->",S_SKIP|S_NEXT,m_null,KB_NEXT,KB_Y+17*8, {stat_settings2}},
// Final entry
{0,S_SKIP|S_END,m_null}
};
setup_menu_t stat_settings2[] =
{
{"WIDGET COLORS",S_SKIP|S_TITLE,m_null,ST_X,ST_Y+ 1*8 },
{"BACKPACK CHANGES THRESHOLDS",S_YESNO,m_null,ST_X,ST_Y+2*8, {"hud_backpack_thresholds"}},
{"COLOR OF ARMOR DEPENDS ON TYPE",S_YESNO,m_null,ST_X,ST_Y+3*8, {"hud_armor_type"}},
{"EXTENDED HUD",S_SKIP|S_TITLE,m_null,ST_X,ST_Y+ 5*8 },
{"\"A SECRET IS REVEALED!\" MESSAGE",S_YESNO,m_null,ST_X,ST_Y+6*8, {"hud_secret_message"}},
{"SHOW TIME/STS ABOVE STATUS BAR",S_YESNO,m_null,ST_X,ST_Y+7*8, {"hud_timests"}},
{"<- PREV" ,S_SKIP|S_PREV,m_null,KB_PREV,KB_Y+17*8, {stat_settings1}},
// Final entry
{0,S_SKIP|S_END,m_null}
};

View File

@ -1768,6 +1768,22 @@ default_t defaults[] = {
"1 to disable display of kills/items/secrets on HUD"
},
// backpack changes thresholds
{
"hud_backpack_thresholds",
(config_t *) &hud_backpack_thresholds, NULL,
{1}, {0,1}, number, ss_none, wad_no,
"backpack changes thresholds"
},
// color of armor depends on type
{
"hud_armor_type",
(config_t *) &hud_armor_type, NULL,
{0}, {0,1}, number, ss_none, wad_no,
"color of armor depends on type"
},
// "A secret is revealed!" message
{
"hud_secret_message",

View File

@ -271,6 +271,9 @@ int armor_red; // armor amount less than which status is red
int armor_yellow; // armor amount less than which status is yellow
int armor_green; // armor amount above is blue, below is green
int hud_backpack_thresholds; // backpack changes thresholds
int hud_armor_type; // color of armor depends on type
// in deathmatch only, summary of frags stats
static st_number_t w_frags;
@ -774,6 +777,7 @@ void ST_doPaletteStuff(void)
void ST_drawWidgets(boolean refresh)
{
int i;
int maxammo = plyr->maxammo[weaponinfo[w_ready.data].ammo];
// used by w_arms[] widgets
st_armson = st_statusbaron && !deathmatch;
@ -781,12 +785,16 @@ void ST_drawWidgets(boolean refresh)
// used by w_frags widget
st_fragson = deathmatch && st_statusbaron;
// backpack changes thresholds
if (plyr->backpack && !hud_backpack_thresholds)
maxammo /= 2;
//jff 2/16/98 make color of ammo depend on amount
if (*w_ready.num*100 < ammo_red*plyr->maxammo[weaponinfo[w_ready.data].ammo])
if (*w_ready.num*100 < ammo_red*maxammo)
STlib_updateNum(&w_ready, cr_red, refresh);
else
if (*w_ready.num*100 <
ammo_yellow*plyr->maxammo[weaponinfo[w_ready.data].ammo])
ammo_yellow*maxammo)
STlib_updateNum(&w_ready, cr_gold, refresh);
else
STlib_updateNum(&w_ready, cr_green, refresh);
@ -807,6 +815,18 @@ void ST_drawWidgets(boolean refresh)
else
STlib_updatePercent(&w_health, cr_blue2, refresh); //killough 2/28/98
// color of armor depends on type
if (hud_armor_type)
{
if (!plyr->armortype)
STlib_updatePercent(&w_armor, cr_red, refresh);
else if (plyr->armortype == 1)
STlib_updatePercent(&w_armor, cr_green, refresh);
else
STlib_updatePercent(&w_armor, cr_blue2, refresh);
}
else
{
//jff 2/16/98 make color of armor depend on amount
if (*w_armor.n.num<armor_red)
STlib_updatePercent(&w_armor, cr_red, refresh);
@ -816,6 +836,7 @@ void ST_drawWidgets(boolean refresh)
STlib_updatePercent(&w_armor, cr_green, refresh);
else
STlib_updatePercent(&w_armor, cr_blue2, refresh); //killough 2/28/98
}
STlib_updateBinIcon(&w_armsbg, refresh);

View File

@ -92,6 +92,9 @@ extern int sts_always_red;// status numbers do not change colors
extern int sts_pct_always_gray;// status percents do not change colors
extern int sts_traditional_keys; // display keys the traditional way
extern int hud_backpack_thresholds; // backpack changes thresholds
extern int hud_armor_type; // color of armor depends on type
#endif
//----------------------------------------------------------------------------