BL_LEVELDESC, BL_EXP, BL_CONDITION
-- There are MAXBLSTATS status fields (from botl.h)
status_update(int fldindex, genericptr_t ptr, int chg, int percentage)
- -- update the value of a status field
+ -- update the value of a status field.
-- the fldindex identifies which field is changing and
is an integer index value from botl.h
-- fldindex could be any one of the following from botl.h:
BL_TITLE, 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_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX,
- BL_LEVELDESC, BL_EXP, BL_CONDITION,
+ BL_LEVELDESC, BL_EXP, BL_CONDITION
-- fldindex could also be BL_FLUSH (-1), which is not really
a field index, but is a special trigger to tell the
windowport that it should redisplay all its status fields,
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.
+
status_finish() -- called when it is time for the window port to tear down
the status display and free allocated memory, etc.
#define percentage(current, maximum) ((100 * current) / maximum)
#define percentagel(current, maximum) ((int)((100L * current) / maximum))
-/* If entries are added to this, botl.h will required updating too */
+/* If entries are added to this, botl.h will require updating too */
struct istat_s blstats[2][MAXBLSTATS] = {
{
{ 0L, P_STR, (genericptr_t)0, (char *)0, 80, 0}, /* 0 BL_TITLE */
(*windowprocs.win_status_init)();
}
for (i = 0; i < MAXBLSTATS; ++i) {
- if ((i == BL_SCORE && !flags.showscore) ||
- (i == BL_EXP && !flags.showexp) ||
- (i == BL_TIME && !flags.time))
+ if ((i == BL_SCORE && !flags.showscore) ||
+ (i == BL_EXP && !flags.showexp) ||
+ (i == BL_TIME && !flags.time) ||
+ (i == BL_HD && !Upolyd) ||
+ ((i == BL_XP || i == BL_EXP) && Upolyd))
status_enablefield(i, fieldnames[i], fieldfmts[i], FALSE);
else
status_enablefield(i, fieldnames[i], fieldfmts[i], TRUE);
#else
money_cnt(invent);
#endif
+ /*
+ * The tty port needs to display the current symbol for gold
+ * as a field header, so to accomodate 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()
+ * for the BL_GOLD case.
+ */
Sprintf(blstats[idx][BL_GOLD].val, "%c:%ld",
oc_syms[COIN_CLASS], *(blstats[idx][BL_GOLD].ptr.a_lptr));
valset[BL_GOLD] = TRUE; /* indicate val already set */
if (((i == BL_SCORE) && !flags.showscore) ||
((i == BL_EXP) && !flags.showexp) ||
((i == BL_TIME) && !flags.time) ||
- ((i == BL_HD) && !Upolyd))
+ ((i == BL_HD) && !Upolyd) ||
+ ((i == BL_XP || i == BL_EXP) && Upolyd))
continue;
ptype = blstats[idx][i].ptype;
switch (ptype) {
};
int fieldorder2[] = {
BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX,
- BL_ENE, BL_ENEMAX, BL_AC, BL_XP, BL_EXP, BL_TIME,
- BL_HUNGER,BL_CAP, BL_CONDITION, -1
+ BL_ENE, BL_ENEMAX, BL_AC, BL_XP, BL_EXP, BL_HD,
+ BL_TIME, BL_HUNGER,BL_CAP, BL_CONDITION, -1
};
if (idx != BL_FLUSH) {