status line update

Adding deafness to the status line spurred me on to something I've
wanted to do for a long time.  This adds 'Stone' and 'Strngl' as
new status conditions, and moves the five fatal ones: "Stone Slime
Strngl FoodPois TermIll" to the front of the status list since
information about them is more important than any of the others.
"Ill" has been renamed "TermIll"; "Df" has been renamed "Deaf";
"Lev", "Fly", and "Ride" are three additional new conditions, with
Lev and Fly being mutually exclusive.  After the fatal ones, the
order of the rest is now
<hunger> <encumbrance> Blind Deaf Stun Conf Hallu Lev Fly Ride

To handle the longer potential status line, the basic bot2() is now
smarter.  If the line is wider than the map, 'T:moves' is moved from
the middle to the end.  If the line without time is still wider than
the map, then experience (HD if polyd, Xp:M/nnnnnn is showexp is on,
or Exp:M) is moved in front of time at the end.  If the line without
experience and time is still wider than the map, dungeon level plus
gold is moved from the beginning to be in front of experience.  The
fields are just reordered, not truncated, so if the interface code
can display lines wider than the map they'll retain the extra info.
The gist is than health and associated fields (Hp, Pw, Ac) get first
priority, status conditions get second priority, then the rest.  In
the usual case where there aren't many conditions, status display is
the same as it has been in the past.

STATUS_VIA_WINDOWPORT has been updated too, and it builds for tty
and X11.  But the bot2() revision to reorder sections has not been
implemented for that.

win/win32/mswproc.c has been updated but not tested.

STATUS_VIA_WINDOWPORT without STATUS_HILITES had several compile
problems; now fixed for core and tty.  STATUS_VIA_WINDOWPORT with
STATUS_HILITES has not been tested.
This commit is contained in:
PatR
2016-01-13 19:13:10 -08:00
parent 5acb659076
commit fa20ef382d
11 changed files with 421 additions and 288 deletions
+2 -2
View File
@@ -155,13 +155,13 @@ poison breath leaves a trail of poison gas
allow knife and stiletto as possible tin opening tools allow knife and stiletto as possible tin opening tools
wizard mode #wizintrinsic command wizard mode #wizintrinsic command
additional tribute passages for The Colour of Magic, The Light Fantastic, additional tribute passages for The Colour of Magic, The Light Fantastic,
Equal Rites, Snuff, and Raising Steam Equal Rites, Mort, Snuff, and Raising Steam
compile-time options SIMPLE_MAIL and SERVER_ADMIN_MSG for public server use compile-time options SIMPLE_MAIL and SERVER_ADMIN_MSG for public server use
database entries for Cleaver, Sunsword, Frost and Fire brands, and database entries for Cleaver, Sunsword, Frost and Fire brands, and
polymorph trap polymorph trap
allow showing coordinates when picking a position on the map and allow showing coordinates when picking a position on the map and
autodescribe option is on autodescribe option is on
add a status line deafness indicator new status line conditions Stone Strngl Deaf Lev Fly Ride
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features
+28 -15
View File
@@ -9,14 +9,22 @@
* than COLNO * than COLNO
* *
* longest practical second status line at the moment is * longest practical second status line at the moment is
* Astral Plane $:12345 HP:700(700) Pw:111(111) AC:-127 Xp:30/123456789 Astral Plane \GXXXXNNNN:123456 HP:1000(1000) Pw:111(111) AC:-127
* T:123456 Satiated Conf FoodPois Ill Blind Stun Hallu Overloaded Xp:30/123456789 T:123456 Stone Slime Strngl FoodPois TermIll
* -- or somewhat over 130 characters Satiated Overloaded Blind Deaf Stun Conf Hallu Lev Ride
* -- or a bit under 185 characters. '$' gets encoded even when it
* could be used as-is. The first five status conditions are fatal
* so it's rare to have more than one at a time.
*
* When the full line is wider than the map, the basic status line
* formatting will move less important fields to the end, so if/when
* truncation is necessary, it will chop off the least significant
* information.
*/ */
#if COLNO <= 140 #if COLNO <= 160
#define MAXCO 160 #define MAXCO 200
#else #else
#define MAXCO (COLNO + 20) #define MAXCO (COLNO + 40)
#endif #endif
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_VIA_WINDOWPORT
@@ -53,23 +61,28 @@ enum statusfields { BL_FLUSH = -1, BL_TITLE = 0, BL_STR, BL_DX, BL_CO, BL_IN,
BL_WI, BL_CH, BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, BL_ENE, BL_ENEMAX, BL_WI, BL_CH, BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, BL_ENE, BL_ENEMAX,
BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX, BL_LEVELDESC, BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX, BL_LEVELDESC,
BL_EXP, BL_CONDITION }; BL_EXP, BL_CONDITION };
#endif
#define MAXBLSTATS BL_CONDITION+1 #define MAXBLSTATS BL_CONDITION+1
#define BEFORE 0 #define BEFORE 0
#define NOW 1 #define NOW 1
#endif
/* Boolean condition bits for the condition mask */ /* Boolean condition bits for the condition mask */
/* clang-format off */ /* clang-format off */
#define BL_MASK_BLIND 0x00000001L #define BL_MASK_STONE 0x00000001L
#define BL_MASK_CONF 0x00000002L #define BL_MASK_SLIME 0x00000002L
#define BL_MASK_FOODPOIS 0x00000004L #define BL_MASK_STRNGL 0x00000004L
#define BL_MASK_ILL 0x00000008L #define BL_MASK_FOODPOIS 0x00000008L
#define BL_MASK_HALLU 0x00000010L #define BL_MASK_TERMILL 0x00000010L
#define BL_MASK_STUNNED 0x00000020L #define BL_MASK_BLIND 0x00000020L
#define BL_MASK_SLIMED 0x00000040L #define BL_MASK_DEAF 0x00000040L
#define BL_MASK_DEAF 0x00000080L #define BL_MASK_STUN 0x00000080L
#define BL_MASK_CONF 0x00000100L
#define BL_MASK_HALLU 0x00000200L
#define BL_MASK_LEV 0x00000400L
#define BL_MASK_FLY 0x00000800L
#define BL_MASK_RIDE 0x00001000L
/* clang-format on */ /* clang-format on */
#define REASSESS_ONLY TRUE #define REASSESS_ONLY TRUE
+228 -167
View File
@@ -78,54 +78,135 @@ bot1()
STATIC_OVL void STATIC_OVL void
bot2() bot2()
{ {
char newbot2[MAXCO]; char newbot2[MAXCO], /* MAXCO: botl.h */
/* dungeon location (and gold), hero health (HP, PW, AC),
experience (HD if poly'd, else Exp level and maybe Exp points),
time (in moves), varying number of status conditions */
dloc[QBUFSZ], hlth[QBUFSZ], expr[QBUFSZ], tmmv[QBUFSZ], cond[QBUFSZ];
register char *nb; register char *nb;
int hp, hpmax; unsigned dln, dx, hln, xln, tln, cln;
int cap = near_capacity(); int hp, hpmax, cap;
long money;
/*
* Various min(x,9999)'s are to avoid having excessive values
* violate the field width assumptions in botl.h and should not
* impact normal play [not too sure about limiting spell power
* to 3 digits]. Particularly 64-bit long for gold which could
* require many more digits if someone figures out a way to get
* and carry a really large (or negative) amount of it.
* Turn counter is also long, but we'll risk that.
*/
/* dungeon location plus gold */
(void) describe_level(dloc); /* includes at least one trailing space */
if ((money = money_cnt(invent)) < 0L)
money = 0L; /* ought to issue impossible() and then discard gold */
Sprintf(eos(dloc), "%s:%-2ld",
encglyph(objnum_to_glyph(GOLD_PIECE)), min(money, 999999L));
dln = strlen(dloc);
/* '$' encoded as \GXXXXNNNN is 9 chars longer than display will need */
dx = strstri(dloc, "\\G") ? 9 : 0;
/* health and armor class (has trailing space for AC 0..9) */
hp = Upolyd ? u.mh : u.uhp; hp = Upolyd ? u.mh : u.uhp;
hpmax = Upolyd ? u.mhmax : u.uhpmax; hpmax = Upolyd ? u.mhmax : u.uhpmax;
if (hp < 0) if (hp < 0)
hp = 0; hp = 0;
(void) describe_level(newbot2); Sprintf(hlth, "HP:%d(%d) Pw:%d(%d) AC:%-2d",
Sprintf(nb = eos(newbot2), "%s:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d", min(hp, 9999), min(hpmax, 9999),
encglyph(objnum_to_glyph(GOLD_PIECE)), money_cnt(invent), hp, min(u.uen, 999), min(u.uenmax, 999), u.uac);
hpmax, u.uen, u.uenmax, u.uac); hln = strlen(hlth);
/* experience */
if (Upolyd) if (Upolyd)
Sprintf(nb = eos(nb), " HD:%d", mons[u.umonnum].mlevel); Sprintf(expr, "HD:%d", mons[u.umonnum].mlevel);
else if (flags.showexp) else if (flags.showexp)
Sprintf(nb = eos(nb), " Xp:%u/%-1ld", u.ulevel, u.uexp); Sprintf(expr, "Xp:%u/%-1ld", u.ulevel, u.uexp);
else else
Sprintf(nb = eos(nb), " Exp:%u", u.ulevel); Sprintf(expr, "Exp:%u", u.ulevel);
xln = strlen(expr);
/* time/move counter */
if (flags.time) if (flags.time)
Sprintf(nb = eos(nb), " T:%ld", moves); Sprintf(tmmv, "T:%ld", moves);
if (strcmp(hu_stat[u.uhs], " ")) { else
Sprintf(nb = eos(nb), " "); tmmv[0] = '\0';
Strcat(newbot2, hu_stat[u.uhs]); tln = strlen(tmmv);
}
if (Confusion) /* status conditions; worst ones first */
Sprintf(nb = eos(nb), " Conf"); cond[0] = '\0'; /* once non-empty, cond will have a leading space */
nb = cond;
/*
* Stoned, Slimed, Strangled, and both types of Sick are all fatal
* unless remedied before timeout expires. Should we order them by
* shortest time left? [Probably not worth the effort, since it's
* unusual for more than one of them to apply at a time.]
*/
if (Stoned)
Strcpy(nb = eos(nb), " Stone");
if (Slimed)
Strcpy(nb = eos(nb), " Slime");
if (Strangled)
Strcpy(nb = eos(nb), " Strngl");
if (Sick) { if (Sick) {
if (u.usick_type & SICK_VOMITABLE) if (u.usick_type & SICK_VOMITABLE)
Sprintf(nb = eos(nb), " FoodPois"); Strcpy(nb = eos(nb), " FoodPois");
if (u.usick_type & SICK_NONVOMITABLE) if (u.usick_type & SICK_NONVOMITABLE)
Sprintf(nb = eos(nb), " Ill"); Strcpy(nb = eos(nb), " TermIll");
} }
if (Blind) if (u.uhs != NOT_HUNGRY)
Sprintf(nb = eos(nb), " Blind"); Sprintf(nb = eos(nb), " %s", hu_stat[u.uhs]);
if (Stunned) if ((cap = near_capacity()) > UNENCUMBERED)
Sprintf(nb = eos(nb), " Stun");
if (Hallucination)
Sprintf(nb = eos(nb), " Hallu");
if (Slimed)
Sprintf(nb = eos(nb), " Slime");
if (Deaf)
Sprintf(nb = eos(nb), " Df");
if (cap > UNENCUMBERED)
Sprintf(nb = eos(nb), " %s", enc_stat[cap]); Sprintf(nb = eos(nb), " %s", enc_stat[cap]);
if (Blind)
Strcpy(nb = eos(nb), " Blind");
if (Deaf)
Strcpy(nb = eos(nb), " Deaf");
if (Stunned)
Strcpy(nb = eos(nb), " Stun");
if (Confusion)
Strcpy(nb = eos(nb), " Conf");
if (Hallucination)
Strcpy(nb = eos(nb), " Hallu");
/* levitation and flying are mutually exclusive; riding is not */
if (Levitation)
Strcpy(nb = eos(nb), " Lev");
if (Flying)
Strcpy(nb = eos(nb), " Fly");
if (u.usteed)
Strcpy(nb = eos(nb), " Ride");
cln = strlen(cond);
/*
* Put the pieces together. If they all fit, keep the traditional
* sequence. Otherwise, move least important parts to the end in
* case the interface side of things has to truncate. Note that
* dloc[] contains '$' encoded in ten character sequence \GXXXXNNNN
* so we want to test its display length rather than buffer length.
*
* We don't have an actual display limit here, so have to go by the
* width of the map. Since we're reordering rather than truncating,
* wider displays can still show wider status than the map if the
* interface supports that.
*/
if ((dln - dx) + 1 + hln + 1 + xln + 1 + tln + 1 + cln <= COLNO) {
Sprintf(newbot2, "%s %s %s %s %s", dloc, hlth, expr, tmmv, cond);
} else {
if (dln + 1 + hln + 1 + xln + 1 + tln + 1 + cln + 1 > MAXCO) {
panic("bot2: second status line exceeds MAXCO (%u > %d)",
(dln + 1 + hln + 1 + xln + 1 + tln + 1 + cln + 1), MAXCO);
} else if ((dln - dx) + 1 + hln + 1 + xln + 1 + cln <= COLNO) {
Sprintf(newbot2, "%s %s %s %s %s", dloc, hlth, expr, cond, tmmv);
} else if ((dln - dx) + 1 + hln + 1 + cln <= COLNO) {
Sprintf(newbot2, "%s %s %s %s %s", dloc, hlth, cond, expr, tmmv);
} else {
Sprintf(newbot2, "%s %s %s %s %s", hlth, cond, dloc, expr, tmmv);
}
/* only two or three consecutive spaces available to squeeze out */
mungspaces(newbot2);
}
curs(WIN_STATUS, 1, 1); curs(WIN_STATUS, 1, 1);
putmixed(WIN_STATUS, 0, newbot2); putmixed(WIN_STATUS, 0, newbot2);
} }
@@ -302,11 +383,10 @@ struct istat_s {
STATIC_DCL void NDECL(init_blstats); STATIC_DCL void NDECL(init_blstats);
STATIC_DCL char *FDECL(anything_to_s, (char *, anything *, int)); STATIC_DCL char *FDECL(anything_to_s, (char *, anything *, int));
STATIC_DCL void FDECL(s_to_anything, (anything *, char *, int));
STATIC_OVL int FDECL(percentage, (struct istat_s *, struct istat_s *)); STATIC_OVL int FDECL(percentage, (struct istat_s *, struct istat_s *));
STATIC_OVL int FDECL(compare_blstats, (struct istat_s *, struct istat_s *)); STATIC_OVL int FDECL(compare_blstats, (struct istat_s *, struct istat_s *));
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
STATIC_DCL void FDECL(s_to_anything, (anything *, char *, int));
STATIC_DCL boolean FDECL(assign_hilite, (char *, char *, char *, char *, STATIC_DCL boolean FDECL(assign_hilite, (char *, char *, char *, char *,
BOOLEAN_P)); BOOLEAN_P));
STATIC_DCL const char *FDECL(clridx_to_s, (char *, int)); STATIC_DCL const char *FDECL(clridx_to_s, (char *, int));
@@ -340,35 +420,6 @@ STATIC_DCL struct istat_s initblstats[MAXBLSTATS] = {
{ (genericptr_t) 0 }, (char *) 0, 0, 0, BL_CONDITION} { (genericptr_t) 0 }, (char *) 0, 0, 0, BL_CONDITION}
}; };
static struct fieldid_t {
const char *fieldname;
enum statusfields fldid;
} fieldids[] = {
{"title", BL_TITLE},
{"strength", BL_STR},
{"dexterity", BL_DX},
{"constitution", BL_CO},
{"intelligence", BL_IN},
{"wisdom", BL_WI},
{"charisma", BL_CH},
{"alignment", BL_ALIGN},
{"score", BL_SCORE},
{"carrying-capacity", BL_CAP},
{"gold", BL_GOLD},
{"power", BL_ENE},
{"power-max", BL_ENEMAX},
{"experience-level", BL_XP},
{"armor-class", BL_AC},
{"HD", BL_HD},
{"time", BL_TIME},
{"hunger", BL_HUNGER},
{"hitpoints", BL_HP},
{"hitpoints-max", BL_HPMAX},
{"dungeon-level", BL_LEVELDESC},
{"experience", BL_EXP},
{"condition", BL_CONDITION},
};
struct istat_s blstats[2][MAXBLSTATS]; struct istat_s blstats[2][MAXBLSTATS];
static boolean blinit = FALSE, update_all = FALSE; static boolean blinit = FALSE, update_all = FALSE;
@@ -378,11 +429,11 @@ bot()
char buf[BUFSZ]; char buf[BUFSZ];
register char *nb; register char *nb;
static int idx = 0, idx_p, idxmax; static int idx = 0, idx_p, idxmax;
boolean updated = FALSE;
unsigned anytype; unsigned anytype;
long money;
int i, pc, chg, cap; int i, pc, chg, cap;
struct istat_s *curr, *prev; struct istat_s *curr, *prev;
boolean valset[MAXBLSTATS], chgval = FALSE; boolean valset[MAXBLSTATS], chgval = FALSE, updated = FALSE;
if (!blinit) if (!blinit)
panic("bot before init."); panic("bot before init.");
@@ -392,41 +443,35 @@ bot()
return; return;
} }
cap = near_capacity();
idx_p = idx; idx_p = idx;
idx = 1 - idx; /* 0 -> 1, 1 -> 0 */ idx = 1 - idx; /* 0 -> 1, 1 -> 0 */
/* clear the "value set" indicators */ /* clear the "value set" indicators */
(void) memset((genericptr_t) valset, 0, MAXBLSTATS * sizeof(boolean)); (void) memset((genericptr_t) valset, 0, MAXBLSTATS * sizeof (boolean));
/*
* Note: min(x,9999) - we enforce the same maximum on hp, maxhp,
* pw, maxpw, and gold as basic status formatting so that the two
* modes of status display don't produce different information.
*/
/* /*
* Player name and title. * Player name and title.
*/ */
buf[0] = '\0'; Strcpy(nb = buf, plname);
Strcpy(buf, plname); nb[0] = highc(nb[0]);
if ('a' <= buf[0] && buf[0] <= 'z') nb[10] = '\0';
buf[0] += 'A' - 'a'; Sprintf(nb = eos(nb), " the ");
buf[10] = 0;
Sprintf(nb = eos(buf), " the ");
if (Upolyd) { if (Upolyd) {
char mbot[BUFSZ]; for (i = 0, nb = strcpy(eos(nb), mons[u.umonnum].mname); nb[i]; i++)
int k = 0; if (i == 0 || nb[i - 1] == ' ')
nb[i] = highc(nb[i]);
Strcpy(mbot, mons[u.umonnum].mname);
while (mbot[k] != 0) {
if ((k == 0 || (k > 0 && mbot[k - 1] == ' ')) && 'a' <= mbot[k]
&& mbot[k] <= 'z')
mbot[k] += 'A' - 'a';
k++;
}
Sprintf1(nb = eos(nb), mbot);
} else } else
Sprintf1(nb = eos(nb), rank()); Strcpy(nb = eos(nb), rank());
Sprintf(blstats[idx][BL_TITLE].val, "%-29s", buf); Sprintf(blstats[idx][BL_TITLE].val, "%-29s", buf);
valset[BL_TITLE] = TRUE; /* indicate val already set */ valset[BL_TITLE] = TRUE; /* indicate val already set */
/* Strength */ /* Strength */
buf[0] = '\0'; buf[0] = '\0';
blstats[idx][BL_STR].a.a_int = ACURR(A_STR); blstats[idx][BL_STR].a.a_int = ACURR(A_STR);
if (ACURR(A_STR) > 18) { if (ACURR(A_STR) > 18) {
@@ -442,7 +487,6 @@ bot()
valset[BL_STR] = TRUE; /* indicate val already set */ valset[BL_STR] = TRUE; /* indicate val already set */
/* Dexterity, constitution, intelligence, wisdom, charisma. */ /* Dexterity, constitution, intelligence, wisdom, charisma. */
blstats[idx][BL_DX].a.a_int = ACURR(A_DEX); blstats[idx][BL_DX].a.a_int = ACURR(A_DEX);
blstats[idx][BL_CO].a.a_int = ACURR(A_CON); blstats[idx][BL_CO].a.a_int = ACURR(A_CON);
blstats[idx][BL_IN].a.a_int = ACURR(A_INT); blstats[idx][BL_IN].a.a_int = ACURR(A_INT);
@@ -450,135 +494,119 @@ bot()
blstats[idx][BL_CH].a.a_int = ACURR(A_CHA); blstats[idx][BL_CH].a.a_int = ACURR(A_CHA);
/* Alignment */ /* Alignment */
Strcpy(blstats[idx][BL_ALIGN].val, (u.ualign.type == A_CHAOTIC)
Strcpy(blstats[idx][BL_ALIGN].val,
(u.ualign.type == A_CHAOTIC)
? "Chaotic" ? "Chaotic"
: (u.ualign.type == A_NEUTRAL) ? "Neutral" : "Lawful"); : (u.ualign.type == A_NEUTRAL)
? "Neutral"
: "Lawful");
/* Score */ /* Score */
blstats[idx][BL_SCORE].a.a_long = blstats[idx][BL_SCORE].a.a_long =
#ifdef SCORE_ON_BOTL #ifdef SCORE_ON_BOTL
botl_score(); botl_score()
#else #else
0; 0L
#endif #endif
/* Hit points */ ;
blstats[idx][BL_HP].a.a_int = Upolyd ? u.mh : u.uhp; /* Hit points */
blstats[idx][BL_HPMAX].a.a_int = Upolyd ? u.mhmax : u.uhpmax; i = Upolyd ? u.mh : u.uhp;
if (blstats[idx][BL_HP].a.a_int < 0) if (i < 0)
blstats[idx][BL_HP].a.a_int = 0; i = 0;
blstats[idx][BL_HP].a.a_int = min(i, 9999);
i = Upolyd ? u.mhmax : u.uhpmax;
blstats[idx][BL_HPMAX].a.a_int = min(i, 9999);
/* Dungeon level. */ /* Dungeon level. */
(void) describe_level(blstats[idx][BL_LEVELDESC].val); (void) describe_level(blstats[idx][BL_LEVELDESC].val);
valset[BL_LEVELDESC] = TRUE; /* indicate val already set */ valset[BL_LEVELDESC] = TRUE; /* indicate val already set */
/* Gold */ /* Gold */
if ((money = money_cnt(invent)) < 0L)
blstats[idx][BL_GOLD].a.a_long = money_cnt(invent); money = 0L; /* ought to issue impossible() and then discard gold */
blstats[idx][BL_GOLD].a.a_long = min(money, 999999L);
/* /*
* The tty port needs to display the current symbol for gold * The tty port needs to display the current symbol for gold
* as a field header, so to accommodate that we pass gold with * as a field header, so to accommodate that we pass gold with
* that already included. If a window port needs to use the text * that already included. If a window port needs to use the text
* gold amount without the leading "$:" the port will have to * gold amount without the leading "$:" the port will have to
* add 2 to the value pointer it was passed in status_update() * skip past ':' to the value pointer it was passed in status_update()
* for the BL_GOLD case. * for the BL_GOLD case.
* *
* Another quirk of BL_GOLD is that the field display may have * Another quirk of BL_GOLD is that the field display may have
* changed if a new symbol set was loaded, or we entered or left * changed if a new symbol set was loaded, or we entered or left
* the rogue level. * the rogue level.
*
* The currency prefix is encoded as ten character \GXXXXNNNN
* sequence.
*/ */
Sprintf(blstats[idx][BL_GOLD].val, "%s:%ld", Sprintf(blstats[idx][BL_GOLD].val, "%s:%ld",
encglyph(objnum_to_glyph(GOLD_PIECE)), encglyph(objnum_to_glyph(GOLD_PIECE)),
blstats[idx][BL_GOLD].a.a_long); blstats[idx][BL_GOLD].a.a_long);
valset[BL_GOLD] = TRUE; /* indicate val already set */ valset[BL_GOLD] = TRUE; /* indicate val already set */
/* Power (magical energy) */ /* Power (magical energy) */
blstats[idx][BL_ENE].a.a_int = min(u.uen, 999);
blstats[idx][BL_ENE].a.a_int = u.uen; blstats[idx][BL_ENEMAX].a.a_int = min(u.uenmax, 999);
blstats[idx][BL_ENEMAX].a.a_int = u.uenmax;
/* Armor class */ /* Armor class */
blstats[idx][BL_AC].a.a_int = u.uac; blstats[idx][BL_AC].a.a_int = u.uac;
/* Monster level (if Upolyd) */ /* Monster level (if Upolyd) */
blstats[idx][BL_HD].a.a_int = Upolyd ? mons[u.umonnum].mlevel : 0;
if (Upolyd)
blstats[idx][BL_HD].a.a_int = mons[u.umonnum].mlevel;
else
blstats[idx][BL_HD].a.a_int = 0;
/* Experience */ /* Experience */
blstats[idx][BL_XP].a.a_int = u.ulevel; blstats[idx][BL_XP].a.a_int = u.ulevel;
blstats[idx][BL_EXP].a.a_int = u.uexp; blstats[idx][BL_EXP].a.a_int = u.uexp;
/* Time (moves) */ /* Time (moves) */
blstats[idx][BL_TIME].a.a_long = moves; blstats[idx][BL_TIME].a.a_long = moves;
/* Hunger */ /* Hunger */
blstats[idx][BL_HUNGER].a.a_uint = u.uhs; blstats[idx][BL_HUNGER].a.a_uint = u.uhs;
*(blstats[idx][BL_HUNGER].val) = '\0'; Strcpy(blstats[idx][BL_HUNGER].val,
if (strcmp(hu_stat[u.uhs], " ") != 0) (u.uhs != NOT_HUNGRY) ? hu_stat[u.uhs] : "");
Strcpy(blstats[idx][BL_HUNGER].val, hu_stat[u.uhs]);
valset[BL_HUNGER] = TRUE; valset[BL_HUNGER] = TRUE;
/* Carrying capacity */ /* Carrying capacity */
cap = near_capacity();
*(blstats[idx][BL_CAP].val) = '\0';
blstats[idx][BL_CAP].a.a_int = cap; blstats[idx][BL_CAP].a.a_int = cap;
if (cap > UNENCUMBERED) Strcpy(blstats[idx][BL_CAP].val,
Strcpy(blstats[idx][BL_CAP].val, enc_stat[cap]); (cap > UNENCUMBERED) ? enc_stat[cap] : "");
valset[BL_CAP] = TRUE; valset[BL_CAP] = TRUE;
/* Conditions */ /* Conditions */
blstats[idx][BL_CONDITION].a.a_ulong = 0L;
if (Stoned)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STONE;
if (Slimed)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_SLIME;
if (Strangled)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STRNGL;
if (Sick && (u.usick_type & SICK_VOMITABLE) != 0)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_FOODPOIS;
if (Sick && (u.usick_type & SICK_NONVOMITABLE) != 0)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_TERMILL;
/*
* basic formatting puts hunger status and encumbrance here
*/
if (Blind) if (Blind)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_BLIND; blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_BLIND;
else
blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_BLIND;
if (Deaf) if (Deaf)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_DEAF; blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_DEAF;
else if (Stunned)
blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_DEAF; blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STUN;
if (Confusion) if (Confusion)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_CONF; blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_CONF;
else
blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_CONF;
if (Sick && u.usick_type & SICK_VOMITABLE)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_FOODPOIS;
else
blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_FOODPOIS;
if (Sick && u.usick_type & SICK_NONVOMITABLE)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_ILL;
else
blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_ILL;
if (Hallucination) if (Hallucination)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_HALLU; blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_HALLU;
else /* levitation and flying are mututally exclusive */
blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_HALLU; if (Levitation)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_LEV;
if (Stunned) if (Flying)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STUNNED; blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_FLY;
else if (u.usteed)
blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_STUNNED; blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_RIDE;
if (Slimed)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_SLIMED;
else
blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_SLIMED;
/* /*
* Now pass the changed values to window port. * Now pass the changed values to window port.
@@ -594,10 +622,11 @@ bot()
curr = &blstats[idx][i]; curr = &blstats[idx][i];
prev = &blstats[idx_p][i]; prev = &blstats[idx_p][i];
chg = 0; chg = 0;
if (update_all || ((chg = compare_blstats(prev, curr)) != 0) if (update_all
|| ((chgval = (valset[i] && strcmp(blstats[idx][i].val, || ((chg = compare_blstats(prev, curr)) != 0)
blstats[idx_p][i].val))) || ((chgval = (valset[i]
!= 0)) { && strcmp(blstats[idx][i].val,
blstats[idx_p][i].val))) != 0)) {
idxmax = blstats[idx][i].idxmax; idxmax = blstats[idx][i].idxmax;
pc = (idxmax) ? percentage(curr, &blstats[idx][idxmax]) : 0; pc = (idxmax) ? percentage(curr, &blstats[idx][idxmax]) : 0;
if (!valset[i]) if (!valset[i])
@@ -606,9 +635,8 @@ bot()
status_update(i, (genericptr_t) curr->val, status_update(i, (genericptr_t) curr->val,
valset[i] ? chgval : chg, pc); valset[i] ? chgval : chg, pc);
} else { } else {
status_update(i,
/* send pointer to mask */ /* send pointer to mask */
(genericptr_t) &curr->a.a_ulong, chg, 0); status_update(i, (genericptr_t) &curr->a.a_ulong, chg, 0);
} }
updated = TRUE; updated = TRUE;
} }
@@ -637,8 +665,8 @@ boolean
reassessment; /* TRUE = just reassess fields w/o other initialization*/ reassessment; /* TRUE = just reassess fields w/o other initialization*/
{ {
int i; int i;
const char *fieldfmt = (const char *)0; const char *fieldfmt = (const char *) 0;
const char *fieldname = (const char *)0; const char *fieldname = (const char *) 0;
if (!reassessment) { if (!reassessment) {
init_blstats(); init_blstats();
@@ -868,6 +896,8 @@ int anytype;
return buf; return buf;
} }
#ifdef STATUS_HILITES
STATIC_OVL void STATIC_OVL void
s_to_anything(a, buf, anytype) s_to_anything(a, buf, anytype)
anything *a; anything *a;
@@ -916,6 +946,8 @@ int anytype;
return; return;
} }
#endif
STATIC_OVL int STATIC_OVL int
compare_blstats(bl1, bl2) compare_blstats(bl1, bl2)
struct istat_s *bl1, *bl2; struct istat_s *bl1, *bl2;
@@ -1047,6 +1079,35 @@ struct istat_s *bl, *maxbl;
/* Core status hiliting support */ /* Core status hiliting support */
/****************************************************************************/ /****************************************************************************/
static struct fieldid_t {
const char *fieldname;
enum statusfields fldid;
} fieldids[] = {
{"title", BL_TITLE},
{"strength", BL_STR},
{"dexterity", BL_DX},
{"constitution", BL_CO},
{"intelligence", BL_IN},
{"wisdom", BL_WI},
{"charisma", BL_CH},
{"alignment", BL_ALIGN},
{"score", BL_SCORE},
{"carrying-capacity", BL_CAP},
{"gold", BL_GOLD},
{"power", BL_ENE},
{"power-max", BL_ENEMAX},
{"experience-level", BL_XP},
{"armor-class", BL_AC},
{"HD", BL_HD},
{"time", BL_TIME},
{"hunger", BL_HUNGER},
{"hitpoints", BL_HP},
{"hitpoints-max", BL_HPMAX},
{"dungeon-level", BL_LEVELDESC},
{"experience", BL_EXP},
{"condition", BL_CONDITION},
};
struct hilite_s { struct hilite_s {
boolean set; boolean set;
unsigned anytype; unsigned anytype;
@@ -1118,6 +1179,7 @@ boolean from_configfile;
{ {
int i; int i;
anything it; anything it;
it = zeroany; it = zeroany;
for (i = 0; i < MAXBLSTATS; ++i) { for (i = 0; i < MAXBLSTATS; ++i) {
(void) memset((genericptr_t) &status_hilites[i], 0, (void) memset((genericptr_t) &status_hilites[i], 0,
@@ -1196,14 +1258,10 @@ boolean from_configfile;
/* actions */ /* actions */
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
if (!i) how = !i ? sc : sd;
how = sc;
else
how = sd;
if (!how) { if (!how) {
if (!i) if (!i)
return FALSE; return FALSE;
else
break; /* sc is mandatory; sd is not */ break; /* sc is mandatory; sd is not */
} }
@@ -1215,6 +1273,7 @@ boolean from_configfile;
normal[i] = TRUE; normal[i] = TRUE;
} else { } else {
int k = match_str2clr(how); int k = match_str2clr(how);
if (k >= CLR_MAX) if (k >= CLR_MAX)
return FALSE; return FALSE;
coloridx[i] = k; coloridx[i] = k;
@@ -1358,6 +1417,7 @@ int bufsiz;
text = "normal"; text = "normal";
} else { } else {
char *blank; char *blank;
(void) strcpy(colorname, c_obj_colors[coloridx]); (void) strcpy(colorname, c_obj_colors[coloridx]);
for (blank = index(colorname, ' '); blank; for (blank = index(colorname, ' '); blank;
blank = index(colorname, ' ')) blank = index(colorname, ' '))
@@ -1434,6 +1494,7 @@ status_hilite_menu()
for (i = 0; i < MAXBLSTATS; i++) { for (i = 0; i < MAXBLSTATS; i++) {
if (field_picks[i]) { if (field_picks[i]) {
menu_item *pick = (menu_item *) 0; menu_item *pick = (menu_item *) 0;
Sprintf(buf, "Threshold behavior options for %s:", Sprintf(buf, "Threshold behavior options for %s:",
fieldids[i].fieldname); fieldids[i].fieldname);
tmpwin = create_nhwindow(NHW_MENU); tmpwin = create_nhwindow(NHW_MENU);
+4 -2
View File
@@ -730,8 +730,9 @@ Amulet_on()
case AMULET_OF_STRANGULATION: case AMULET_OF_STRANGULATION:
if (can_be_strangled(&youmonst)) { if (can_be_strangled(&youmonst)) {
makeknown(AMULET_OF_STRANGULATION); makeknown(AMULET_OF_STRANGULATION);
pline("It constricts your throat!");
Strangled = 6L; Strangled = 6L;
context.botl = TRUE;
pline("It constricts your throat!");
} }
break; break;
case AMULET_OF_RESTFUL_SLEEP: { case AMULET_OF_RESTFUL_SLEEP: {
@@ -780,11 +781,12 @@ Amulet_off()
break; break;
case AMULET_OF_STRANGULATION: case AMULET_OF_STRANGULATION:
if (Strangled) { if (Strangled) {
Strangled = 0L;
context.botl = TRUE;
if (Breathless) if (Breathless)
Your("%s is no longer constricted!", body_part(NECK)); Your("%s is no longer constricted!", body_part(NECK));
else else
You("can breathe more easily!"); You("can breathe more easily!");
Strangled = 0L;
} }
break; break;
case AMULET_OF_RESTFUL_SLEEP: case AMULET_OF_RESTFUL_SLEEP:
+4 -1
View File
@@ -114,6 +114,7 @@ float_vs_flight()
BFlying |= I_SPECIAL; BFlying |= I_SPECIAL;
else else
BFlying &= ~I_SPECIAL; BFlying &= ~I_SPECIAL;
context.botl = TRUE;
} }
/* for changing into form that's immune to strangulation */ /* for changing into form that's immune to strangulation */
@@ -127,10 +128,11 @@ boolean on;
vulnerable form into another causes the counter to be reset */ vulnerable form into another causes the counter to be reset */
if (uamul && uamul->otyp == AMULET_OF_STRANGULATION if (uamul && uamul->otyp == AMULET_OF_STRANGULATION
&& can_be_strangled(&youmonst)) { && can_be_strangled(&youmonst)) {
Strangled = 6L;
context.botl = TRUE;
Your("%s %s your %s!", simpleonames(uamul), Your("%s %s your %s!", simpleonames(uamul),
Strangled ? "still constricts" : "begins constricting", Strangled ? "still constricts" : "begins constricting",
body_part(NECK)); /* "throat" */ body_part(NECK)); /* "throat" */
Strangled = 6L;
makeknown(AMULET_OF_STRANGULATION); makeknown(AMULET_OF_STRANGULATION);
} }
@@ -138,6 +140,7 @@ boolean on;
} else { } else {
if (Strangled && !can_be_strangled(&youmonst)) { if (Strangled && !can_be_strangled(&youmonst)) {
Strangled = 0L; Strangled = 0L;
context.botl = TRUE;
You("are no longer being strangled."); You("are no longer being strangled.");
} }
} }
+15 -24
View File
@@ -165,12 +165,12 @@ const char *msg;
if (Unaware) if (Unaware)
msg = 0; msg = 0;
#endif #endif
if ((!xtime && old) || (xtime && !old)) { set_itimeout(&Slimed, xtime);
if ((xtime != 0L) ^ (old != 0L)) {
context.botl = TRUE;
if (msg) if (msg)
pline1(msg); pline1(msg);
context.botl = 1;
} }
set_itimeout(&Slimed, xtime);
if (!Slimed) if (!Slimed)
dealloc_killer(find_delayed_killer(SLIMED)); dealloc_killer(find_delayed_killer(SLIMED));
} }
@@ -189,12 +189,12 @@ const char *killername;
if (Unaware) if (Unaware)
msg = 0; msg = 0;
#endif #endif
if ((!xtime && old) || (xtime && !old)) { set_itimeout(&Stoned, xtime);
if ((xtime != 0L) ^ (old != 0L)) {
context.botl = TRUE;
if (msg) if (msg)
pline1(msg); pline1(msg);
/* context.botl = 1; --- Stoned is not a status line item */
} }
set_itimeout(&Stoned, xtime);
if (!Stoned) if (!Stoned)
dealloc_killer(find_delayed_killer(STONED)); dealloc_killer(find_delayed_killer(STONED));
else if (!old) else if (!old)
@@ -211,11 +211,11 @@ boolean talk;
if (Unaware) if (Unaware)
talk = FALSE; talk = FALSE;
set_itimeout(&Vomiting, xtime);
context.botl = TRUE;
if (!xtime && old) if (!xtime && old)
if (talk) if (talk)
You_feel("much less nauseated now."); You_feel("much less nauseated now.");
set_itimeout(&Vomiting, xtime);
} }
static const char vismsg[] = "vision seems to %s for a moment but is %s now."; static const char vismsg[] = "vision seems to %s for a moment but is %s now.";
@@ -292,7 +292,7 @@ boolean talk;
set_itimeout(&Blinded, xtime); set_itimeout(&Blinded, xtime);
if (u_could_see ^ can_see_now) { /* one or the other but not both */ if (u_could_see ^ can_see_now) { /* one or the other but not both */
context.botl = 1; context.botl = TRUE;
vision_full_recalc = 1; /* blindness just got toggled */ vision_full_recalc = 1; /* blindness just got toggled */
/* this vision recalculation used to be deferred until /* this vision recalculation used to be deferred until
moveloop(), but that made it possible for vision moveloop(), but that made it possible for vision
@@ -383,7 +383,7 @@ long mask; /* nonzero if resistance status should change by mask */
(eg. Qt windowport's equipped items display) */ (eg. Qt windowport's equipped items display) */
update_inventory(); update_inventory();
context.botl = 1; context.botl = TRUE;
if (talk) if (talk)
pline(message, verb); pline(message, verb);
} }
@@ -396,25 +396,16 @@ long xtime;
boolean talk; boolean talk;
{ {
long old = HDeaf; long old = HDeaf;
boolean toggled = FALSE;
if (Unaware) if (Unaware)
talk = FALSE; talk = FALSE;
if (!xtime && old) {
if (talk)
You("can hear again.");
toggled = TRUE;
} else if (xtime && !old) {
if (talk)
You("are unable to hear anything.");
toggled = TRUE;
}
/* request a status update */
if (toggled)
context.botl = TRUE;
set_itimeout(&HDeaf, xtime); set_itimeout(&HDeaf, xtime);
if ((xtime != 0L) ^ (old != 0L)) {
context.botl = TRUE;
if (talk)
You(old ? "can hear again." : "are unable to hear anything.");
}
} }
STATIC_OVL void STATIC_OVL void
+5 -4
View File
@@ -285,7 +285,7 @@ boolean force; /* Quietly force this animal */
} }
if (!can_saddle(mtmp) || !can_ride(mtmp)) { if (!can_saddle(mtmp) || !can_ride(mtmp)) {
You_cant("ride such a creature."); You_cant("ride such a creature.");
return (0); return FALSE;
} }
/* Is the player impaired? */ /* Is the player impaired? */
@@ -332,7 +332,8 @@ boolean force; /* Quietly force this animal */
u.usteed = mtmp; u.usteed = mtmp;
remove_monster(mtmp->mx, mtmp->my); remove_monster(mtmp->mx, mtmp->my);
teleds(mtmp->mx, mtmp->my, TRUE); teleds(mtmp->mx, mtmp->my, TRUE);
return (TRUE); context.botl = TRUE;
return TRUE;
} }
/* You and your steed have moved */ /* You and your steed have moved */
@@ -610,11 +611,11 @@ int reason; /* Player was thrown off etc. */
in_steed_dismounting = TRUE; in_steed_dismounting = TRUE;
(void) float_down(0L, W_SADDLE); (void) float_down(0L, W_SADDLE);
in_steed_dismounting = FALSE; in_steed_dismounting = FALSE;
context.botl = 1; context.botl = TRUE;
(void) encumber_msg(); (void) encumber_msg();
vision_full_recalc = 1; vision_full_recalc = 1;
} else } else
context.botl = 1; context.botl = TRUE;
/* polearms behave differently when not mounted */ /* polearms behave differently when not mounted */
if (uwep && is_pole(uwep)) if (uwep && is_pole(uwep))
unweapon = TRUE; unweapon = TRUE;
+2
View File
@@ -2733,6 +2733,7 @@ boolean byplayer;
void void
float_up() float_up()
{ {
context.botl = TRUE;
if (u.utrap) { if (u.utrap) {
if (u.utraptype == TT_PIT) { if (u.utraptype == TT_PIT) {
u.utrap = 0; u.utrap = 0;
@@ -2811,6 +2812,7 @@ long hmask, emask; /* might cancel timeout */
float_vs_flight(); /* before nomul() rather than after */ float_vs_flight(); /* before nomul() rather than after */
return 0; return 0;
} }
context.botl = TRUE;
nomul(0); /* stop running or resting */ nomul(0); /* stop running or resting */
if (BFlying) { if (BFlying) {
/* controlled flight no longer overridden by levitation */ /* controlled flight no longer overridden by levitation */
+25 -11
View File
@@ -751,8 +751,9 @@ hup_get_color_string(VOID_ARGS)
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
hup_status_update(idx, ptr, chg, percent) hup_status_update(idx, ptr, chg, percent)
int idx UNUSED, chg UNUSED, percent UNUSED; int idx UNUSED;
genericptr_t ptr UNUSED; genericptr_t ptr UNUSED;
int chg UNUSED, percent UNUSED;
{ {
return; return;
} }
@@ -855,8 +856,9 @@ boolean enable;
void void
genl_status_update(idx, ptr, chg, percent) genl_status_update(idx, ptr, chg, percent)
int idx, chg, percent; int idx;
genericptr_t ptr; genericptr_t ptr;
int chg UNUSED, percent UNUSED;
{ {
char newbot1[MAXCO], newbot2[MAXCO]; char newbot1[MAXCO], newbot2[MAXCO];
long cond, *condptr = (long *) ptr; long cond, *condptr = (long *) ptr;
@@ -879,20 +881,32 @@ genericptr_t ptr;
case BL_CONDITION: case BL_CONDITION:
cond = *condptr; cond = *condptr;
*status_vals[idx] = '\0'; *status_vals[idx] = '\0';
if (cond & BL_MASK_BLIND) if (cond & BL_MASK_STONE)
Strcat(status_vals[idx], " Blind"); Strcat(status_vals[idx], " Stone");
if (cond & BL_MASK_CONF) if (cond & BL_MASK_SLIME)
Strcat(status_vals[idx], " Conf"); Strcat(status_vals[idx], " Slime");
if (cond & BL_MASK_STRNGL)
Strcat(status_vals[idx], " Strngl");
if (cond & BL_MASK_FOODPOIS) if (cond & BL_MASK_FOODPOIS)
Strcat(status_vals[idx], " FoodPois"); Strcat(status_vals[idx], " FoodPois");
if (cond & BL_MASK_ILL) if (cond & BL_MASK_TERMILL)
Strcat(status_vals[idx], " Ill"); Strcat(status_vals[idx], " TermIll");
if (cond & BL_MASK_STUNNED) if (cond & BL_MASK_BLIND)
Strcat(status_vals[idx], " Blind");
if (cond & BL_MASK_DEAF)
Strcat(status_vals[idx], " Deaf");
if (cond & BL_MASK_STUN)
Strcat(status_vals[idx], " Stun"); Strcat(status_vals[idx], " Stun");
if (cond & BL_MASK_CONF)
Strcat(status_vals[idx], " Conf");
if (cond & BL_MASK_HALLU) if (cond & BL_MASK_HALLU)
Strcat(status_vals[idx], " Hallu"); Strcat(status_vals[idx], " Hallu");
if (cond & BL_MASK_SLIMED) if (cond & BL_MASK_LEV)
Strcat(status_vals[idx], " Slime"); Strcat(status_vals[idx], " Lev");
if (cond & BL_MASK_FLY)
Strcat(status_vals[idx], " Fly");
if (cond & BL_MASK_RIDE)
Strcat(status_vals[idx], " Ride");
break; break;
default: default:
Sprintf(status_vals[idx], Sprintf(status_vals[idx],
+59 -30
View File
@@ -3387,17 +3387,23 @@ tty_status_init()
* -- ptr is usually a "char *", unless fldindex is BL_CONDITION. * -- ptr is usually a "char *", unless fldindex is BL_CONDITION.
* If fldindex is BL_CONDITION, then ptr is a long value with * If fldindex is BL_CONDITION, then ptr is a long value with
* any or none of the following bits set (from botl.h): * any or none of the following bits set (from botl.h):
* BL_MASK_BLIND 0x00000001L * BL_MASK_STONE 0x00000001L
* BL_MASK_CONF 0x00000002L * BL_MASK_SLIME 0x00000002L
* BL_MASK_FOODPOIS 0x00000004L * BL_MASK_STRNGL 0x00000004L
* BL_MASK_ILL 0x00000008L * BL_MASK_FOODPOIS 0x00000008L
* BL_MASK_HALLU 0x00000010L * BL_MASK_TERMILL 0x00000010L
* BL_MASK_STUNNED 0x00000020L * BL_MASK_BLIND 0x00000020L
* BL_MASK_SLIMED 0x00000040L * BL_MASK_DEAF 0x00000040L
* -- The value passed for BL_GOLD includes a leading * BL_MASK_STUN 0x00000080L
* symbol for GOLD "$:nnn". If the window port needs to use * BL_MASK_CONF 0x00000100L
* the textual gold amount without the leading "$:" the port * BL_MASK_HALLU 0x00000200L
* will have to add 2 to the passed "ptr" for the BL_GOLD case. * BL_MASK_LEV 0x00000400L
* BL_MASK_FLY 0x00000800L
* BL_MASK_RIDE 0x00001000L
* -- The value passed for BL_GOLD includes an encoded leading
* symbol for GOLD "\GXXXXNNNN:nnn". If the window port needs to use
* the textual gold amount without the leading "$:" the port will
* have to skip past ':' in the passed "ptr" for the BL_GOLD case.
*/ */
void void
tty_status_update(fldidx, ptr, chg, percent) tty_status_update(fldidx, ptr, chg, percent)
@@ -3412,8 +3418,6 @@ genericptr_t ptr;
* BL_HILITE_INVERSE -2 + 3 = 1 (statusattr[1]) * BL_HILITE_INVERSE -2 + 3 = 1 (statusattr[1])
* BL_HILITE_BOLD -3 + 3 = 0 (statusattr[0]) * BL_HILITE_BOLD -3 + 3 = 0 (statusattr[0])
*/ */
int statusattr[] = { ATR_BOLD, ATR_INVERSE, ATR_NONE };
int attridx = 0;
long value = -1L; long value = -1L;
static boolean beenhere = FALSE; static boolean beenhere = FALSE;
enum statusfields fieldorder[2][15] = { enum statusfields fieldorder[2][15] = {
@@ -3424,6 +3428,13 @@ genericptr_t ptr;
BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER, BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
BL_CAP, BL_CONDITION, BL_FLUSH } BL_CAP, BL_CONDITION, BL_FLUSH }
}; };
#ifdef STATUS_HILITES
static int statusattr[] = { ATR_BOLD, ATR_INVERSE, ATR_NONE };
int attridx = 0;
#else
nhUse(chg);
nhUse(percent);
#endif
if (fldidx != BL_FLUSH) { if (fldidx != BL_FLUSH) {
if (!status_activefields[fldidx]) if (!status_activefields[fldidx])
@@ -3432,20 +3443,32 @@ genericptr_t ptr;
case BL_CONDITION: case BL_CONDITION:
cond = *condptr; cond = *condptr;
*status_vals[fldidx] = '\0'; *status_vals[fldidx] = '\0';
if (cond & BL_MASK_BLIND) if (cond & BL_MASK_STONE)
Strcat(status_vals[fldidx], " Blind"); Strcat(status_vals[fldidx], " Stone");
if (cond & BL_MASK_CONF) if (cond & BL_MASK_SLIME)
Strcat(status_vals[fldidx], " Conf"); Strcat(status_vals[fldidx], " Slime");
if (cond & BL_MASK_STRNGL)
Strcat(status_vals[fldidx], " Strngl");
if (cond & BL_MASK_FOODPOIS) if (cond & BL_MASK_FOODPOIS)
Strcat(status_vals[fldidx], " FoodPois"); Strcat(status_vals[fldidx], " FoodPois");
if (cond & BL_MASK_ILL) if (cond & BL_MASK_TERMILL)
Strcat(status_vals[fldidx], " Ill"); Strcat(status_vals[fldidx], " TermIll");
if (cond & BL_MASK_STUNNED) if (cond & BL_MASK_BLIND)
Strcat(status_vals[fldidx], " Blind");
if (cond & BL_MASK_DEAF)
Strcat(status_vals[fldidx], " Deaf");
if (cond & BL_MASK_STUN)
Strcat(status_vals[fldidx], " Stun"); Strcat(status_vals[fldidx], " Stun");
if (cond & BL_MASK_CONF)
Strcat(status_vals[fldidx], " Conf");
if (cond & BL_MASK_HALLU) if (cond & BL_MASK_HALLU)
Strcat(status_vals[fldidx], " Hallu"); Strcat(status_vals[fldidx], " Hallu");
if (cond & BL_MASK_SLIMED) if (cond & BL_MASK_LEV)
Strcat(status_vals[fldidx], " Slime"); Strcat(status_vals[fldidx], " Lev");
if (cond & BL_MASK_FLY)
Strcat(status_vals[fldidx], " Fly");
if (cond & BL_MASK_RIDE)
Strcat(status_vals[fldidx], " Ride");
value = cond; value = cond;
break; break;
default: default:
@@ -3554,22 +3577,25 @@ genericptr_t ptr;
int fldidx1 = fieldorder[0][i]; int fldidx1 = fieldorder[0][i];
if (status_activefields[fldidx1]) { if (status_activefields[fldidx1]) {
if (tty_status_colors[fldidx1] < 0 && #ifdef STATUS_HILITES
tty_status_colors[fldidx1] >= -3) { if (tty_status_colors[fldidx1] < 0
&& tty_status_colors[fldidx1] >= -3) {
/* attribute, not a color */ /* attribute, not a color */
attridx = tty_status_colors[fldidx1] + 3; attridx = tty_status_colors[fldidx1] + 3;
term_start_attr(statusattr[attridx]); term_start_attr(statusattr[attridx]);
putstr(WIN_STATUS, 0, status_vals[fldidx1]); putstr(WIN_STATUS, 0, status_vals[fldidx1]);
term_end_attr(statusattr[attridx]); term_end_attr(statusattr[attridx]);
} else
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
} else if (tty_status_colors[fldidx1] != CLR_MAX) { if (tty_status_colors[fldidx1] != CLR_MAX) {
if (tty_status_colors[fldidx1] != NO_COLOR) if (tty_status_colors[fldidx1] != NO_COLOR)
term_start_color(tty_status_colors[fldidx1]); term_start_color(tty_status_colors[fldidx1]);
putstr(WIN_STATUS, 0, status_vals[fldidx1]); putstr(WIN_STATUS, 0, status_vals[fldidx1]);
if (tty_status_colors[fldidx1] != NO_COLOR) if (tty_status_colors[fldidx1] != NO_COLOR)
term_end_color(); term_end_color();
#endif
} else } else
#endif
#endif /* STATUS_HILITES */
putstr(WIN_STATUS, 0, status_vals[fldidx1]); putstr(WIN_STATUS, 0, status_vals[fldidx1]);
} }
} }
@@ -3578,15 +3604,17 @@ genericptr_t ptr;
int fldidx2 = fieldorder[1][i]; int fldidx2 = fieldorder[1][i];
if (status_activefields[fldidx2]) { if (status_activefields[fldidx2]) {
if (tty_status_colors[fldidx2] < 0 && #ifdef STATUS_HILITES
tty_status_colors[fldidx2] >= -3) { if (tty_status_colors[fldidx2] < 0
&& tty_status_colors[fldidx2] >= -3) {
/* attribute, not a color */ /* attribute, not a color */
attridx = tty_status_colors[fldidx2] + 3; attridx = tty_status_colors[fldidx2] + 3;
term_start_attr(statusattr[attridx]); term_start_attr(statusattr[attridx]);
putstr(WIN_STATUS, 0, status_vals[fldidx2]); putstr(WIN_STATUS, 0, status_vals[fldidx2]);
term_end_attr(statusattr[attridx]); term_end_attr(statusattr[attridx]);
} else
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
} else if (tty_status_colors[fldidx2] != CLR_MAX) { if (tty_status_colors[fldidx2] != CLR_MAX) {
if (tty_status_colors[fldidx2] != NO_COLOR) if (tty_status_colors[fldidx2] != NO_COLOR)
term_start_color(tty_status_colors[fldidx2]); term_start_color(tty_status_colors[fldidx2]);
if (fldidx2 == BL_GOLD) { if (fldidx2 == BL_GOLD) {
@@ -3597,8 +3625,9 @@ genericptr_t ptr;
} }
if (tty_status_colors[fldidx2] != NO_COLOR) if (tty_status_colors[fldidx2] != NO_COLOR)
term_end_color(); term_end_color();
#endif
} else } else
#endif
#endif /* STATUS_HILITES */
putstr(WIN_STATUS, 0, status_vals[fldidx2]); putstr(WIN_STATUS, 0, status_vals[fldidx2]);
} }
} }
+38 -21
View File
@@ -2819,18 +2819,23 @@ status_update(int fldindex, genericptr_t ptr, int chg, int percentage)
-- ptr is usually a "char *", unless fldindex is BL_CONDITION. -- ptr is usually a "char *", unless fldindex is BL_CONDITION.
If fldindex is BL_CONDITION, then ptr is a long value with If fldindex is BL_CONDITION, then ptr is a long value with
any or none of the following bits set (from botl.h): any or none of the following bits set (from botl.h):
BL_MASK_BLIND 0x00000001L BL_MASK_STONE 0x00000001L
BL_MASK_CONF 0x00000002L BL_MASK_SLIME 0x00000002L
BL_MASK_FOODPOIS 0x00000004L BL_MASK_STRNGL 0x00000004L
BL_MASK_ILL 0x00000008L BL_MASK_FOODPOIS 0x00000008L
BL_MASK_HALLU 0x00000010L BL_MASK_TERMILL 0x00000010L
BL_MASK_STUNNED 0x00000020L BL_MASK_BLIND 0x00000020L
BL_MASK_SLIMED 0x00000040L BL_MASK_DEAF 0x00000040L
-- The value passed for BL_GOLD includes a leading BL_MASK_STUN 0x00000080L
symbol for GOLD "$:nnn". If the window port needs to use BL_MASK_CONF 0x00000100L
the textual gold amount without the leading "$:" the port BL_MASK_HALLU 0x00000200L
will have to add 2 to the passed "ptr" for the BL_GOLD BL_MASK_LEV 0x00000400L
case. BL_MASK_FLY 0x00000800L
BL_MASK_RIDE 0x00001000L
-- The value passed for BL_GOLD includes an encoded leading
symbol for GOLD "\GXXXXNNNN:nnn". If window port needs
textual gold amount without the leading "$:" the port will
have to skip past ':' in passed "ptr" for the BL_GOLD case.
*/ */
void void
mswin_status_update(int idx, genericptr_t ptr, int chg, int percent) mswin_status_update(int idx, genericptr_t ptr, int chg, int percent)
@@ -2851,20 +2856,32 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent)
case BL_CONDITION: { case BL_CONDITION: {
cond = *condptr; cond = *condptr;
*_status_vals[idx] = '\0'; *_status_vals[idx] = '\0';
if (cond & BL_MASK_BLIND) if (cond & BL_MASK_STONE)
Strcat(_status_vals[idx], " Blind"); Strcat(_status_vals[idx], " Stone");
if (cond & BL_MASK_CONF) if (cond & BL_MASK_SLIME)
Strcat(_status_vals[idx], " Conf"); Strcat(_status_vals[idx], " Slime");
if (cond & BL_MASK_STRNGL)
Strcat(_status_vals[idx], " Strngl");
if (cond & BL_MASK_FOODPOIS) if (cond & BL_MASK_FOODPOIS)
Strcat(_status_vals[idx], " FoodPois"); Strcat(_status_vals[idx], " FoodPois");
if (cond & BL_MASK_ILL) if (cond & BL_MASK_TERMILL)
Strcat(_status_vals[idx], " Ill"); Strcat(_status_vals[idx], " TermIll");
if (cond & BL_MASK_STUNNED) if (cond & BL_MASK_BLIND)
Strcat(_status_vals[idx], " Blind");
if (cond & BL_MASK_DEAF)
Strcat(_status_vals[idx], " Deaf");
if (cond & BL_MASK_STUN)
Strcat(_status_vals[idx], " Stun"); Strcat(_status_vals[idx], " Stun");
if (cond & BL_MASK_CONF)
Strcat(_status_vals[idx], " Conf");
if (cond & BL_MASK_HALLU) if (cond & BL_MASK_HALLU)
Strcat(_status_vals[idx], " Hallu"); Strcat(_status_vals[idx], " Hallu");
if (cond & BL_MASK_SLIMED) if (cond & BL_MASK_LEV)
Strcat(_status_vals[idx], " Slime"); Strcat(_status_vals[idx], " Lev");
if (cond & BL_MASK_FLY)
Strcat(_status_vals[idx], " Fly");
if (cond & BL_MASK_RIDE)
Strcat(_status_vals[idx], " Ride");
value = cond; value = cond;
} break; } break;
case BL_GOLD: { case BL_GOLD: {