Qt hitpointbar
Add support for the 'hitpointbar' to the Qt interface. Rather than rendering the status title (name+rank or name+monster_species) using inverse video for leading substring to produce distinct left and right sides, draw a horizontal bar above that field. The left portion (current health) is thicker and uses red for <10% or <5hp, orange for <25% or <10hp, yellow for <50%, green for <75%, blue for <100%, and black for 100%. The right portion (missing maximum health) is thinner and runs from white (paired with red), light gray (paired with orange), dark gray (with yellow), plain gray (which turns out to be darker than dark gray, with green), dark blue (with blue), and black (but black is never shown for injury portion because that's suppressed when at full health). Qt already supports a square frame around the hero's map tile that changes color according to health. Turning the hitpointbar option Off or On has no effect on that.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 options.c $NHDT-Date: 1599893947 2020/09/12 06:59:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.473 $ */
|
||||
/* NetHack 3.7 options.c $NHDT-Date: 1603666043 2020/10/25 22:47:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.478 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Michael Allison, 2008. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -4607,6 +4607,12 @@ char *op;
|
||||
/* [is reassessment really needed here?] */
|
||||
status_initialize(REASSESS_ONLY);
|
||||
g.opt_need_redraw = TRUE;
|
||||
#ifdef QT_GRAPHICS
|
||||
} else if (WINDOWPORT("Qt")) {
|
||||
/* Qt doesn't support HILITE_STATUS or FLUSH_STATUS so fails
|
||||
VIA_WINDOWPORT(), but it does support WC2_HITPOINTBAR */
|
||||
g.context.botlx = TRUE;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case opt_color:
|
||||
@@ -7619,7 +7625,8 @@ doset() /* changing options via menu by Per Liboriussen */
|
||||
check_gold_symbol();
|
||||
reglyph_darkroom();
|
||||
(void) doredraw();
|
||||
} else if (g.context.botl || g.context.botlx) {
|
||||
}
|
||||
if (g.context.botl || g.context.botlx) {
|
||||
bot();
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user