STATIC_OVL void
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;
- int hp, hpmax;
- int cap = near_capacity();
+ unsigned dln, dx, hln, xln, tln, cln;
+ 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;
hpmax = Upolyd ? u.mhmax : u.uhpmax;
-
if (hp < 0)
hp = 0;
- (void) describe_level(newbot2);
- Sprintf(nb = eos(newbot2), "%s:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d",
- encglyph(objnum_to_glyph(GOLD_PIECE)), money_cnt(invent), hp,
- hpmax, u.uen, u.uenmax, u.uac);
+ Sprintf(hlth, "HP:%d(%d) Pw:%d(%d) AC:%-2d",
+ min(hp, 9999), min(hpmax, 9999),
+ min(u.uen, 999), min(u.uenmax, 999), u.uac);
+ hln = strlen(hlth);
+ /* experience */
if (Upolyd)
- Sprintf(nb = eos(nb), " HD:%d", mons[u.umonnum].mlevel);
+ Sprintf(expr, "HD:%d", mons[u.umonnum].mlevel);
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
- Sprintf(nb = eos(nb), " Exp:%u", u.ulevel);
+ Sprintf(expr, "Exp:%u", u.ulevel);
+ xln = strlen(expr);
+ /* time/move counter */
if (flags.time)
- Sprintf(nb = eos(nb), " T:%ld", moves);
- if (strcmp(hu_stat[u.uhs], " ")) {
- Sprintf(nb = eos(nb), " ");
- Strcat(newbot2, hu_stat[u.uhs]);
- }
- if (Confusion)
- Sprintf(nb = eos(nb), " Conf");
+ Sprintf(tmmv, "T:%ld", moves);
+ else
+ tmmv[0] = '\0';
+ tln = strlen(tmmv);
+
+ /* status conditions; worst ones first */
+ 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 (u.usick_type & SICK_VOMITABLE)
- Sprintf(nb = eos(nb), " FoodPois");
+ Strcpy(nb = eos(nb), " FoodPois");
if (u.usick_type & SICK_NONVOMITABLE)
- Sprintf(nb = eos(nb), " Ill");
+ Strcpy(nb = eos(nb), " TermIll");
}
+ if (u.uhs != NOT_HUNGRY)
+ Sprintf(nb = eos(nb), " %s", hu_stat[u.uhs]);
+ if ((cap = near_capacity()) > UNENCUMBERED)
+ Sprintf(nb = eos(nb), " %s", enc_stat[cap]);
if (Blind)
- Sprintf(nb = eos(nb), " Blind");
+ Strcpy(nb = eos(nb), " Blind");
+ if (Deaf)
+ Strcpy(nb = eos(nb), " Deaf");
if (Stunned)
- Sprintf(nb = eos(nb), " Stun");
+ Strcpy(nb = eos(nb), " Stun");
+ if (Confusion)
+ Strcpy(nb = eos(nb), " Conf");
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]);
+ 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);
putmixed(WIN_STATUS, 0, newbot2);
}
STATIC_DCL void NDECL(init_blstats);
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(compare_blstats, (struct istat_s *, struct istat_s *));
-
#ifdef STATUS_HILITES
+STATIC_DCL void FDECL(s_to_anything, (anything *, char *, int));
STATIC_DCL boolean FDECL(assign_hilite, (char *, char *, char *, char *,
BOOLEAN_P));
STATIC_DCL const char *FDECL(clridx_to_s, (char *, int));
{ (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];
static boolean blinit = FALSE, update_all = FALSE;
char buf[BUFSZ];
register char *nb;
static int idx = 0, idx_p, idxmax;
- boolean updated = FALSE;
unsigned anytype;
+ long money;
int i, pc, chg, cap;
struct istat_s *curr, *prev;
- boolean valset[MAXBLSTATS], chgval = FALSE;
+ boolean valset[MAXBLSTATS], chgval = FALSE, updated = FALSE;
if (!blinit)
panic("bot before init.");
return;
}
- cap = near_capacity();
idx_p = idx;
idx = 1 - idx; /* 0 -> 1, 1 -> 0 */
/* 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.
*/
- buf[0] = '\0';
- Strcpy(buf, plname);
- if ('a' <= buf[0] && buf[0] <= 'z')
- buf[0] += 'A' - 'a';
- buf[10] = 0;
- Sprintf(nb = eos(buf), " the ");
+ Strcpy(nb = buf, plname);
+ nb[0] = highc(nb[0]);
+ nb[10] = '\0';
+ Sprintf(nb = eos(nb), " the ");
if (Upolyd) {
- char mbot[BUFSZ];
- int k = 0;
-
- 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);
+ for (i = 0, nb = strcpy(eos(nb), mons[u.umonnum].mname); nb[i]; i++)
+ if (i == 0 || nb[i - 1] == ' ')
+ nb[i] = highc(nb[i]);
} else
- Sprintf1(nb = eos(nb), rank());
+ Strcpy(nb = eos(nb), rank());
Sprintf(blstats[idx][BL_TITLE].val, "%-29s", buf);
valset[BL_TITLE] = TRUE; /* indicate val already set */
/* Strength */
-
buf[0] = '\0';
blstats[idx][BL_STR].a.a_int = ACURR(A_STR);
if (ACURR(A_STR) > 18) {
valset[BL_STR] = TRUE; /* indicate val already set */
/* Dexterity, constitution, intelligence, wisdom, charisma. */
-
blstats[idx][BL_DX].a.a_int = ACURR(A_DEX);
blstats[idx][BL_CO].a.a_int = ACURR(A_CON);
blstats[idx][BL_IN].a.a_int = ACURR(A_INT);
blstats[idx][BL_CH].a.a_int = ACURR(A_CHA);
/* Alignment */
-
- Strcpy(blstats[idx][BL_ALIGN].val,
- (u.ualign.type == A_CHAOTIC)
- ? "Chaotic"
- : (u.ualign.type == A_NEUTRAL) ? "Neutral" : "Lawful");
+ Strcpy(blstats[idx][BL_ALIGN].val, (u.ualign.type == A_CHAOTIC)
+ ? "Chaotic"
+ : (u.ualign.type == A_NEUTRAL)
+ ? "Neutral"
+ : "Lawful");
/* Score */
-
blstats[idx][BL_SCORE].a.a_long =
#ifdef SCORE_ON_BOTL
- botl_score();
+ botl_score()
#else
- 0;
+ 0L
#endif
- /* Hit points */
+ ;
- blstats[idx][BL_HP].a.a_int = Upolyd ? u.mh : u.uhp;
- blstats[idx][BL_HPMAX].a.a_int = Upolyd ? u.mhmax : u.uhpmax;
- if (blstats[idx][BL_HP].a.a_int < 0)
- blstats[idx][BL_HP].a.a_int = 0;
+ /* Hit points */
+ i = Upolyd ? u.mh : u.uhp;
+ if (i < 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. */
-
(void) describe_level(blstats[idx][BL_LEVELDESC].val);
valset[BL_LEVELDESC] = TRUE; /* indicate val already set */
/* Gold */
-
- blstats[idx][BL_GOLD].a.a_long = money_cnt(invent);
+ if ((money = money_cnt(invent)) < 0L)
+ 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
* as a field header, so to accommodate that we pass gold with
* that already included. If a window port needs to use the text
* 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.
*
* 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
* the rogue level.
+ *
+ * The currency prefix is encoded as ten character \GXXXXNNNN
+ * sequence.
*/
-
Sprintf(blstats[idx][BL_GOLD].val, "%s:%ld",
encglyph(objnum_to_glyph(GOLD_PIECE)),
blstats[idx][BL_GOLD].a.a_long);
valset[BL_GOLD] = TRUE; /* indicate val already set */
/* Power (magical energy) */
-
- blstats[idx][BL_ENE].a.a_int = u.uen;
- blstats[idx][BL_ENEMAX].a.a_int = u.uenmax;
+ blstats[idx][BL_ENE].a.a_int = min(u.uen, 999);
+ blstats[idx][BL_ENEMAX].a.a_int = min(u.uenmax, 999);
/* Armor class */
-
blstats[idx][BL_AC].a.a_int = u.uac;
/* Monster level (if Upolyd) */
-
- if (Upolyd)
- blstats[idx][BL_HD].a.a_int = mons[u.umonnum].mlevel;
- else
- blstats[idx][BL_HD].a.a_int = 0;
+ blstats[idx][BL_HD].a.a_int = Upolyd ? mons[u.umonnum].mlevel : 0;
/* Experience */
-
blstats[idx][BL_XP].a.a_int = u.ulevel;
blstats[idx][BL_EXP].a.a_int = u.uexp;
/* Time (moves) */
-
blstats[idx][BL_TIME].a.a_long = moves;
/* Hunger */
-
blstats[idx][BL_HUNGER].a.a_uint = u.uhs;
- *(blstats[idx][BL_HUNGER].val) = '\0';
- if (strcmp(hu_stat[u.uhs], " ") != 0)
- Strcpy(blstats[idx][BL_HUNGER].val, hu_stat[u.uhs]);
+ Strcpy(blstats[idx][BL_HUNGER].val,
+ (u.uhs != NOT_HUNGRY) ? hu_stat[u.uhs] : "");
valset[BL_HUNGER] = TRUE;
/* Carrying capacity */
-
- *(blstats[idx][BL_CAP].val) = '\0';
+ cap = near_capacity();
blstats[idx][BL_CAP].a.a_int = cap;
- if (cap > UNENCUMBERED)
- Strcpy(blstats[idx][BL_CAP].val, enc_stat[cap]);
+ Strcpy(blstats[idx][BL_CAP].val,
+ (cap > UNENCUMBERED) ? enc_stat[cap] : "");
valset[BL_CAP] = TRUE;
/* 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)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_BLIND;
- else
- blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_BLIND;
-
if (Deaf)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_DEAF;
- else
- blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_DEAF;
-
+ if (Stunned)
+ blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STUN;
if (Confusion)
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)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_HALLU;
- else
- blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_HALLU;
-
- if (Stunned)
- blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STUNNED;
- else
- blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_STUNNED;
-
- if (Slimed)
- blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_SLIMED;
- else
- blstats[idx][BL_CONDITION].a.a_ulong &= ~BL_MASK_SLIMED;
+ /* levitation and flying are mututally exclusive */
+ if (Levitation)
+ blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_LEV;
+ if (Flying)
+ blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_FLY;
+ if (u.usteed)
+ blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_RIDE;
/*
* Now pass the changed values to window port.
curr = &blstats[idx][i];
prev = &blstats[idx_p][i];
chg = 0;
- if (update_all || ((chg = compare_blstats(prev, curr)) != 0)
- || ((chgval = (valset[i] && strcmp(blstats[idx][i].val,
- blstats[idx_p][i].val)))
- != 0)) {
+ if (update_all
+ || ((chg = compare_blstats(prev, curr)) != 0)
+ || ((chgval = (valset[i]
+ && strcmp(blstats[idx][i].val,
+ blstats[idx_p][i].val))) != 0)) {
idxmax = blstats[idx][i].idxmax;
pc = (idxmax) ? percentage(curr, &blstats[idx][idxmax]) : 0;
if (!valset[i])
status_update(i, (genericptr_t) curr->val,
valset[i] ? chgval : chg, pc);
} else {
- status_update(i,
- /* send pointer to mask */
- (genericptr_t) &curr->a.a_ulong, chg, 0);
+ /* send pointer to mask */
+ status_update(i, (genericptr_t) &curr->a.a_ulong, chg, 0);
}
updated = TRUE;
}
reassessment; /* TRUE = just reassess fields w/o other initialization*/
{
int i;
- const char *fieldfmt = (const char *)0;
- const char *fieldname = (const char *)0;
+ const char *fieldfmt = (const char *) 0;
+ const char *fieldname = (const char *) 0;
if (!reassessment) {
init_blstats();
return buf;
}
+#ifdef STATUS_HILITES
+
STATIC_OVL void
s_to_anything(a, buf, anytype)
anything *a;
return;
}
+#endif
+
STATIC_OVL int
compare_blstats(bl1, bl2)
struct istat_s *bl1, *bl2;
/* 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 {
boolean set;
unsigned anytype;
{
int i;
anything it;
+
it = zeroany;
for (i = 0; i < MAXBLSTATS; ++i) {
(void) memset((genericptr_t) &status_hilites[i], 0,
/* actions */
for (i = 0; i < 2; ++i) {
- if (!i)
- how = sc;
- else
- how = sd;
+ how = !i ? sc : sd;
if (!how) {
if (!i)
return FALSE;
- else
- break; /* sc is mandatory; sd is not */
+ break; /* sc is mandatory; sd is not */
}
if (strcmpi(how, "bold") == 0) {
normal[i] = TRUE;
} else {
int k = match_str2clr(how);
+
if (k >= CLR_MAX)
return FALSE;
coloridx[i] = k;
for (idx = 0; idx < MAXBLSTATS; ++idx) {
if (status_hilites[idx].set)
status_threshold(idx, status_hilites[idx].anytype,
- status_hilites[idx].threshold,
- status_hilites[idx].behavior,
- status_hilites[idx].coloridx[0],
- status_hilites[idx].coloridx[1]);
+ status_hilites[idx].threshold,
+ status_hilites[idx].behavior,
+ status_hilites[idx].coloridx[0],
+ status_hilites[idx].coloridx[1]);
else
status_threshold(idx, blstats[0][idx].anytype, it, 0, 0, 0);
text = "normal";
} else {
char *blank;
+
(void) strcpy(colorname, c_obj_colors[coloridx]);
for (blank = index(colorname, ' '); blank;
blank = index(colorname, ' '))
for (i = 0; i < MAXBLSTATS; i++) {
if (field_picks[i]) {
menu_item *pick = (menu_item *) 0;
+
Sprintf(buf, "Threshold behavior options for %s:",
fieldids[i].fieldname);
tmpwin = create_nhwindow(NHW_MENU);
* -- ptr is usually a "char *", unless fldindex is BL_CONDITION.
* If fldindex is BL_CONDITION, then ptr is a long value with
* any or none of the following bits set (from botl.h):
- * BL_MASK_BLIND 0x00000001L
- * BL_MASK_CONF 0x00000002L
- * BL_MASK_FOODPOIS 0x00000004L
- * BL_MASK_ILL 0x00000008L
- * BL_MASK_HALLU 0x00000010L
- * BL_MASK_STUNNED 0x00000020L
- * BL_MASK_SLIMED 0x00000040L
- * -- The value passed for BL_GOLD includes a leading
- * symbol for GOLD "$:nnn". If the window port needs to use
- * the textual gold amount without the leading "$:" the port
- * will have to add 2 to the passed "ptr" for the BL_GOLD case.
+ * BL_MASK_STONE 0x00000001L
+ * BL_MASK_SLIME 0x00000002L
+ * BL_MASK_STRNGL 0x00000004L
+ * BL_MASK_FOODPOIS 0x00000008L
+ * BL_MASK_TERMILL 0x00000010L
+ * BL_MASK_BLIND 0x00000020L
+ * BL_MASK_DEAF 0x00000040L
+ * BL_MASK_STUN 0x00000080L
+ * BL_MASK_CONF 0x00000100L
+ * BL_MASK_HALLU 0x00000200L
+ * 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
tty_status_update(fldidx, ptr, chg, percent)
* BL_HILITE_INVERSE -2 + 3 = 1 (statusattr[1])
* BL_HILITE_BOLD -3 + 3 = 0 (statusattr[0])
*/
- int statusattr[] = { ATR_BOLD, ATR_INVERSE, ATR_NONE };
- int attridx = 0;
long value = -1L;
static boolean beenhere = FALSE;
enum statusfields fieldorder[2][15] = {
BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
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 (!status_activefields[fldidx])
case BL_CONDITION:
cond = *condptr;
*status_vals[fldidx] = '\0';
+ if (cond & BL_MASK_STONE)
+ Strcat(status_vals[fldidx], " Stone");
+ if (cond & BL_MASK_SLIME)
+ Strcat(status_vals[fldidx], " Slime");
+ if (cond & BL_MASK_STRNGL)
+ Strcat(status_vals[fldidx], " Strngl");
+ if (cond & BL_MASK_FOODPOIS)
+ Strcat(status_vals[fldidx], " FoodPois");
+ if (cond & BL_MASK_TERMILL)
+ Strcat(status_vals[fldidx], " TermIll");
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");
if (cond & BL_MASK_CONF)
Strcat(status_vals[fldidx], " Conf");
- if (cond & BL_MASK_FOODPOIS)
- Strcat(status_vals[fldidx], " FoodPois");
- if (cond & BL_MASK_ILL)
- Strcat(status_vals[fldidx], " Ill");
- if (cond & BL_MASK_STUNNED)
- Strcat(status_vals[fldidx], " Stun");
if (cond & BL_MASK_HALLU)
Strcat(status_vals[fldidx], " Hallu");
- if (cond & BL_MASK_SLIMED)
- Strcat(status_vals[fldidx], " Slime");
+ if (cond & BL_MASK_LEV)
+ 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;
break;
default:
int fldidx1 = fieldorder[0][i];
if (status_activefields[fldidx1]) {
- if (tty_status_colors[fldidx1] < 0 &&
- tty_status_colors[fldidx1] >= -3) {
+#ifdef STATUS_HILITES
+ if (tty_status_colors[fldidx1] < 0
+ && tty_status_colors[fldidx1] >= -3) {
/* attribute, not a color */
attridx = tty_status_colors[fldidx1] + 3;
term_start_attr(statusattr[attridx]);
putstr(WIN_STATUS, 0, status_vals[fldidx1]);
term_end_attr(statusattr[attridx]);
+ } else
#ifdef TEXTCOLOR
- } else if (tty_status_colors[fldidx1] != CLR_MAX) {
+ if (tty_status_colors[fldidx1] != CLR_MAX) {
if (tty_status_colors[fldidx1] != NO_COLOR)
term_start_color(tty_status_colors[fldidx1]);
putstr(WIN_STATUS, 0, status_vals[fldidx1]);
if (tty_status_colors[fldidx1] != NO_COLOR)
term_end_color();
-#endif
} else
- putstr(WIN_STATUS, 0, status_vals[fldidx1]);
+#endif
+#endif /* STATUS_HILITES */
+ putstr(WIN_STATUS, 0, status_vals[fldidx1]);
}
}
curs(WIN_STATUS, 1, 1);
int fldidx2 = fieldorder[1][i];
if (status_activefields[fldidx2]) {
- if (tty_status_colors[fldidx2] < 0 &&
- tty_status_colors[fldidx2] >= -3) {
+#ifdef STATUS_HILITES
+ if (tty_status_colors[fldidx2] < 0
+ && tty_status_colors[fldidx2] >= -3) {
/* attribute, not a color */
attridx = tty_status_colors[fldidx2] + 3;
term_start_attr(statusattr[attridx]);
putstr(WIN_STATUS, 0, status_vals[fldidx2]);
term_end_attr(statusattr[attridx]);
+ } else
#ifdef TEXTCOLOR
- } else if (tty_status_colors[fldidx2] != CLR_MAX) {
+ if (tty_status_colors[fldidx2] != CLR_MAX) {
if (tty_status_colors[fldidx2] != NO_COLOR)
term_start_color(tty_status_colors[fldidx2]);
if (fldidx2 == BL_GOLD) {
/* putmixed() due to GOLD glyph */
- putmixed(WIN_STATUS, 0, status_vals[fldidx2]);
+ putmixed(WIN_STATUS, 0, status_vals[fldidx2]);
} else {
- putstr(WIN_STATUS, 0, status_vals[fldidx2]);
+ putstr(WIN_STATUS, 0, status_vals[fldidx2]);
}
if (tty_status_colors[fldidx2] != NO_COLOR)
term_end_color();
-#endif
} else
- putstr(WIN_STATUS, 0, status_vals[fldidx2]);
+#endif
+#endif /* STATUS_HILITES */
+ putstr(WIN_STATUS, 0, status_vals[fldidx2]);
}
}
return;