From: Sean Hunt Date: Sat, 14 Feb 2015 19:15:27 +0000 (-0500) Subject: Make LOADSYMSETS unconditional. X-Git-Tag: NetHack-3.6.0_RC01~659 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d218bedbf7757ccc59499cab6cdce594186a3b99;p=nethack Make LOADSYMSETS unconditional. There are some bugs here, but this functionality should make it into the release in some form. --- diff --git a/include/config.h b/include/config.h index 282b6949b..db5070a3a 100644 --- a/include/config.h +++ b/include/config.h @@ -412,7 +412,6 @@ typedef unsigned char uchar; */ /* display features */ -#define LOADSYMSETS /* loadable symbol sets; only default symbols w/o this */ /* dungeon features */ /* dungeon levels */ #define WALLIFIED_MAZE /* Fancy mazes - Jean-Christophe Collet */ diff --git a/include/extern.h b/include/extern.h index be15406c2..836b64d5f 100644 --- a/include/extern.h +++ b/include/extern.h @@ -515,11 +515,9 @@ E void NDECL(init_r_symbols); E void NDECL(init_symbols); E void NDECL(init_showsyms); E void NDECL(init_l_symbols); -#ifdef LOADSYMSETS E void FDECL(clear_symsetentry, (int,BOOLEAN_P)); E void FDECL(update_l_symset, (struct symparse *,int)); E void FDECL(update_r_symset, (struct symparse *,int)); -#endif E boolean FDECL(cursed_object_at, (int, int)); /* ### dungeon.c ### */ @@ -733,11 +731,9 @@ E boolean FDECL(can_read_file, (const char *)); E boolean FDECL(read_config_file, (const char *, int)); E void FDECL(check_recordfile, (const char *)); E void NDECL(read_wizkit); -#ifdef LOADSYMSETS E int FDECL(read_sym_file, (int)); E int FDECL(parse_sym_line, (char *,int)); E int FDECL(sym_val, (const char *)); -#endif E void FDECL(paniclog, (const char *, const char *)); E int FDECL(validate_prefix_locations, (char *)); #ifdef SELECTSAVED @@ -1589,11 +1585,9 @@ E void FDECL(set_wc2_option_mod_status, (unsigned long, int)); E void FDECL(set_option_mod_status, (const char *,int)); E int FDECL(add_autopickup_exception, (const char *)); E void NDECL(free_autopickup_exceptions); -#ifdef LOADSYMSETS E int FDECL(load_symset, (const char *,int)); E void FDECL(parsesymbols, (char *)); E struct symparse *FDECL(match_sym, (char *)); -#endif E void NDECL(set_playmode); /* ### pager.c ### */ diff --git a/include/rm.h b/include/rm.h index 8747407f9..2fa3da6b6 100644 --- a/include/rm.h +++ b/include/rm.h @@ -278,12 +278,8 @@ extern const struct symdef def_warnsyms[WARNCOUNT]; extern int currentgraphics; /* from drawing.c */ extern nhsym showsyms[]; -#ifdef LOADSYMSETS extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */ #define SYMHANDLING(ht) (symset[currentgraphics].handling == (ht)) -#else -#define SYMHANDLING(ht) ((ht) == H_UNK) -#endif /* * The 5 possible states of doors diff --git a/src/drawing.c b/src/drawing.c index 3d94d8803..7fb0d461a 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -19,9 +19,7 @@ #define C(n) #endif -#ifdef LOADSYMSETS struct symsetentry symset[NUM_GRAPHICS]; -#endif int currentgraphics = 0; @@ -399,9 +397,7 @@ init_l_symbols() l_syms[i + SYM_OFF_X] = DEF_INVISIBLE; } -#ifdef LOADSYMSETS clear_symsetentry(PRIMARY, FALSE); -#endif } void @@ -433,13 +429,11 @@ init_r_symbols() r_syms[i + SYM_OFF_X] = DEF_INVISIBLE; } -# ifdef LOADSYMSETS clear_symsetentry(ROGUESET, FALSE); symset[ROGUESET].nocolor = 1; /* default on Rogue level is no color * but some symbol sets can * override that */ -# endif } void @@ -499,7 +493,6 @@ int nondefault; init_symbols(); } -#ifdef LOADSYMSETS void update_l_symset(symp, val) struct symparse *symp; @@ -755,7 +748,6 @@ struct symparse loadsyms[] = { {SYM_OTH, SYM_INVISIBLE + SYM_OFF_X, "S_invisible"}, {0,0,(const char *)0} /* fence post */ }; -#endif /*LOADSYMSETS*/ /*drawing.c*/ diff --git a/src/files.c b/src/files.c index 5d8b2bf2e..cb7363399 100644 --- a/src/files.c +++ b/src/files.c @@ -190,10 +190,8 @@ STATIC_DCL FILE *FDECL(fopen_config_file, (const char *, int)); STATIC_DCL int FDECL(get_uchars, (FILE *,char *,char *,uchar *,BOOLEAN_P,int,const char *)); int FDECL(parse_config_line, (FILE *,char *,int)); -#ifdef LOADSYMSETS STATIC_DCL FILE *NDECL(fopen_sym_file); STATIC_DCL void FDECL(set_symhandling, (char *,int)); -#endif #ifdef NOCWD_ASSUMPTIONS STATIC_DCL void FDECL(adjust_prefix, (char *, int)); #endif @@ -2202,10 +2200,6 @@ int src; WARNCOUNT, "WARNINGS"); assign_warnings(translate); } else if (match_varname(buf, "SYMBOLS", 4)) { - /* This part is not ifdef LOADSYMSETS because we want to be able - * to silently ignore its presence in a config file if that is - * not defined. - */ char *op, symbuf[BUFSZ]; boolean morelines; do { @@ -2224,10 +2218,8 @@ int src; /* strip trailing space now that '\' is gone */ while (--op >= bufp && isspace(*op)) *op = '\0'; } -#ifdef LOADSYMSETS /* parse here */ parsesymbols(bufp); -#endif if (morelines) do { *symbuf = '\0'; @@ -2238,9 +2230,7 @@ int src; bufp = symbuf; } while (*bufp == '#'); } while (morelines); -#ifdef LOADSYMSETS switch_symbols(TRUE); -#endif } else if (match_varname(buf, "WIZKIT", 6)) { (void) strncpy(wizkit, bufp, WIZKIT_MAX-1); #ifdef AMIGA @@ -2561,7 +2551,6 @@ read_wizkit() return; } -#ifdef LOADSYMSETS extern struct symsetentry *symset_list; /* options.c */ extern struct symparse loadsyms[]; /* drawing.c */ extern const char *known_handling[]; /* drawing.c */ @@ -2897,7 +2886,6 @@ const char *cp; } return cval; } -#endif /*LOADSYMSETS*/ /* ---------- END CONFIG FILE HANDLING ----------- */ diff --git a/src/mapglyph.c b/src/mapglyph.c index f1adae27a..c00d6f8ad 100644 --- a/src/mapglyph.c +++ b/src/mapglyph.c @@ -34,9 +34,6 @@ int explcolors[] = { #define pet_color(n) color = iflags.use_color ? mons[n].mcolor : NO_COLOR #define warn_color(n) color = iflags.use_color ? def_warnsyms[n].color : NO_COLOR #define explode_color(n) color = iflags.use_color ? explcolors[n] : NO_COLOR -#ifdef LOADSYMSETS -# define ROGUE_COLOR -#endif #else /* no text color */ @@ -66,17 +63,13 @@ int *ochar; unsigned *ospecial; { register int offset, idx; -#if defined(TEXTCOLOR) || defined(ROGUE_COLOR) int color = NO_COLOR; -#endif nhsym ch; unsigned special = 0; /* condense multiple tests in macro version down to single */ boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS; -#ifdef ROGUE_COLOR boolean has_rogue_color = (has_rogue_ibm_graphics && (symset[currentgraphics].nocolor == 0)); -#endif /* * Map the glyph back to a character and color. @@ -86,45 +79,36 @@ unsigned *ospecial; */ if ((offset = (glyph - GLYPH_STATUE_OFF)) >= 0) { /* a statue */ idx = mons[offset].mlet + SYM_OFF_M; -# ifdef ROGUE_COLOR if (has_rogue_color) color = CLR_RED; else -# endif obj_color(STATUE); special |= MG_STATUE; } else if ((offset = (glyph - GLYPH_WARNING_OFF)) >= 0) { /* a warning flash */ idx = offset + SYM_OFF_W; -# ifdef ROGUE_COLOR if (has_rogue_color) color = NO_COLOR; else -# endif warn_color(offset); } else if ((offset = (glyph - GLYPH_SWALLOW_OFF)) >= 0) { /* swallow */ /* see swallow_to_glyph() in display.c */ idx = (S_sw_tl + (offset & 0x7)) + SYM_OFF_P; -#ifdef ROGUE_COLOR if (has_rogue_color && iflags.use_color) color = NO_COLOR; else -#endif mon_color(offset >> 3); } else if ((offset = (glyph - GLYPH_ZAP_OFF)) >= 0) { /* zap beam */ /* see zapdir_to_glyph() in display.c */ idx = (S_vbeam + (offset & 0x3)) + SYM_OFF_P; -#ifdef ROGUE_COLOR if (has_rogue_color && iflags.use_color) color = NO_COLOR; else -#endif zap_color((offset >> 2)); } else if ((offset = (glyph - GLYPH_EXPLODE_OFF)) >= 0) { /* explosion */ idx = ((offset % MAXEXPCHARS) + S_explode1) + SYM_OFF_P; explode_color(offset / MAXEXPCHARS); } else if ((offset = (glyph - GLYPH_CMAP_OFF)) >= 0) { /* cmap */ idx = offset + SYM_OFF_P; -#ifdef ROGUE_COLOR if (has_rogue_color && iflags.use_color) { if (offset >= S_vwall && offset <= S_hcdoor) color = CLR_BROWN; @@ -137,7 +121,6 @@ unsigned *ospecial; else color = NO_COLOR; } else -#endif #ifdef TEXTCOLOR /* provide a visible difference if normal and lit corridor * use the same symbol */ @@ -151,7 +134,6 @@ unsigned *ospecial; idx = objects[offset].oc_class + SYM_OFF_O; if (offset == BOULDER && iflags.bouldersym) idx = SYM_BOULDER + SYM_OFF_X; -#ifdef ROGUE_COLOR if (has_rogue_color && iflags.use_color) { switch(objects[offset].oc_class) { case COIN_CLASS: color = CLR_YELLOW; break; @@ -159,70 +141,56 @@ unsigned *ospecial; default: color = CLR_BRIGHT_BLUE; break; } } else -#endif obj_color(offset); } else if ((offset = (glyph - GLYPH_RIDDEN_OFF)) >= 0) { /* mon ridden */ idx = mons[offset].mlet + SYM_OFF_M; -#ifdef ROGUE_COLOR if (has_rogue_color) /* This currently implies that the hero is here -- monsters */ /* don't ride (yet...). Should we set it to yellow like in */ /* the monster case below? There is no equivalent in rogue. */ color = NO_COLOR; /* no need to check iflags.use_color */ else -#endif mon_color(offset); special |= MG_RIDDEN; } else if ((offset = (glyph - GLYPH_BODY_OFF)) >= 0) { /* a corpse */ idx = objects[CORPSE].oc_class + SYM_OFF_O; -#ifdef ROGUE_COLOR if (has_rogue_color && iflags.use_color) color = CLR_RED; else -#endif mon_color(offset); special |= MG_CORPSE; } else if ((offset = (glyph - GLYPH_DETECT_OFF)) >= 0) { /* mon detect */ idx = mons[offset].mlet + SYM_OFF_M; -#ifdef ROGUE_COLOR if (has_rogue_color) color = NO_COLOR; /* no need to check iflags.use_color */ else -#endif mon_color(offset); /* Disabled for now; anyone want to get reverse video to work? */ /* is_reverse = TRUE; */ special |= MG_DETECT; } else if ((offset = (glyph - GLYPH_INVIS_OFF)) >= 0) { /* invisible */ idx = SYM_INVISIBLE + SYM_OFF_X; -#ifdef ROGUE_COLOR if (has_rogue_color) color = NO_COLOR; /* no need to check iflags.use_color */ else -#endif invis_color(offset); special |= MG_INVIS; } else if ((offset = (glyph - GLYPH_PET_OFF)) >= 0) { /* a pet */ idx = mons[offset].mlet + SYM_OFF_M; -#ifdef ROGUE_COLOR if (has_rogue_color) color = NO_COLOR; /* no need to check iflags.use_color */ else -#endif pet_color(offset); special |= MG_PET; } else { /* a monster */ idx = mons[glyph].mlet + SYM_OFF_M; -#ifdef ROGUE_COLOR if (has_rogue_color && iflags.use_color) { if (x == u.ux && y == u.uy) /* actually player should be yellow-on-gray if in a corridor */ color = CLR_YELLOW; else color = NO_COLOR; - } else -#endif - { + } else { mon_color(glyph); /* special case the hero for `showrace' option */ #ifdef TEXTCOLOR @@ -236,11 +204,7 @@ unsigned *ospecial; ch = showsyms[idx]; #ifdef TEXTCOLOR /* Turn off color if no color defined, or rogue level w/o PC graphics. */ -# ifdef ROGUE_COLOR if (!has_color(color) || (Is_rogue_level(&u.uz) && !has_rogue_color)) -# else - if (!has_color(color) || Is_rogue_level(&u.uz)) -# endif color = NO_COLOR; #endif diff --git a/src/options.c b/src/options.c index ecb259159..51bda6c59 100644 --- a/src/options.c +++ b/src/options.c @@ -350,17 +350,9 @@ static struct Comp_Opt { "soundcard", "type of sound card to use", 20, SET_IN_FILE }, #endif { "symset", "load a set of display symbols from the symbols file", 70, -#ifdef LOADSYMSETS SET_IN_GAME }, -#else - DISP_IN_GAME}, -#endif { "roguesymset", "load a set of rogue display symbols from the symbols file", 70, -#ifdef LOADSYMSETS SET_IN_GAME }, -#else - DISP_IN_GAME}, -#endif { "suppress_alert", "suppress alerts about version-specific features", 8, SET_IN_GAME }, { "tile_width", "width of tiles", 20, DISP_IN_GAME}, /*WC*/ @@ -654,11 +646,9 @@ initoptions_init() */ /* this detects the IBM-compatible console on most 386 boxes */ if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) { -#ifdef LOADSYMSETS if (!symset[PRIMARY].name) load_symset("IBMGraphics", PRIMARY); if (!symset[ROGUESET].name) load_symset("RogueIBM", ROGUESET); switch_symbols(TRUE); -#endif # ifdef TEXTCOLOR iflags.use_color = TRUE; # endif @@ -670,10 +660,8 @@ initoptions_init() if ((opts = nh_getenv("TERM")) && !strncmpi(opts, "vt", 2) && AS && AE && index(AS, '\016') && index(AE, '\017')) { -# ifdef LOADSYMSETS if (!symset[PRIMARY].name) load_symset("DECGraphics", PRIMARY); switch_symbols(TRUE); -# endif /*LOADSYMSETS*/ } # endif #endif /* UNIX || VMS */ @@ -1406,7 +1394,6 @@ boolean tinitial, tfrom_file; fullname = "symset"; if (match_optname(opts, fullname, 6, TRUE)) { -#ifdef LOADSYMSETS if (duplicate) complain_about_duplicate(opts,1); if (negated) bad_negation(fullname, FALSE); else if ((op = string_for_opt(opts, FALSE)) != 0) { @@ -1422,7 +1409,6 @@ boolean tinitial, tfrom_file; need_redraw = TRUE; } } -#endif return; } @@ -2505,7 +2491,6 @@ goodfruit: fullname = "DECgraphics"; if (match_optname(opts, fullname, 10, TRUE)) { boolean badflag = FALSE; -# ifdef LOADSYMSETS if (duplicate) complain_about_duplicate(opts,1); if (!negated) { /* There is no rogue level DECgraphics-specific set */ @@ -2525,14 +2510,12 @@ goodfruit: wait_synch(); } } -# endif /*LOADSYMSETS*/ return; } fullname = "IBMgraphics"; if (match_optname(opts, fullname, 10, TRUE)) { const char *sym_name = fullname; boolean badflag = FALSE; -# ifdef LOADSYMSETS if (duplicate) complain_about_duplicate(opts,1); if (!negated) { for (i = PRIMARY; i <= ROGUESET; ++i) { @@ -2559,7 +2542,6 @@ goodfruit: assign_graphics(ROGUESET); } } -# endif /*LOADSYMSETS*/ return; } #endif @@ -2567,7 +2549,6 @@ goodfruit: fullname = "MACgraphics"; if (match_optname(opts, fullname, 11, TRUE)) { boolean badflag = FALSE; -# ifdef LOADSYMSETS if (duplicate) complain_about_duplicate(opts,1); if (!negated) { if (symset[PRIMARY]).name badflag = TRUE; @@ -2589,7 +2570,6 @@ goodfruit: assign_graphics(ROGUESET); } } -# endif /*LOADSYMSETS*/ return; } #endif @@ -2997,10 +2977,8 @@ doset() return 0; } -#ifdef LOADSYMSETS struct symsetentry *symset_list = 0; /* files.c will populate this with list of available sets */ -#endif STATIC_OVL boolean special_handling(optname, setinitial, setfromfile) @@ -3390,19 +3368,16 @@ boolean setinitial,setfromfile; rogueflag = (*optname == 'r'), ready_to_switch = FALSE, nothing_to_do = FALSE; -#ifdef LOADSYMSETS int res; char *symset_name, fmtstr[20]; struct symsetentry *sl; int setcount = 0; -#endif int chosen = -2, which_set; if (rogueflag) which_set = ROGUESET; else which_set = PRIMARY; -#ifdef LOADSYMSETS /* clear symset[].name as a flag to read_sym_file() to build list */ symset_name = symset[which_set].name; symset[which_set].name = (char *)0; @@ -3551,7 +3526,6 @@ boolean setinitial,setfromfile; assign_graphics(ROGUESET); } else if (!rogueflag) assign_graphics(PRIMARY); need_redraw = TRUE; -#endif /*LOADSYMSETS*/ return TRUE; } else { @@ -3772,10 +3746,8 @@ char *buf; Sprintf(buf, "%s", rolestring(flags.initrace, races, noun)); else if (!strcmp(optname, "roguesymset")) { Sprintf(buf, "%s", -#ifdef LOADSYMSETS symset[ROGUESET].name ? symset[ROGUESET].name : -#endif "default"); if (currentgraphics == ROGUESET && symset[ROGUESET].name) Strcat(buf, ", active"); @@ -3813,10 +3785,8 @@ char *buf; } else if (!strcmp(optname, "symset")) { Sprintf(buf, "%s", -#ifdef LOADSYMSETS symset[PRIMARY].name ? symset[PRIMARY].name : -#endif "default"); if (currentgraphics == PRIMARY && symset[PRIMARY].name) Strcat(buf, ", active"); @@ -3992,7 +3962,6 @@ free_autopickup_exceptions() } } -#ifdef LOADSYMSETS /* bundle some common usage into one easy-to-use routine */ int load_symset(s, which_set) @@ -4070,7 +4039,6 @@ char *buf; } return (struct symparse *)0; } -#endif /*LOADSYMSETS*/ /* data for option_help() */ static const char *opt_intro[] = { diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 55188619b..6635c56ad 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -303,8 +303,7 @@ char *argv[]; process_options(argc, argv); #endif -#ifdef LOADSYMSETS -# if defined(MSDOS) || defined(WIN32) +#if defined(MSDOS) || defined(WIN32) /* Player didn't specify any symbol set so use IBM defaults */ if (!symset[PRIMARY].name) { load_symset("IBMGraphics_2", PRIMARY); @@ -312,8 +311,7 @@ char *argv[]; if (!symset[ROGUESET].name) { load_symset("RogueEpyx", ROGUESET); } -# endif -#endif /*LOADSYMSETS*/ +#endif #ifdef MSDOS init_nhwindows(&argc,argv); @@ -536,20 +534,16 @@ char *argv[]; case 'I': case 'i': if (!strncmpi(argv[0]+1, "IBM", 3)) { -# ifdef LOADSYMSETS load_symset("IBMGraphics", PRIMARY); load_symset("RogueIBM", ROGUESET); switch_symbols(TRUE); -# endif } break; /* case 'D': */ case 'd': if (!strncmpi(argv[0]+1, "DEC", 3)) { -# ifdef LOADSYMSETS load_symset("DECGraphics", PRIMARY); switch_symbols(TRUE); -# endif } break; #endif diff --git a/sys/share/unixtty.c b/sys/share/unixtty.c index 68c6f104c..678ab565d 100644 --- a/sys/share/unixtty.c +++ b/sys/share/unixtty.c @@ -364,11 +364,9 @@ init_sco_cons() if (!strcmp(windowprocs.name, "tty") && sco_flag_console) { atexit(sco_mapon); sco_mapoff(); -# ifdef LOADSYMSETS load_symset("IBMGraphics", PRIMARY); load_symset("RogueIBM", ROGUESET); switch_symbols(TRUE); -# endif # ifdef TEXTCOLOR if (has_colors()) iflags.use_color = TRUE; diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index f7cb9b26c..c470dc6e0 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -357,20 +357,16 @@ char *argv[]; case 'I': case 'i': if (!strncmpi(argv[0]+1, "IBM", 3)) { -#ifdef LOADSYMSETS load_symset("IBMGraphics", PRIMARY); load_symset("RogueIBM", ROGUESET); switch_symbols(TRUE); -#endif } break; /* case 'D': */ case 'd': if (!strncmpi(argv[0]+1, "DEC", 3)) { -#ifdef LOADSYMSETS load_symset("DECGraphics", PRIMARY); switch_symbols(TRUE); -#endif } break; case 'p': /* profession (role) */ diff --git a/sys/vms/vmsmain.c b/sys/vms/vmsmain.c index a34224005..abeff040e 100644 --- a/sys/vms/vmsmain.c +++ b/sys/vms/vmsmain.c @@ -266,20 +266,16 @@ char *argv[]; case 'I': case 'i': if (!strncmpi(argv[0]+1, "IBM", 3)) { -#ifdef LOADSYMSETS load_symset("IBMGraphics", PRIMARY); load_symset("RogueIBM", ROGUESET); switch_symbols(TRUE); -#endif } break; /* case 'D': */ case 'd': if (!strncmpi(argv[0]+1, "DEC", 3)) { -#ifdef LOADSYMSETS load_symset("DECGraphics", PRIMARY); switch_symbols(TRUE); -#endif } break; case 'p': /* profession (role) */