color altars

Something I noticed in the hardfought diff what looked interesting.
Unfortunately the most interesting bit turns out to be unuseable.

Display high altars (Moloch's Sanctum and the Astral Plane) in
bright-magenta and unaligned altars (aside from the Sanctum one) in
red.  Hardfought's code also uses white for lawful, gray for neutral,
and black for chaotic, matching the unicorn colors associated with
the alignments.  But those colors don't render in a reliable fashion
(see the comment in mapglyph.c) and become confusing about why they're
used for altars of particular alignments.
This commit is contained in:
PatR
2019-12-07 13:44:46 -08:00
parent f2dd00f86b
commit 708773c514
3 changed files with 57 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.17 $ $NHDT-Date: 1575542023 2019/12/05 10:33:43 $
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.19 $ $NHDT-Date: 1575755075 2019/12/07 21:44:35 $
General Fixes and Modified Features
-----------------------------------
@@ -40,6 +40,7 @@ split off some of the functionality that was in makedefs (compiled-in options
and accessed on the target platform
replace quest.txt and associated conversion to quest.dat via makedefs with
lua quest texts loaded at runtime
some altars are displayed in different colors (for tty and curses at least)
Platform- and/or Interface-Specific New Features

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mapglyph.c $NHDT-Date: 1573943501 2019/11/16 22:31:41 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.51 $ */
/* NetHack 3.6 mapglyph.c $NHDT-Date: 1575755075 2019/12/07 21:44:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.58 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
@@ -138,8 +138,52 @@ unsigned mgflags;
if they use the same symbol and color is disabled */
} else if (!iflags.use_color && offset == S_lava
&& (g.showsyms[idx] == g.showsyms[S_pool + SYM_OFF_P]
|| g.showsyms[idx] == g.showsyms[S_water + SYM_OFF_P])) {
|| g.showsyms[idx]
== 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))
&& (levl[x][y].altarmask & AM_SHRINE)) {
/* high altar */
color = CLR_BRIGHT_MAGENTA;
} else {
switch (levl[x][y].altarmask & AM_MASK) {
#if 0 /*
* On OSX with XTERM=xterm-color256 these render as
* white -> tty: gray, curses: ok
* gray -> both tty and curses: black
* black -> both tty and curses: blue
* red -> both tty and curses: ok.
* Since the colors have specific associations (mainly with
* the unicorns matched with each alignment), we shouldn't use
* scrambled colors and we don't have sufficient information
* to handle platform-specific variations.
*/
case AM_LAWFUL: /* 4 */
color = CLR_WHITE;
break;
case AM_NEUTRAL: /* 2 */
color = CLR_GRAY;
break;
case AM_CHAOTIC: /* 1 */
color = CLR_BLACK;
break;
#else /* !0: TEMP? */
case AM_LAWFUL: /* 4 */
case AM_NEUTRAL: /* 2 */
case AM_CHAOTIC: /* 1 */
cmap_color(S_altar); /* gray */
break;
#endif /* 0 */
case AM_NONE: /* 0 */
color = CLR_RED;
break;
default: /* 3, 5..7 -- shouldn't happen but 3 was possible
* prior to 3.6.3 (due to faulty sink polymorph) */
color = NO_COLOR;
break;
}
}
} else {
cmap_color(offset);
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pray.c $NHDT-Date: 1573346192 2019/11/10 00:36:32 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.118 $ */
/* NetHack 3.6 pray.c $NHDT-Date: 1575755077 2019/12/07 21:44:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.133 $ */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1384,6 +1384,7 @@ dosacrifice()
/* curse the lawful/neutral altar */
pline_The("altar is stained with %s blood.", g.urace.adj);
levl[u.ux][u.uy].altarmask = AM_CHAOTIC;
newsym(u.ux, u.uy); /* in case Invisible to self */
angry_priest();
} else {
struct monst *dmon;
@@ -1640,15 +1641,16 @@ dosacrifice()
a_gname());
if (rn2(8 + u.ulevel) > 5) {
struct monst *pri;
boolean shrine;
You_feel("the power of %s increase.", u_gname());
exercise(A_WIS, TRUE);
change_luck(1);
/* Yes, this is supposed to be &=, not |= */
levl[u.ux][u.uy].altarmask &= AM_SHRINE;
/* the following accommodates stupid compilers */
levl[u.ux][u.uy].altarmask =
levl[u.ux][u.uy].altarmask
| (Align2amask(u.ualign.type));
shrine = on_shrine();
levl[u.ux][u.uy].altarmask = Align2amask(u.ualign.type);
if (shrine)
levl[u.ux][u.uy].altarmask |= AM_SHRINE;
newsym(u.ux, u.uy); /* in case Invisible to self */
if (!Blind)
pline_The("altar glows %s.",
hcolor((u.ualign.type == A_LAWFUL)