diff --git a/include/display.h b/include/display.h index 89bf29b6c..eb8eebfb8 100644 --- a/include/display.h +++ b/include/display.h @@ -729,6 +729,8 @@ int glyph_to_cmap(int glpyh); #define glyph_to_swallow(glyph) \ (glyph_is_swallow(glyph) ? (((glyph) - GLYPH_SWALLOW_OFF) & 0x7) : 0) +#define glyph_to_explosion(glyph) \ + (glyph_is_explosion(glyph) ? (((glyph) - GLYPH_EXPLODE_OFF) % (S_expl_br - S_expl_tl + 1)) : 0) #define glyph_to_warning(glyph) \ (glyph_is_warning(glyph) ? ((glyph) - GLYPH_WARNING_OFF) : NO_GLYPH) diff --git a/src/glyphs.c b/src/glyphs.c index 021889190..e378b594e 100644 --- a/src/glyphs.c +++ b/src/glyphs.c @@ -214,6 +214,10 @@ glyph_to_cmap(int glyph) return (glyph - GLYPH_CMAP_C_OFF) + S_digbeam; else if (glyph_is_cmap_zap(glyph)) return ((glyph - GLYPH_ZAP_OFF) % 4) + S_vbeam; + else if (glyph_is_swallow(glyph)) + return glyph_to_swallow(glyph) + S_sw_tl; + else if (glyph_is_explosion(glyph)) + return glyph_to_explosion(glyph) + S_expl_tl; else return MAXPCHARS; } @@ -1051,8 +1055,7 @@ parse_id(const char *id, struct find_struct *findwhat) j = glyph - GLYPH_EXPLODE_OFF; expl = j / ((S_expl_br - S_expl_tl) + 1); - cmap = (j % ((S_expl_br - S_expl_tl) + 1)) - + S_expl_tl; + cmap = glyph_to_explosion(glyph) + S_expl_tl; i = cmap - S_expl_tl; Snprintf(buf[2], sizeof buf[2], "%s ", expl_type_texts[expl]);