more symbol set stuff (trunk only)

- Instead of checking for the Rogue level, check which
  graphics are engaged (PRIMARY or ROGUESET) in the
  SYMHANDLING() macro.

- track which graphics are active through 'currentgraphics'.

- Instead of symset and roguesymset and symhandling and roguehandling
  variables, have symset and symhandling be arrays of two, with the
  following indexes:
	PRIMARY
	ROGUESET
  That reduced the amount of repeated code.
  (Not to be confused with the 'symset' and 'roguesymset' config file options
   both of which still exist)

- the symbol routines were adjusted to pass
the index , rather than 'rogueflag' and coding to roguesymset etc.

Other than fixing bugs that are encountered, this is probably
the last of the symbol stuff, with the exception of
making the symset and roguesymset config file options
accept the keyword value "default".
This commit is contained in:
nethack.allison
2006-09-22 02:00:30 +00:00
parent a3e0bf97b1
commit 719721e017
14 changed files with 251 additions and 314 deletions

View File

@@ -491,9 +491,9 @@ E boolean FDECL(hurtle_step, (genericptr_t, int, int));
E int FDECL(def_char_to_objclass, (CHAR_P));
E int FDECL(def_char_to_monclass, (CHAR_P));
#if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C)
E void FDECL(switch_graphics, (int));
E void FDECL(switch_symbols, (int));
E void FDECL(assign_graphics, (int));
#ifdef REINCARNATION
E void FDECL(assign_rogue_graphics, (BOOLEAN_P));
E void NDECL(init_r_symbols);
#endif
E void NDECL(init_symbols);
@@ -502,7 +502,6 @@ E void NDECL(init_l_symbols);
#ifdef ASCIIGRAPH
E void FDECL(update_l_symset, (struct symparse *,int));
E void FDECL(update_r_symset, (struct symparse *,int));
E void FDECL(switch_graphics, (int));
#endif
#ifdef BARGETHROUGH
E boolean FDECL(cursed_object_at, (int, int));
@@ -719,8 +718,8 @@ E void FDECL(check_recordfile, (const char *));
E void NDECL(read_wizkit);
#endif
#ifdef ASCIIGRAPH
E int FDECL(read_sym_file, (BOOLEAN_P));
E int FDECL(parse_sym_line, (char *,BOOLEAN_P));
E int FDECL(read_sym_file, (int));
E int FDECL(parse_sym_line, (char *,int));
#endif
E void FDECL(paniclog, (const char *, const char *));
E int FDECL(validate_prefix_locations, (char *));
@@ -1537,7 +1536,7 @@ E int FDECL(add_autopickup_exception, (const char *));
E void NDECL(free_autopickup_exceptions);
#endif /* AUTOPICKUP_EXCEPTIONS */
#ifdef ASCIIGRAPH
E int FDECL(load_symset, (const char *,BOOLEAN_P));
E int FDECL(load_symset, (const char *,int));
E void FDECL(parsesymbols, (char *));
E struct symparse *FDECL(match_sym, (char *));
E int FDECL(sym_val, (char *));

View File

@@ -242,7 +242,15 @@ struct textlist {
};
/*
* special symbol set handling types (callbacks, etc.)
* Graphics sets for display symbols
*/
#define DEFAULT_GRAPHICS 0 /* regular characters: '-', '+', &c */
#define PRIMARY 0 /* primary graphics */
#define ROGUESET 1 /* rogue graphics */
#define NUM_GRAPHICS 2
/*
* special symbol set handling types ( for invoking callbacks, etc.)
* Must match the order of the known_handlers strings
* in drawing.c
*/
@@ -250,29 +258,13 @@ struct textlist {
#define H_IBM 1
#define H_DEC 2
#ifdef REINCARNATION
#define ROGUEHANDLING(ht) (Is_rogue_level(&u.uz) && \
rogue_level.dlevel != 0 && roguehandling == (ht))
#define SYMHANDLING(ht) \
(ROGUEHANDLING(ht) || \
((!Is_rogue_level(&u.uz) || rogue_level.dlevel == 0) && \
symhandling == (ht)))
#else
#define SYMHANDLING(ht) (symhandling == (ht))
#endif
extern const struct symdef defsyms[MAXPCHARS]; /* defaults */
extern uchar showsyms[MAXPCHARS];
extern const struct symdef def_warnsyms[WARNCOUNT];
extern char *symset, *roguesymset; /* from drawing.c */
extern int symhandling, roguehandling; /* from drawing.c */
extern char *symset[NUM_GRAPHICS]; /* from drawing.c */
extern int symhandling[NUM_GRAPHICS], currentgraphics; /* from drawing.c */
/*
* Graphics sets for display symbols
*/
#define DEFAULT_GRAPHICS 0 /* regular characters: '-', '+', &c */
#define ROGUESET 1 /* useful for load_symset() */
#define PRIMARY 0
#define SYMHANDLING(ht) (symhandling[currentgraphics] == (ht))
/*
* The 5 possible states of doors