artifact.c, cmd.c and makemon.c globals moved to instance_globals.

This commit is contained in:
Bart House
2018-11-23 21:06:53 -08:00
parent cc881d02b1
commit 471224ea70
9 changed files with 314 additions and 303 deletions

View File

@@ -442,6 +442,78 @@ struct early_opt {
boolean valallowed;
};
/* special key functions */
enum nh_keyfunc {
NHKF_ESC = 0,
NHKF_DOAGAIN,
NHKF_REQMENU,
/* run ... clicklook need to be in a continuous block */
NHKF_RUN,
NHKF_RUN2,
NHKF_RUSH,
NHKF_FIGHT,
NHKF_FIGHT2,
NHKF_NOPICKUP,
NHKF_RUN_NOPICKUP,
NHKF_DOINV,
NHKF_TRAVEL,
NHKF_CLICKLOOK,
NHKF_REDRAW,
NHKF_REDRAW2,
NHKF_GETDIR_SELF,
NHKF_GETDIR_SELF2,
NHKF_GETDIR_HELP,
NHKF_COUNT,
NHKF_GETPOS_SELF,
NHKF_GETPOS_PICK,
NHKF_GETPOS_PICK_Q, /* quick */
NHKF_GETPOS_PICK_O, /* once */
NHKF_GETPOS_PICK_V, /* verbose */
NHKF_GETPOS_SHOWVALID,
NHKF_GETPOS_AUTODESC,
NHKF_GETPOS_MON_NEXT,
NHKF_GETPOS_MON_PREV,
NHKF_GETPOS_OBJ_NEXT,
NHKF_GETPOS_OBJ_PREV,
NHKF_GETPOS_DOOR_NEXT,
NHKF_GETPOS_DOOR_PREV,
NHKF_GETPOS_UNEX_NEXT,
NHKF_GETPOS_UNEX_PREV,
NHKF_GETPOS_INTERESTING_NEXT,
NHKF_GETPOS_INTERESTING_PREV,
NHKF_GETPOS_VALID_NEXT,
NHKF_GETPOS_VALID_PREV,
NHKF_GETPOS_HELP,
NHKF_GETPOS_MENU,
NHKF_GETPOS_LIMITVIEW,
NHKF_GETPOS_MOVESKIP,
NUM_NHKF
};
/* commands[] is used to directly access cmdlist[] instead of looping
through it to find the entry for a given input character;
move_X is the character used for moving one step in direction X;
alphadirchars corresponds to old sdir,
dirchars corresponds to ``iflags.num_pad ? ndir : sdir'';
pcHack_compat and phone_layout only matter when num_pad is on,
swap_yz only matters when it's off */
struct cmd {
unsigned serialno; /* incremented after each update */
boolean num_pad; /* same as iflags.num_pad except during updates */
boolean pcHack_compat; /* for numpad: affects 5, M-5, and M-0 */
boolean phone_layout; /* inverted keypad: 1,2,3 above, 7,8,9 below */
boolean swap_yz; /* QWERTZ keyboards; use z to move NW, y to zap */
char move_W, move_NW, move_N, move_NE, move_E, move_SE, move_S, move_SW;
const char *dirchars; /* current movement/direction characters */
const char *alphadirchars; /* same as dirchars if !numpad */
const struct ext_func_tab *commands[256]; /* indexed by input character */
char spkeys[NUM_NHKF];
};
/* 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.
@@ -449,19 +521,35 @@ struct early_opt {
* unlike instance_flags, values in the structure can be of any type. */
struct instance_globals {
/* apply.c */
int jumping_is_magic; /* current jump result of magic */
int polearm_range_min;
int polearm_range_max;
/* artifcat.c */
int spec_dbon_applies; /* coordinate effects from spec_dbon() with
messages in artifact_hit() */
/* flags including which artifacts have already been created */
boolean artiexist[1 + NROFARTIFACTS + 1];
/* and a discovery list for them (no dummy first entry here) */
xchar artidisco[NROFARTIFACTS];
/* botl.c */
int mrank_sz; /* loaded by max_rank_sz */
/* cmd.c */
struct cmd Cmd; /* flag.h */
/* dog.c */
int petname_used; /* user preferred pet name has been used */
/* makemon.c */
struct {
int choice_count;
char mchoices[SPECIAL_PM]; /* value range is 0..127 */
} rndmonst_state;
/* muse.c */
boolean m_using; /* kludge to use mondided instead of killed */
int trapx;

View File

@@ -529,58 +529,6 @@ enum runmode_types {
struct ext_func_tab; /* from func_tab.h */
#endif
/* special key functions */
enum nh_keyfunc {
NHKF_ESC = 0,
NHKF_DOAGAIN,
NHKF_REQMENU,
/* run ... clicklook need to be in a continuous block */
NHKF_RUN,
NHKF_RUN2,
NHKF_RUSH,
NHKF_FIGHT,
NHKF_FIGHT2,
NHKF_NOPICKUP,
NHKF_RUN_NOPICKUP,
NHKF_DOINV,
NHKF_TRAVEL,
NHKF_CLICKLOOK,
NHKF_REDRAW,
NHKF_REDRAW2,
NHKF_GETDIR_SELF,
NHKF_GETDIR_SELF2,
NHKF_GETDIR_HELP,
NHKF_COUNT,
NHKF_GETPOS_SELF,
NHKF_GETPOS_PICK,
NHKF_GETPOS_PICK_Q, /* quick */
NHKF_GETPOS_PICK_O, /* once */
NHKF_GETPOS_PICK_V, /* verbose */
NHKF_GETPOS_SHOWVALID,
NHKF_GETPOS_AUTODESC,
NHKF_GETPOS_MON_NEXT,
NHKF_GETPOS_MON_PREV,
NHKF_GETPOS_OBJ_NEXT,
NHKF_GETPOS_OBJ_PREV,
NHKF_GETPOS_DOOR_NEXT,
NHKF_GETPOS_DOOR_PREV,
NHKF_GETPOS_UNEX_NEXT,
NHKF_GETPOS_UNEX_PREV,
NHKF_GETPOS_INTERESTING_NEXT,
NHKF_GETPOS_INTERESTING_PREV,
NHKF_GETPOS_VALID_NEXT,
NHKF_GETPOS_VALID_PREV,
NHKF_GETPOS_HELP,
NHKF_GETPOS_MENU,
NHKF_GETPOS_LIMITVIEW,
NHKF_GETPOS_MOVESKIP,
NUM_NHKF
};
enum gloctypes {
GLOC_MONS = 0,
GLOC_OBJS,
@@ -592,26 +540,4 @@ enum gloctypes {
NUM_GLOCS
};
/* commands[] is used to directly access cmdlist[] instead of looping
through it to find the entry for a given input character;
move_X is the character used for moving one step in direction X;
alphadirchars corresponds to old sdir,
dirchars corresponds to ``iflags.num_pad ? ndir : sdir'';
pcHack_compat and phone_layout only matter when num_pad is on,
swap_yz only matters when it's off */
struct cmd {
unsigned serialno; /* incremented after each update */
boolean num_pad; /* same as iflags.num_pad except during updates */
boolean pcHack_compat; /* for numpad: affects 5, M-5, and M-0 */
boolean phone_layout; /* inverted keypad: 1,2,3 above, 7,8,9 below */
boolean swap_yz; /* QWERTZ keyboards; use z to move NW, y to zap */
char move_W, move_NW, move_N, move_NE, move_E, move_SE, move_S, move_SW;
const char *dirchars; /* current movement/direction characters */
const char *alphadirchars; /* same as dirchars if !numpad */
const struct ext_func_tab *commands[256]; /* indexed by input character */
char spkeys[NUM_NHKF];
};
extern NEARDATA struct cmd Cmd;
#endif /* FLAG_H */