rogue symset issues following expanded glyphs
Contributed by entrez Also, remove the iflags.use_color test from the many if-statements in reset_glyphmap(), and test and/or override it once before the assignment to gmap->color.
This commit is contained in:
137
src/display.c
137
src/display.c
@@ -2284,6 +2284,31 @@ int wallcolors[sokoban_walls + 1] = {
|
||||
&& g.level.objects[(x)][(y)]->nexthere)
|
||||
#endif
|
||||
|
||||
static int cmap_to_roguecolor(int);
|
||||
|
||||
static int
|
||||
cmap_to_roguecolor(int cmap)
|
||||
{
|
||||
int color = NO_COLOR;
|
||||
|
||||
if (g.symset[g.currentgraphics].nocolor)
|
||||
return NO_COLOR;
|
||||
|
||||
if (cmap >= S_vwall && cmap <= S_hcdoor)
|
||||
color = CLR_BROWN;
|
||||
else if (cmap >= S_arrow_trap && cmap <= S_polymorph_trap)
|
||||
color = CLR_MAGENTA;
|
||||
else if (cmap == S_corr || cmap == S_litcorr)
|
||||
color = CLR_GRAY;
|
||||
else if (cmap >= S_room && cmap <= S_water
|
||||
&& cmap != S_darkroom)
|
||||
color = CLR_GREEN;
|
||||
else
|
||||
color = NO_COLOR;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
/*
|
||||
reset_glyphmap(trigger)
|
||||
|
||||
@@ -2361,7 +2386,7 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
gmap->glyphflags |= (MG_STATUE | MG_MALE | MG_OBJPILE);
|
||||
} else if ((offset = (glyph - GLYPH_BODY_PILETOP_OFF)) >= 0) {
|
||||
gmap->symidx = objects[CORPSE].oc_class + SYM_OFF_O;
|
||||
if (has_rogue_color && iflags.use_color)
|
||||
if (has_rogue_color)
|
||||
color = CLR_RED;
|
||||
else
|
||||
mon_color(offset);
|
||||
@@ -2370,7 +2395,7 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
gmap->symidx = objects[offset].oc_class + SYM_OFF_O;
|
||||
if (offset == BOULDER)
|
||||
gmap->symidx = SYM_BOULDER + SYM_OFF_X;
|
||||
if (has_rogue_color && iflags.use_color) {
|
||||
if (has_rogue_color) {
|
||||
switch (objects[offset].oc_class) {
|
||||
case COIN_CLASS:
|
||||
color = CLR_YELLOW;
|
||||
@@ -2430,54 +2455,28 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
} else if ((offset = (glyph - GLYPH_SWALLOW_OFF)) >= 0) {
|
||||
/* see swallow_to_glyph() in display.c */
|
||||
gmap->symidx = (S_sw_tl + (offset & 0x7)) + SYM_OFF_P;
|
||||
if (has_rogue_color && iflags.use_color)
|
||||
if (has_rogue_color)
|
||||
color = NO_COLOR;
|
||||
else
|
||||
mon_color(offset >> 3);
|
||||
} else if ((offset = (glyph - GLYPH_CMAP_C_OFF)) >= 0) {
|
||||
gmap->symidx = S_digbeam + offset + SYM_OFF_P;
|
||||
cmap_color(S_digbeam + offset);
|
||||
if (has_rogue_color)
|
||||
color = cmap_to_roguecolor(S_digbeam + offset);
|
||||
else
|
||||
cmap_color(S_digbeam + offset);
|
||||
} else if ((offset = (glyph - GLYPH_ZAP_OFF)) >= 0) {
|
||||
/* see zapdir_to_glyph() in display.c */
|
||||
gmap->symidx = (S_vbeam + (offset & 0x3)) + SYM_OFF_P;
|
||||
zap_color((offset >> 2));
|
||||
if (has_rogue_color)
|
||||
color = NO_COLOR;
|
||||
else
|
||||
zap_color((offset >> 2));
|
||||
} else if ((offset = (glyph - GLYPH_CMAP_B_OFF)) >= 0) {
|
||||
gmap->symidx = S_grave + offset + SYM_OFF_P;
|
||||
cmap_color(S_grave + offset);
|
||||
} else if ((offset = (glyph - GLYPH_ALTAR_OFF)) >= 0) {
|
||||
/* unaligned, chaotic, neutral, lawful, other altar */
|
||||
gmap->symidx = S_altar + SYM_OFF_P;
|
||||
altar_color(offset);
|
||||
} else if ((offset = (glyph - GLYPH_CMAP_A_OFF)) >= 0) {
|
||||
int cmap = S_ndoor + offset;
|
||||
int cmap = S_grave + offset;
|
||||
gmap->symidx = cmap + SYM_OFF_P;
|
||||
cmap_color(cmap);
|
||||
/*
|
||||
* Some speciality color mappings not hardcoded in data init
|
||||
*/
|
||||
if (iflags.use_color) {
|
||||
if (has_rogue_color) {
|
||||
if (cmap >= S_vwall && cmap <= S_hcdoor)
|
||||
color = CLR_BROWN;
|
||||
else if (cmap >= S_arrow_trap && cmap <= S_polymorph_trap)
|
||||
color = CLR_MAGENTA;
|
||||
else if (cmap == S_corr || cmap == S_litcorr)
|
||||
color = CLR_GRAY;
|
||||
else if (cmap >= S_room && cmap <= S_water
|
||||
&& cmap != S_darkroom)
|
||||
color = CLR_GREEN;
|
||||
else
|
||||
color = NO_COLOR;
|
||||
#ifdef TEXTCOLOR
|
||||
/* provide a visible difference if normal and lit corridor
|
||||
use the same symbol */
|
||||
} else if ((cmap == S_litcorr)
|
||||
&& g.showsyms[gmap->symidx]
|
||||
== g.showsyms[S_corr + SYM_OFF_P]) {
|
||||
color = CLR_WHITE;
|
||||
#endif
|
||||
}
|
||||
} else { /* !iflags.use_color */
|
||||
if (!iflags.use_color) {
|
||||
/* try to provide a visible difference between water and lava
|
||||
if they use the same symbol and color is disabled */
|
||||
if (cmap == S_lava
|
||||
@@ -2495,6 +2494,33 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
+ SYM_OFF_P])) {
|
||||
gmap->glyphflags |= MG_BW_ICE;
|
||||
}
|
||||
} else if (has_rogue_color) {
|
||||
color = cmap_to_roguecolor(cmap);
|
||||
}
|
||||
} else if ((offset = (glyph - GLYPH_ALTAR_OFF)) >= 0) {
|
||||
/* unaligned, chaotic, neutral, lawful, other altar */
|
||||
gmap->symidx = S_altar + SYM_OFF_P;
|
||||
if (has_rogue_color)
|
||||
color = cmap_to_roguecolor(S_altar);
|
||||
else
|
||||
altar_color(offset);
|
||||
} else if ((offset = (glyph - GLYPH_CMAP_A_OFF)) >= 0) {
|
||||
int cmap = S_ndoor + offset;
|
||||
gmap->symidx = cmap + SYM_OFF_P;
|
||||
cmap_color(cmap);
|
||||
/*
|
||||
* Some speciality color mappings not hardcoded in data init
|
||||
*/
|
||||
if (has_rogue_color) {
|
||||
color = cmap_to_roguecolor(cmap);
|
||||
#ifdef TEXTCOLOR
|
||||
/* provide a visible difference if normal and lit corridor
|
||||
use the same symbol */
|
||||
} else if ((cmap == S_litcorr)
|
||||
&& g.showsyms[gmap->symidx]
|
||||
== g.showsyms[S_corr + SYM_OFF_P]) {
|
||||
color = CLR_WHITE;
|
||||
#endif
|
||||
}
|
||||
} else if ((offset = (glyph - GLYPH_CMAP_SOKO_OFF)) >= 0) {
|
||||
gmap->symidx = S_vwall + offset + SYM_OFF_P;
|
||||
@@ -2510,7 +2536,10 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
wall_color(mines_walls);
|
||||
} else if ((offset = (glyph - GLYPH_CMAP_MAIN_OFF)) >= 0) {
|
||||
gmap->symidx = S_vwall + offset + SYM_OFF_P;
|
||||
wall_color(main_walls);
|
||||
if (has_rogue_color)
|
||||
color = cmap_to_roguecolor(S_vwall + offset);
|
||||
else
|
||||
wall_color(main_walls);
|
||||
} else if ((offset = (glyph - GLYPH_CMAP_STONE_OFF)) >= 0) {
|
||||
gmap->symidx = SYM_OFF_P;
|
||||
cmap_color(S_stone);
|
||||
@@ -2518,7 +2547,7 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
gmap->symidx = objects[offset].oc_class + SYM_OFF_O;
|
||||
if (offset == BOULDER)
|
||||
gmap->symidx = SYM_BOULDER + SYM_OFF_X;
|
||||
if (has_rogue_color && iflags.use_color) {
|
||||
if (has_rogue_color) {
|
||||
switch (objects[offset].oc_class) {
|
||||
case COIN_CLASS:
|
||||
color = CLR_YELLOW;
|
||||
@@ -2539,20 +2568,20 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
/* 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 */
|
||||
color = NO_COLOR;
|
||||
else
|
||||
mon_color(offset);
|
||||
gmap->glyphflags |= (MG_RIDDEN | MG_FEMALE);
|
||||
} else if ((offset = (glyph - GLYPH_RIDDEN_MALE_OFF)) >= 0) {
|
||||
gmap->symidx = mons[offset].mlet + SYM_OFF_M;
|
||||
if (has_rogue_color)
|
||||
color = NO_COLOR; /* no need to check iflags.use_color */
|
||||
color = NO_COLOR;
|
||||
else
|
||||
mon_color(offset);
|
||||
gmap->glyphflags |= (MG_RIDDEN | MG_MALE);
|
||||
} else if ((offset = (glyph - GLYPH_BODY_OFF)) >= 0) {
|
||||
gmap->symidx = objects[CORPSE].oc_class + SYM_OFF_O;
|
||||
if (has_rogue_color && iflags.use_color)
|
||||
if (has_rogue_color)
|
||||
color = CLR_RED;
|
||||
else
|
||||
mon_color(offset);
|
||||
@@ -2560,7 +2589,7 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
} else if ((offset = (glyph - GLYPH_DETECT_FEM_OFF)) >= 0) {
|
||||
gmap->symidx = mons[offset].mlet + SYM_OFF_M;
|
||||
if (has_rogue_color)
|
||||
color = NO_COLOR; /* no need to check iflags.use_color */
|
||||
color = NO_COLOR;
|
||||
else
|
||||
mon_color(offset);
|
||||
/* Disabled for now; anyone want to get reverse video to work? */
|
||||
@@ -2569,7 +2598,7 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
} else if ((offset = (glyph - GLYPH_DETECT_MALE_OFF)) >= 0) {
|
||||
gmap->symidx = mons[offset].mlet + SYM_OFF_M;
|
||||
if (has_rogue_color)
|
||||
color = NO_COLOR; /* no need to check iflags.use_color */
|
||||
color = NO_COLOR;
|
||||
else
|
||||
mon_color(offset);
|
||||
/* Disabled for now; anyone want to get reverse video to work? */
|
||||
@@ -2578,27 +2607,27 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
} else if ((offset = (glyph - GLYPH_INVIS_OFF)) >= 0) {
|
||||
gmap->symidx = SYM_INVISIBLE + SYM_OFF_X;
|
||||
if (has_rogue_color)
|
||||
color = NO_COLOR; /* no need to check iflags.use_color */
|
||||
color = NO_COLOR;
|
||||
else
|
||||
invis_color(offset);
|
||||
gmap->glyphflags |= MG_INVIS;
|
||||
} else if ((offset = (glyph - GLYPH_PET_FEM_OFF)) >= 0) {
|
||||
gmap->symidx = mons[offset].mlet + SYM_OFF_M;
|
||||
if (has_rogue_color)
|
||||
color = NO_COLOR; /* no need to check iflags.use_color */
|
||||
color = NO_COLOR;
|
||||
else
|
||||
pet_color(offset);
|
||||
gmap->glyphflags |= (MG_PET | MG_FEMALE);
|
||||
} else if ((offset = (glyph - GLYPH_PET_MALE_OFF)) >= 0) {
|
||||
gmap->symidx = mons[offset].mlet + SYM_OFF_M;
|
||||
if (has_rogue_color)
|
||||
color = NO_COLOR; /* no need to check iflags.use_color */
|
||||
color = NO_COLOR;
|
||||
else
|
||||
pet_color(offset);
|
||||
gmap->glyphflags |= (MG_PET | MG_MALE);
|
||||
} else if ((offset = (glyph - GLYPH_MON_FEM_OFF)) >= 0) {
|
||||
gmap->symidx = mons[offset].mlet + SYM_OFF_M;
|
||||
if (has_rogue_color && iflags.use_color) {
|
||||
if (has_rogue_color) {
|
||||
color = NO_COLOR;
|
||||
} else {
|
||||
mon_color(offset);
|
||||
@@ -2606,7 +2635,7 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
gmap->glyphflags |= MG_FEMALE;
|
||||
} else if ((offset = (glyph - GLYPH_MON_MALE_OFF)) >= 0) {
|
||||
gmap->symidx = mons[offset].mlet + SYM_OFF_M;
|
||||
if (has_rogue_color && iflags.use_color) {
|
||||
if (has_rogue_color) {
|
||||
color = CLR_YELLOW;
|
||||
} else {
|
||||
mon_color(offset);
|
||||
@@ -2626,9 +2655,9 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|
||||
#ifdef TEXTCOLOR
|
||||
/* Turn off color if no color defined, or rogue level w/o PC graphics.
|
||||
*/
|
||||
if (!has_color(color)
|
||||
|| ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL)
|
||||
&& !has_rogue_color))
|
||||
if ((!has_color(color)
|
||||
|| ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL)
|
||||
&& !has_rogue_color)) || !iflags.use_color)
|
||||
#endif
|
||||
color = NO_COLOR;
|
||||
gmap->color = color;
|
||||
|
||||
@@ -237,6 +237,7 @@ assign_graphics(int whichset)
|
||||
g.currentgraphics = PRIMARY;
|
||||
break;
|
||||
}
|
||||
reset_glyphmap(gm_symchange);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user