Merge branch 'altarmask-sanctum-bit' of https://github.com/entrez/NetHack into pr748

This commit is contained in:
nhmall
2022-05-09 08:47:02 -04:00
7 changed files with 26 additions and 31 deletions
+5 -3
View File
@@ -34,11 +34,13 @@ typedef struct align { /* alignment & record */
/* Some altars are considered shrines, add a flag for that /* Some altars are considered shrines, add a flag for that
for the altarmask field of struct rm. */ for the altarmask field of struct rm. */
#define AM_SHRINE 0x08 #define AM_SHRINE 0x08
/* High altar on Astral plane or Moloch's sanctum */
#define AM_SANCTUM 0x10
/* special level flags, gone by the time the level has been loaded */ /* special level flags, gone by the time the level has been loaded */
#define AM_SPLEV_CO 0x10 /* co-aligned: force alignment to match hero's */ #define AM_SPLEV_CO 0x20 /* co-aligned: force alignment to match hero's */
#define AM_SPLEV_NONCO 0x20 /* non-co-aligned: force alignment to not match */ #define AM_SPLEV_NONCO 0x40 /* non-co-aligned: force alignment to not match */
#define AM_SPLEV_RANDOM 0x40 #define AM_SPLEV_RANDOM 0x80
#define Amask2align(x) \ #define Amask2align(x) \
((aligntyp) ((((x) & AM_MASK) == 0) ? A_NONE \ ((aligntyp) ((((x) & AM_MASK) == 0) ? A_NONE \
+11 -12
View File
@@ -544,18 +544,17 @@ enum glyph_offsets {
(((mon)->female == 0) ? GLYPH_PET_MALE_OFF : GLYPH_PET_FEM_OFF)) (((mon)->female == 0) ? GLYPH_PET_MALE_OFF : GLYPH_PET_FEM_OFF))
#define altar_to_glyph(amsk) \ #define altar_to_glyph(amsk) \
(((amsk & (AM_MASK | AM_SHRINE)) == AM_NONE) \ ((((amsk) & AM_SANCTUM) == AM_SANCTUM) \
? (GLYPH_ALTAR_OFF + altar_unaligned) \ ? (GLYPH_ALTAR_OFF + altar_other) \
: (((amsk & AM_SHRINE) == AM_SHRINE) \ : (((amsk) & AM_MASK) == AM_LAWFUL) \
&& (Is_astralevel(&u.uz) || Is_sanctum(&u.uz))) \ ? (GLYPH_ALTAR_OFF + altar_lawful) \
? (GLYPH_ALTAR_OFF + altar_other) \ : (((amsk) & AM_MASK) == AM_NEUTRAL) \
: ((amsk & AM_MASK) == AM_CHAOTIC) \ ? (GLYPH_ALTAR_OFF + altar_neutral) \
? (GLYPH_ALTAR_OFF + altar_chaotic) \ : (((amsk) & AM_MASK) == AM_CHAOTIC) \
: ((amsk & AM_MASK) == AM_NEUTRAL) \ ? (GLYPH_ALTAR_OFF + altar_chaotic) \
? (GLYPH_ALTAR_OFF + altar_neutral) \ : (((amsk) & AM_MASK) == AM_NONE) \
: ((amsk & AM_MASK) == AM_LAWFUL) \ ? (GLYPH_ALTAR_OFF + altar_unaligned) \
? (GLYPH_ALTAR_OFF + altar_lawful) \ : (GLYPH_ALTAR_OFF + altar_neutral))
: (GLYPH_ALTAR_OFF + altar_neutral))
/* not used, nor is it correct /* not used, nor is it correct
#define zap_to_glyph(zaptype, cmap_idx) \ #define zap_to_glyph(zaptype, cmap_idx) \
+1 -4
View File
@@ -3991,10 +3991,7 @@ dfeature_at(int x, int y, char *buf)
cmap = S_sink; /* "sink" */ cmap = S_sink; /* "sink" */
else if (IS_ALTAR(ltyp)) { else if (IS_ALTAR(ltyp)) {
Sprintf(altbuf, "%saltar to %s (%s)", Sprintf(altbuf, "%saltar to %s (%s)",
((lev->altarmask & AM_SHRINE) (lev->altarmask & AM_SANCTUM) ? "high " : "",
&& (Is_astralevel(&u.uz) || Is_sanctum(&u.uz)))
? "high "
: "",
a_gname(), a_gname(),
align_str(Amask2align(lev->altarmask & ~AM_SHRINE))); align_str(Amask2align(lev->altarmask & ~AM_SHRINE)));
dfeature = altbuf; dfeature = altbuf;
+3 -5
View File
@@ -292,12 +292,10 @@ do_earthquake(int force)
pline_The("kitchen sink falls%s.", into_a_chasm); pline_The("kitchen sink falls%s.", into_a_chasm);
goto do_pit; goto do_pit;
case ALTAR: case ALTAR:
/* always preserve the high altars */
if (Is_astralevel(&u.uz) || Is_sanctum(&u.uz))
break;
/* no need to check for high altar here; we've just
excluded those */
amsk = altarmask_at(x, y); amsk = altarmask_at(x, y);
/* always preserve the high altars */
if ((amsk & AM_SANCTUM) != 0)
break;
algn = Amask2align(amsk & AM_MASK); algn = Amask2align(amsk & AM_MASK);
if (cansee(x, y)) if (cansee(x, y))
pline_The("%s altar falls%s.", pline_The("%s altar falls%s.",
+3 -5
View File
@@ -619,13 +619,11 @@ lookat(int x, int y, char *buf, char *monbuf)
Sprintf(buf, "%s %saltar", Sprintf(buf, "%s %saltar",
/* like endgame high priests, endgame high altars /* like endgame high priests, endgame high altars
are only recognizable when immediately adjacent */ are only recognizable when immediately adjacent */
(Is_astralevel(&u.uz) && !next2u(x, y)) (Is_astralevel(&u.uz) && !next2u(x, y)
&& (amsk & AM_SANCTUM))
? "aligned" ? "aligned"
: align_str(algn), : align_str(algn),
((amsk & AM_SHRINE) != 0 (amsk & AM_SANCTUM) ? "high " : "");
&& (Is_astralevel(&u.uz) || Is_sanctum(&u.uz)))
? "high "
: "");
break; break;
case S_ndoor: case S_ndoor:
if (is_drawbridge_wall(x, y) >= 0) if (is_drawbridge_wall(x, y) >= 0)
+1 -2
View File
@@ -1468,8 +1468,7 @@ dosacrifice(void)
You("are not standing on an altar."); You("are not standing on an altar.");
return ECMD_OK; return ECMD_OK;
} }
highaltar = ((Is_astralevel(&u.uz) || Is_sanctum(&u.uz)) highaltar = (levl[u.ux][u.uy].altarmask & AM_SANCTUM);
&& (levl[u.ux][u.uy].altarmask & AM_SHRINE));
otmp = floorfood("sacrifice", 1); otmp = floorfood("sacrifice", 1);
if (!otmp) if (!otmp)
+2
View File
@@ -2330,6 +2330,8 @@ create_altar(altar* a, struct mkroom* croom)
if (a->shrine) { /* Is it a shrine or sanctum? */ if (a->shrine) { /* Is it a shrine or sanctum? */
priestini(&u.uz, croom, x, y, (a->shrine > 1)); priestini(&u.uz, croom, x, y, (a->shrine > 1));
levl[x][y].altarmask |= AM_SHRINE; levl[x][y].altarmask |= AM_SHRINE;
if (a->shrine == 2) /* high altar or sanctum */
levl[x][y].altarmask |= AM_SANCTUM;
g.level.flags.has_temple = TRUE; g.level.flags.has_temple = TRUE;
} }
} }