From: nethack.allison Date: Sun, 1 Oct 2006 19:30:08 +0000 (+0000) Subject: more symbol stuff (trunk only) X-Git-Tag: MOVE2GIT~868 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=374e9fbbb4d05f66d1545ee6f62f9fefbefe6f94;p=nethack more symbol stuff (trunk only) - reduce the number of symbol tables for each graphics set {PRIMARY, ROGUESET} from three {map, oc, mon} tables for each of the display symbols, the loadable symbols, and the rogue symbols, to one continguous table for each: showsyms: the current display symbols l_syms: the loaded, alterable symbols r_syms: the rogue symbols - Modify mapglyph so that the index into the symbolt table is available as a return value (it was a void function), rather than just the char converted from the glyph. - That makes it possible for a window port to use the same index value to extract from another table (perhaps a unicode table) for a different set of display symbols. The index is much more useful than trying to convert the character into another type of symbol, as some contributed patches have done. - It is much easier to load a single alternative flat table to make substitutions, since the corresponding value just has to get placed into the same index offset in the alternative table. This also fixes a bug I found in botl.c, where you could go to the rogue level, and the bottom line gold symbol was not being updated with the new character as it should. The reason was because the gold value had not changed, only the field symbol used had changed. This updates multiple ports to place a (void) cast on the mapglyph call, now that it returns a value, so this is going to generate a lot of diff e-mails. --- diff --git a/doc/window.doc b/doc/window.doc index 8f444269e..6be38e2b5 100644 --- a/doc/window.doc +++ b/doc/window.doc @@ -787,12 +787,17 @@ These are not part of the interface. They may be called by your window port routines to perform the desired task, instead of duplicating the necessary code in each window port. -mapglyph(int glyph, int *ochar, int *ocolor, unsigned *special, int x, int y) +int mapglyph(int glyph, int *ochar, int *ocolor, unsigned *special, int x, int y) -- Maps glyph at x,y to NetHack ascii character and color. - If it represents something special such as a pet, that - information is returned as set bits in "special." + The return value is an index into the showsyms[] array, in + case a port wants to index into its own alternative + set of display symbols (such as a unicode set) instead of + the default set. + + If the glyph represents something special such as a pet, + that information is returned as set bits in "special." Usually called from the window port's print_glyph() - routine. + routine. VII. Game startup diff --git a/include/extern.h b/include/extern.h index f18970367..c5267f664 100644 --- a/include/extern.h +++ b/include/extern.h @@ -497,7 +497,7 @@ E void FDECL(assign_graphics, (int)); E void NDECL(init_r_symbols); #endif E void NDECL(init_symbols); -E void NDECL(init_disp_symbols); +E void NDECL(init_showsyms); E void NDECL(init_l_symbols); E void FDECL(clear_symsetentry, (int,BOOLEAN_P)); #ifdef ASCIIGRAPH @@ -1027,7 +1027,7 @@ E boolean FDECL(usmellmon, (struct permonst *)); /* ### mapglyph.c ### */ -E void FDECL(mapglyph, (int, int *, int *, unsigned *, int, int)); +E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int)); /* ### mcastu.c ### */ diff --git a/include/hack.h b/include/hack.h index 5078b0ae3..37aff098a 100644 --- a/include/hack.h +++ b/include/hack.h @@ -144,6 +144,14 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ #include "rect.h" #include "region.h" +/* Symbol offsets */ +#define SYM_OFF_P (0) +#define SYM_OFF_O (SYM_OFF_P + MAXPCHARS) +#define SYM_OFF_M (SYM_OFF_O + MAXOCLASSES) +#define SYM_OFF_W (SYM_OFF_M + MAXMCLASSES) +#define SYM_OFF_X (SYM_OFF_W + WARNCOUNT) +#define SYM_MAX (SYM_OFF_X + MAXOTHER) + #ifdef USE_TRAMPOLI /* This doesn't belong here, but we have little choice */ #undef NDECL #define NDECL(f) f() diff --git a/include/rm.h b/include/rm.h index 95f298dbf..28ae5bb34 100644 --- a/include/rm.h +++ b/include/rm.h @@ -227,13 +227,18 @@ struct symparse { unsigned range; #define SYM_CONTROL 1 /* start/finish markers */ #define SYM_PCHAR 2 /* index into showsyms */ -#define SYM_MON 3 /* index into monsyms */ -#define SYM_OC 4 /* index into oc_syms */ -#define SYM_OBJ 5 /* index into objects */ +#define SYM_OC 3 /* index into oc_syms */ +#define SYM_MON 4 /* index into monsyms */ +#define SYM_OTH 5 /* misc */ int idx; const char *name; }; +/* misc symbol definitions */ +#define SYM_BOULDER 0 +#define SYM_INVISIBLE 1 +#define MAXOTHER 2 + /* linked list of symsets and their characteristics */ struct symsetentry { struct symsetentry *next; /* next in list */ @@ -263,10 +268,10 @@ struct symsetentry { #define H_DEC 2 extern const struct symdef defsyms[MAXPCHARS]; /* defaults */ -extern uchar showsyms[MAXPCHARS]; extern const struct symdef def_warnsyms[WARNCOUNT]; extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */ extern int currentgraphics; /* from drawing.c */ +extern uchar showsyms[]; #define SYMHANDLING(ht) (symset[currentgraphics].handling == (ht)) diff --git a/src/botl.c b/src/botl.c index 915a5cb86..49f159288 100644 --- a/src/botl.c +++ b/src/botl.c @@ -265,7 +265,8 @@ bot2() if(hp < 0) hp = 0; (void) describe_level(newbot2); Sprintf(nb = eos(newbot2), - "%c:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d", oc_syms[COIN_CLASS], + "%c:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d", + showsyms[COIN_CLASS + SYM_OFF_O], #ifndef GOLDOBJ u.ugold, #else @@ -613,7 +614,7 @@ bot() unsigned anytype; int i, pc, chg, cap; struct istat_s *curr, *prev; - boolean valset[MAXBLSTATS]; + boolean valset[MAXBLSTATS], chgval = FALSE; if (!blinit) panic("bot before init."); if (!youmonst.data) { @@ -720,11 +721,18 @@ bot() * gold amount without the leading "$:" the port will have to * add 2 to the value pointer it was passed in status_update() * for the BL_GOLD case. + * + * Another quirk of BL_GOLD is that the field display may have + * changed if a new symbol set was loaded, or we entered or left + * the rogue level. */ + Sprintf(blstats[idx][BL_GOLD].val, "%c:%ld", - oc_syms[COIN_CLASS], blstats[idx][BL_GOLD].a.a_long); + showsyms[COIN_CLASS + SYM_OFF_O], + blstats[idx][BL_GOLD].a.a_long); valset[BL_GOLD] = TRUE; /* indicate val already set */ + /* Power (magical energy) */ blstats[idx][BL_ENE].a.a_int = u.uen; @@ -805,14 +813,17 @@ bot() curr = &blstats[idx][i]; prev = &blstats[idx_p][i]; chg = 0; - if (update_all || (chg = compare_blstats(prev, curr)) != 0) { + if (update_all || ((chg = compare_blstats(prev, curr)) != 0) || + ((chgval = (valset[i] && + strcmp(blstats[idx][i].val,blstats[idx_p][i].val))) != 0)) { idxmax = blstats[idx][i].idxmax; pc = (idxmax) ? percentage(curr, &blstats[idx][idxmax]) : 0; if (!valset[i]) (void) anything_to_s(curr->val, &curr->a, anytype); if (anytype != ANY_MASK32) { - status_update(i, (genericptr_t)curr->val, chg, pc); + status_update(i, (genericptr_t)curr->val, + valset[i] ? chgval : chg, pc); } else { status_update(i, /* send pointer to mask */ diff --git a/src/drawing.c b/src/drawing.c index 7718d2fcb..d9b726de3 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -1,11 +1,11 @@ -/* SCCS Id: @(#)drawing.c 3.5 2006/09/22 */ +/* SCCS Id: @(#)drawing.c 3.5 2006/10/01 */ /* Copyright (c) NetHack Development Team 1992. */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" #include "tcap.h" -/* Relevent header information in rm.h and objclass.h. */ +/* Relevent header information in rm.h, objclass.h, and monsym.h. */ #ifdef C #undef C @@ -20,20 +20,10 @@ struct symsetentry symset[NUM_GRAPHICS]; int currentgraphics = 0; -uchar oc_syms[MAXOCLASSES] = DUMMY; /* the current object display symbols */ -uchar showsyms[MAXPCHARS] = DUMMY; /* the current feature display symbols */ -uchar monsyms[MAXMCLASSES] = DUMMY; /* the current monster display symbols */ - -/* loaded primary syms */ -uchar l_oc_syms[MAXOCLASSES] = DUMMY; -uchar l_showsyms[MAXPCHARS] = DUMMY; -uchar l_monsyms[MAXMCLASSES] = DUMMY; - +uchar showsyms[SYM_MAX] = DUMMY; /* symbols to be displayed */ +uchar l_syms[SYM_MAX] = DUMMY; /* loaded symbols */ #ifdef REINCARNATION -/* rogue syms */ -uchar r_oc_syms[MAXOCLASSES] = DUMMY; -uchar r_showsyms[MAXPCHARS] = DUMMY; -uchar r_monsyms[MAXMCLASSES] = DUMMY; +uchar r_syms[SYM_MAX] = DUMMY; /* rogue symbols */ #endif uchar warnsyms[WARNCOUNT] = DUMMY; /* the current warning display symbols */ @@ -102,7 +92,7 @@ const struct class_sym def_monsyms[MAXMCLASSES] = { { DEF_FUNGUS, "", "fungus or mold"}, { DEF_GNOME, "", "gnome"}, { DEF_GIANT, "", "giant humanoid"}, - { '\0', "", ""}, + { '\0', "", "invisible monster"}, { DEF_JABBERWOCK, "", "jabberwock"}, { DEF_KOP, "", "Keystone Kop"}, { DEF_LICH, "", "lich"}, @@ -280,7 +270,7 @@ void NDECL((*ascgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ /* * Convert the given character to an object class. If the character is not - * recognized, then MAXOCLASSES is returned. Used in detect.c invent.c, + * recognized, then MAXOCLASSES is returned. Used in detect.c, invent.c, * objnam.c, options.c, pickup.c, sp_lev.c, lev_main.c, and tilemap.c. */ int @@ -304,7 +294,7 @@ def_char_to_monclass(ch) { int i; for (i = 1; i < MAXMCLASSES; i++) - if (def_monsyms[i].sym == ch) break; + if (ch == def_monsyms[i].sym) break; return i; } @@ -314,7 +304,7 @@ def_char_to_monclass(ch) * init_symbols() * Sets the current display symbols, the * loadable symbols to the default NetHack - * symbols, including the r_* rogue level + * symbols, including the r_syms rogue level * symbols if REINCARNATION is defined. * This would typically be done immediately * after execution begins. Any previously @@ -322,35 +312,29 @@ def_char_to_monclass(ch) * * 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. + * (showsyms) from either the default symbols, + * or from the loaded symbols. * - * If (arg == 0) then the display symbols are - * taken from def_monsyms, defsyms, def_oc_syms - * default NetHack symbols. + * If (arg == 0) then showsyms are taken from + * defsyms, def_oc_syms, and def_monsyms. * - * 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. + * If (arg != 0), which is the normal expected + * usage, then showsyms are taken from the + * adjustable display symbols found in l_syms. + * l_syms 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. + * out of other {rogue} level display modes. * * 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. + * symbols from r_syms into showsyms. * * 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. + * from l_monsyms into showsyms. * * update_l_symset() * Update a member of the loadable (l_*) symbol set. @@ -368,14 +352,8 @@ int nondefault; register int i; if (nondefault) { - 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]; + for (i = 0; i < SYM_MAX; i++) + showsyms[i] = l_syms[i]; # ifdef PC9800 if (SYMHANDLING(H_IBM) && ibmgraphics_mode_callback) @@ -397,24 +375,35 @@ void init_symbols() { init_l_symbols(); - init_disp_symbols(); + init_showsyms(); #ifdef REINCARNATION init_r_symbols(); #endif } void -init_disp_symbols() +init_showsyms() { register int i; - for (i = 0; i < MAXMCLASSES; i++) - monsyms[i] = def_monsyms[i].sym; for (i = 0; i < MAXPCHARS; i++) - showsyms[i] = defsyms[i].sym; + showsyms[i + SYM_OFF_P] = defsyms[i].sym; for (i = 0; i < MAXOCLASSES; i++) - oc_syms[i] = def_oc_syms[i].sym; + showsyms[i + SYM_OFF_O] = def_oc_syms[i].sym; + + for (i = 0; i < MAXMCLASSES; i++) + showsyms[i + SYM_OFF_M] = def_monsyms[i].sym; + + for (i = 0; i < WARNCOUNT; i++) + showsyms[i + SYM_OFF_W] = def_warnsyms[i].sym; + + for (i = 0; i < MAXOTHER; i++) { + if (i == SYM_BOULDER) + showsyms[i + SYM_OFF_X] = iflags.bouldersym; + else if (i == SYM_INVISIBLE) + showsyms[i + SYM_OFF_X] = DEF_INVISIBLE; + } } /* initialize defaults for the loadable symset */ @@ -422,17 +411,67 @@ void init_l_symbols() { register int i; - for (i = 0; i < MAXMCLASSES; i++) - l_monsyms[i] = def_monsyms[i].sym; for (i = 0; i < MAXPCHARS; i++) - l_showsyms[i] = defsyms[i].sym; + l_syms[i + SYM_OFF_P] = defsyms[i].sym; for (i = 0; i < MAXOCLASSES; i++) - l_oc_syms[i] = def_oc_syms[i].sym; + l_syms[i + SYM_OFF_O] = def_oc_syms[i].sym; + + for (i = 0; i < MAXMCLASSES; i++) + l_syms[i + SYM_OFF_M] = def_monsyms[i].sym; + + for (i = 0; i < WARNCOUNT; i++) + l_syms[i + SYM_OFF_W] = def_warnsyms[i].sym; + + for (i = 0; i < MAXOTHER; i++) { + if (i == SYM_BOULDER) + l_syms[i + SYM_OFF_X] = iflags.bouldersym; + else if (i == SYM_INVISIBLE) + l_syms[i + SYM_OFF_X] = DEF_INVISIBLE; + } + clear_symsetentry(PRIMARY, FALSE); } +#ifdef REINCARNATION +void +init_r_symbols() +{ + register int i; + + /* These are defaults that can get overwritten + later by the roguesymbols option */ + + for (i = 0; i < MAXPCHARS; i++) + r_syms[i + SYM_OFF_P] = defsyms[i].sym; + r_syms[S_vodoor] = r_syms[S_hodoor] = r_syms[S_ndoor] = '+'; + r_syms[S_upstair] = r_syms[S_dnstair] = '%'; + + for (i = 0; i < MAXOCLASSES; i++) + r_syms[i + SYM_OFF_O] = def_oc_syms[i].sym; + + for (i = 0; i < MAXMCLASSES; i++) + r_syms[i + SYM_OFF_M] = def_monsyms[i].sym; + + for (i = 0; i < WARNCOUNT; i++) + r_syms[i + SYM_OFF_W] = def_warnsyms[i].sym; + + for (i = 0; i < MAXOTHER; i++) { + if (i == SYM_BOULDER) + r_syms[i + SYM_OFF_X] = iflags.bouldersym; + else if (i == SYM_INVISIBLE) + r_syms[i + SYM_OFF_X] = DEF_INVISIBLE; + } + + clear_symsetentry(ROGUESET, FALSE); + symset[ROGUESET].nocolor = 1; /* default on Rogue level is no color + * but some symbol sets can + * override that + */ +} +#endif /*REINCARNATION*/ + void assign_graphics(whichset) int whichset; @@ -444,14 +483,8 @@ int whichset; case ROGUESET: /* Adjust graphics display characters on Rogue levels */ - 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]; + for (i = 0; i < SYM_MAX; i++) + showsyms[i] = r_syms[i]; # if defined(MSDOS) && defined(USE_TILES) if (iflags.grmode) tileview(FALSE); @@ -459,16 +492,12 @@ int whichset; currentgraphics = ROGUESET; break; # endif + 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 < SYM_MAX; i++) + showsyms[i] = l_syms[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 @@ -477,77 +506,24 @@ int whichset; } } -#ifdef REINCARNATION -void -init_r_symbols() -{ - register int i; - /* These are defaults that can get overwritten - later by the roguesymbols option */ - - for (i = 0; i < MAXMCLASSES; i++) - r_monsyms[i] = def_monsyms[i].sym; - - for (i = 0; i < MAXPCHARS; i++) - r_showsyms[i] = defsyms[i].sym; - r_showsyms[S_vodoor] = r_showsyms[S_hodoor] = r_showsyms[S_ndoor] = '+'; - r_showsyms[S_upstair] = r_showsyms[S_dnstair] = '%'; - - for (i = 0; i < MAXOCLASSES; i++) - r_oc_syms[i] = def_r_oc_syms[i]; - - clear_symsetentry(ROGUESET, FALSE); - symset[ROGUESET].nocolor = 1; /* default on Rogue level is no color - * but some symbol sets can - * override that - */ -} - +#ifdef ASCIIGRAPH void -update_r_symset(symp, val) +update_l_symset(symp, val) struct symparse *symp; int val; { - switch (symp->range) { - case SYM_PCHAR: /* index into r_showsyms */ - r_showsyms[symp->idx] = val; - break; - case SYM_MON: /* index into r_monsyms */ - r_monsyms[symp->idx] = val; - break; - case SYM_OC: /* index into r_oc_syms */ - r_oc_syms[symp->idx] = val; - break; - case SYM_OBJ: /* index into objects */ - if (symp->idx == BOULDER) - iflags.bouldersym = val; - break; - } + l_syms[symp->idx] = val; } -#endif /* REINCARNATION */ -#ifdef ASCIIGRAPH +# ifdef REINCARNATION void -update_l_symset(symp, val) +update_r_symset(symp, val) struct symparse *symp; int val; { - switch (symp->range) { - case SYM_PCHAR: /* index into l_showsyms */ - l_showsyms[symp->idx] = val; - break; - case SYM_MON: /* index into l_monsyms */ - l_monsyms[symp->idx] = val; - break; - case SYM_OC: /* index into l_oc_syms */ - l_oc_syms[symp->idx] = val; - break; - case SYM_OBJ: /* index into objects */ - if (symp->idx == BOULDER) - iflags.bouldersym = val; - break; - } + r_syms[symp->idx] = val; } +# endif /* REINCARNATION */ void clear_symsetentry(which_set, name_too) @@ -580,7 +556,6 @@ const char *known_handling[] = { "DEC", /* H_DEC */ (const char *)0, }; - struct symparse loadsyms[] = { {SYM_CONTROL, 0, "start"}, @@ -682,83 +657,84 @@ struct symparse loadsyms[] = { {SYM_PCHAR, S_explode7, "S_explode7"}, {SYM_PCHAR, S_explode8, "S_explode8"}, {SYM_PCHAR, S_explode9, "S_explode9"}, - {SYM_MON, S_ANT, "S_ant"}, - {SYM_MON, S_BLOB, "S_blob"}, - {SYM_MON, S_COCKATRICE, "S_cockatrice"}, - {SYM_MON, S_DOG, "S_dog"}, - {SYM_MON, S_EYE, "S_eye"}, - {SYM_MON, S_FELINE, "S_feline"}, - {SYM_MON, S_GREMLIN, "S_gremlin"}, - {SYM_MON, S_HUMANOID, "S_humanoid"}, - {SYM_MON, S_IMP, "S_imp"}, - {SYM_MON, S_JELLY, "S_jelly"}, - {SYM_MON, S_KOBOLD, "S_kobold"}, - {SYM_MON, S_LEPRECHAUN, "S_leprechaun"}, - {SYM_MON, S_MIMIC, "S_mimic"}, - {SYM_MON, S_NYMPH, "S_nymph"}, - {SYM_MON, S_ORC, "S_orc"}, - {SYM_MON, S_PIERCER, "S_piercer"}, - {SYM_MON, S_QUADRUPED, "S_quadruped"}, - {SYM_MON, S_RODENT, "S_rodent"}, - {SYM_MON, S_SPIDER, "S_spider"}, - {SYM_MON, S_TRAPPER, "S_trapper"}, - {SYM_MON, S_UNICORN, "S_unicorn"}, - {SYM_MON, S_VORTEX, "S_vortex"}, - {SYM_MON, S_WORM, "S_worm"}, - {SYM_MON, S_XAN, "S_xan"}, - {SYM_MON, S_LIGHT, "S_light"}, - {SYM_MON, S_ZRUTY, "S_zruty"}, - {SYM_MON, S_ANGEL, "S_angel"}, - {SYM_MON, S_BAT, "S_bat"}, - {SYM_MON, S_CENTAUR, "S_centaur"}, - {SYM_MON, S_DRAGON, "S_dragon"}, - {SYM_MON, S_ELEMENTAL, "S_elemental"}, - {SYM_MON, S_FUNGUS, "S_fungus"}, - {SYM_MON, S_GNOME, "S_gnome"}, - {SYM_MON, S_GIANT, "S_giant"}, - {SYM_MON, S_JABBERWOCK, "S_jabberwock"}, - {SYM_MON, S_KOP, "S_kop"}, - {SYM_MON, S_LICH, "S_lich"}, - {SYM_MON, S_MUMMY, "S_mummy"}, - {SYM_MON, S_NAGA, "S_naga"}, - {SYM_MON, S_OGRE, "S_ogre"}, - {SYM_MON, S_PUDDING, "S_pudding"}, - {SYM_MON, S_QUANTMECH, "S_quantmech"}, - {SYM_MON, S_RUSTMONST, "S_rustmonst"}, - {SYM_MON, S_SNAKE, "S_snake"}, - {SYM_MON, S_TROLL, "S_troll"}, - {SYM_MON, S_UMBER, "S_umber"}, - {SYM_MON, S_VAMPIRE, "S_vampire"}, - {SYM_MON, S_WRAITH, "S_wraith"}, - {SYM_MON, S_XORN, "S_xorn"}, - {SYM_MON, S_YETI, "S_yeti"}, - {SYM_MON, S_ZOMBIE, "S_zombie"}, - {SYM_MON, S_HUMAN, "S_human"}, - {SYM_MON, S_GHOST, "S_ghost"}, - {SYM_MON, S_GOLEM, "S_golem"}, - {SYM_MON, S_DEMON, "S_demon"}, - {SYM_MON, S_EEL, "S_eel"}, - {SYM_MON, S_LIZARD, "S_lizard"}, - {SYM_MON, S_WORM_TAIL, "S_worm_tail"}, - {SYM_MON, S_MIMIC_DEF, "S_mimic_def"}, - {SYM_OC, WEAPON_CLASS, "S_weapon"}, - {SYM_OC, ARMOR_CLASS, "S_armor"}, - {SYM_OC, ARMOR_CLASS, "S_armour"}, - {SYM_OC, RING_CLASS, "S_ring"}, - {SYM_OC, AMULET_CLASS, "S_amulet"}, - {SYM_OC, TOOL_CLASS, "S_tool"}, - {SYM_OC, FOOD_CLASS, "S_food"}, - {SYM_OC, POTION_CLASS, "S_potion"}, - {SYM_OC, SCROLL_CLASS, "S_scroll"}, - {SYM_OC, SPBOOK_CLASS, "S_book"}, - {SYM_OC, WAND_CLASS, "S_wand"}, - {SYM_OC, COIN_CLASS, "S_coin"}, - {SYM_OC, GEM_CLASS, "S_gem"}, - {SYM_OC, ROCK_CLASS,"S_rock"}, - {SYM_OC, BALL_CLASS, "S_ball"}, - {SYM_OC, CHAIN_CLASS, "S_chain"}, - {SYM_OC, VENOM_CLASS, "S_venom"}, - {SYM_OBJ, BOULDER, "S_boulder"}, + {SYM_OC, WEAPON_CLASS + SYM_OFF_O, "S_weapon"}, + {SYM_OC, ARMOR_CLASS + SYM_OFF_O, "S_armor"}, + {SYM_OC, ARMOR_CLASS + SYM_OFF_O, "S_armour"}, + {SYM_OC, RING_CLASS + SYM_OFF_O, "S_ring"}, + {SYM_OC, AMULET_CLASS + SYM_OFF_O, "S_amulet"}, + {SYM_OC, TOOL_CLASS + SYM_OFF_O, "S_tool"}, + {SYM_OC, FOOD_CLASS + SYM_OFF_O, "S_food"}, + {SYM_OC, POTION_CLASS + SYM_OFF_O, "S_potion"}, + {SYM_OC, SCROLL_CLASS + SYM_OFF_O, "S_scroll"}, + {SYM_OC, SPBOOK_CLASS + SYM_OFF_O, "S_book"}, + {SYM_OC, WAND_CLASS + SYM_OFF_O, "S_wand"}, + {SYM_OC, COIN_CLASS + SYM_OFF_O, "S_coin"}, + {SYM_OC, GEM_CLASS + SYM_OFF_O, "S_gem"}, + {SYM_OC, ROCK_CLASS + SYM_OFF_O, "S_rock"}, + {SYM_OC, BALL_CLASS + SYM_OFF_O, "S_ball"}, + {SYM_OC, CHAIN_CLASS + SYM_OFF_O, "S_chain"}, + {SYM_OC, VENOM_CLASS + SYM_OFF_O, "S_venom"}, + {SYM_MON, S_ANT + SYM_OFF_M, "S_ant"}, + {SYM_MON, S_BLOB + SYM_OFF_M, "S_blob"}, + {SYM_MON, S_COCKATRICE + SYM_OFF_M, "S_cockatrice"}, + {SYM_MON, S_DOG + SYM_OFF_M, "S_dog"}, + {SYM_MON, S_EYE + SYM_OFF_M, "S_eye"}, + {SYM_MON, S_FELINE + SYM_OFF_M, "S_feline"}, + {SYM_MON, S_GREMLIN + SYM_OFF_M, "S_gremlin"}, + {SYM_MON, S_HUMANOID + SYM_OFF_M, "S_humanoid"}, + {SYM_MON, S_IMP + SYM_OFF_M, "S_imp"}, + {SYM_MON, S_JELLY + SYM_OFF_M, "S_jelly"}, + {SYM_MON, S_KOBOLD + SYM_OFF_M, "S_kobold"}, + {SYM_MON, S_LEPRECHAUN + SYM_OFF_M, "S_leprechaun"}, + {SYM_MON, S_MIMIC + SYM_OFF_M, "S_mimic"}, + {SYM_MON, S_NYMPH + SYM_OFF_M, "S_nymph"}, + {SYM_MON, S_ORC + SYM_OFF_M, "S_orc"}, + {SYM_MON, S_PIERCER + SYM_OFF_M, "S_piercer"}, + {SYM_MON, S_QUADRUPED + SYM_OFF_M, "S_quadruped"}, + {SYM_MON, S_RODENT + SYM_OFF_M, "S_rodent"}, + {SYM_MON, S_SPIDER + SYM_OFF_M, "S_spider"}, + {SYM_MON, S_TRAPPER + SYM_OFF_M, "S_trapper"}, + {SYM_MON, S_UNICORN + SYM_OFF_M, "S_unicorn"}, + {SYM_MON, S_VORTEX + SYM_OFF_M, "S_vortex"}, + {SYM_MON, S_WORM + SYM_OFF_M, "S_worm"}, + {SYM_MON, S_XAN + SYM_OFF_M, "S_xan"}, + {SYM_MON, S_LIGHT + SYM_OFF_M, "S_light"}, + {SYM_MON, S_ZRUTY + SYM_OFF_M, "S_zruty"}, + {SYM_MON, S_ANGEL + SYM_OFF_M, "S_angel"}, + {SYM_MON, S_BAT + SYM_OFF_M, "S_bat"}, + {SYM_MON, S_CENTAUR + SYM_OFF_M, "S_centaur"}, + {SYM_MON, S_DRAGON + SYM_OFF_M, "S_dragon"}, + {SYM_MON, S_ELEMENTAL + SYM_OFF_M, "S_elemental"}, + {SYM_MON, S_FUNGUS + SYM_OFF_M, "S_fungus"}, + {SYM_MON, S_GNOME + SYM_OFF_M, "S_gnome"}, + {SYM_MON, S_GIANT + SYM_OFF_M, "S_giant"}, + {SYM_MON, S_JABBERWOCK + SYM_OFF_M, "S_jabberwock"}, + {SYM_MON, S_KOP + SYM_OFF_M, "S_kop"}, + {SYM_MON, S_LICH + SYM_OFF_M, "S_lich"}, + {SYM_MON, S_MUMMY + SYM_OFF_M, "S_mummy"}, + {SYM_MON, S_NAGA + SYM_OFF_M, "S_naga"}, + {SYM_MON, S_OGRE + SYM_OFF_M, "S_ogre"}, + {SYM_MON, S_PUDDING + SYM_OFF_M, "S_pudding"}, + {SYM_MON, S_QUANTMECH + SYM_OFF_M, "S_quantmech"}, + {SYM_MON, S_RUSTMONST + SYM_OFF_M, "S_rustmonst"}, + {SYM_MON, S_SNAKE + SYM_OFF_M, "S_snake"}, + {SYM_MON, S_TROLL + SYM_OFF_M, "S_troll"}, + {SYM_MON, S_UMBER + SYM_OFF_M, "S_umber"}, + {SYM_MON, S_VAMPIRE + SYM_OFF_M, "S_vampire"}, + {SYM_MON, S_WRAITH + SYM_OFF_M, "S_wraith"}, + {SYM_MON, S_XORN + SYM_OFF_M, "S_xorn"}, + {SYM_MON, S_YETI + SYM_OFF_M, "S_yeti"}, + {SYM_MON, S_ZOMBIE + SYM_OFF_M, "S_zombie"}, + {SYM_MON, S_HUMAN + SYM_OFF_M, "S_human"}, + {SYM_MON, S_GHOST + SYM_OFF_M, "S_ghost"}, + {SYM_MON, S_GOLEM + SYM_OFF_M, "S_golem"}, + {SYM_MON, S_DEMON + SYM_OFF_M, "S_demon"}, + {SYM_MON, S_EEL + SYM_OFF_M, "S_eel"}, + {SYM_MON, S_LIZARD + SYM_OFF_M, "S_lizard"}, + {SYM_MON, S_WORM_TAIL + SYM_OFF_M, "S_worm_tail"}, + {SYM_MON, S_MIMIC_DEF + SYM_OFF_M, "S_mimic_def"}, + {SYM_OTH, SYM_BOULDER + SYM_OFF_X, "S_boulder"}, + {SYM_OTH, SYM_INVISIBLE + SYM_OFF_X, "S_invisible"}, {0,0,(const char *)0} /* fence post */ }; #endif /*ASCIIGRAPH*/ diff --git a/src/files.c b/src/files.c index 2769b7ede..75f276c98 100644 --- a/src/files.c +++ b/src/files.c @@ -2056,7 +2056,6 @@ char *tmp_levels; WARNCOUNT, "WARNINGS"); assign_warnings(translate); } else if (match_varname(buf, "SYMBOLS", 4)) { -#ifdef ASCIIGRAPH char *op, symbuf[BUFSZ]; boolean morelines; do { @@ -2076,9 +2075,10 @@ char *tmp_levels; while (--op >= bufp && isspace(*op)) *op = '\0'; } +#ifdef ASCIIGRAPH /* parse here */ - parsesymbols(bufp); - + parsesymbols(bufp); +#endif /*ASCIIGRAPH*/ if (morelines) do { *symbuf = '\0'; @@ -2089,6 +2089,7 @@ char *tmp_levels; bufp = symbuf; } while (*bufp == '#'); } while (morelines); +#ifdef ASCIIGRAPH switch_symbols(TRUE); #endif /*ASCIIGRAPH*/ #ifdef WIZARD diff --git a/src/mapglyph.c b/src/mapglyph.c index 7964a7fb3..23c886091 100644 --- a/src/mapglyph.c +++ b/src/mapglyph.c @@ -57,13 +57,13 @@ int explcolors[] = { # endif /*ARGSUSED*/ -void +int mapglyph(glyph, ochar, ocolor, ospecial, x, y) int glyph, *ocolor, x, y; int *ochar; unsigned *ospecial; { - register int offset; + register int offset, idx; #if defined(TEXTCOLOR) || defined(ROGUE_COLOR) int color = NO_COLOR; #endif @@ -83,7 +83,7 @@ unsigned *ospecial; * offsets. The order is set in display.h. */ if ((offset = (glyph - GLYPH_WARNING_OFF)) >= 0) { /* a warning flash */ - ch = warnsyms[offset]; + idx = offset + SYM_OFF_W; # ifdef ROGUE_COLOR if (has_rogue_color) color = NO_COLOR; @@ -92,7 +92,7 @@ unsigned *ospecial; warn_color(offset); } else if ((offset = (glyph - GLYPH_SWALLOW_OFF)) >= 0) { /* swallow */ /* see swallow_to_glyph() in display.c */ - ch = (uchar) showsyms[S_sw_tl + (offset & 0x7)]; + idx = (S_sw_tl + (offset & 0x7)) + SYM_OFF_P; #ifdef ROGUE_COLOR if (has_rogue_color && iflags.use_color) color = NO_COLOR; @@ -101,7 +101,7 @@ unsigned *ospecial; mon_color(offset >> 3); } else if ((offset = (glyph - GLYPH_ZAP_OFF)) >= 0) { /* zap beam */ /* see zapdir_to_glyph() in display.c */ - ch = showsyms[S_vbeam + (offset & 0x3)]; + idx = (S_vbeam + (offset & 0x3)) + SYM_OFF_P; #ifdef ROGUE_COLOR if (has_rogue_color && iflags.use_color) color = NO_COLOR; @@ -109,10 +109,10 @@ unsigned *ospecial; #endif zap_color((offset >> 2)); } else if ((offset = (glyph - GLYPH_EXPLODE_OFF)) >= 0) { /* explosion */ - ch = showsyms[(offset % MAXEXPCHARS) + S_explode1]; + idx = ((offset % MAXEXPCHARS) + S_explode1) + SYM_OFF_P; explode_color(offset / MAXEXPCHARS); } else if ((offset = (glyph - GLYPH_CMAP_OFF)) >= 0) { /* cmap */ - ch = showsyms[offset]; + idx = offset + SYM_OFF_P; #ifdef ROGUE_COLOR if (has_rogue_color && iflags.use_color) { if (offset >= S_vwall && offset <= S_hcdoor) @@ -130,15 +130,16 @@ unsigned *ospecial; #ifdef TEXTCOLOR /* provide a visible difference if normal and lit corridor * use the same symbol */ - if (iflags.use_color && - offset == S_litcorr && ch == showsyms[S_corr]) + if (iflags.use_color && offset == S_litcorr && + showsyms[idx] == showsyms[S_corr + SYM_OFF_P]) color = CLR_WHITE; else #endif cmap_color(offset); } else if ((offset = (glyph - GLYPH_OBJ_OFF)) >= 0) { /* object */ - if (offset == BOULDER && iflags.bouldersym) ch = iflags.bouldersym; - else ch = oc_syms[(int)objects[offset].oc_class]; + 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) { @@ -150,7 +151,7 @@ unsigned *ospecial; #endif obj_color(offset); } else if ((offset = (glyph - GLYPH_RIDDEN_OFF)) >= 0) { /* mon ridden */ - ch = monsyms[(int)mons[offset].mlet]; + idx = mons[offset].mlet + SYM_OFF_M; #ifdef ROGUE_COLOR if (has_rogue_color) /* This currently implies that the hero is here -- monsters */ @@ -162,7 +163,7 @@ unsigned *ospecial; mon_color(offset); special |= MG_RIDDEN; } else if ((offset = (glyph - GLYPH_BODY_OFF)) >= 0) { /* a corpse */ - ch = oc_syms[(int)objects[CORPSE].oc_class]; + idx = objects[CORPSE].oc_class + SYM_OFF_O; #ifdef ROGUE_COLOR if (has_rogue_color && iflags.use_color) color = CLR_RED; @@ -171,7 +172,7 @@ unsigned *ospecial; mon_color(offset); special |= MG_CORPSE; } else if ((offset = (glyph - GLYPH_DETECT_OFF)) >= 0) { /* mon detect */ - ch = monsyms[(int)mons[offset].mlet]; + idx = mons[offset].mlet + SYM_OFF_M; #ifdef ROGUE_COLOR if (has_rogue_color) color = NO_COLOR; /* no need to check iflags.use_color */ @@ -182,7 +183,7 @@ unsigned *ospecial; /* is_reverse = TRUE; */ special |= MG_DETECT; } else if ((offset = (glyph - GLYPH_INVIS_OFF)) >= 0) { /* invisible */ - ch = DEF_INVISIBLE; + idx = SYM_INVISIBLE + SYM_OFF_X; #ifdef ROGUE_COLOR if (has_rogue_color) color = NO_COLOR; /* no need to check iflags.use_color */ @@ -191,7 +192,7 @@ unsigned *ospecial; invis_color(offset); special |= MG_INVIS; } else if ((offset = (glyph - GLYPH_PET_OFF)) >= 0) { /* a pet */ - ch = monsyms[(int)mons[offset].mlet]; + idx = mons[offset].mlet + SYM_OFF_M; #ifdef ROGUE_COLOR if (has_rogue_color) color = NO_COLOR; /* no need to check iflags.use_color */ @@ -200,7 +201,7 @@ unsigned *ospecial; pet_color(offset); special |= MG_PET; } else { /* a monster */ - ch = monsyms[(int)mons[glyph].mlet]; + idx = mons[glyph].mlet + SYM_OFF_M; #ifdef ROGUE_COLOR if (has_rogue_color && iflags.use_color) { if (x == u.ux && y == u.uy) @@ -221,6 +222,7 @@ unsigned *ospecial; } } + ch = showsyms[idx]; #ifdef TEXTCOLOR /* Turn off color if no color defined, or rogue level w/o PC graphics. */ # ifdef REINCARNATION @@ -240,7 +242,7 @@ unsigned *ospecial; #ifdef TEXTCOLOR *ocolor = color; #endif - return; + return idx; } /*mapglyph.c*/ diff --git a/src/options.c b/src/options.c index 7e406ae21..9463c58af 100644 --- a/src/options.c +++ b/src/options.c @@ -3323,7 +3323,8 @@ char *buf; #ifdef BACKWARD_COMPAT else if (!strcmp(optname, "boulder")) Sprintf(buf, "%c", iflags.bouldersym ? - iflags.bouldersym : oc_syms[(int)objects[BOULDER].oc_class]); + iflags.bouldersym : + showsyms[(int)objects[BOULDER].oc_class + SYM_OFF_O]); #endif else if (!strcmp(optname, "catname")) Sprintf(buf, "%s", catname[0] ? catname : none ); diff --git a/src/pager.c b/src/pager.c index be3f359de..9d232cee6 100644 --- a/src/pager.c +++ b/src/pager.c @@ -546,19 +546,19 @@ do_look(mode, click_cc) } else if (glyph_is_trap(glyph)) { sym = showsyms[trap_to_defsym(glyph_to_trap(glyph))]; } else if (glyph_is_object(glyph)) { - sym = oc_syms[(int)objects[glyph_to_obj(glyph)].oc_class]; + sym = showsyms[(int)objects[glyph_to_obj(glyph)].oc_class + SYM_OFF_O]; if (sym == '`' && iflags.bouldersym && (int)glyph_to_obj(glyph) == BOULDER) sym = iflags.bouldersym; } else if (glyph_is_monster(glyph)) { /* takes care of pets, detected, ridden, and regular mons */ - sym = monsyms[(int)mons[glyph_to_mon(glyph)].mlet]; + sym = showsyms[(int)mons[glyph_to_mon(glyph)].mlet + SYM_OFF_M]; } else if (glyph_is_swallow(glyph)) { sym = showsyms[glyph_to_swallow(glyph)+S_sw_tl]; } else if (glyph_is_invisible(glyph)) { sym = DEF_INVISIBLE; } else if (glyph_is_warning(glyph)) { sym = glyph_to_warning(glyph); - sym = warnsyms[sym]; + sym = showsyms[sym + SYM_OFF_W]; } else { impossible("do_look: bad glyph %d at (%d,%d)", glyph, (int)cc.x, (int)cc.y); @@ -573,7 +573,8 @@ do_look(mode, click_cc) /* Check for monsters */ for (i = 0; i < MAXMCLASSES; i++) { - if (sym == ((from_screen || clicklook) ? monsyms[i] : def_monsyms[i].sym) && + if (sym == ((from_screen || clicklook) ? + showsyms[i + SYM_OFF_M] : def_monsyms[i].sym) && def_monsyms[i].explain) { need_to_look = TRUE; if (!found) { @@ -589,7 +590,7 @@ do_look(mode, click_cc) playing a character which isn't normally displayed by that symbol; firstmatch is assumed to already be set for '@' */ if (((from_screen || clicklook) ? - (sym == monsyms[S_HUMAN] && cc.x == u.ux && cc.y == u.uy) : + (sym == showsyms[S_HUMAN + SYM_OFF_M] && cc.x == u.ux && cc.y == u.uy) : (sym == def_monsyms[S_HUMAN].sym && !flags.showrace)) && !(Race_if(PM_HUMAN) || Race_if(PM_ELF)) && !Upolyd) found += append_str(out_str, "you"); /* tack on "or you" */ @@ -611,7 +612,8 @@ do_look(mode, click_cc) /* Now check for objects */ for (i = 1; i < MAXOCLASSES; i++) { - if (sym == ((from_screen || clicklook) ? oc_syms[i] : def_oc_syms[i].sym)) { + if (sym == ((from_screen || clicklook) ? + showsyms[i + SYM_OFF_O] : def_oc_syms[i].sym)) { need_to_look = TRUE; if ((from_screen || clicklook) && i == VENOM_CLASS) { skipped_venom++; diff --git a/sys/amiga/winfuncs.c b/sys/amiga/winfuncs.c index c09953278..ee54d75f2 100644 --- a/sys/amiga/winfuncs.c +++ b/sys/amiga/winfuncs.c @@ -2087,7 +2087,7 @@ if(u.uz.dlevel != x){ else /* AMII, or Rogue level in either version */ { /* map glyph to character and color */ - mapglyph(glyph, &och, &color, &special, x, y); + (void) mapglyph(glyph, &och, &color, &special, x, y); /* XXX next if should be ifdef REINCARNATION */ ch = (uchar)och; if( WINVERS_AMIV ){ /* implies Rogue level here */ diff --git a/sys/wince/mhmap.c b/sys/wince/mhmap.c index 0006407d7..fe6a4a0a9 100644 --- a/sys/wince/mhmap.c +++ b/sys/wince/mhmap.c @@ -588,7 +588,7 @@ void onPaint(HWND hWnd) OldFg = SetTextColor (hDC, nhcolor_to_RGB(color) ); #else /* rely on NetHack core helper routine */ - mapglyph(data->map[i][j], &mgch, &color, + (void)mapglyph(data->map[i][j], &mgch, &color, &special, i, j); ch = (char)mgch; if (((special & MG_PET) && iflags.hilite_pet) || @@ -851,30 +851,30 @@ void nhglyph2charcolor(short g, uchar* ch, int* color) #endif if ((offset = (g - GLYPH_WARNING_OFF)) >= 0) { /* a warning flash */ - *ch = warnsyms[offset]; + *ch = showsyms[offset + SYM_OFF_W]; warn_color(offset); } else if ((offset = (g - GLYPH_SWALLOW_OFF)) >= 0) { /* swallow */ /* see swallow_to_glyph() in display.c */ - *ch = (uchar) showsyms[S_sw_tl + (offset & 0x7)]; + *ch = (uchar) showsyms[(S_sw_tl + (offset & 0x7)) + SYM_OFF_P]; mon_color(offset >> 3); } else if ((offset = (g - GLYPH_ZAP_OFF)) >= 0) { /* zap beam */ /* see zapdir_to_glyph() in display.c */ - *ch = showsyms[S_vbeam + (offset & 0x3)]; + *ch = showsyms[(S_vbeam + (offset & 0x3)) + SYM_OFF_P]; zap_color((offset >> 2)); } else if ((offset = (g - GLYPH_CMAP_OFF)) >= 0) { /* cmap */ - *ch = showsyms[offset]; + *ch = showsyms[offset + SYM_OFF_P]; cmap_color(offset); } else if ((offset = (g - GLYPH_OBJ_OFF)) >= 0) { /* object */ - *ch = oc_syms[(int)objects[offset].oc_class]; + *ch = showsyms[(int)objects[offset].oc_class + SYM_OFF_O]; obj_color(offset); } else if ((offset = (g - GLYPH_BODY_OFF)) >= 0) { /* a corpse */ - *ch = oc_syms[(int)objects[CORPSE].oc_class]; + *ch = showsyms[(int)objects[CORPSE].oc_class + SYM_OFF_O]; mon_color(offset); } else if ((offset = (g - GLYPH_PET_OFF)) >= 0) { /* a pet */ - *ch = monsyms[(int)mons[offset].mlet]; + *ch = showsyms[(int)mons[offset].mlet + SYM_OFF_M]; pet_color(offset); } else { /* a monster */ - *ch = monsyms[(int)mons[g].mlet]; + *ch = showsyms[(int)mons[g].mlet + SYM_OFF_M]; mon_color(g); } // end of wintty code diff --git a/sys/wince/mhstatus.c b/sys/wince/mhstatus.c index 87a956e8e..4507d202e 100644 --- a/sys/wince/mhstatus.c +++ b/sys/wince/mhstatus.c @@ -230,7 +230,7 @@ void FormatStatusString(char* text, int format) if(hp < 0) hp = 0; (void) describe_level(nb=eos(nb)); Sprintf(nb = eos(nb), - "%c:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d", oc_syms[COIN_CLASS], + "%c:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d", showsyms[COIN_CLASS + SYM_OFF_O], #ifndef GOLDOBJ u.ugold, #else diff --git a/win/Qt/qt_win.cpp b/win/Qt/qt_win.cpp index 51cc6f84a..0d7e2cddd 100644 --- a/win/Qt/qt_win.cpp +++ b/win/Qt/qt_win.cpp @@ -1689,7 +1689,7 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event) painter.setPen( green ); /* map glyph to character and color */ - mapglyph(g, &och, &color, &special, i, j); + (void)mapglyph(g, &och, &color, &special, i, j); ch = (uchar)och; #ifdef TEXTCOLOR painter.setPen( nhcolor_to_pen(color) ); diff --git a/win/X11/winmap.c b/win/X11/winmap.c index 27b7d5924..a86468e81 100644 --- a/win/X11/winmap.c +++ b/win/X11/winmap.c @@ -105,7 +105,7 @@ X11_print_glyph(window, x, y, glyph) register unsigned char *co_ptr; #endif /* map glyph to character and color */ - mapglyph(glyph, &och, &color, &special, x, y); + (void)mapglyph(glyph, &och, &color, &special, x, y); ch = (uchar)och; /* Only update if we need to. */ diff --git a/win/gem/wingem.c b/win/gem/wingem.c index 199c09642..50dce814f 100644 --- a/win/gem/wingem.c +++ b/win/gem/wingem.c @@ -953,7 +953,7 @@ void mar_print_gl_char(window, x, y, glyph) unsigned special; /* map glyph to character and color */ - mapglyph(glyph, &ch, &color, &special, x, y); + (void)mapglyph(glyph, &ch, &color, &special, x, y); #ifdef TEXTCOLOR /* Turn off color if rogue level. */ diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 693b5b772..1c09465f2 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -2497,7 +2497,7 @@ tty_print_glyph(window, x, y, glyph) } #endif /* map glyph to character and color */ - mapglyph(glyph, &ch, &color, &special, x, y); + (void)mapglyph(glyph, &ch, &color, &special, x, y); /* Move the cursor. */ tty_curs(window, x,y); diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index a60668493..e998a81f0 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -538,8 +538,9 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) if( data->map[col][row] == -1 ) { mgch = ' '; } else { - mapglyph(data->map[col][row], &mgch, &color, - &special, col, row); + (void)mapglyph(data->map[col][row], + &mgch, &color, + &special, col, row); } msg_data->buffer[index] = mgch; index++; @@ -632,7 +633,7 @@ void onPaint(HWND hWnd) OldFg = SetTextColor (hDC, nhcolor_to_RGB(color) ); #else /* rely on NetHack core helper routine */ - mapglyph(data->map[i][j], &mgch, &color, + (void)mapglyph(data->map[i][j], &mgch, &color, &special, i, j); ch = (char)mgch; if (((special & MG_PET) && iflags.hilite_pet) || @@ -892,30 +893,30 @@ void nhglyph2charcolor(short g, uchar* ch, int* color) #endif if ((offset = (g - GLYPH_WARNING_OFF)) >= 0) { /* a warning flash */ - *ch = warnsyms[offset]; + *ch = showsyms[offset + SYM_OFF_W]; warn_color(offset); } else if ((offset = (g - GLYPH_SWALLOW_OFF)) >= 0) { /* swallow */ /* see swallow_to_glyph() in display.c */ - *ch = (uchar) showsyms[S_sw_tl + (offset & 0x7)]; + *ch = (uchar) showsyms[(S_sw_tl + (offset & 0x7)) + SYM_OFF_P]; mon_color(offset >> 3); } else if ((offset = (g - GLYPH_ZAP_OFF)) >= 0) { /* zap beam */ /* see zapdir_to_glyph() in display.c */ - *ch = showsyms[S_vbeam + (offset & 0x3)]; + *ch = showsyms[(S_vbeam + (offset & 0x3)) + SYM_OFF_P]; zap_color((offset >> 2)); } else if ((offset = (g - GLYPH_CMAP_OFF)) >= 0) { /* cmap */ - *ch = showsyms[offset]; + *ch = showsyms[offset + SYM_OFF_P]; cmap_color(offset); } else if ((offset = (g - GLYPH_OBJ_OFF)) >= 0) { /* object */ - *ch = oc_syms[(int)objects[offset].oc_class]; + *ch = showsyms[(int)objects[offset].oc_class + SYM_OFF_O]; obj_color(offset); } else if ((offset = (g - GLYPH_BODY_OFF)) >= 0) { /* a corpse */ - *ch = oc_syms[(int)objects[CORPSE].oc_class]; + *ch = showsyms[(int)objects[CORPSE].oc_class + SYM_OFF_O]; mon_color(offset); } else if ((offset = (g - GLYPH_PET_OFF)) >= 0) { /* a pet */ - *ch = monsyms[(int)mons[offset].mlet]; + *ch = showsyms[(int)mons[offset].mlet + SYM_OFF_M]; pet_color(offset); } else { /* a monster */ - *ch = monsyms[(int)mons[g].mlet]; + *ch = showsyms[(int)mons[g].mlet + SYM_OFF_M]; mon_color(g); } // end of wintty code