diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 2921d7b88..af0bdfaaa 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -13,6 +13,8 @@ improvements to pronoun usage when hallucinating message "your knapsack can't accomodate any more items" when picking stuff up or removing such from container was inaccurate if there was some gold pending; vary the message rather than add more convoluted pickup code +function calls made from mapglyph based on dungeon level are now called once + per level Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository diff --git a/include/decl.h b/include/decl.h index ce0ecabe8..d6100e241 100644 --- a/include/decl.h +++ b/include/decl.h @@ -1260,6 +1260,9 @@ struct instance_globals { char lua_ver[LUA_VER_BUFSIZ]; char lua_copyright[LUA_COPYRIGHT_BUFSIZ]; + /* per-level glyph mapping flags */ + long glyphmap_perlevel_flags; + unsigned long magic; /* validate that structure layout is preserved */ }; diff --git a/src/decl.c b/src/decl.c index a0c3a9d4a..8ae9aa6c7 100644 --- a/src/decl.c +++ b/src/decl.c @@ -695,6 +695,9 @@ const struct instance_globals g_init = { DUMMY, /* lua_ver[LUA_VER_BUFSIZ] */ DUMMY, /* lua_copyright[LUA_COPYRIGHT_BUFSIZ] */ + /* per-level glyph mapping flags */ + 0L, /* glyphmap_perlevel_flags */ + IVMAGIC /* used to validate that structure layout has been preserved */ }; diff --git a/src/do.c b/src/do.c index 9cf5669ad..9b5cbd965 100644 --- a/src/do.c +++ b/src/do.c @@ -1578,6 +1578,7 @@ boolean at_stairs, falling, portal; /* Reset the screen. */ vision_reset(); /* reset the blockages */ + g.glyphmap_perlevel_flags = 0L; /* force per-level mapglyph() changes */ docrt(); /* does a full vision recalc */ flush_screen(-1); diff --git a/src/mapglyph.c b/src/mapglyph.c index bc7e4f727..7a28091d9 100644 --- a/src/mapglyph.c +++ b/src/mapglyph.c @@ -9,9 +9,11 @@ #include "color.h" #define HI_DOMESTIC CLR_WHITE /* monst.c */ +#if 0 #if !defined(TTY_GRAPHICS) #define has_color(n) TRUE #endif +#endif #ifdef TEXTCOLOR static const int explcolors[] = { @@ -57,6 +59,10 @@ static const int explcolors[] = { #define is_objpile(x,y) (!Hallucination && g.level.objects[(x)][(y)] \ && g.level.objects[(x)][(y)]->nexthere) +#define GMAP_SET 0x00000001 +#define GMAP_ROGUELEVEL 0x00000002 +#define GMAP_ALTARCOLOR 0x00000004 + /*ARGSUSED*/ int mapglyph(glyph, ochar, ocolor, ospecial, x, y, mgflags) @@ -75,6 +81,21 @@ unsigned mgflags; has_rogue_color = (has_rogue_ibm_graphics && g.symset[g.currentgraphics].nocolor == 0); + if (!g.glyphmap_perlevel_flags) { + /* + * GMAP_SET 0x00000001 + * GMAP_ROGUELEVEL 0x00000002 + * GMAP_ALTARCOLOR 0x00000004 + */ + g.glyphmap_perlevel_flags |= GMAP_SET; + + if (Is_rogue_level(&u.uz)) { + g.glyphmap_perlevel_flags |= GMAP_ROGUELEVEL; + } else if ((Is_astralevel(&u.uz) || Is_sanctum(&u.uz))) { + g.glyphmap_perlevel_flags |= GMAP_ALTARCOLOR; + } + } + /* * Map the glyph back to a character and color. * @@ -142,7 +163,7 @@ unsigned mgflags; == g.showsyms[S_water + SYM_OFF_P])) { special |= MG_BW_LAVA; } else if (offset == S_altar && iflags.use_color) { - if ((Is_astralevel(&u.uz) || Is_sanctum(&u.uz)) + if ((g.glyphmap_perlevel_flags & GMAP_ALTARCOLOR) && (levl[x][y].altarmask & AM_SHRINE)) { /* high altar */ color = CLR_BRIGHT_MAGENTA; @@ -273,14 +294,16 @@ unsigned mgflags; if ((special & MG_PET) != 0) { ovidx = SYM_PET_OVERRIDE + SYM_OFF_X; - if (Is_rogue_level(&u.uz) ? g.ov_rogue_syms[ovidx] - : g.ov_primary_syms[ovidx]) + if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) + ? g.ov_rogue_syms[ovidx] + : g.ov_primary_syms[ovidx]) idx = ovidx; } if (is_you) { ovidx = SYM_HERO_OVERRIDE + SYM_OFF_X; - if (Is_rogue_level(&u.uz) ? g.ov_rogue_syms[ovidx] - : g.ov_primary_syms[ovidx]) + if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) + ? g.ov_rogue_syms[ovidx] + : g.ov_primary_syms[ovidx]) idx = ovidx; } } @@ -288,7 +311,8 @@ unsigned mgflags; ch = g.showsyms[idx]; #ifdef TEXTCOLOR /* Turn off color if no color defined, or rogue level w/o PC graphics. */ - if (!has_color(color) || (Is_rogue_level(&u.uz) && !has_rogue_color)) + if (!has_color(color) || + ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) && !has_rogue_color)) #endif color = NO_COLOR; *ochar = (int) ch;