Skip to content

Commit

Permalink
Get rid of ISBETWEEN(), reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlaux committed May 6, 2023
1 parent 0960144 commit 0e262e1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
8 changes: 6 additions & 2 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,12 @@ void D_Display (void)
// [Nugget] Moved here, as to be called after AM_Drawer()
if (gamestate == GS_LEVEL && gametic)
{
ST_Drawer( scaledviewheight == 200
&& !ISBETWEEN(CRISPY_HUD, screenblocks, CRISPY_HUD_WIDE), // [Nugget]
// [Nugget]:
// [crispy] distinguish classic status bar with background and player face from Crispy HUD
oldcrispy = st_crispyhud; // [Nugget]
st_crispyhud = (CRISPY_HUD <= screenblocks && screenblocks <= CRISPY_HUD_WIDE) && automap_off;

ST_Drawer(scaledviewheight == 200 && !st_crispyhud, // [Nugget]
redrawsbar);

// Moved here too, as to be called
Expand Down
3 changes: 0 additions & 3 deletions src/doomtype.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ typedef unsigned char byte;
#define BETWEEN(l,u,x) ((l)>(x)?(l):(x)>(u)?(u):(x))
#endif

// [Nugget]
#define ISBETWEEN(min,val,max) (((min) <= (val)) && ((val) <= (max)))

#if defined(_MSC_VER) && !defined(__cplusplus)
#define inline __inline
#endif
Expand Down
7 changes: 2 additions & 5 deletions src/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1493,8 +1493,7 @@ void HU_Drawer(void)
if (w->line->visible)
{
// [Nugget] Special treatment for Time/STS in Nugget HUD
if (ISBETWEEN(CRISPY_HUD-3, screenSize, CRISPY_HUD_WIDE-3))
{
if (st_crispyhud) {
const int delta = st_widecrispyhud ? WIDESCREENDELTA : 0;

if (w->line == &w_sttime) {
Expand Down Expand Up @@ -1753,9 +1752,7 @@ void HU_Ticker(void)
HU_enableWidget(&w_sttime, hud_level_time || plr->event_tics); // [Nugget] Event timers
}
else if (scaledviewheight &&
(scaledviewheight < SCREENHEIGHT
// [Nugget] Allow Time/STS in Crispy HUD
|| ISBETWEEN(CRISPY_HUD-3, screenSize, CRISPY_HUD_WIDE-3)) &&
(scaledviewheight < SCREENHEIGHT || st_crispyhud) && // [Nugget] Allow Time/STS in Crispy HUD
automap_off)
{
HU_enableWidget(&w_monsec, hud_level_stats);
Expand Down
12 changes: 4 additions & 8 deletions src/st_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,8 +990,7 @@ void ST_drawWidgets(void)
{ STlib_updateMultIcon(&w_arms[i]); }

// [Nugget] This probably shouldn't go here, but it works
if (ISBETWEEN(CRISPY_HUD, screenblocks, CRISPY_HUD_WIDE)
&& (nughud.face.x > -1) && nughud.face_bg)
if (st_crispyhud && (nughud.face.x > -1) && nughud.face_bg)
{
// [Nugget] Nugget HUD
V_DrawPatch(nughud.face.x + (delta*nughud.face.wide), nughud.face.y+1,
Expand Down Expand Up @@ -1032,19 +1031,16 @@ void ST_diffDraw(void)
ST_drawWidgets();
}

boolean oldcrispy, oldwide; // [Nugget]
boolean oldcrispy; // [Nugget]

void ST_Drawer(boolean fullscreen, boolean refresh)
{
static boolean oldwide; // [Nugget]

st_statusbaron = !fullscreen || automap_on;
// [crispy] immediately redraw status bar after help screens have been shown
st_firsttime = st_firsttime || refresh || inhelpscreens;

// [Nugget]:
// [crispy] distinguish classic status bar with background and player face from Crispy HUD
oldcrispy = st_crispyhud; // [Nugget]
st_crispyhud = ISBETWEEN(CRISPY_HUD, screenblocks, CRISPY_HUD_WIDE) && automap_off;

st_classicstatusbar = st_statusbaron && !st_crispyhud;
st_statusbarface = st_classicstatusbar || (st_crispyhud && nughud.face.x > -1);

Expand Down
2 changes: 1 addition & 1 deletion src/st_stuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ 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 boolean st_crispyhud, st_widecrispyhud; // [Nugget]
extern boolean st_crispyhud, oldcrispy, st_widecrispyhud; // [Nugget]

extern int hud_backpack_thresholds; // backpack changes thresholds
extern int hud_armor_type; // color of armor depends on type
Expand Down

0 comments on commit 0e262e1

Please sign in to comment.