More globals moved to instance_globals.

This commit is contained in:
Bart House
2018-11-24 17:59:16 -08:00
parent 3645e415e3
commit ff5fe26e72
11 changed files with 233 additions and 227 deletions

View File

@@ -96,7 +96,36 @@ enum hlattribs { HL_UNDEF = 0x00,
HL_ULINE = 0x08, HL_ULINE = 0x08,
HL_BLINK = 0x10, HL_BLINK = 0x10,
HL_DIM = 0x20 }; HL_DIM = 0x20 };
/* #endif STATUS_HILITES */
#ifdef STATUS_HILITES
struct hilite_s {
enum statusfields fld;
boolean set;
unsigned anytype;
anything value;
int behavior;
char textmatch[QBUFSZ];
enum relationships rel;
int coloridx;
struct hilite_s *next;
};
#endif
struct istat_s {
const char *fldname;
const char *fldfmt;
long time; /* moves when this field hilite times out */
boolean chg; /* need to recalc time? */
unsigned anytype;
anything a;
char *val;
int valwidth;
enum statusfields idxmax;
enum statusfields fld;
#ifdef STATUS_HILITES
struct hilite_s *thresholds;
#endif
};
extern const char *status_fieldnames[]; /* in botl.c */ extern const char *status_fieldnames[]; /* in botl.c */

View File

@@ -545,6 +545,13 @@ struct xlock_s {
boolean magic_key; boolean magic_key;
}; };
struct trapinfo {
struct obj *tobj;
xchar tx, ty;
int time_needed;
boolean force_bungle;
};
/* instance_globals holds engine state that does not need to be /* instance_globals holds engine state that does not need to be
* persisted upon game exit. The initialization state is well defined * persisted upon game exit. The initialization state is well defined
* an set in decl.c during early early engine initialization. * an set in decl.c during early early engine initialization.
@@ -559,6 +566,7 @@ struct instance_globals {
int jumping_is_magic; /* current jump result of magic */ int jumping_is_magic; /* current jump result of magic */
int polearm_range_min; int polearm_range_min;
int polearm_range_max; int polearm_range_max;
struct trapinfo trapinfo;
/* artifcat.c */ /* artifcat.c */
int spec_dbon_applies; /* coordinate effects from spec_dbon() with int spec_dbon_applies; /* coordinate effects from spec_dbon() with
@@ -567,9 +575,16 @@ struct instance_globals {
boolean artiexist[1 + NROFARTIFACTS + 1]; boolean artiexist[1 + NROFARTIFACTS + 1];
/* and a discovery list for them (no dummy first entry here) */ /* and a discovery list for them (no dummy first entry here) */
xchar artidisco[NROFARTIFACTS]; xchar artidisco[NROFARTIFACTS];
int mkot_trap_warn_count;
/* botl.c */ /* botl.c */
int mrank_sz; /* loaded by max_rank_sz */ int mrank_sz; /* loaded by max_rank_sz */
struct istat_s blstats[2][MAXBLSTATS];
boolean blinit;
boolean update_all;
boolean valset[MAXBLSTATS];
long bl_hilite_moves;
unsigned long cond_hilites[BL_ATTCLR_MAX];
/* cmd.c */ /* cmd.c */
struct cmd Cmd; /* flag.h */ struct cmd Cmd; /* flag.h */
@@ -690,6 +705,9 @@ struct instance_globals {
* baalz level */ * baalz level */
boolean was_waterlevel; /* ugh... this shouldn't be needed */ boolean was_waterlevel; /* ugh... this shouldn't be needed */
/* mon.c */
boolean vamp_rise_msg;
boolean disintegested;
/* muse.c */ /* muse.c */
boolean m_using; /* kludge to use mondided instead of killed */ boolean m_using; /* kludge to use mondided instead of killed */

View File

@@ -197,6 +197,7 @@ typedef struct {
#include "wintype.h" #include "wintype.h"
#include "context.h" #include "context.h"
#include "rm.h" #include "rm.h"
#include "botl.h"
/* Symbol offsets */ /* Symbol offsets */
#define SYM_OFF_P (0) #define SYM_OFF_P (0)

View File

@@ -748,7 +748,7 @@ const char *msg;
* *
*/ */
static struct early_opt earlyopts[] = { static const struct early_opt earlyopts[] = {
{ARG_DEBUG, "debug", 5, TRUE}, {ARG_DEBUG, "debug", 5, TRUE},
{ARG_VERSION, "version", 4, TRUE}, {ARG_VERSION, "version", 4, TRUE},
#ifdef WIN32 #ifdef WIN32

View File

@@ -2437,18 +2437,11 @@ struct obj *tstone;
return; return;
} }
static struct trapinfo {
struct obj *tobj;
xchar tx, ty;
int time_needed;
boolean force_bungle;
} trapinfo;
void void
reset_trapset() reset_trapset()
{ {
trapinfo.tobj = 0; g.trapinfo.tobj = 0;
trapinfo.force_bungle = 0; g.trapinfo.force_bungle = 0;
} }
/* Place a landmine/bear trap. Helge Hafting */ /* Place a landmine/bear trap. Helge Hafting */
@@ -2495,22 +2488,23 @@ struct obj *otmp;
return; return;
} }
ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP; ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP;
if (otmp == trapinfo.tobj && u.ux == trapinfo.tx && u.uy == trapinfo.ty) { if (otmp == g.trapinfo.tobj && u.ux == g.trapinfo.tx
&& u.uy == g.trapinfo.ty) {
You("resume setting %s%s.", shk_your(buf, otmp), You("resume setting %s%s.", shk_your(buf, otmp),
defsyms[trap_to_defsym(what_trap(ttyp))].explanation); defsyms[trap_to_defsym(what_trap(ttyp))].explanation);
set_occupation(set_trap, occutext, 0); set_occupation(set_trap, occutext, 0);
return; return;
} }
trapinfo.tobj = otmp; g.trapinfo.tobj = otmp;
trapinfo.tx = u.ux, trapinfo.ty = u.uy; g.trapinfo.tx = u.ux, g.trapinfo.ty = u.uy;
tmp = ACURR(A_DEX); tmp = ACURR(A_DEX);
trapinfo.time_needed = g.trapinfo.time_needed =
(tmp > 17) ? 2 : (tmp > 12) ? 3 : (tmp > 7) ? 4 : 5; (tmp > 17) ? 2 : (tmp > 12) ? 3 : (tmp > 7) ? 4 : 5;
if (Blind) if (Blind)
trapinfo.time_needed *= 2; g.trapinfo.time_needed *= 2;
tmp = ACURR(A_STR); tmp = ACURR(A_STR);
if (ttyp == BEAR_TRAP && tmp < 18) if (ttyp == BEAR_TRAP && tmp < 18)
trapinfo.time_needed += (tmp > 12) ? 1 : (tmp > 7) ? 2 : 4; g.trapinfo.time_needed += (tmp > 12) ? 1 : (tmp > 7) ? 2 : 4;
/*[fumbling and/or confusion and/or cursed object check(s) /*[fumbling and/or confusion and/or cursed object check(s)
should be incorporated here instead of in set_trap]*/ should be incorporated here instead of in set_trap]*/
if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) { if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) {
@@ -2527,8 +2521,8 @@ struct obj *otmp;
if (chance) { if (chance) {
switch (ttyp) { switch (ttyp) {
case LANDMINE: /* set it off */ case LANDMINE: /* set it off */
trapinfo.time_needed = 0; g.trapinfo.time_needed = 0;
trapinfo.force_bungle = TRUE; g.trapinfo.force_bungle = TRUE;
break; break;
case BEAR_TRAP: /* drop it without arming it */ case BEAR_TRAP: /* drop it without arming it */
reset_trapset(); reset_trapset();
@@ -2554,18 +2548,18 @@ STATIC_PTR
int int
set_trap() set_trap()
{ {
struct obj *otmp = trapinfo.tobj; struct obj *otmp = g.trapinfo.tobj;
struct trap *ttmp; struct trap *ttmp;
int ttyp; int ttyp;
if (!otmp || !carried(otmp) || u.ux != trapinfo.tx if (!otmp || !carried(otmp) || u.ux != g.trapinfo.tx
|| u.uy != trapinfo.ty) { || u.uy != g.trapinfo.ty) {
/* ?? */ /* ?? */
reset_trapset(); reset_trapset();
return 0; return 0;
} }
if (--trapinfo.time_needed > 0) if (--g.trapinfo.time_needed > 0)
return 1; /* still busy */ return 1; /* still busy */
ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP; ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP;
@@ -2576,13 +2570,13 @@ set_trap()
if (*in_rooms(u.ux, u.uy, SHOPBASE)) { if (*in_rooms(u.ux, u.uy, SHOPBASE)) {
add_damage(u.ux, u.uy, 0L); /* schedule removal */ add_damage(u.ux, u.uy, 0L); /* schedule removal */
} }
if (!trapinfo.force_bungle) if (!g.trapinfo.force_bungle)
You("finish arming %s.", You("finish arming %s.",
the(defsyms[trap_to_defsym(what_trap(ttyp))].explanation)); the(defsyms[trap_to_defsym(what_trap(ttyp))].explanation));
if (((otmp->cursed || Fumbling) && (rnl(10) > 5)) if (((otmp->cursed || Fumbling) && (rnl(10) > 5))
|| trapinfo.force_bungle) || g.trapinfo.force_bungle)
dotrap(ttmp, dotrap(ttmp,
(unsigned) (trapinfo.force_bungle ? FORCEBUNGLE : 0)); (unsigned) (g.trapinfo.force_bungle ? FORCEBUNGLE : 0));
} else { } else {
/* this shouldn't happen */ /* this shouldn't happen */
Your("trap setting attempt fails."); Your("trap setting attempt fails.");

View File

@@ -2088,8 +2088,6 @@ int dropflag; /* 0==don't drop, 1==drop all, 2==drop weapon */
clear_bypasses(); /* reset upon final exit */ clear_bypasses(); /* reset upon final exit */
} }
static int mkot_trap_warn_count = 0;
STATIC_OVL int STATIC_OVL int
count_surround_traps(x, y) count_surround_traps(x, y)
int x, y; int x, y;
@@ -2147,13 +2145,13 @@ mkot_trap_warn()
if (!uarmg && uwep && uwep->oartifact == ART_MASTER_KEY_OF_THIEVERY) { if (!uarmg && uwep && uwep->oartifact == ART_MASTER_KEY_OF_THIEVERY) {
int idx, ntraps = count_surround_traps(u.ux, u.uy); int idx, ntraps = count_surround_traps(u.ux, u.uy);
if (ntraps != mkot_trap_warn_count) { if (ntraps != g.mkot_trap_warn_count) {
idx = min(ntraps, SIZE(heat) - 1); idx = min(ntraps, SIZE(heat) - 1);
pline_The("Key feels %s%c", heat[idx], (ntraps > 3) ? '!' : '.'); pline_The("Key feels %s%c", heat[idx], (ntraps > 3) ? '!' : '.');
} }
mkot_trap_warn_count = ntraps; g.mkot_trap_warn_count = ntraps;
} else } else
mkot_trap_warn_count = 0; g.mkot_trap_warn_count = 0;
} }
/* Master Key is magic key if its bless/curse state meets our criteria: /* Master Key is magic key if its bless/curse state meets our criteria:

View File

@@ -399,41 +399,12 @@ char *buf;
/* structure that tracks the status details in the core */ /* structure that tracks the status details in the core */
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
struct hilite_s {
enum statusfields fld;
boolean set;
unsigned anytype;
anything value;
int behavior;
char textmatch[QBUFSZ];
enum relationships rel;
int coloridx;
struct hilite_s *next;
};
struct condmap { struct condmap {
const char *id; const char *id;
unsigned long bitmask; unsigned long bitmask;
}; };
#endif /* STATUS_HILITES */ #endif /* STATUS_HILITES */
struct istat_s {
const char *fldname;
const char *fldfmt;
long time; /* moves when this field hilite times out */
boolean chg; /* need to recalc time? */
unsigned anytype;
anything a;
char *val;
int valwidth;
enum statusfields idxmax;
enum statusfields fld;
#ifdef STATUS_HILITES
struct hilite_s *thresholds;
#endif
};
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_OVL int FDECL(percentage, (struct istat_s *, struct istat_s *)); STATIC_OVL int FDECL(percentage, (struct istat_s *, struct istat_s *));
@@ -469,7 +440,7 @@ STATIC_DCL int FDECL(status_hilite_menu_choose_behavior, (int));
STATIC_DCL int FDECL(status_hilite_menu_choose_updownboth, (int, const char *, STATIC_DCL int FDECL(status_hilite_menu_choose_updownboth, (int, const char *,
BOOLEAN_P, BOOLEAN_P)); BOOLEAN_P, BOOLEAN_P));
STATIC_DCL boolean FDECL(status_hilite_menu_add, (int)); STATIC_DCL boolean FDECL(status_hilite_menu_add, (int));
#define has_hilite(i) (blstats[0][(i)].thresholds) #define has_hilite(i) (g.blstats[0][(i)].thresholds)
#endif #endif
#define INIT_BLSTAT(name, fmtstr, anytyp, wid, fld) \ #define INIT_BLSTAT(name, fmtstr, anytyp, wid, fld) \
@@ -510,12 +481,6 @@ STATIC_DCL struct istat_s initblstats[MAXBLSTATS] = {
#undef INIT_BLSTATP #undef INIT_BLSTATP
#undef INIT_BLSTAT #undef INIT_BLSTAT
struct istat_s blstats[2][MAXBLSTATS];
static boolean blinit = FALSE, update_all = FALSE;
static boolean valset[MAXBLSTATS];
unsigned long blcolormasks[CLR_MAX];
static long bl_hilite_moves = 0L;
/* we don't put this next declaration in #ifdef STATUS_HILITES. /* we don't put this next declaration in #ifdef STATUS_HILITES.
* In the absence of STATUS_HILITES, each array * In the absence of STATUS_HILITES, each array
* element will be 0 however, and quite meaningless, * element will be 0 however, and quite meaningless,
@@ -523,7 +488,6 @@ static long bl_hilite_moves = 0L;
* the final argument of status_update, with or * the final argument of status_update, with or
* without STATUS_HILITES. * without STATUS_HILITES.
*/ */
unsigned long cond_hilites[BL_ATTCLR_MAX];
void void
bot_via_windowport() bot_via_windowport()
@@ -533,14 +497,14 @@ bot_via_windowport()
static int i, idx = 0, idx_p, cap; static int i, idx = 0, idx_p, cap;
long money; long money;
if (!blinit) if (!g.blinit)
panic("bot before init."); panic("bot before init.");
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) g.valset, 0, MAXBLSTATS * sizeof (boolean));
/* /*
* Note: min(x,9999) - we enforce the same maximum on hp, maxhp, * Note: min(x,9999) - we enforce the same maximum on hp, maxhp,
@@ -561,30 +525,30 @@ bot_via_windowport()
nb[i] = highc(nb[i]); nb[i] = highc(nb[i]);
} else } else
Strcpy(nb = eos(nb), rank()); Strcpy(nb = eos(nb), rank());
Sprintf(blstats[idx][BL_TITLE].val, "%-29s", buf); Sprintf(g.blstats[idx][BL_TITLE].val, "%-29s", buf);
valset[BL_TITLE] = TRUE; /* indicate val already set */ g.valset[BL_TITLE] = TRUE; /* indicate val already set */
/* Strength */ /* Strength */
blstats[idx][BL_STR].a.a_int = ACURR(A_STR); g.blstats[idx][BL_STR].a.a_int = ACURR(A_STR);
Strcpy(blstats[idx][BL_STR].val, get_strength_str()); Strcpy(g.blstats[idx][BL_STR].val, get_strength_str());
valset[BL_STR] = TRUE; /* indicate val already set */ g.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); g.blstats[idx][BL_DX].a.a_int = ACURR(A_DEX);
blstats[idx][BL_CO].a.a_int = ACURR(A_CON); g.blstats[idx][BL_CO].a.a_int = ACURR(A_CON);
blstats[idx][BL_IN].a.a_int = ACURR(A_INT); g.blstats[idx][BL_IN].a.a_int = ACURR(A_INT);
blstats[idx][BL_WI].a.a_int = ACURR(A_WIS); g.blstats[idx][BL_WI].a.a_int = ACURR(A_WIS);
blstats[idx][BL_CH].a.a_int = ACURR(A_CHA); g.blstats[idx][BL_CH].a.a_int = ACURR(A_CHA);
/* Alignment */ /* Alignment */
Strcpy(blstats[idx][BL_ALIGN].val, (u.ualign.type == A_CHAOTIC) Strcpy(g.blstats[idx][BL_ALIGN].val, (u.ualign.type == A_CHAOTIC)
? "Chaotic" ? "Chaotic"
: (u.ualign.type == A_NEUTRAL) : (u.ualign.type == A_NEUTRAL)
? "Neutral" ? "Neutral"
: "Lawful"); : "Lawful");
/* Score */ /* Score */
blstats[idx][BL_SCORE].a.a_long = g.blstats[idx][BL_SCORE].a.a_long =
#ifdef SCORE_ON_BOTL #ifdef SCORE_ON_BOTL
flags.showscore ? botl_score() : flags.showscore ? botl_score() :
#endif #endif
@@ -594,18 +558,18 @@ bot_via_windowport()
i = Upolyd ? u.mh : u.uhp; i = Upolyd ? u.mh : u.uhp;
if (i < 0) if (i < 0)
i = 0; i = 0;
blstats[idx][BL_HP].a.a_int = min(i, 9999); g.blstats[idx][BL_HP].a.a_int = min(i, 9999);
i = Upolyd ? u.mhmax : u.uhpmax; i = Upolyd ? u.mhmax : u.uhpmax;
blstats[idx][BL_HPMAX].a.a_int = min(i, 9999); g.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(g.blstats[idx][BL_LEVELDESC].val);
valset[BL_LEVELDESC] = TRUE; /* indicate val already set */ g.valset[BL_LEVELDESC] = TRUE; /* indicate val already set */
/* Gold */ /* Gold */
if ((money = money_cnt(invent)) < 0L) if ((money = money_cnt(invent)) < 0L)
money = 0L; /* ought to issue impossible() and then discard gold */ money = 0L; /* ought to issue impossible() and then discard gold */
blstats[idx][BL_GOLD].a.a_long = min(money, 999999L); g.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
@@ -621,78 +585,78 @@ bot_via_windowport()
* The currency prefix is encoded as ten character \GXXXXNNNN * The currency prefix is encoded as ten character \GXXXXNNNN
* sequence. * sequence.
*/ */
Sprintf(blstats[idx][BL_GOLD].val, "%s:%ld", Sprintf(g.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); g.blstats[idx][BL_GOLD].a.a_long);
valset[BL_GOLD] = TRUE; /* indicate val already set */ g.valset[BL_GOLD] = TRUE; /* indicate val already set */
/* Power (magical energy) */ /* Power (magical energy) */
blstats[idx][BL_ENE].a.a_int = min(u.uen, 9999); g.blstats[idx][BL_ENE].a.a_int = min(u.uen, 9999);
blstats[idx][BL_ENEMAX].a.a_int = min(u.uenmax, 9999); g.blstats[idx][BL_ENEMAX].a.a_int = min(u.uenmax, 9999);
/* Armor class */ /* Armor class */
blstats[idx][BL_AC].a.a_int = u.uac; g.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 ? (int) mons[u.umonnum].mlevel : 0; g.blstats[idx][BL_HD].a.a_int = Upolyd ? (int) mons[u.umonnum].mlevel : 0;
/* Experience */ /* Experience */
blstats[idx][BL_XP].a.a_int = u.ulevel; g.blstats[idx][BL_XP].a.a_int = u.ulevel;
blstats[idx][BL_EXP].a.a_long = u.uexp; g.blstats[idx][BL_EXP].a.a_long = u.uexp;
/* Time (moves) */ /* Time (moves) */
blstats[idx][BL_TIME].a.a_long = moves; g.blstats[idx][BL_TIME].a.a_long = moves;
/* Hunger */ /* Hunger */
/* note: u.uhs is unsigned, and 3.6.1's STATUS_HILITE defined /* note: u.uhs is unsigned, and 3.6.1's STATUS_HILITE defined
BL_HUNGER to be ANY_UINT, but that was the only non-int/non-long BL_HUNGER to be ANY_UINT, but that was the only non-int/non-long
numeric field so it's far simpler to treat it as plain int and numeric field so it's far simpler to treat it as plain int and
not need ANY_UINT handling at all */ not need ANY_UINT handling at all */
blstats[idx][BL_HUNGER].a.a_int = (int) u.uhs; g.blstats[idx][BL_HUNGER].a.a_int = (int) u.uhs;
Strcpy(blstats[idx][BL_HUNGER].val, Strcpy(g.blstats[idx][BL_HUNGER].val,
(u.uhs != NOT_HUNGRY) ? hu_stat[u.uhs] : ""); (u.uhs != NOT_HUNGRY) ? hu_stat[u.uhs] : "");
valset[BL_HUNGER] = TRUE; g.valset[BL_HUNGER] = TRUE;
/* Carrying capacity */ /* Carrying capacity */
cap = near_capacity(); cap = near_capacity();
blstats[idx][BL_CAP].a.a_int = cap; g.blstats[idx][BL_CAP].a.a_int = cap;
Strcpy(blstats[idx][BL_CAP].val, Strcpy(g.blstats[idx][BL_CAP].val,
(cap > UNENCUMBERED) ? enc_stat[cap] : ""); (cap > UNENCUMBERED) ? enc_stat[cap] : "");
valset[BL_CAP] = TRUE; g.valset[BL_CAP] = TRUE;
/* Conditions */ /* Conditions */
blstats[idx][BL_CONDITION].a.a_ulong = 0L; g.blstats[idx][BL_CONDITION].a.a_ulong = 0L;
if (Stoned) if (Stoned)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STONE; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STONE;
if (Slimed) if (Slimed)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_SLIME; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_SLIME;
if (Strangled) if (Strangled)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STRNGL; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STRNGL;
if (Sick && (u.usick_type & SICK_VOMITABLE) != 0) if (Sick && (u.usick_type & SICK_VOMITABLE) != 0)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_FOODPOIS; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_FOODPOIS;
if (Sick && (u.usick_type & SICK_NONVOMITABLE) != 0) if (Sick && (u.usick_type & SICK_NONVOMITABLE) != 0)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_TERMILL; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_TERMILL;
/* /*
* basic formatting puts hunger status and encumbrance here * basic formatting puts hunger status and encumbrance here
*/ */
if (Blind) if (Blind)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_BLIND; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_BLIND;
if (Deaf) if (Deaf)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_DEAF; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_DEAF;
if (Stunned) if (Stunned)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STUN; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_STUN;
if (Confusion) if (Confusion)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_CONF; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_CONF;
if (Hallucination) if (Hallucination)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_HALLU; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_HALLU;
/* levitation and flying are mututally exclusive */ /* levitation and flying are mututally exclusive */
if (Levitation) if (Levitation)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_LEV; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_LEV;
if (Flying) if (Flying)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_FLY; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_FLY;
if (u.usteed) if (u.usteed)
blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_RIDE; g.blstats[idx][BL_CONDITION].a.a_ulong |= BL_MASK_RIDE;
evaluate_and_notify_windowport(valset, idx, idx_p); evaluate_and_notify_windowport(g.valset, idx, idx_p);
} }
STATIC_OVL boolean STATIC_OVL boolean
@@ -711,18 +675,18 @@ boolean *valsetlist;
/* /*
* Now pass the changed values to window port. * Now pass the changed values to window port.
*/ */
anytype = blstats[idx][fld].anytype; anytype = g.blstats[idx][fld].anytype;
curr = &blstats[idx][fld]; curr = &g.blstats[idx][fld];
prev = &blstats[idx_p][fld]; prev = &g.blstats[idx_p][fld];
color = NO_COLOR; color = NO_COLOR;
chg = update_all ? 0 : compare_blstats(prev, curr); chg = g.update_all ? 0 : compare_blstats(prev, curr);
/* Temporary? hack: moveloop()'s prolog for a new game sets /* Temporary? hack: moveloop()'s prolog for a new game sets
* context.rndencode after the status window has been init'd, * context.rndencode after the status window has been init'd,
* so $:0 has already been encoded and cached by the window * so $:0 has already been encoded and cached by the window
* port. Without this hack, gold's \G sequence won't be * port. Without this hack, gold's \G sequence won't be
* recognized and ends up being displayed as-is for 'update_all'. * recognized and ends up being displayed as-is for 'g.update_all'.
* *
* Also, even if context.rndencode hasn't changed and the * Also, even if context.rndencode hasn't changed and the
* gold amount itself hasn't changed, the glyph portion of the * gold amount itself hasn't changed, the glyph portion of the
@@ -747,16 +711,16 @@ boolean *valsetlist;
reset = FALSE; reset = FALSE;
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
if (!update_all && !chg) { if (!g.update_all && !chg) {
reset = hilite_reset_needed(prev, bl_hilite_moves); reset = hilite_reset_needed(prev, g.bl_hilite_moves);
if (reset) if (reset)
curr->time = prev->time = 0L; curr->time = prev->time = 0L;
} }
#endif #endif
if (update_all || chg || reset) { if (g.update_all || chg || reset) {
idxmax = curr->idxmax; idxmax = curr->idxmax;
pc = (idxmax >= 0) ? percentage(curr, &blstats[idx][idxmax]) : 0; pc = (idxmax >= 0) ? percentage(curr, &g.blstats[idx][idxmax]) : 0;
if (!valsetlist[fld]) if (!valsetlist[fld])
(void) anything_to_s(curr->val, &curr->a, anytype); (void) anything_to_s(curr->val, &curr->a, anytype);
@@ -773,11 +737,11 @@ boolean *valsetlist;
} }
#endif /* STATUS_HILITES */ #endif /* STATUS_HILITES */
status_update(fld, (genericptr_t) curr->val, status_update(fld, (genericptr_t) curr->val,
chg, pc, color, &cond_hilites[0]); chg, pc, color, &g.cond_hilites[0]);
} else { } else {
/* Color for conditions is done through cond_hilites[] */ /* Color for conditions is done through g.cond_hilites[] */
status_update(fld, (genericptr_t) &curr->a.a_ulong, chg, pc, status_update(fld, (genericptr_t) &curr->a.a_ulong, chg, pc,
color, &cond_hilites[0]); color, &g.cond_hilites[0]);
} }
curr->chg = prev->chg = TRUE; curr->chg = prev->chg = TRUE;
updated = TRUE; updated = TRUE;
@@ -832,13 +796,13 @@ boolean *valsetlist;
*/ */
if (context.botlx && (windowprocs.wincap2 & WC2_RESET_STATUS) != 0L) if (context.botlx && (windowprocs.wincap2 & WC2_RESET_STATUS) != 0L)
status_update(BL_RESET, (genericptr_t) 0, 0, 0, status_update(BL_RESET, (genericptr_t) 0, 0, 0,
NO_COLOR, &cond_hilites[0]); NO_COLOR, &g.cond_hilites[0]);
else if ((windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L) else if ((windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L)
status_update(BL_FLUSH, (genericptr_t) 0, 0, 0, status_update(BL_FLUSH, (genericptr_t) 0, 0, 0,
NO_COLOR, &cond_hilites[0]); NO_COLOR, &g.cond_hilites[0]);
context.botl = context.botlx = 0; context.botl = context.botlx = 0;
update_all = FALSE; g.update_all = FALSE;
} }
void void
@@ -848,17 +812,17 @@ status_eval_next_unhilite()
struct istat_s *curr = NULL; struct istat_s *curr = NULL;
long next_unhilite, this_unhilite; long next_unhilite, this_unhilite;
bl_hilite_moves = moves; g.bl_hilite_moves = moves;
/* figure out when the next unhilight needs to be performed */ /* figure out when the next unhilight needs to be performed */
next_unhilite = 0L; next_unhilite = 0L;
for (i = 0; i < MAXBLSTATS; ++i) { for (i = 0; i < MAXBLSTATS; ++i) {
curr = &blstats[0][i]; /* blstats[0][*].time == blstats[1][*].time */ curr = &g.blstats[0][i]; /* g.blstats[0][*].time == g.blstats[1][*].time */
if (curr->chg) { if (curr->chg) {
struct istat_s *prev = &blstats[1][i]; struct istat_s *prev = &g.blstats[1][i];
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
curr->time = prev->time = (bl_hilite_moves + iflags.hilite_delta); curr->time = prev->time = (g.bl_hilite_moves + iflags.hilite_delta);
#endif #endif
curr->chg = prev->chg = FALSE; curr->chg = prev->chg = FALSE;
} }
@@ -872,7 +836,7 @@ status_eval_next_unhilite()
) )
next_unhilite = this_unhilite; next_unhilite = this_unhilite;
} }
if (next_unhilite > 0L && next_unhilite < bl_hilite_moves) if (next_unhilite > 0L && next_unhilite < g.bl_hilite_moves)
context.botl = TRUE; context.botl = TRUE;
} }
@@ -886,11 +850,11 @@ boolean
const char *fieldname = (const char *) 0; const char *fieldname = (const char *) 0;
if (!reassessment) { if (!reassessment) {
if (blinit) if (g.blinit)
impossible("2nd status_initialize with full init."); impossible("2nd status_initialize with full init.");
init_blstats(); init_blstats();
(*windowprocs.win_status_init)(); (*windowprocs.win_status_init)();
blinit = TRUE; g.blinit = TRUE;
} }
for (i = 0; i < MAXBLSTATS; ++i) { for (i = 0; i < MAXBLSTATS; ++i) {
enum statusfields fld = initblstats[i].fld; enum statusfields fld = initblstats[i].fld;
@@ -908,7 +872,7 @@ boolean
fieldfmt = initblstats[i].fldfmt; fieldfmt = initblstats[i].fldfmt;
status_enablefield(fld, fieldname, fieldfmt, fldenabled); status_enablefield(fld, fieldname, fieldfmt, fldenabled);
} }
update_all = TRUE; g.update_all = TRUE;
} }
void void
@@ -922,19 +886,19 @@ status_finish()
/* free memory that we alloc'd now */ /* free memory that we alloc'd now */
for (i = 0; i < MAXBLSTATS; ++i) { for (i = 0; i < MAXBLSTATS; ++i) {
if (blstats[0][i].val) if (g.blstats[0][i].val)
free((genericptr_t) blstats[0][i].val), blstats[0][i].val = 0; free((genericptr_t) g.blstats[0][i].val), g.blstats[0][i].val = 0;
if (blstats[1][i].val) if (g.blstats[1][i].val)
free((genericptr_t) blstats[1][i].val), blstats[1][i].val = 0; free((genericptr_t) g.blstats[1][i].val), g.blstats[1][i].val = 0;
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
if (blstats[0][i].thresholds) { if (g.blstats[0][i].thresholds) {
struct hilite_s *temp = blstats[0][i].thresholds, struct hilite_s *temp = g.blstats[0][i].thresholds,
*next = (struct hilite_s *)0; *next = (struct hilite_s *)0;
while (temp) { while (temp) {
next = temp->next; next = temp->next;
free(temp); free(temp);
blstats[0][i].thresholds = (struct hilite_s *)0; g.blstats[0][i].thresholds = (struct hilite_s *)0;
blstats[1][i].thresholds = blstats[0][i].thresholds; g.blstats[1][i].thresholds = g.blstats[0][i].thresholds;
temp = next; temp = next;
} }
} }
@@ -957,18 +921,18 @@ init_blstats()
for (i = BEFORE; i <= NOW; ++i) { for (i = BEFORE; i <= NOW; ++i) {
for (j = 0; j < MAXBLSTATS; ++j) { for (j = 0; j < MAXBLSTATS; ++j) {
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
struct hilite_s *keep_hilite_chain = blstats[i][j].thresholds; struct hilite_s *keep_hilite_chain = g.blstats[i][j].thresholds;
#endif #endif
blstats[i][j] = initblstats[j]; g.blstats[i][j] = initblstats[j];
blstats[i][j].a = zeroany; g.blstats[i][j].a = zeroany;
if (blstats[i][j].valwidth) { if (g.blstats[i][j].valwidth) {
blstats[i][j].val = (char *) alloc(blstats[i][j].valwidth); g.blstats[i][j].val = (char *) alloc(g.blstats[i][j].valwidth);
blstats[i][j].val[0] = '\0'; g.blstats[i][j].val[0] = '\0';
} else } else
blstats[i][j].val = (char *) 0; g.blstats[i][j].val = (char *) 0;
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
blstats[i][j].thresholds = keep_hilite_chain; g.blstats[i][j].thresholds = keep_hilite_chain;
#endif #endif
} }
} }
@@ -1233,9 +1197,7 @@ struct istat_s *bl, *maxbl;
/* Core status hiliting support */ /* Core status hiliting support */
/****************************************************************************/ /****************************************************************************/
struct hilite_s status_hilites[MAXBLSTATS]; static const struct fieldid_t {
static struct fieldid_t {
const char *fieldname; const char *fieldname;
enum statusfields fldid; enum statusfields fldid;
} fieldids_alias[] = { } fieldids_alias[] = {
@@ -1352,8 +1314,8 @@ reset_status_hilites()
int i; int i;
for (i = 0; i < MAXBLSTATS; ++i) for (i = 0; i < MAXBLSTATS; ++i)
blstats[0][i].time = blstats[1][i].time = 0L; g.blstats[0][i].time = g.blstats[1][i].time = 0L;
update_all = TRUE; g.update_all = TRUE;
} }
context.botlx = TRUE; context.botlx = TRUE;
} }
@@ -1428,7 +1390,7 @@ int *colorptr;
if (!colorptr || fldidx < 0 || fldidx >= MAXBLSTATS) if (!colorptr || fldidx < 0 || fldidx >= MAXBLSTATS)
return; return;
if (blstats[idx][fldidx].thresholds) { if (g.blstats[idx][fldidx].thresholds) {
int dt; int dt;
/* there are hilites set here */ /* there are hilites set here */
int max_pc = -1, min_pc = 101; int max_pc = -1, min_pc = 101;
@@ -1442,7 +1404,7 @@ int *colorptr;
perc_or_abs = FALSE; perc_or_abs = FALSE;
/* min_/max_ are used to track best fit */ /* min_/max_ are used to track best fit */
for (hl = blstats[idx][fldidx].thresholds; hl; hl = hl->next) { for (hl = g.blstats[idx][fldidx].thresholds; hl; hl = hl->next) {
dt = initblstats[fldidx].anytype; /* only needed for 'absolute' */ dt = initblstats[fldidx].anytype; /* only needed for 'absolute' */
/* if we've already matched a temporary highlight, it takes /* if we've already matched a temporary highlight, it takes
precedence over all persistent ones; we still process precedence over all persistent ones; we still process
@@ -1577,7 +1539,7 @@ int *colorptr;
} }
break; break;
case BL_TH_TEXTMATCH: /* ANY_STR */ case BL_TH_TEXTMATCH: /* ANY_STR */
txtstr = blstats[idx][fldidx].val; txtstr = g.blstats[idx][fldidx].val;
if (fldidx == BL_TITLE) if (fldidx == BL_TITLE)
/* "<name> the <rank-title>", skip past "<name> the " */ /* "<name> the <rank-title>", skip past "<name> the " */
txtstr += (strlen(plname) + sizeof " the " - sizeof ""); txtstr += (strlen(plname) + sizeof " the " - sizeof "");
@@ -1834,12 +1796,12 @@ struct hilite_s *hilite;
new_hilite->set = TRUE; new_hilite->set = TRUE;
new_hilite->fld = fld; new_hilite->fld = fld;
new_hilite->next = blstats[0][fld].thresholds; new_hilite->next = g.blstats[0][fld].thresholds;
blstats[0][fld].thresholds = new_hilite; g.blstats[0][fld].thresholds = new_hilite;
/* sort_hilites(fld) */ /* sort_hilites(fld) */
/* current and prev must both point at the same hilites */ /* current and prev must both point at the same hilites */
blstats[1][fld].thresholds = blstats[0][fld].thresholds; g.blstats[1][fld].thresholds = g.blstats[0][fld].thresholds;
} }
@@ -2365,21 +2327,21 @@ int sidx;
for (i = 0; i < sf; ++i) { for (i = 0; i < sf; ++i) {
int a = match_str2attr(subfields[i], FALSE); int a = match_str2attr(subfields[i], FALSE);
if (a == ATR_DIM) if (a == ATR_DIM)
cond_hilites[HL_ATTCLR_DIM] |= conditions_bitmask; g.cond_hilites[HL_ATTCLR_DIM] |= conditions_bitmask;
else if (a == ATR_BLINK) else if (a == ATR_BLINK)
cond_hilites[HL_ATTCLR_BLINK] |= conditions_bitmask; g.cond_hilites[HL_ATTCLR_BLINK] |= conditions_bitmask;
else if (a == ATR_ULINE) else if (a == ATR_ULINE)
cond_hilites[HL_ATTCLR_ULINE] |= conditions_bitmask; g.cond_hilites[HL_ATTCLR_ULINE] |= conditions_bitmask;
else if (a == ATR_INVERSE) else if (a == ATR_INVERSE)
cond_hilites[HL_ATTCLR_INVERSE] |= conditions_bitmask; g.cond_hilites[HL_ATTCLR_INVERSE] |= conditions_bitmask;
else if (a == ATR_BOLD) else if (a == ATR_BOLD)
cond_hilites[HL_ATTCLR_BOLD] |= conditions_bitmask; g.cond_hilites[HL_ATTCLR_BOLD] |= conditions_bitmask;
else if (a == ATR_NONE) { else if (a == ATR_NONE) {
cond_hilites[HL_ATTCLR_DIM] &= ~conditions_bitmask; g.cond_hilites[HL_ATTCLR_DIM] &= ~conditions_bitmask;
cond_hilites[HL_ATTCLR_BLINK] &= ~conditions_bitmask; g.cond_hilites[HL_ATTCLR_BLINK] &= ~conditions_bitmask;
cond_hilites[HL_ATTCLR_ULINE] &= ~conditions_bitmask; g.cond_hilites[HL_ATTCLR_ULINE] &= ~conditions_bitmask;
cond_hilites[HL_ATTCLR_INVERSE] &= ~conditions_bitmask; g.cond_hilites[HL_ATTCLR_INVERSE] &= ~conditions_bitmask;
cond_hilites[HL_ATTCLR_BOLD] &= ~conditions_bitmask; g.cond_hilites[HL_ATTCLR_BOLD] &= ~conditions_bitmask;
} else { } else {
int k = match_str2clr(subfields[i]); int k = match_str2clr(subfields[i]);
@@ -2391,7 +2353,7 @@ int sidx;
/* set the bits in the appropriate member of the /* set the bits in the appropriate member of the
condition array according to color chosen as index */ condition array according to color chosen as index */
cond_hilites[coloridx] |= conditions_bitmask; g.cond_hilites[coloridx] |= conditions_bitmask;
success = TRUE; success = TRUE;
sidx++; sidx++;
} }
@@ -2404,14 +2366,14 @@ clear_status_hilites()
int i; int i;
for (i = 0; i < MAXBLSTATS; ++i) { for (i = 0; i < MAXBLSTATS; ++i) {
if (blstats[0][i].thresholds) { if (g.blstats[0][i].thresholds) {
struct hilite_s *temp = blstats[0][i].thresholds, struct hilite_s *temp = g.blstats[0][i].thresholds,
*next = (struct hilite_s *)0; *next = (struct hilite_s *)0;
while (temp) { while (temp) {
next = temp->next; next = temp->next;
free(temp); free(temp);
blstats[0][i].thresholds = (struct hilite_s *)0; g.blstats[0][i].thresholds = (struct hilite_s *)0;
blstats[1][i].thresholds = blstats[0][i].thresholds; g.blstats[1][i].thresholds = g.blstats[0][i].thresholds;
temp = next; temp = next;
} }
} }
@@ -2555,19 +2517,19 @@ status_hilite_linestr_gather_conditions()
int j; int j;
for (j = 0; j < CLR_MAX; j++) for (j = 0; j < CLR_MAX; j++)
if (cond_hilites[j] & valid_conditions[i].bitmask) { if (g.cond_hilites[j] & valid_conditions[i].bitmask) {
clr = j; clr = j;
break; break;
} }
if (cond_hilites[HL_ATTCLR_DIM] & valid_conditions[i].bitmask) if (g.cond_hilites[HL_ATTCLR_DIM] & valid_conditions[i].bitmask)
atr |= HL_DIM; atr |= HL_DIM;
if (cond_hilites[HL_ATTCLR_BOLD] & valid_conditions[i].bitmask) if (g.cond_hilites[HL_ATTCLR_BOLD] & valid_conditions[i].bitmask)
atr |= HL_BOLD; atr |= HL_BOLD;
if (cond_hilites[HL_ATTCLR_BLINK] & valid_conditions[i].bitmask) if (g.cond_hilites[HL_ATTCLR_BLINK] & valid_conditions[i].bitmask)
atr |= HL_BLINK; atr |= HL_BLINK;
if (cond_hilites[HL_ATTCLR_ULINE] & valid_conditions[i].bitmask) if (g.cond_hilites[HL_ATTCLR_ULINE] & valid_conditions[i].bitmask)
atr |= HL_ULINE; atr |= HL_ULINE;
if (cond_hilites[HL_ATTCLR_INVERSE] & valid_conditions[i].bitmask) if (g.cond_hilites[HL_ATTCLR_INVERSE] & valid_conditions[i].bitmask)
atr |= HL_INVERSE; atr |= HL_INVERSE;
if (atr != HL_NONE) if (atr != HL_NONE)
atr &= ~HL_NONE; atr &= ~HL_NONE;
@@ -2626,7 +2588,7 @@ status_hilite_linestr_gather()
status_hilite_linestr_done(); status_hilite_linestr_done();
for (i = 0; i < MAXBLSTATS; i++) { for (i = 0; i < MAXBLSTATS; i++) {
hl = blstats[0][i].thresholds; hl = g.blstats[0][i].thresholds;
while (hl) { while (hl) {
status_hilite_linestr_add(i, hl, 0UL, status_hilite2str(hl)); status_hilite_linestr_add(i, hl, 0UL, status_hilite2str(hl));
hl = hl->next; hl = hl->next;
@@ -2730,7 +2692,7 @@ status_hilite_menu_choose_field()
for (i = 0; i < MAXBLSTATS; i++) { for (i = 0; i < MAXBLSTATS; i++) {
#ifndef SCORE_ON_BOTL #ifndef SCORE_ON_BOTL
if (initblstats[i].fld == BL_SCORE if (initblstats[i].fld == BL_SCORE
&& !blstats[0][BL_SCORE].thresholds) && !g.blstats[0][BL_SCORE].thresholds)
continue; continue;
#endif #endif
any = zeroany; any = zeroany;
@@ -3275,23 +3237,23 @@ choose_color:
char *tmpattr; char *tmpattr;
if (atr & HL_DIM) if (atr & HL_DIM)
cond_hilites[HL_ATTCLR_DIM] |= cond; g.cond_hilites[HL_ATTCLR_DIM] |= cond;
else if (atr & HL_BLINK) else if (atr & HL_BLINK)
cond_hilites[HL_ATTCLR_BLINK] |= cond; g.cond_hilites[HL_ATTCLR_BLINK] |= cond;
else if (atr & HL_ULINE) else if (atr & HL_ULINE)
cond_hilites[HL_ATTCLR_ULINE] |= cond; g.cond_hilites[HL_ATTCLR_ULINE] |= cond;
else if (atr & HL_INVERSE) else if (atr & HL_INVERSE)
cond_hilites[HL_ATTCLR_INVERSE] |= cond; g.cond_hilites[HL_ATTCLR_INVERSE] |= cond;
else if (atr & HL_BOLD) else if (atr & HL_BOLD)
cond_hilites[HL_ATTCLR_BOLD] |= cond; g.cond_hilites[HL_ATTCLR_BOLD] |= cond;
else if (atr == HL_NONE) { else if (atr == HL_NONE) {
cond_hilites[HL_ATTCLR_DIM] &= ~cond; g.cond_hilites[HL_ATTCLR_DIM] &= ~cond;
cond_hilites[HL_ATTCLR_BLINK] &= ~cond; g.cond_hilites[HL_ATTCLR_BLINK] &= ~cond;
cond_hilites[HL_ATTCLR_ULINE] &= ~cond; g.cond_hilites[HL_ATTCLR_ULINE] &= ~cond;
cond_hilites[HL_ATTCLR_INVERSE] &= ~cond; g.cond_hilites[HL_ATTCLR_INVERSE] &= ~cond;
cond_hilites[HL_ATTCLR_BOLD] &= ~cond; g.cond_hilites[HL_ATTCLR_BOLD] &= ~cond;
} }
cond_hilites[clr] |= cond; g.cond_hilites[clr] |= cond;
(void) strNsubst(strcpy(clrbuf, clr2colorname(clr)), " ", "-", 0); (void) strNsubst(strcpy(clrbuf, clr2colorname(clr)), " ", "-", 0);
tmpattr = hlattr2attrname(atr, attrbuf, BUFSZ); tmpattr = hlattr2attrname(atr, attrbuf, BUFSZ);
if (tmpattr) if (tmpattr)
@@ -3342,16 +3304,16 @@ int id;
int i; int i;
for (i = 0; i < CLR_MAX; i++) for (i = 0; i < CLR_MAX; i++)
cond_hilites[i] &= ~hlstr->mask; g.cond_hilites[i] &= ~hlstr->mask;
cond_hilites[HL_ATTCLR_DIM] &= ~hlstr->mask; g.cond_hilites[HL_ATTCLR_DIM] &= ~hlstr->mask;
cond_hilites[HL_ATTCLR_BOLD] &= ~hlstr->mask; g.cond_hilites[HL_ATTCLR_BOLD] &= ~hlstr->mask;
cond_hilites[HL_ATTCLR_BLINK] &= ~hlstr->mask; g.cond_hilites[HL_ATTCLR_BLINK] &= ~hlstr->mask;
cond_hilites[HL_ATTCLR_ULINE] &= ~hlstr->mask; g.cond_hilites[HL_ATTCLR_ULINE] &= ~hlstr->mask;
cond_hilites[HL_ATTCLR_INVERSE] &= ~hlstr->mask; g.cond_hilites[HL_ATTCLR_INVERSE] &= ~hlstr->mask;
return TRUE; return TRUE;
} else { } else {
int fld = hlstr->fld; int fld = hlstr->fld;
struct hilite_s *hl = blstats[0][fld].thresholds; struct hilite_s *hl = g.blstats[0][fld].thresholds;
struct hilite_s *hlprev = (struct hilite_s *) 0; struct hilite_s *hlprev = (struct hilite_s *) 0;
if (hl) { if (hl) {
@@ -3360,9 +3322,9 @@ int id;
if (hlprev) { if (hlprev) {
hlprev->next = hl->next; hlprev->next = hl->next;
} else { } else {
blstats[0][fld].thresholds = hl->next; g.blstats[0][fld].thresholds = hl->next;
blstats[1][fld].thresholds = g.blstats[1][fld].thresholds =
blstats[0][fld].thresholds; g.blstats[0][fld].thresholds;
} }
free((genericptr_t) hl); free((genericptr_t) hl);
return TRUE; return TRUE;

View File

@@ -326,14 +326,22 @@ const struct instance_globals g_init = {
0, /* jumping_is_magic */ 0, /* jumping_is_magic */
-1, /* polearm_range_min */ -1, /* polearm_range_min */
-1, /* polearm_range_max */ -1, /* polearm_range_max */
UNDEFINED_VALUES, /* trapinfo */
/* artifact.c */ /* artifact.c */
0, /* spec_dbon_applies */ 0, /* spec_dbon_applies */
UNDEFINED_VALUES, /* artiexist */ UNDEFINED_VALUES, /* artiexist */
UNDEFINED_VALUES, /* artdisco */ UNDEFINED_VALUES, /* artdisco */
0, /* mkot_trap_warn_count */
/* botl.c */ /* botl.c */
0, /* mrank_sz */ 0, /* mrank_sz */
UNDEFINED_VALUES, /* blstats */
FALSE, /* blinit */
FALSE, /* update_all */
UNDEFINED_VALUES, /* valset */
0, /* bl_hilite_moves */
UNDEFINED_VALUES, /* cond_hilites */
/* cmd.c */ /* cmd.c */
UNDEFINED_VALUES, /* Cmd */ UNDEFINED_VALUES, /* Cmd */
@@ -440,6 +448,9 @@ const struct instance_globals g_init = {
{ {COLNO, ROWNO, 0, 0}, {COLNO, ROWNO, 0, 0} }, /* bughack */ { {COLNO, ROWNO, 0, 0}, {COLNO, ROWNO, 0, 0} }, /* bughack */
UNDEFINED_VALUE, /* was_waterlevel */ UNDEFINED_VALUE, /* was_waterlevel */
/* mon.c */
UNDEFINED_VALUE, /* vamp_rise_msg */
UNDEFINED_VALUE, /* disintegested */
/* mused.c */ /* mused.c */
FALSE, /* m_using */ FALSE, /* m_using */

View File

@@ -24,9 +24,6 @@ STATIC_DCL void FDECL(migr_booty_item, (int, const char *));
STATIC_DCL void FDECL(migrate_orc, (struct monst *, unsigned long)); STATIC_DCL void FDECL(migrate_orc, (struct monst *, unsigned long));
STATIC_DCL void NDECL(stolen_booty); STATIC_DCL void NDECL(stolen_booty);
lev_region bughack; /* for preserving the insect legs when wallifying
* baalz level */
/* adjust a coordinate one step in the specified direction */ /* adjust a coordinate one step in the specified direction */
#define mz_move(X, Y, dir) \ #define mz_move(X, Y, dir) \
do { \ do { \

View File

@@ -12,8 +12,6 @@
#include "mfndpos.h" #include "mfndpos.h"
#include <ctype.h> #include <ctype.h>
STATIC_VAR boolean vamp_rise_msg, disintegested;
STATIC_DCL void FDECL(sanity_check_single_mon, (struct monst *, BOOLEAN_P, STATIC_DCL void FDECL(sanity_check_single_mon, (struct monst *, BOOLEAN_P,
const char *)); const char *));
STATIC_DCL boolean FDECL(restrap, (struct monst *)); STATIC_DCL boolean FDECL(restrap, (struct monst *));
@@ -1898,7 +1896,7 @@ register struct monst *mtmp;
spec_mon = (nonliving(mtmp->data) spec_mon = (nonliving(mtmp->data)
|| noncorporeal(mtmp->data) || noncorporeal(mtmp->data)
|| amorphous(mtmp->data)), || amorphous(mtmp->data)),
spec_death = (disintegested /* disintegrated or digested */ spec_death = (g.disintegested /* disintegrated or digested */
|| noncorporeal(mtmp->data) || noncorporeal(mtmp->data)
|| amorphous(mtmp->data)); || amorphous(mtmp->data));
@@ -1939,7 +1937,7 @@ register struct monst *mtmp;
if (!type_is_pname(mtmp->data)) if (!type_is_pname(mtmp->data))
whom = an(whom); whom = an(whom);
pline(upstart(buf), whom); pline(upstart(buf), whom);
vamp_rise_msg = TRUE; g.vamp_rise_msg = TRUE;
} }
newsym(x, y); newsym(x, y);
return; return;
@@ -2226,8 +2224,8 @@ int how;
be_sad = (mdef->mtame != 0); be_sad = (mdef->mtame != 0);
/* no corpses if digested or disintegrated */ /* no corpses if digested or disintegrated */
disintegested = (how == AD_DGST || how == -AD_RBRE); g.disintegested = (how == AD_DGST || how == -AD_RBRE);
if (disintegested) if (g.disintegested)
mondead(mdef); mondead(mdef);
else else
mondied(mdef); mondied(mdef);
@@ -2323,14 +2321,14 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
thrownobj = 0; thrownobj = 0;
} }
vamp_rise_msg = FALSE; /* might get set in mondead(); only checked below */ g.vamp_rise_msg = FALSE; /* might get set in mondead(); only checked below */
disintegested = nocorpse; /* alternate vamp_rise message needed if true */ g.disintegested = nocorpse; /* alternate vamp_rise message needed if true */
/* dispose of monster and make cadaver */ /* dispose of monster and make cadaver */
if (stoned) if (stoned)
monstone(mtmp); monstone(mtmp);
else else
mondead(mtmp); mondead(mtmp);
disintegested = FALSE; /* reset */ g.disintegested = FALSE; /* reset */
if (!DEADMONSTER(mtmp)) { /* monster lifesaved */ if (!DEADMONSTER(mtmp)) { /* monster lifesaved */
/* Cannot put the non-visible lifesaving message in /* Cannot put the non-visible lifesaving message in
@@ -2338,7 +2336,7 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
* kill it (as opposed to visible lifesaving which always appears). * kill it (as opposed to visible lifesaving which always appears).
*/ */
stoned = FALSE; stoned = FALSE;
if (!cansee(x, y) && !vamp_rise_msg) if (!cansee(x, y) && !g.vamp_rise_msg)
pline("Maybe not..."); pline("Maybe not...");
return; return;
} }

View File

@@ -18,8 +18,6 @@
#pragma warning(disable : 4244) #pragma warning(disable : 4244)
#endif #endif
lev_region *lregions;
typedef void FDECL((*select_iter_func), (int, int, genericptr)); typedef void FDECL((*select_iter_func), (int, int, genericptr));
extern void FDECL(mkmap, (lev_init *)); extern void FDECL(mkmap, (lev_init *));