From: nethack.allison Date: Mon, 24 Nov 2003 03:35:33 +0000 (+0000) Subject: status change followup (trunk only) X-Git-Tag: MOVE2GIT~1561 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac9b871dc3090bdd305d9d72fb1e70ce129ff7bd;p=nethack status change followup (trunk only) - Get the HD display working right when Upolyd. - add a couple of comments. --- diff --git a/doc/window.doc b/doc/window.doc index 871f3ef40..3596debe2 100644 --- a/doc/window.doc +++ b/doc/window.doc @@ -356,14 +356,14 @@ status_enablefield(int fldindex, char fldname, char fieldfmt, boolean enable) 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, @@ -378,6 +378,11 @@ status_update(int fldindex, genericptr_t ptr, int chg, int percentage) 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. diff --git a/src/botl.c b/src/botl.c index e2f625d05..7e66fac92 100644 --- a/src/botl.c +++ b/src/botl.c @@ -316,7 +316,7 @@ struct istat_s { #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 */ @@ -369,9 +369,11 @@ boolean reassessment; /* TRUE = just reassess fields w/o other initialization*/ (*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); @@ -535,6 +537,14 @@ bot() #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 */ @@ -612,7 +622,8 @@ bot() 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) { @@ -772,8 +783,8 @@ genericptr_t ptr; }; 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) { diff --git a/src/polyself.c b/src/polyself.c index f6a311b2d..a911994ac 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -24,6 +24,9 @@ void set_uasmon() { set_mon_data(&youmonst, &mons[u.umonnum], 0); +#ifdef STATUS_VIA_WINDOWPORT + status_initialize(TRUE); /* TRUE = reassess fields only */ +#endif } /* make a (new) human out of the player */