new composite status conditions: weaponstatus,\

armorstatus, and terrainstatus

This adds three special status items to show at a glance what the hero
is wielding, wearing, and standing on.

Each of the three items has its own boolean option rather than try to
fix them in with the existing opttional status conditions.  After a
lot of testing, I think the weapon and armor ones will prove useful
but the terrain one probably won't be.

Presently it is implemented for tty and curses.  When I developed it
six years ago, it was also working for X11 but I'm not able to test
the resurrection of that part so have left it out.
This commit is contained in:
PatR
2026-04-16 13:35:08 -07:00
parent 45e8305918
commit 84ddf85cb4
20 changed files with 659 additions and 72 deletions

View File

@@ -5,7 +5,12 @@
#ifndef BOTL_H
#define BOTL_H
/* MAXCO must hold longest uncompressed status line, and must be larger
/* Note: this comment is about the pre-VIA_WINDOWPORT two line status
* which is still available but has not added a bunch of conditional
* extra status conditions (Grab, InLava, Held, Zzz and many others)
* or the new fields Weapon, Armor, and Terrain.
*
* MAXCO must hold longest uncompressed status line, and must be larger
* than COLNO
*
* longest practical second status line at the moment is
@@ -39,13 +44,20 @@ enum statusfields {
BL_CHARACTERISTICS = -3, /* alias for BL_STR..BL_CH */
BL_RESET = -2, /* Force everything to redisplay */
BL_FLUSH = -1, /* Finished cycling through bot fields */
/*
* Note: status_sanity_check() in wintty.c has strings for the rest
* of these, so if any get renumbered or more get added, be sure to
* keep those in sync.
*/
BL_TITLE = 0,
BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, /* 1..6 */
BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, BL_ENE, BL_ENEMAX, /* 7..12 */
BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, /* 13..18 */
BL_HPMAX, BL_LEVELDESC, BL_EXP, BL_CONDITION, /* 19..22 */
BL_VERS, /* 23 */
MAXBLSTATS, /* [24] */
BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, /* 1.. 6 */
BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, /* 7..10 */
BL_ENE, BL_ENEMAX, BL_XP, BL_AC, BL_HD, /* 11..15 */
BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX, /* 16..19 */
BL_LEVELDESC, BL_EXP, BL_CONDITION, /* 20..22 */
BL_WEAPON, BL_ARMOR, BL_TERRAIN, /* 23..25 */
BL_VERS, /* 26 */
MAXBLSTATS /* [27] */
};
enum relationships {
@@ -55,7 +67,7 @@ enum relationships {
};
enum blconditions {
bl_bareh,
bl_bareh, /* deprecated -- bl_weapon encompasses this */
bl_blind,
bl_busy,
bl_conf,
@@ -67,7 +79,7 @@ enum blconditions {
bl_grab,
bl_hallu,
bl_held,
bl_icy,
bl_icy, /* bl_terrain encompasses this */
bl_inlava,
bl_lev,
bl_parlyz,
@@ -78,7 +90,7 @@ enum blconditions {
bl_stone,
bl_strngl,
bl_stun,
bl_submerged,
bl_submerged, /* bl_terrain encompasses this */
bl_termill,
bl_tethered,
bl_trapped,

View File

@@ -276,6 +276,8 @@ extern void max_rank_sz(void);
extern long botl_score(void);
#endif
extern int describe_level(char *, int);
extern char *weapon_status(char *) NONNULL NONNULLARG1;
extern char *armor_status(char *) NONNULL NONNULLARG1;
extern void status_initialize(boolean);
extern void status_finish(void);
extern boolean exp_percent_changing(void);
@@ -1215,6 +1217,7 @@ extern void runmode_delay_output(void);
extern void overexert_hp(void);
extern boolean overexertion(void);
extern void invocation_message(void);
extern void classify_terrain(void);
extern void switch_terrain(void);
extern void set_uinwater(int);
extern boolean pooleffects(boolean);

View File

@@ -17,6 +17,7 @@
struct flag {
boolean acoustics; /* allow dungeon sound messages */
boolean armorstatus; /* show armor info on status lines */
boolean autodig; /* MRKR: Automatically dig */
boolean autoquiver; /* Automatically fill quiver */
boolean autoopen; /* open doors by walking into them */
@@ -63,9 +64,11 @@ struct flag {
boolean sortpack; /* sorted inventory */
boolean sparkle; /* show "resisting" special FX (Scott Bigham) */
boolean standout; /* use standout for --More-- */
boolean terrainstatus; /* show terrain info on status lines */
boolean time; /* display elapsed 'time' */
boolean tombstone; /* print tombstone */
boolean verbose; /* max battle info */
boolean weaponstatus; /* show weapon info on status lines */
int end_top, end_around; /* describe desired score list */
unsigned autounlock; /* locked door/chest action */
#define AUTOUNLOCK_UNTRAP 1
@@ -307,6 +310,7 @@ struct instance_flags {
int getpos_coords; /* show coordinates when getting cursor position */
int menuinvertmode; /* 0 = invert toggles every item;
* 1 = invert skips 'all items' item */
int terrain_typ; /* index into terrain_descr[] for botl */
color_attr menu_headings; /* CLR_ and ATR_ for menu headings */
uint32_t colorcount; /* store how many colors terminal is capable of */
boolean use_truecolor; /* force use of truecolor */

View File

@@ -164,6 +164,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
Off, Yes, No, No, NoAlias, (boolean *) 0, Term_False,
(char *)0)
#endif
NHOPTB(armorstatus, Status, 0, opt_in, set_in_game,
Off, Yes, No, No, NoAlias, &flags.armorstatus, Term_False,
"summarize currently worn armor in a status field")
NHOPTB(ascii_map, Advanced, 0, opt_in, set_in_game,
ascii_map_Def, Yes, No, No, NoAlias, &iflags.wc_ascii_map,
Term_False, "show map as text")
@@ -741,6 +744,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
No, Yes, No, No, "termcolumns", "number of columns")
NHOPTC(term_rows, Advanced, 6, opt_in, set_in_config,
No, Yes, No, No, NoAlias, "number of rows")
NHOPTB(terrainstatus, Status, 0, opt_in, set_in_game,
Off, Yes, No, No, NoAlias, &flags.terrainstatus, Term_False,
"show hero's location as a status field")
NHOPTC(tile_file, Advanced, 70, opt_in, set_gameview,
No, Yes, No, No, NoAlias, "name of tile file")
NHOPTC(tile_height, Advanced, 20, opt_in, set_gameview,
@@ -853,6 +859,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
#endif
NHOPTC(warnings, Advanced, 10, opt_in, set_in_config,
No, Yes, No, No, NoAlias, "display characters for warnings")
NHOPTB(weaponstatus, Status, 0, opt_in, set_in_game,
Off, Yes, No, No, NoAlias, &flags.weaponstatus, Term_False,
"show currently wielded weapon in a status field")
NHOPTC(whatis_coord, Advanced, 1, opt_in, set_in_game,
Yes, Yes, No, Yes, NoAlias,
"show coordinates when auto-describing cursor position")

View File

@@ -92,7 +92,20 @@ enum levl_typ_types {
CLOUD = 36,
MAX_TYPE = 37,
/* for special levels */
MATCH_WALL = 38,
/* these aren't levl[][].typ values, they're additional indices
into terrain_descr[] for status feedback */
xFLOOR = 39,
xGROUND = 40,
xOPENDOOR = 41,
xSHUTDOOR = 42,
xSWAMP = 43,
xSUBMERGED = 44,
xSEA = 45,
xWATERWALL = 46,
INVALID_TYPE = 127
};

View File

@@ -262,6 +262,9 @@ extern
#define WC2_U_UTF8STR 0x020000L /* 18 utf8str support */
#define WC2_EXTRACOLORS 0x040000L /* 19 color support beyond NH_BASIC_COLOR */
/* 13 free bits */
#define WC2_EXTRASTATUS 0x080000L /* 20 optional weaponstatus, armorstatus,
* terrainstatus */
/* 12 free bits */
#define ALIGN_LEFT 1
#define ALIGN_RIGHT 2