Moved more globals to instance_globals.

This commit is contained in:
Bart House
2018-11-24 02:13:54 -08:00
parent f1e48cddfe
commit 3645e415e3
37 changed files with 987 additions and 869 deletions

View File

@@ -37,8 +37,6 @@ E NEARDATA int nroom;
E NEARDATA int nsubroom;
E NEARDATA int occtime;
#define WARNCOUNT 6 /* number of different warning levels */
E nhsym warnsyms[WARNCOUNT];
E NEARDATA int warn_obj_cnt; /* count of monsters meeting criteria */
E int x_maze_max, y_maze_max;
@@ -514,12 +512,47 @@ struct cmd {
char spkeys[NUM_NHKF];
};
#define ENTITIES 2
struct entity {
struct monst *emon; /* youmonst for the player */
struct permonst *edata; /* must be non-zero for record to be valid */
int ex, ey;
};
/* these probably ought to be generated by makedefs, like LAST_GEM */
#define FIRST_GEM DILITHIUM_CRYSTAL
#define FIRST_AMULET AMULET_OF_ESP
#define LAST_AMULET AMULET_OF_YENDOR
struct valuable_data {
long count;
int typ;
};
struct val_list {
struct valuable_data *list;
int size;
};
/* at most one of `door' and `box' should be non-null at any given time */
struct xlock_s {
struct rm *door;
struct obj *box;
int picktyp, /* key|pick|card for unlock, sharp vs blunt for #force */
chance, usedtime;
boolean magic_key;
};
/* instance_globals holds engine state that does not need to be
* persisted upon game exit. The initialization state is well defined
* an set in decl.c during early early engine initialization.
*
* unlike instance_flags, values in the structure can be of any type. */
#define BSIZE 20
struct instance_globals {
/* apply.c */
@@ -540,9 +573,85 @@ struct instance_globals {
/* cmd.c */
struct cmd Cmd; /* flag.h */
/* Provide a means to redo the last command. The flag `in_doagain' is set
* to true while redoing the command. This flag is tested in commands that
* require additional input (like `throw' which requires a thing and a
* direction), and the input prompt is not shown. Also, while in_doagain is
* TRUE, no keystrokes can be saved into the saveq.
*/
char pushq[BSIZE];
char saveq[BSIZE];
int phead;
int ptail;
int shead;
int stail;
coord clicklook_cc;
winid en_win;
boolean en_via_menu;
/* dbridge.c */
struct entity occupants[ENTITIES];
/* dig.c */
boolean did_dig_msg;
/* do.c */
boolean at_ladder;
char *dfr_pre_msg; /* pline() before level change */
char *dfr_post_msg; /* pline() after level change */
d_level save_dlevel;
/* do_name.c */
struct opvar *gloc_filter_map;
int gloc_filter_floodfill_match_glyph;
int via_naming;
/* dog.c */
int petname_used; /* user preferred pet name has been used */
xchar gtyp; /* type of dog's current goal */
xchar gx; /* x position of dog's current goal */
char gy; /* y position of dog's current goal */
/* dokick.c */
struct rm *maploc;
struct rm nowhere;
const char *gate_str;
/* drawing */
struct symsetentry symset[NUM_GRAPHICS];
int currentgraphics;
nhsym showsyms[SYM_MAX]; /* symbols to be displayed */
nhsym l_syms[SYM_MAX]; /* loaded symbols */
nhsym r_syms[SYM_MAX]; /* rogue symbols */
nhsym warnsyms[WARNCOUNT]; /* the current warning display symbols */
/* dungeon.c */
int n_dgns; /* number of dungeons (also used in mklev.c and do.c) */
branch *branches; /* dungeon branch list */
mapseen *mapseenchn; /*DUNGEON_OVERVIEW*/
/* eat.c */
boolean force_save_hs;
/* end.c */
struct valuable_data gems[LAST_GEM + 1 - FIRST_GEM + 1]; /* +1 for glass */
struct valuable_data amulets[LAST_AMULET + 1 - FIRST_AMULET];
struct val_list valuables[3];
/* hack.c */
anything tmp_anything;
int wc; /* current weight_cap(); valid after call to inv_weight() */
/* invent.c */
int lastinvnr; /* 0 ... 51 (never saved&restored) */
unsigned sortlootmode; /* set by sortloot() for use by sortloot_cmp();
* reset by sortloot when done */
char *invbuf;
unsigned invbufsiz;
/* lock.c */
struct xlock_s xlock;
/* makemon.c */
struct {
@@ -550,6 +659,38 @@ struct instance_globals {
char mchoices[SPECIAL_PM]; /* value range is 0..127 */
} rndmonst_state;
/* mhitm.c */
boolean vis;
boolean far_noise;
long noisetime;
struct obj *otmp;
int dieroll; /* Needed for the special case of monsters wielding vorpal
* blades (rare). If we use this a lot it should probably
* be a parameter to mdamagem() instead of a global variable.
*/
/* mhitu.c */
int mhitu_dieroll;
/* mklev.c */
xchar vault_x;
xchar vault_y;
boolean made_branch; /* used only during level creation */
/* mkmap.c */
char *new_locations;
int min_rx; /* rectangle bounds for regions */
int max_rx;
int min_ry;
int max_ry;
int n_loc_filled;
/* mkmaze.c */
lev_region bughack; /* for preserving the insect legs when wallifying
* baalz level */
boolean was_waterlevel; /* ugh... this shouldn't be needed */
/* muse.c */
boolean m_using; /* kludge to use mondided instead of killed */
int trapx;
@@ -630,6 +771,11 @@ struct instance_globals {
unsigned ustuck_id; /* need to preserve during save */
unsigned usteed_id; /* need to preserve during save */
/* sp_lev.c */
char *lev_message;
lev_region *lregions;
int num_lregions;
/* trap.c */
int force_mintrap; /* mintrap() should take a flags argument, but for time
being we use this */