header file changes hack.h, decl.h/.c, system.h, wintty.h
- Move secondary preprocessor defines down further in config.h
so that they can be overridden via [platform]conf.h which is
included from global.h, specifically:
LIVELOGFILE when LIVELOG is defined
DUMPLOG_FILE when DUMPLOG is defined
- Minimize platform-specific, or compiler-specific code in hack.h and decl.h.
- reorganize src/decl.c to align with include/decl.h.
- a new header file cstd.h added, containing calls to C99
standard header files.
- hack.h, decl.h, and decl.c have been cleaned up and had code
moved so that things line up as follows:
hack.h defines values that are available to all
NetHack source files, contains enums for use in all
NetHack source files, and contains a number of
struct definitions for use in all NetHack source files.
It does not contain variable declarations or variable
definitions.
decl.h contains the extern declarations for variables that
are defined in decl.c. These variables are global and
available to all NetHack source files. The location of
the variables within decl.h was random, so give it some
order for now.
decl.c contains the definition of the variables declared in
decl.h, and initializes them where appropriate. The
variable definitions are laid out in much the
same order as their declarations in decl.h.
- wintty.h: There were some varying terminal-related prototypes in
system.h, and that was the only thing left that demanded that
system.h be included. Those have been replaced by an #include
<term.h> in include/wintty.h to get the more current (and hopefully
more correct) prototypes, rather than hardcoding them in NetHack
sources.
For edge-case platform compatiblity, there is no #include <term.h>
if the build defines NO_TERMCAP_HEADERS. In that case one set of
hardcoded prototypes is still used in include/wintty.h.
The added #include "term.h" is also bypassed for NO_TERMS builds (builds
that don't link to terminfo/termcap at all, but still present a tty
interface using platform or window-port specific functions to fulfill
the same role as that of terminfo/termcap).
- some scattered, unnecessary #include "integer.h" were removed from
various files, since that's always included in current NetHack-3.7
sources, either directly from config.h or indirectly from #include
"hack.h".
- system.h references removed.
- new cstd.h added; the #include "system.h" references in Makefiles
and project files (Xcode, visual studio), were replaced
with #include "cstd.h" references. A "make depends" is probably
warranted.
Also:
- Use of <term.h>, which defines clear_screen() as a macro, conflicts
with an actual function with that name in win/tty/termcap.c. The most
straight-forward course of action was to rename the NetHack function,
and change the references to it, from clear_screen() to
term_clear_screen(), so that was done.
This commit is contained in:
694
include/decl.h
694
include/decl.h
@@ -6,279 +6,14 @@
|
||||
#ifndef DECL_H
|
||||
#define DECL_H
|
||||
|
||||
/* max size of a windowtype option */
|
||||
#define WINTYPELEN 16
|
||||
|
||||
struct dgn_topology { /* special dungeon levels for speed */
|
||||
d_level d_oracle_level;
|
||||
d_level d_bigroom_level; /* unused */
|
||||
d_level d_rogue_level;
|
||||
d_level d_medusa_level;
|
||||
d_level d_stronghold_level;
|
||||
d_level d_valley_level;
|
||||
d_level d_wiz1_level;
|
||||
d_level d_wiz2_level;
|
||||
d_level d_wiz3_level;
|
||||
d_level d_juiblex_level;
|
||||
d_level d_orcus_level;
|
||||
d_level d_baalzebub_level; /* unused */
|
||||
d_level d_asmodeus_level; /* unused */
|
||||
d_level d_portal_level; /* only in goto_level() [do.c] */
|
||||
d_level d_sanctum_level;
|
||||
d_level d_earth_level;
|
||||
d_level d_water_level;
|
||||
d_level d_fire_level;
|
||||
d_level d_air_level;
|
||||
d_level d_astral_level;
|
||||
xint16 d_tower_dnum;
|
||||
xint16 d_sokoban_dnum;
|
||||
xint16 d_mines_dnum, d_quest_dnum;
|
||||
d_level d_qstart_level, d_qlocate_level, d_nemesis_level;
|
||||
d_level d_knox_level;
|
||||
d_level d_mineend_level;
|
||||
d_level d_sokoend_level;
|
||||
};
|
||||
|
||||
/* macros for accessing the dungeon levels by their old names */
|
||||
/* clang-format off */
|
||||
#define oracle_level (gd.dungeon_topology.d_oracle_level)
|
||||
#define bigroom_level (gd.dungeon_topology.d_bigroom_level)
|
||||
#define rogue_level (gd.dungeon_topology.d_rogue_level)
|
||||
#define medusa_level (gd.dungeon_topology.d_medusa_level)
|
||||
#define stronghold_level (gd.dungeon_topology.d_stronghold_level)
|
||||
#define valley_level (gd.dungeon_topology.d_valley_level)
|
||||
#define wiz1_level (gd.dungeon_topology.d_wiz1_level)
|
||||
#define wiz2_level (gd.dungeon_topology.d_wiz2_level)
|
||||
#define wiz3_level (gd.dungeon_topology.d_wiz3_level)
|
||||
#define juiblex_level (gd.dungeon_topology.d_juiblex_level)
|
||||
#define orcus_level (gd.dungeon_topology.d_orcus_level)
|
||||
#define baalzebub_level (gd.dungeon_topology.d_baalzebub_level)
|
||||
#define asmodeus_level (gd.dungeon_topology.d_asmodeus_level)
|
||||
#define portal_level (gd.dungeon_topology.d_portal_level)
|
||||
#define sanctum_level (gd.dungeon_topology.d_sanctum_level)
|
||||
#define earth_level (gd.dungeon_topology.d_earth_level)
|
||||
#define water_level (gd.dungeon_topology.d_water_level)
|
||||
#define fire_level (gd.dungeon_topology.d_fire_level)
|
||||
#define air_level (gd.dungeon_topology.d_air_level)
|
||||
#define astral_level (gd.dungeon_topology.d_astral_level)
|
||||
#define tower_dnum (gd.dungeon_topology.d_tower_dnum)
|
||||
#define sokoban_dnum (gd.dungeon_topology.d_sokoban_dnum)
|
||||
#define mines_dnum (gd.dungeon_topology.d_mines_dnum)
|
||||
#define quest_dnum (gd.dungeon_topology.d_quest_dnum)
|
||||
#define qstart_level (gd.dungeon_topology.d_qstart_level)
|
||||
#define qlocate_level (gd.dungeon_topology.d_qlocate_level)
|
||||
#define nemesis_level (gd.dungeon_topology.d_nemesis_level)
|
||||
#define knox_level (gd.dungeon_topology.d_knox_level)
|
||||
#define mineend_level (gd.dungeon_topology.d_mineend_level)
|
||||
#define sokoend_level (gd.dungeon_topology.d_sokoend_level)
|
||||
/* clang-format on */
|
||||
|
||||
#define dunlev_reached(x) (gd.dungeons[(x)->dnum].dunlev_ureached)
|
||||
|
||||
#include "quest.h"
|
||||
|
||||
extern NEARDATA char tune[6];
|
||||
|
||||
#define MAXLINFO (MAXDUNGEON * MAXLEVEL)
|
||||
|
||||
/* structure for 'program_state'; not saved and restored */
|
||||
struct sinfo {
|
||||
int gameover; /* self explanatory? */
|
||||
int stopprint; /* inhibit further end of game disclosure */
|
||||
#ifdef HANGUPHANDLING
|
||||
volatile int done_hup; /* SIGHUP or moral equivalent received
|
||||
* -- no more screen output */
|
||||
int preserve_locks; /* don't remove level files prior to exit */
|
||||
#endif
|
||||
int something_worth_saving; /* in case of panic */
|
||||
int panicking; /* `panic' is in progress */
|
||||
int exiting; /* an exit handler is executing */
|
||||
int saving; /* creating a save file */
|
||||
int restoring; /* reloading a save file */
|
||||
int in_moveloop; /* normal gameplay in progress */
|
||||
int in_impossible; /* reporting a warning */
|
||||
int in_docrt; /* in docrt(): redrawing the whole screen */
|
||||
int in_self_recover; /* processing orphaned level files */
|
||||
int in_checkpoint; /* saving insurance checkpoint */
|
||||
int in_parseoptions; /* in parseoptions */
|
||||
int in_role_selection; /* role/race/&c selection menus in progress */
|
||||
int config_error_ready; /* config_error_add is ready, available */
|
||||
int beyond_savefile_load; /* set when past savefile loading */
|
||||
#ifdef PANICLOG
|
||||
int in_paniclog; /* writing a paniclog entry */
|
||||
#endif
|
||||
int wizkit_wishing; /* starting wizard mode game w/ WIZKIT file */
|
||||
/* getting_a_command: only used for ALTMETA config to process ESC, but
|
||||
present and updated unconditionally; set by parse() when requesting
|
||||
next command keystroke, reset by readchar() as it returns a key */
|
||||
int getting_a_command; /* next key pressed will be entering a cmnd */
|
||||
};
|
||||
|
||||
/* Flags for controlling uptodate */
|
||||
#define UTD_CHECKSIZES 0x01
|
||||
#define UTD_CHECKFIELDCOUNTS 0x02
|
||||
#define UTD_SKIP_SANITY1 0x04
|
||||
#define UTD_SKIP_SAVEFILEINFO 0x08
|
||||
|
||||
/* NetHack ftypes */
|
||||
#define NHF_LEVELFILE 1
|
||||
#define NHF_SAVEFILE 2
|
||||
#define NHF_BONESFILE 3
|
||||
/* modes */
|
||||
#define READING 0x0
|
||||
#define COUNTING 0x1
|
||||
#define WRITING 0x2
|
||||
#define FREEING 0x4
|
||||
#define MAX_BMASK 4
|
||||
/* operations of the various saveXXXchn & co. routines */
|
||||
#define perform_bwrite(nhfp) ((nhfp)->mode & (COUNTING | WRITING))
|
||||
#define release_data(nhfp) ((nhfp)->mode & FREEING)
|
||||
|
||||
/* Content types for fieldlevel files */
|
||||
struct fieldlevel_content {
|
||||
boolean deflt; /* individual fields */
|
||||
boolean binary; /* binary rather than text */
|
||||
boolean json; /* JSON */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int fd; /* for traditional structlevel binary writes */
|
||||
int mode; /* holds READING, WRITING, or FREEING modes */
|
||||
int ftype; /* NHF_LEVELFILE, NHF_SAVEFILE, or NHF_BONESFILE */
|
||||
int fnidx; /* index of procs for fieldlevel saves */
|
||||
long count; /* holds current line count for default style file,
|
||||
field count for binary style */
|
||||
boolean structlevel; /* traditional structure binary saves */
|
||||
boolean fieldlevel; /* fieldlevel saves saves each field individually */
|
||||
boolean addinfo; /* if set, some additional context info from core */
|
||||
boolean eof; /* place to mark eof reached */
|
||||
boolean bendian; /* set to true if executing on big-endian machine */
|
||||
FILE *fpdef; /* file pointer for fieldlevel default style */
|
||||
FILE *fpdefmap; /* file pointer mapfile for def format */
|
||||
FILE *fplog; /* file pointer logfile */
|
||||
FILE *fpdebug; /* file pointer debug info */
|
||||
struct fieldlevel_content style;
|
||||
} NHFILE;
|
||||
|
||||
extern const char quitchars[];
|
||||
extern const char vowels[];
|
||||
extern const char ynchars[];
|
||||
extern const char ynqchars[];
|
||||
extern const char ynaqchars[];
|
||||
extern const char ynNaqchars[];
|
||||
extern NEARDATA long yn_number;
|
||||
|
||||
extern const char disclosure_options[];
|
||||
|
||||
struct kinfo {
|
||||
struct kinfo *next; /* chain of delayed killers */
|
||||
int id; /* uprop keys to ID a delayed killer */
|
||||
int format; /* one of the killer formats */
|
||||
#define KILLED_BY_AN 0
|
||||
#define KILLED_BY 1
|
||||
#define NO_KILLER_PREFIX 2
|
||||
char name[BUFSZ]; /* actual killer name */
|
||||
};
|
||||
|
||||
/* game events log */
|
||||
struct gamelog_line {
|
||||
long turn; /* turn when this happened */
|
||||
long flags; /* LL_foo flags */
|
||||
char *text;
|
||||
struct gamelog_line *next;
|
||||
};
|
||||
|
||||
enum movemodes {
|
||||
MV_ANY = -1,
|
||||
MV_WALK,
|
||||
MV_RUN,
|
||||
MV_RUSH,
|
||||
|
||||
N_MOVEMODES
|
||||
};
|
||||
|
||||
enum movementdirs {
|
||||
DIR_ERR = -1,
|
||||
DIR_W,
|
||||
DIR_NW,
|
||||
DIR_N,
|
||||
DIR_NE,
|
||||
DIR_E,
|
||||
DIR_SE,
|
||||
DIR_S,
|
||||
DIR_SW,
|
||||
DIR_DOWN,
|
||||
DIR_UP,
|
||||
|
||||
N_DIRS_Z
|
||||
};
|
||||
/* N_DIRS_Z, minus up & down */
|
||||
#define N_DIRS (N_DIRS_Z - 2)
|
||||
/* direction adjustments */
|
||||
#define DIR_180(dir) (((dir) + 4) % N_DIRS)
|
||||
#define DIR_LEFT(dir) (((dir) + 7) % N_DIRS)
|
||||
#define DIR_RIGHT(dir) (((dir) + 1) % N_DIRS)
|
||||
#define DIR_LEFT2(dir) (((dir) + 6) % N_DIRS)
|
||||
#define DIR_RIGHT2(dir) (((dir) + 2) % N_DIRS)
|
||||
#define DIR_CLAMP(dir) (((dir) + N_DIRS) % N_DIRS)
|
||||
|
||||
extern const schar xdir[], ydir[], zdir[], dirs_ord[];
|
||||
|
||||
struct multishot {
|
||||
int n, i;
|
||||
short o;
|
||||
boolean s;
|
||||
};
|
||||
|
||||
extern NEARDATA boolean has_strong_rngseed;
|
||||
extern const int shield_static[];
|
||||
|
||||
#include "spell.h"
|
||||
|
||||
/* default object class symbols */
|
||||
extern const struct class_sym def_oc_syms[MAXOCLASSES];
|
||||
/* current object class symbols */
|
||||
extern uchar oc_syms[MAXOCLASSES];
|
||||
|
||||
/* default mon class symbols */
|
||||
extern const struct class_sym def_monsyms[MAXMCLASSES];
|
||||
/* current mon class symbols */
|
||||
extern uchar monsyms[MAXMCLASSES];
|
||||
/* The names of the colors used for gems, etc. */
|
||||
extern const char *c_obj_colors[];
|
||||
|
||||
/* lua callback queue names */
|
||||
extern const char * const nhcb_name[];
|
||||
extern int nhcb_counts[];
|
||||
|
||||
#include "obj.h"
|
||||
extern NEARDATA struct obj *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf,
|
||||
*uarmu, /* under-wear, so to speak */
|
||||
*uskin, *uamul, *uleft, *uright, *ublindf, *uwep, *uswapwep, *uquiver;
|
||||
|
||||
extern NEARDATA struct obj *uchain; /* defined only when punished */
|
||||
extern NEARDATA struct obj *uball;
|
||||
|
||||
#include "engrave.h"
|
||||
extern struct engr *head_engr;
|
||||
|
||||
#include "you.h"
|
||||
extern NEARDATA struct you u;
|
||||
extern NEARDATA time_t ubirthday;
|
||||
extern NEARDATA struct u_realtime urealtime;
|
||||
|
||||
struct mvitals {
|
||||
uchar born;
|
||||
uchar died;
|
||||
uchar mvflags;
|
||||
};
|
||||
|
||||
struct c_color_names {
|
||||
const char *const c_black, *const c_amber, *const c_golden,
|
||||
*const c_light_blue, *const c_red, *const c_green, *const c_silver,
|
||||
*const c_blue, *const c_purple, *const c_white, *const c_orange;
|
||||
};
|
||||
|
||||
extern NEARDATA const struct c_color_names c_color_names;
|
||||
|
||||
#define NH_BLACK c_color_names.c_black
|
||||
#define NH_AMBER c_color_names.c_amber
|
||||
#define NH_GOLDEN c_color_names.c_golden
|
||||
@@ -291,19 +26,8 @@ extern NEARDATA const struct c_color_names c_color_names;
|
||||
#define NH_WHITE c_color_names.c_white
|
||||
#define NH_ORANGE c_color_names.c_orange
|
||||
|
||||
/* The names of the colors used for gems, etc. */
|
||||
extern const char *c_obj_colors[];
|
||||
|
||||
struct c_common_strings {
|
||||
const char *const c_nothing_happens, *const c_thats_enough_tries,
|
||||
*const c_silly_thing_to, *const c_shudder_for_moment,
|
||||
*const c_something, *const c_Something, *const c_You_can_move_again,
|
||||
*const c_Never_mind, *c_vision_clears, *const c_the_your[2],
|
||||
*const c_fakename[2];
|
||||
};
|
||||
|
||||
/* common_strings */
|
||||
extern const struct c_common_strings c_common_strings;
|
||||
|
||||
#define nothing_happens c_common_strings.c_nothing_happens
|
||||
#define thats_enough_tries c_common_strings.c_thats_enough_tries
|
||||
#define silly_thing_to c_common_strings.c_silly_thing_to
|
||||
@@ -318,41 +42,63 @@ extern const struct c_common_strings c_common_strings;
|
||||
name ending in 's' */
|
||||
#define fakename c_common_strings.c_fakename
|
||||
|
||||
/* material strings */
|
||||
extern const char *materialnm[];
|
||||
/* default object class symbols */
|
||||
extern const struct class_sym def_oc_syms[MAXOCLASSES];
|
||||
|
||||
/* default mon class symbols */
|
||||
extern const struct class_sym def_monsyms[MAXMCLASSES];
|
||||
|
||||
extern const char disclosure_options[];
|
||||
|
||||
/* empty string that is non-const for parameter use */
|
||||
extern char emptystr[];
|
||||
|
||||
/* Monster name articles */
|
||||
#define ARTICLE_NONE 0
|
||||
#define ARTICLE_THE 1
|
||||
#define ARTICLE_A 2
|
||||
#define ARTICLE_YOUR 3
|
||||
#ifdef WIN32
|
||||
extern boolean fqn_prefix_locked[PREFIX_COUNT];
|
||||
#endif
|
||||
#ifdef PREFIXES_IN_USE
|
||||
extern const char *fqn_prefix_names[PREFIX_COUNT];
|
||||
#endif
|
||||
|
||||
/* x_monnam() monster name suppress masks */
|
||||
#define SUPPRESS_IT 0x01
|
||||
#define SUPPRESS_INVISIBLE 0x02
|
||||
#define SUPPRESS_HALLUCINATION 0x04
|
||||
#define SUPPRESS_SADDLE 0x08
|
||||
#define EXACT_NAME 0x0F
|
||||
#define SUPPRESS_NAME 0x10
|
||||
#define AUGMENT_IT 0x20 /* use "someone" or "something" instead of "it" */
|
||||
extern NEARDATA boolean has_strong_rngseed;
|
||||
extern struct engr *head_engr;
|
||||
|
||||
/* material strings */
|
||||
extern const char *materialnm[];
|
||||
|
||||
/* current mon class symbols */
|
||||
extern uchar monsyms[MAXMCLASSES];
|
||||
|
||||
/* current object class symbols */
|
||||
extern uchar oc_syms[MAXOCLASSES];
|
||||
|
||||
extern const char quitchars[];
|
||||
extern NEARDATA char tune[6];
|
||||
extern const schar xdir[], ydir[], zdir[], dirs_ord[];
|
||||
extern const char vowels[];
|
||||
extern const char ynchars[];
|
||||
extern const char ynqchars[];
|
||||
extern const char ynaqchars[];
|
||||
extern const char ynNaqchars[];
|
||||
extern NEARDATA long yn_number;
|
||||
extern struct restore_info restoreinfo;
|
||||
extern NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo;
|
||||
extern const int shield_static[];
|
||||
|
||||
extern NEARDATA struct obj *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf,
|
||||
*uarmu, /* under-wear, so to speak */
|
||||
*uskin, *uamul, *uleft, *uright, *ublindf, *uwep, *uswapwep, *uquiver;
|
||||
extern NEARDATA struct obj *uchain; /* defined only when punished */
|
||||
extern NEARDATA struct obj *uball;
|
||||
extern NEARDATA struct you u;
|
||||
extern NEARDATA time_t ubirthday;
|
||||
extern NEARDATA struct u_realtime urealtime;
|
||||
|
||||
/* Window system stuff */
|
||||
extern NEARDATA winid WIN_MESSAGE;
|
||||
extern NEARDATA winid WIN_STATUS;
|
||||
extern NEARDATA winid WIN_MAP, WIN_INVEN;
|
||||
|
||||
/* pline (et al) for a single string argument (suppress compiler warning) */
|
||||
#define pline1(cstr) pline("%s", cstr)
|
||||
#define Your1(cstr) Your("%s", cstr)
|
||||
#define You1(cstr) You("%s", cstr)
|
||||
#define verbalize1(cstr) verbalize("%s", cstr)
|
||||
#define You_hear1(cstr) You_hear("%s", cstr)
|
||||
#define Sprintf1(buf, cstr) Sprintf(buf, "%s", cstr)
|
||||
#define panic1(cstr) panic("%s", cstr)
|
||||
|
||||
#ifndef TCAP_H
|
||||
extern struct tc_gbl_data { /* also declared in tcap.h */
|
||||
char *tc_AS, *tc_AE; /* graphics start and end (tty font swapping) */
|
||||
@@ -364,352 +110,10 @@ extern struct tc_gbl_data { /* also declared in tcap.h */
|
||||
#define CO gt.tc_gbl_data.tc_CO
|
||||
#endif
|
||||
|
||||
/* Some systems want to use full pathnames for some subsets of file names,
|
||||
* rather than assuming that they're all in the current directory. This
|
||||
* provides all the subclasses that seem reasonable, and sets up for all
|
||||
* prefixes being null. Port code can set those that it wants.
|
||||
*/
|
||||
#define HACKPREFIX 0 /* shared, RO */
|
||||
#define LEVELPREFIX 1 /* per-user, RW */
|
||||
#define SAVEPREFIX 2 /* per-user, RW */
|
||||
#define BONESPREFIX 3 /* shared, RW */
|
||||
#define DATAPREFIX 4 /* dungeon/dlb; must match value in dlb.c */
|
||||
#define SCOREPREFIX 5 /* shared, RW */
|
||||
#define LOCKPREFIX 6 /* shared, RW */
|
||||
#define SYSCONFPREFIX 7 /* shared, RO */
|
||||
#define CONFIGPREFIX 8
|
||||
#define TROUBLEPREFIX 9 /* shared or per-user, RW (append-only) */
|
||||
#define PREFIX_COUNT 10
|
||||
/* used in files.c; xxconf.h can override if needed */
|
||||
#ifndef FQN_MAX_FILENAME
|
||||
#define FQN_MAX_FILENAME 512
|
||||
#endif
|
||||
|
||||
#if defined(NOCWD_ASSUMPTIONS) || defined(VAR_PLAYGROUND)
|
||||
/* the bare-bones stuff is unconditional above to simplify coding; for
|
||||
* ports that actually use prefixes, add some more localized things
|
||||
*/
|
||||
#define PREFIXES_IN_USE
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
extern boolean fqn_prefix_locked[PREFIX_COUNT];
|
||||
#endif
|
||||
#ifdef PREFIXES_IN_USE
|
||||
extern const char *fqn_prefix_names[PREFIX_COUNT];
|
||||
#endif
|
||||
|
||||
struct restore_info {
|
||||
const char *name;
|
||||
int mread_flags;
|
||||
};
|
||||
extern struct restore_info restoreinfo;
|
||||
|
||||
extern NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo;
|
||||
|
||||
struct selectionvar {
|
||||
int wid, hei;
|
||||
boolean bounds_dirty;
|
||||
NhRect bounds; /* use selection_getbounds() */
|
||||
char *map;
|
||||
};
|
||||
|
||||
struct autopickup_exception {
|
||||
struct nhregex *regex;
|
||||
char *pattern;
|
||||
boolean grab;
|
||||
struct autopickup_exception *next;
|
||||
};
|
||||
|
||||
struct plinemsg_type {
|
||||
xint16 msgtype; /* one of MSGTYP_foo */
|
||||
struct nhregex *regex;
|
||||
char *pattern;
|
||||
struct plinemsg_type *next;
|
||||
};
|
||||
|
||||
#define MSGTYP_NORMAL 0
|
||||
#define MSGTYP_NOREP 1
|
||||
#define MSGTYP_NOSHOW 2
|
||||
#define MSGTYP_STOP 3
|
||||
/* bitmask for callers of hide_unhide_msgtypes() */
|
||||
#define MSGTYP_MASK_REP_SHOW ((1 << MSGTYP_NOREP) | (1 << MSGTYP_NOSHOW))
|
||||
|
||||
enum bcargs {override_restriction = -1};
|
||||
struct breadcrumbs {
|
||||
const char *funcnm;
|
||||
int linenum;
|
||||
boolean in_effect;
|
||||
};
|
||||
#ifdef PANICTRACE
|
||||
extern const char *ARGV0;
|
||||
#endif
|
||||
|
||||
enum earlyarg {
|
||||
ARG_DEBUG, ARG_VERSION, ARG_SHOWPATHS
|
||||
#ifndef NODUMPENUMS
|
||||
, ARG_DUMPENUMS
|
||||
#endif
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
, ARG_DUMPGLYPHIDS
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
, ARG_WINDOWS
|
||||
#endif
|
||||
};
|
||||
|
||||
struct early_opt {
|
||||
enum earlyarg e;
|
||||
const char *name;
|
||||
int minlength;
|
||||
boolean valallowed;
|
||||
};
|
||||
|
||||
/* special key functions */
|
||||
enum nh_keyfunc {
|
||||
NHKF_ESC = 0,
|
||||
|
||||
NHKF_GETDIR_SELF,
|
||||
NHKF_GETDIR_SELF2,
|
||||
NHKF_GETDIR_HELP,
|
||||
NHKF_GETDIR_MOUSE, /* simulated click for #therecmdmenu; use '_' as
|
||||
* direction to initiate, then getpos() finishing
|
||||
* with ',' (left click) or '.' (right click) */
|
||||
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 */
|
||||
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 */
|
||||
const struct ext_func_tab *mousebtn[NUM_MOUSE_BUTTONS];
|
||||
char spkeys[NUM_NHKF];
|
||||
char extcmd_char; /* key that starts an extended command ('#') */
|
||||
};
|
||||
|
||||
|
||||
#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;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
struct trapinfo {
|
||||
struct obj *tobj;
|
||||
coordxy tx, ty;
|
||||
int time_needed;
|
||||
boolean force_bungle;
|
||||
};
|
||||
|
||||
enum vanq_order_modes {
|
||||
VANQ_MLVL_MNDX = 0, /* t - traditional: by monster level */
|
||||
VANQ_MSTR_MNDX, /* d - by difficulty rating */
|
||||
VANQ_ALPHA_SEP, /* a - alphabetical, first uniques, then ordinary */
|
||||
VANQ_ALPHA_MIX, /* A - alpha with uniques and ordinary intermixed */
|
||||
VANQ_MCLS_HTOL, /* C - by class, high to low within class */
|
||||
VANQ_MCLS_LTOH, /* c - by class, low to high within class */
|
||||
VANQ_COUNT_H_L, /* n - by count, high to low */
|
||||
VANQ_COUNT_L_H, /* z - by count, low to high */
|
||||
|
||||
NUM_VANQ_ORDER_MODES
|
||||
};
|
||||
|
||||
struct rogueroom {
|
||||
coordxy rlx, rly;
|
||||
coordxy dx, dy;
|
||||
boolean real;
|
||||
uchar doortable;
|
||||
int nroom; /* Only meaningful for "real" rooms */
|
||||
};
|
||||
|
||||
typedef struct ls_t {
|
||||
struct ls_t *next;
|
||||
coordxy x, y; /* source's position */
|
||||
short range; /* source's current range */
|
||||
short flags;
|
||||
short type; /* type of light source */
|
||||
anything id; /* source's identifier */
|
||||
} light_source;
|
||||
|
||||
struct container {
|
||||
struct container *next;
|
||||
coordxy x, y;
|
||||
short what;
|
||||
genericptr_t list;
|
||||
};
|
||||
|
||||
enum bubble_contains_types {
|
||||
CONS_OBJ = 0,
|
||||
CONS_MON,
|
||||
CONS_HERO,
|
||||
CONS_TRAP
|
||||
};
|
||||
|
||||
#define MAX_BMASK 4
|
||||
|
||||
struct bubble {
|
||||
coordxy x, y; /* coordinates of the upper left corner */
|
||||
schar dx, dy; /* the general direction of the bubble's movement */
|
||||
uchar bm[MAX_BMASK + 2]; /* bubble bit mask */
|
||||
struct bubble *prev, *next; /* need to traverse the list up and down */
|
||||
struct container *cons;
|
||||
};
|
||||
|
||||
struct musable {
|
||||
struct obj *offensive;
|
||||
struct obj *defensive;
|
||||
struct obj *misc;
|
||||
int has_offense, has_defense, has_misc;
|
||||
/* =0, no capability; otherwise, different numbers.
|
||||
* If it's an object, the object is also set (it's 0 otherwise).
|
||||
*/
|
||||
};
|
||||
|
||||
struct h2o_ctx {
|
||||
int dkn_boom, unk_boom; /* track dknown, !dknown separately */
|
||||
boolean ctx_valid;
|
||||
};
|
||||
|
||||
struct launchplace {
|
||||
struct obj *obj;
|
||||
coordxy x, y;
|
||||
};
|
||||
|
||||
struct repo { /* repossession context */
|
||||
struct monst *shopkeeper;
|
||||
coord location;
|
||||
};
|
||||
|
||||
/* from options.c */
|
||||
#define MAX_MENU_MAPPED_CMDS 32 /* some number */
|
||||
|
||||
/* player selection constants */
|
||||
#define BP_ALIGN 0
|
||||
#define BP_GEND 1
|
||||
#define BP_RACE 2
|
||||
#define BP_ROLE 3
|
||||
#define NUM_BP 4
|
||||
|
||||
#define NUM_ROLES (13)
|
||||
struct role_filter {
|
||||
boolean roles[NUM_ROLES + 1];
|
||||
short mask;
|
||||
};
|
||||
|
||||
/* read.c, create_particular() & create_particular_parse() */
|
||||
struct _create_particular_data {
|
||||
int quan;
|
||||
int which;
|
||||
int fem; /* -1, MALE, FEMALE, NEUTRAL */
|
||||
int genderconf; /* conflicting gender */
|
||||
char monclass;
|
||||
boolean randmonst;
|
||||
boolean maketame, makepeaceful, makehostile;
|
||||
boolean sleeping, saddled, invisible, hidden;
|
||||
};
|
||||
|
||||
/* some array sizes for 'g' */
|
||||
#define WIZKIT_MAX 128
|
||||
#define CVT_BUF_SIZE 64
|
||||
|
||||
#define LUA_VER_BUFSIZ 20
|
||||
#define LUA_COPYRIGHT_BUFSIZ 120
|
||||
|
||||
/*
|
||||
* Rudimentary command queue.
|
||||
* Allows the code to put keys and extended commands into the queue,
|
||||
* and they're executed just as if the user did them. Time passes
|
||||
* normally when doing queued actions. The queue will get cleared
|
||||
* if hero is interrupted.
|
||||
*/
|
||||
enum cmdq_cmdtypes {
|
||||
CMDQ_KEY = 0, /* a literal character, cmdq_add_key() */
|
||||
CMDQ_EXTCMD, /* extended command, cmdq_add_ec() */
|
||||
CMDQ_DIR, /* direction, cmdq_add_dir() */
|
||||
CMDQ_USER_INPUT, /* placeholder for user input, cmdq_add_userinput() */
|
||||
CMDQ_INT, /* integer value, cmdq_add_int() */
|
||||
};
|
||||
|
||||
struct _cmd_queue {
|
||||
int typ;
|
||||
char key;
|
||||
schar dirx, diry, dirz;
|
||||
int intval;
|
||||
const struct ext_func_tab *ec_entry;
|
||||
struct _cmd_queue *next;
|
||||
};
|
||||
|
||||
struct enum_dump {
|
||||
int val;
|
||||
const char *nm;
|
||||
};
|
||||
|
||||
typedef long cmdcount_nht; /* Command counts */
|
||||
|
||||
enum {
|
||||
CQ_CANNED = 0, /* internal canned sequence */
|
||||
CQ_REPEAT, /* user-inputted, if gi.in_doagain, replayed */
|
||||
NUM_CQS
|
||||
};
|
||||
|
||||
/*
|
||||
* 'gX' -- instance_globals holds engine state that does not need to be
|
||||
* persisted upon game exit. The initialization state is well defined
|
||||
|
||||
Reference in New Issue
Block a user