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

@@ -1104,7 +1104,7 @@ boolean at_stairs, falling, portal;
#ifdef REINCARNATION
if (Is_rogue_level(newlevel) || Is_rogue_level(&u.uz))
assign_rogue_graphics(Is_rogue_level(newlevel));
assign_graphics(Is_rogue_level(newlevel) ? ROGUESET : PRIMARY);
#endif
#ifdef USE_TILES
substitute_tiles(newlevel);

View File

@@ -17,8 +17,8 @@
#define C(n)
#endif
char *symset = 0, *roguesymset = 0;
int symhandling = 0, roguehandling = 0;
char *symset[NUM_GRAPHICS] = {0,0};
int symhandling[NUM_GRAPHICS] = {0,0}, currentgraphics = 0;
uchar oc_syms[MAXOCLASSES] = DUMMY; /* the current object display symbols */
uchar showsyms[MAXPCHARS] = DUMMY; /* the current feature display symbols */
@@ -310,21 +310,6 @@ def_char_to_monclass(ch)
/*
* Explanations of the functions found below:
*
* switch_graphics(arg)
* Called to swap the current display symbols
* (monsyms, showsyms, oc_syms).
*
* If !arg then the display symbols are
* taken from def_monsyms, defsyms, def_oc_syms
* default NetHack symbols.
*
* If arg then the display symbols are
* taken from the adjustable display symbols
* found in l_monsyms, l_showsyms, l_oc_syms.
* Those symbols may have been loaded from an
* external symfile by config file options or
* interactively in the options menu.
*
* init_symbols()
* Sets the current display symbols, the
* loadable symbols to the default NetHack
@@ -334,18 +319,36 @@ def_char_to_monclass(ch)
* after execution begins. Any previously
* loaded external symbol sets are discarded.
*
* assign_rogue_graphics(arg)
* switch_symbols(arg)
* Called to swap in new current display symbols
* (monsyms, showsyms, oc_syms) from either
* the default symbols, or from the loadable
* symbols.
*
* If (arg == 0) then the display symbols are
* taken from def_monsyms, defsyms, def_oc_syms
* default NetHack symbols.
*
* If (arg != 0), which is the expected usage,
* then the display symbols are taken from the
* adjustable display symbols found in l_monsyms,
* l_showsyms, l_oc_syms. Those symbols may have
* been loaded from an external symbol file by
* config file options or interactively in the
* options menu.
*
* assign_graphics(arg)
*
* This is used in the game core to toggle in and
* out of rogue level display mode.
*
* If arg is TRUE, this places the rogue level
* If arg is ROGUESET, this places the rogue level
* symbols from r_monsyms, r_showsyms, and r_oc_syms
* into the current display symbols: monsyms, showsyms,
* and oc_syms.
*
* If arg is FALSE, this places the symbols from
* l_monsyms, l_showsyms, l_oc_syms into the current
* If arg is PRIMARY, this places the symbols
* from l_monsyms, l_showsyms, l_oc_syms into the current
* display symbols: monsyms, showsyms, oc_syms.
*
* update_l_symset()
@@ -357,7 +360,7 @@ def_char_to_monclass(ch)
*/
void
switch_graphics(nondefault)
switch_symbols(nondefault)
int nondefault;
{
#ifdef ASCIIGRAPH
@@ -372,22 +375,15 @@ int nondefault;
for (i = 0; i < MAXOCLASSES; i++)
oc_syms[i] = l_oc_syms[i];
/*
* We can't use the SYMHANDLING or ROGUEHANDLING
* macros in this file (drawing.c) because doing
* so would cause link errors during some util
* program builds because of the presence of
* the Is_Roguelevel checks in those macros.
*/
#ifdef PC9800
if (symhandling == H_IBM
if (SYMHANDLING(H_IBM)
&& ibmgraphics_mode_callback)
(*ibmgraphics_mode_callback)();
else if (!symset && ascgraphics_mode_callback)
else if (!symset[currentgraphics] && ascgraphics_mode_callback)
(*ascgraphics_mode_callback)();
#endif
#ifdef TERMLIB
if (symhandling == H_DEC
if (SYMHANDLING(H_DEC)
&& decgraphics_mode_callback)
(*decgraphics_mode_callback)();
#endif
@@ -433,6 +429,49 @@ init_l_symbols()
for (i = 0; i < MAXOCLASSES; i++)
l_oc_syms[i] = def_oc_syms[i].sym;
symhandling[PRIMARY] = H_UNK;
}
void
assign_graphics(whichset)
int whichset;
{
/* Adjust graphics display characters on Rogue levels */
register int i;
switch(whichset) {
case ROGUESET:
for (i = 0; i < MAXMCLASSES; i++)
monsyms[i] = r_monsyms[i];
for (i = 0; i < MAXPCHARS; i++)
showsyms[i] = r_showsyms[i];
for (i = 0; i < MAXOCLASSES; i++)
oc_syms[i] = r_oc_syms[i];
# if defined(MSDOS) && defined(USE_TILES)
if (iflags.grmode) tileview(FALSE);
# endif
currentgraphics = ROGUESET;
break;
case PRIMARY:
default:
for (i = 0; i < MAXMCLASSES; i++)
monsyms[i] = l_monsyms[i];
for (i = 0; i < MAXPCHARS; i++)
showsyms[i] = l_showsyms[i];
for (i = 0; i < MAXOCLASSES; i++)
oc_syms[i] = l_oc_syms[i];
# if defined(MSDOS) && defined(USE_TILES)
if (iflags.grmode) tileview(TRUE);
# endif
currentgraphics = PRIMARY;
break;
}
}
#ifdef REINCARNATION
@@ -453,43 +492,8 @@ init_r_symbols()
for (i = 0; i < MAXOCLASSES; i++)
r_oc_syms[i] = def_r_oc_syms[i];
}
void
assign_rogue_graphics(is_rlevel)
boolean is_rlevel;
{
/* Adjust graphics display characters on Rogue levels */
register int i;
if (is_rlevel) {
register int i;
for (i = 0; i < MAXMCLASSES; i++)
monsyms[i] = r_monsyms[i];
for (i = 0; i < MAXPCHARS; i++)
showsyms[i] = r_showsyms[i];
for (i = 0; i < MAXOCLASSES; i++)
oc_syms[i] = r_oc_syms[i];
# if defined(MSDOS) && defined(USE_TILES)
if (iflags.grmode) tileview(FALSE);
# endif
} else {
for (i = 0; i < MAXMCLASSES; i++)
monsyms[i] = l_monsyms[i];
for (i = 0; i < MAXPCHARS; i++)
showsyms[i] = l_showsyms[i];
for (i = 0; i < MAXOCLASSES; i++)
oc_syms[i] = l_oc_syms[i];
# if defined(MSDOS) && defined(USE_TILES)
if (iflags.grmode) tileview(TRUE);
# endif
}
symhandling[ROGUESET] = H_UNK;
}
void
@@ -730,28 +734,5 @@ struct symparse loadsyms[] = {
};
#endif /*ASCIIGRAPH*/
/* OBSOLETE */
#if 0
STATIC_OVL void
graphics_opts(opts, optype, maxlen, offset)
register char *opts;
const char *optype;
int maxlen, offset;
{
uchar translate[MAXPCHARS+1];
int length, i;
if (!(opts = string_for_env_opt(optype, opts, FALSE)))
return;
escapes(opts, opts);
length = strlen(opts);
if (length > maxlen) length = maxlen;
/* match the form obtained from PC configuration files */
for (i = 0; i < length; i++)
translate[i] = (uchar) opts[i];
assign_graphics(translate, length, maxlen, offset);
}
#endif
/*drawing.c*/

View File

@@ -187,7 +187,7 @@ STATIC_DCL int FDECL(get_uchars, (FILE *,char *,char *,uchar *,BOOLEAN_P,int,con
int FDECL(parse_config_line, (FILE *,char *,char *,char *));
#ifdef ASCIIGRAPH
STATIC_DCL FILE *NDECL(fopen_sym_file);
STATIC_DCL void FDECL(set_symhandling, (char *,BOOLEAN_P));
STATIC_DCL void FDECL(set_symhandling, (char *,int));
#endif
#ifdef NOCWD_ASSUMPTIONS
STATIC_DCL void FDECL(adjust_prefix, (char *, int));
@@ -2089,7 +2089,7 @@ char *tmp_levels;
bufp = symbuf;
} while (*bufp == '#');
} while (morelines);
switch_graphics(TRUE);
switch_symbols(TRUE);
#endif /*ASCIIGRAPH*/
#ifdef WIZARD
} else if (match_varname(buf, "WIZKIT", 6)) {
@@ -2442,8 +2442,8 @@ fopen_sym_file()
* 0 if it wasn't found in the sym file or other problem.
*/
int
read_sym_file(rogueflag)
boolean rogueflag;
read_sym_file(which_set)
int which_set;
{
char buf[4*BUFSZ];
FILE *fp;
@@ -2453,19 +2453,17 @@ boolean rogueflag;
symset_count = 0;
chosen_symset_start = chosen_symset_end = FALSE;
while (fgets(buf, 4*BUFSZ, fp)) {
if (!parse_sym_line(buf, rogueflag)) {
if (!parse_sym_line(buf, which_set)) {
raw_printf("Bad symbol line: \"%.50s\"", buf);
wait_synch();
}
}
(void) fclose(fp);
if (!chosen_symset_end && !chosen_symset_start) return 0;
if (!chosen_symset_end && !chosen_symset_start)
return (symset[which_set] == 0) ? 1 : 0;
if (!chosen_symset_end) {
raw_printf("Missing finish for symset \"%s\"",
#ifdef REINCARNATION
rogueflag ? roguesymset :
#endif
symset);
symset[which_set] ? symset[which_set] : "unknown");
wait_synch();
}
return 1;
@@ -2473,18 +2471,13 @@ boolean rogueflag;
/* returns 0 on error */
int
parse_sym_line(buf, rogueflag)
parse_sym_line(buf, which_set)
char *buf;
boolean rogueflag;
int which_set;
{
int val;
struct symparse *symp = (struct symparse *)0;
char *bufp, *commentp, *altp;
char *symsetname =
#ifdef REINCARNATION
rogueflag ? roguesymset :
#endif
symset;
if (*buf == '#')
return 1;
@@ -2516,8 +2509,9 @@ boolean rogueflag;
if (!bufp) {
if (strncmpi(buf, "finish", 6) == 0) {
/* end current graphics set */
if (chosen_symset_start)
chosen_symset_end = TRUE;
chosen_symset_start = FALSE;
chosen_symset_end = TRUE;
return 1;
}
return 0;
@@ -2530,8 +2524,8 @@ boolean rogueflag;
if (!symp)
return 0;
if (!symsetname) {
/* A null symsetname indicates that we're just
if (!symset[which_set]) {
/* A null symset name indicates that we're just
building a pick-list of possible symset
values from the file, so only do that */
if (symp->range == SYM_CONTROL && symp->idx == 0) {
@@ -2557,36 +2551,31 @@ boolean rogueflag;
switch(symp->idx) {
case 0:
/* start of symset */
if (!strcmpi(bufp, symsetname)) { /* desired one? */
if (!strcmpi(bufp, symset[which_set])) { /* desired one? */
chosen_symset_start = TRUE;
#ifdef REINCARNATION
if (rogueflag) {
init_r_symbols();
roguehandling = H_UNK;
}
if (which_set == ROGUESET) init_r_symbols();
#endif
if (!rogueflag) {
init_l_symbols();
symhandling = H_UNK;
}
if (which_set == PRIMARY) init_l_symbols();
}
break;
case 1:
/* finish symset */
if (chosen_symset_start)
chosen_symset_end = TRUE;
chosen_symset_start = FALSE;
chosen_symset_end = TRUE;
break;
case 2:
/* handler type identified */
if (chosen_symset_start)
set_symhandling(bufp, rogueflag);
set_symhandling(bufp, which_set);
break;
}
} else { /* !SYM_CONTROL */
val = sym_val(bufp);
if (chosen_symset_start) {
#ifdef REINCARNATION
if (rogueflag)
if (which_set == ROGUESET)
update_r_symset(symp, val);
else
#endif
@@ -2598,28 +2587,17 @@ boolean rogueflag;
}
STATIC_OVL void
set_symhandling(handling, rogueflag)
set_symhandling(handling, which_set)
char *handling;
boolean rogueflag;
int which_set;
{
int i = 0;
#ifdef REINCARNATION
if (rogueflag) roguehandling = H_UNK;
#endif
if (!rogueflag) symhandling = H_UNK;
symhandling[which_set] = H_UNK;
while (known_handling[i]) {
if (!strcmpi(known_handling[i], handling)) {
#ifdef REINCARNATION
if (rogueflag) {
roguehandling = i;
return;
}
#endif
if (!rogueflag) {
symhandling = i;
return;
}
symhandling[which_set] = i;
return;
}
i++;
}

View File

@@ -50,9 +50,11 @@ int explcolors[] = {
#ifdef ROGUE_COLOR
# if defined(USE_TILES) && defined(MSDOS)
#define HAS_ROGUE_IBM_GRAPHICS (ROGUEHANDLING(H_IBM) && !iflags.grmode)
#define HAS_ROGUE_IBM_GRAPHICS (currentgraphics == ROGUESET && \
SYMHANDLING(H_IBM) && !iflags.grmode)
# else
#define HAS_ROGUE_IBM_GRAPHICS (ROGUEHANDLING(H_IBM))
#define HAS_ROGUE_IBM_GRAPHICS (currentgraphics == ROGUESET && \
SYMHANDLING(H_IBM))
# endif
#endif

View File

@@ -364,10 +364,10 @@ static struct Comp_Opt
80, DISP_IN_GAME },
{ "windowtype", "windowing system to use", WINTYPELEN, DISP_IN_GAME },
#ifdef BACKWARD_COMPAT
{"DECgraphics", "deprecated", 70, SET_IN_FILE},
{"IBMgraphics", "deprecated", 70, SET_IN_FILE},
{"DECgraphics", "load DECGraphics display symbols", 70, SET_IN_FILE},
{"IBMgraphics", "load IBMGraphics display symbols", 70, SET_IN_FILE},
# ifdef MAC_GRAPHICS_ENV
{"Macgraphics", "deprecated", 70, SET_IN_FILE},
{"Macgraphics", "load MACGraphics display symbols", 70, SET_IN_FILE},
# endif
#endif
{ (char *)0, (char *)0, 0, 0 }
@@ -597,7 +597,7 @@ initoptions()
for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++)
flags.end_disclose[i] = DISCLOSE_PROMPT_DEFAULT_NO;
switch_graphics(DEFAULT_GRAPHICS); /* set default characters */
switch_symbols(FALSE); /* set default characters */
#if defined(UNIX) && defined(TTY_GRAPHICS)
/*
* Set defaults for some options depending on what we can
@@ -609,11 +609,11 @@ initoptions()
/* this detects the IBM-compatible console on most 386 boxes */
if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) {
#ifdef ASCIIGRAPH
if (!symset) load_symset("IBMGraphics", PRIMARY);
if (!symset[PRIMARY]) load_symset("IBMGraphics", PRIMARY);
if (!roguesymset) load_symset("RogueIBM", ROGUESET);
if (!symset[ROGUESET]) load_symset("RogueIBM", ROGUESET);
switch_graphics(TRUE);
switch_symbols(TRUE);
#endif
# ifdef TEXTCOLOR
iflags.use_color = TRUE;
@@ -627,19 +627,19 @@ initoptions()
!strncmpi(opts, "vt", 2) && AS && AE &&
index(AS, '\016') && index(AE, '\017')) {
# ifdef ASCIIGRAPH
if (!symset) load_symset("DECGraphics", PRIMARY);
if (!symset[PRIMARY]) load_symset("DECGraphics", PRIMARY);
switch_graphics(TRUE);
switch_symbols(TRUE);
# endif /*ASCIIGRAPH*/
}
# endif
#endif /* UNIX || VMS */
#ifdef MAC_GRAPHICS_ENV
if (!symset) load_symset("MACGraphics", PRIMARY);
switch_graphics(TRUE);
if (!symset[PRIMARY]) load_symset("MACGraphics", PRIMARY);
switch_symbols(TRUE);
#endif /* MAC_GRAPHICS_ENV */
flags.menu_style = MENU_FULL;
@@ -1301,15 +1301,15 @@ boolean tinitial, tfrom_file;
if (duplicate) complain_about_duplicate(opts,1);
if (negated) bad_negation(fullname, FALSE);
else if ((op = string_for_opt(opts, FALSE)) != 0) {
roguesymset = (char *)alloc(strlen(op) + 1);
Strcpy(roguesymset, op);
if (!read_sym_file(TRUE)) {
symset[ROGUESET] = (char *)alloc(strlen(op) + 1);
Strcpy(symset[ROGUESET], op);
if (!read_sym_file(ROGUESET)) {
badoption(opts);
free((char *)roguesymset);
roguesymset = (char *)0;
free((char *)symset[ROGUESET]);
symset[ROGUESET] = (char *)0;
} else {
if (!initial && Is_rogue_level(&u.uz))
assign_rogue_graphics(TRUE);
assign_graphics(ROGUESET);
need_redraw = TRUE;
}
}
@@ -1323,14 +1323,14 @@ boolean tinitial, tfrom_file;
if (duplicate) complain_about_duplicate(opts,1);
if (negated) bad_negation(fullname, FALSE);
else if ((op = string_for_opt(opts, FALSE)) != 0) {
symset = (char *)alloc(strlen(op) + 1);
Strcpy(symset, op);
if (!read_sym_file(FALSE)) {
symset[PRIMARY] = (char *)alloc(strlen(op) + 1);
Strcpy(symset[PRIMARY], op);
if (!read_sym_file(PRIMARY)) {
badoption(opts);
free((char *)symset);
symset = (char *)0;
free((char *)symset[PRIMARY]);
symset[PRIMARY] = (char *)0;
} else {
switch_graphics(TRUE);
switch_symbols(TRUE);
need_redraw = TRUE;
}
}
@@ -2288,15 +2288,17 @@ goodfruit:
boolean badflag = FALSE;
if (duplicate) complain_about_duplicate(opts,1);
if (!negated) {
if (symset) badflag = TRUE;
/* There is no rogue level DECgraphics-specific set */
if (symset[PRIMARY])
badflag = TRUE;
else {
symset = (char *)alloc(strlen(fullname) + 1);
Strcpy(symset, fullname);
if (!read_sym_file(FALSE)) {
symset[PRIMARY] = (char *)alloc(strlen(fullname) + 1);
Strcpy(symset[PRIMARY], fullname);
if (!read_sym_file(PRIMARY)) {
badflag = TRUE;
free((char *)symset);
symset = (char *)0;
} else switch_graphics(TRUE);
free((char *)symset[PRIMARY]);
symset[PRIMARY] = (char *)0;
} else switch_symbols(TRUE);
}
if (badflag) {
pline("Failure to load symbol set %s.",
@@ -2308,37 +2310,33 @@ goodfruit:
}
fullname = "IBMgraphics";
if (match_optname(opts, fullname, 10, TRUE)) {
const char *sym_name = fullname;
boolean badflag = FALSE;
if (duplicate) complain_about_duplicate(opts,1);
if (!negated) {
if (symset) badflag = TRUE;
else {
symset = (char *)alloc(strlen(fullname) + 1);
Strcpy(symset, fullname);
if (!read_sym_file(FALSE)) {
for (i = 0; i < NUM_GRAPHICS; ++i) {
if (symset[i])
badflag = TRUE;
else {
if (i == ROGUESET) sym_name = "RogueIBM";
symset[i] = (char *)alloc(strlen(sym_name) + 1);
Strcpy(symset[i], sym_name);
if (!read_sym_file(i)) {
badflag = TRUE;
free((char *)symset);
symset = (char *)0;
} else switch_graphics(TRUE);
free((char *)symset[i]);
symset[i] = (char *)0;
break;
}
}
}
#ifdef REINCARNATION
if (roguesymset) badflag = TRUE;
else {
roguesymset = (char *)alloc(strlen(fullname) + 1);
Strcpy(roguesymset, fullname);
if (!read_sym_file(TRUE)) {
badflag = TRUE;
free((char *)roguesymset);
roguesymset = (char *)0;
}
if (!initial && Is_rogue_level(&u.uz))
assign_rogue_graphics(TRUE);
}
#endif
if (badflag) {
pline("Failure to load symbol set %s.",
fullname);
sym_name);
wait_synch();
} else {
switch_symbols(TRUE);
if (!initial && Is_rogue_level(&u.uz))
assign_graphics(ROGUESET);
}
}
return;
@@ -2349,20 +2347,24 @@ goodfruit:
boolean badflag = FALSE;
if (duplicate) complain_about_duplicate(opts,1);
if (!negated) {
if (symset) badflag = TRUE;
if (symset[PRIMARY]) badflag = TRUE;
else {
symset = (char *)alloc(strlen(fullname) + 1);
Strcpy(symset, fullname);
if (!read_sym_file(FALSE)) {
symset[PRIMARY] = (char *)alloc(strlen(fullname) + 1);
Strcpy(symset[PRIMARY], fullname);
if (!read_sym_file(PRIMARY)) {
badflag = TRUE;
free((char *)symset);
symset = (char *)0;
} else switch_graphics(TRUE);
free((char *)symset[PRIMARY]);
symset[PRIMARY] = (char *)0;
}
}
if (badflag) {
pline("Failure to load symbol set %s.",
fullname);
wait_synch();
} else {
switch_symbols(TRUE);
if (!initial && Is_rogue_level(&u.uz))
assign_graphics(ROGUESET);
}
}
return;
@@ -2777,7 +2779,8 @@ doset()
return 0;
}
struct textlist *symset_list; /* files.c will populate this wil list of available sets */
struct textlist *symset_list = 0; /* files.c will populate this with
list of available sets */
STATIC_OVL boolean
special_handling(optname, setinitial, setfromfile)
@@ -3136,34 +3139,29 @@ boolean setinitial,setfromfile;
if (pick_cnt >= 0) goto ape_again;
}
#endif /* AUTOPICKUP_EXCEPTIONS */
#ifdef ASCIIGRAPH
} else if (!strcmp("symset", optname) ||
!strcmp("roguesymset", optname)) {
!strcmp("roguesymset", optname)) {
menu_item *symset_pick = (menu_item *)0;
boolean rogueflag = (*optname == 'r');
char *symset_name;
int chosen = -2;
/* clear symset/roguesymset as a flag to read_sym_file() to build list */
if (!rogueflag) {
symset_name = symset;
symset = (char *)0;
}
int chosen = -2, which_set =
#ifdef REINCARNATION
if (rogueflag) {
symset_name = roguesymset;
roguesymset = (char *)0;
}
rogueflag ? ROGUESET :
#endif
PRIMARY;
#ifdef ASCIIGRAPH
/* clear symset as a flag to read_sym_file() to build list */
symset_name = symset[which_set];
symset[which_set] = (char *)0;
if (read_sym_file(rogueflag) && symset_list) {
if (read_sym_file(which_set) && symset_list) {
int let = 'a';
struct textlist *sl;
tmpwin = create_nhwindow(NHW_MENU);
start_menu(tmpwin);
any.a_int = 1;
add_menu(tmpwin, NO_GLYPH, &any, let++, 0,
ATR_NONE, "NetHack default", MENU_UNSELECTED);
ATR_NONE, "Default Symbols", MENU_UNSELECTED);
sl = symset_list;
while (sl) {
if (sl->text) {
@@ -3182,54 +3180,55 @@ boolean setinitial,setfromfile;
}
destroy_nhwindow(tmpwin);
if (chosen > -1) {
/* chose an actual symset name from file */
sl = symset_list;
while (sl) {
if (sl->idx == chosen) {
if (symset_name)
if (symset_name) {
free((genericptr_t)symset_name);
symset_name = (char *)alloc(strlen(sl->text)+1);
Strcpy(symset_name, sl->text);
symset_name = (char *)0;
}
symset[which_set] = (char *)alloc(strlen(sl->text)+1);
Strcpy(symset[which_set], sl->text);
}
sl = sl->next;
}
} else if (chosen == -1) {
/* explicit selection of defaults */
if (symset_name) free ((genericptr_t)symset_name);
symset_name = (char *)0;
}
/* clean up */
while (symset_list) {
sl = symset_list;
if (sl->text) free((genericptr_t)sl->text);
symset_list = sl->next;
free((genericptr_t)sl);
}
symset_list = (struct textlist *)0;
}
if(!rogueflag) {
init_l_symbols();
if (chosen >= 0) {
symset = symset_name;
if (!read_sym_file(FALSE)) {
free((genericptr_t)symset);
symset = (char *)0;
}
}
}
# ifdef REINCARNATION
if (rogueflag) {
init_r_symbols();
if (chosen >= 0) {
roguesymset = symset_name;
if (!read_sym_file(TRUE)) {
free((genericptr_t)roguesymset);
roguesymset = (char *)0;
}
/* these set default symbols and clear the handling value */
if(rogueflag) init_r_symbols();
else init_l_symbols();
if (!symset[which_set] && symset_name)
symset[which_set] = symset_name;
if (symset[which_set]) {
if (read_sym_file(which_set))
switch_symbols(TRUE);
else {
free((genericptr_t)symset[which_set]);
symset[which_set] = (char *)0;
return 0;
}
}
switch_symbols(TRUE);
if (Is_rogue_level(&u.uz))
assign_rogue_graphics(TRUE);
assign_graphics(ROGUESET);
else
assign_rogue_graphics(FALSE);
#else
switch_graphics(TRUE);
# endif
assign_graphics(PRIMARY);
need_redraw = TRUE;
#endif /*ASCIIGRAPH*/
} else {
@@ -3431,7 +3430,8 @@ char *buf;
Sprintf(buf, "%s", rolestring(flags.initrace, races, noun));
#ifdef REINCARNATION
else if (!strcmp(optname, "roguesymset"))
Sprintf(buf, "%s", roguesymset ? roguesymset : "default");
Sprintf(buf, "%s",
symset[ROGUESET] ? symset[ROGUESET] : "default");
#endif
else if (!strcmp(optname, "role"))
Sprintf(buf, "%s", rolestring(flags.initrole, roles, name.m));
@@ -3465,7 +3465,8 @@ char *buf;
FEATURE_NOTICE_VER_PATCH);
}
else if (!strcmp(optname, "symset"))
Sprintf(buf, "%s", symset ? symset : "default");
Sprintf(buf, "%s",
symset[PRIMARY] ? symset[PRIMARY] : "default");
else if (!strcmp(optname, "tile_file"))
Sprintf(buf, "%s", iflags.wc_tile_file ? iflags.wc_tile_file : defopt);
else if (!strcmp(optname, "tile_height")) {
@@ -3643,35 +3644,19 @@ free_autopickup_exceptions()
#ifdef ASCIIGRAPH
/* bundle some common usage into one easy-to-use routine */
int
load_symset(s, rogueflag)
load_symset(s, which_set)
const char *s;
boolean rogueflag;
int which_set;
{
#ifdef REINCARNATION
if (rogueflag) {
if (roguesymset) free((genericptr_t)roguesymset);
roguesymset = (char *)alloc(strlen(s)+1);
Strcpy(roguesymset,s);
if (read_sym_file(TRUE))
switch_graphics(TRUE);
else {
free((genericptr_t)roguesymset);
roguesymset = (char *)0;
return 0;
}
}
#endif
if (!rogueflag) {
if (symset) free((genericptr_t)symset);
symset = (char *)alloc(strlen(s)+1);
Strcpy(symset,s);
if (read_sym_file(FALSE))
switch_graphics(TRUE);
else {
free((genericptr_t)symset);
symset = (char *)0;
return 0;
}
if (symset[which_set]) free((genericptr_t)symset[which_set]);
symset[which_set] = (char *)alloc(strlen(s)+1);
Strcpy(symset[which_set],s);
if (read_sym_file(which_set))
switch_symbols(TRUE);
else {
free((genericptr_t)symset[which_set]);
symset[which_set] = (char *)0;
return 0;
}
return 1;
}

View File

@@ -822,7 +822,7 @@ register int fd;
if (!wizard && !discover)
(void) delete_savefile();
#ifdef REINCARNATION
if (Is_rogue_level(&u.uz)) assign_rogue_graphics(TRUE);
if (Is_rogue_level(&u.uz)) assign_graphics(ROGUESET);
#endif
#ifdef USE_TILES
substitute_tiles(&u.uz);