make a distinction between rock and unexplored area

This adds a pair of new glyphs: GLYPH_UNEXPLORED and GLYPH_NOTHING

GLYPH_UNEXPLORED is meant to be the glyph for areas of the map that
haven't been explored yet.

GLYPH_NOTHING is a glyph that represents that which cannot be seen,
for instance the dark part of a room when the dark_room option is
not set.  Since the symbol for stone can now be overridden to
a players choice, it no longer made sense using S_stone for the
dark areas of the room with dark_room off. This allows the same
intended result even if S_stone symbol is mapped to something visible.

GLYPH_UNEXPLORED is what areas of the map get initialized to now
instead of STONE.

This adds a pair of new symbols: S_unexplored and S_nothing.

S_nothing is meant to be left as an unseen character (space) in
order to achieve the intended effect on the display.

S_unexplored is the symbol that is mapped to GLYPH_UNEXPLORED, and
is a distinct symbol from S_stone, even if they are set to the same
character. They don't have to be set to the same character.

Hopefully there are minimal bugs, but it is a deviation from a
fairly long-standing approach so there could be some unintended
glitches that will need repair.
This commit is contained in:
nhmall
2020-02-08 00:48:03 -05:00
parent 84daf75981
commit d37fa196b2
19 changed files with 248 additions and 126 deletions

View File

@@ -1199,6 +1199,7 @@ struct const_globals {
const struct obj zeroobj; /* used to zero out a struct obj */
const struct monst zeromonst; /* used to zero out a struct monst */
const anything zeroany; /* used to zero out union any */
const struct rm zerorm; /* used to zero out struct rm */
};
E const struct const_globals cg;

View File

@@ -275,6 +275,9 @@
*
* statue One for each monster. Count: NUMMONS
*
* unexplored One for unexplored areas of the map
* nothing Nothing but background
*
* The following are offsets used to convert to and from a glyph.
*/
#define NUM_ZAP 8 /* number of zap beam types */
@@ -292,10 +295,14 @@
#define GLYPH_SWALLOW_OFF ((NUM_ZAP << 2) + GLYPH_ZAP_OFF)
#define GLYPH_WARNING_OFF ((NUMMONS << 3) + GLYPH_SWALLOW_OFF)
#define GLYPH_STATUE_OFF (WARNCOUNT + GLYPH_WARNING_OFF)
#define MAX_GLYPH (NUMMONS + GLYPH_STATUE_OFF)
#define GLYPH_UNEXPLORED_OFF (NUMMONS + GLYPH_STATUE_OFF)
#define GLYPH_NOTHING_OFF (GLYPH_UNEXPLORED_OFF + 1)
#define MAX_GLYPH (GLYPH_NOTHING_OFF + 1)
#define NO_GLYPH MAX_GLYPH
#define GLYPH_INVISIBLE GLYPH_INVIS_OFF
#define GLYPH_UNEXPLORED GLYPH_UNEXPLORED_OFF
#define GLYPH_NOTHING GLYPH_NOTHING_OFF
#define warning_to_glyph(mwarnlev) ((mwarnlev) + GLYPH_WARNING_OFF)
#define mon_to_glyph(mon, rng) \
@@ -434,5 +441,7 @@
#define glyph_is_warning(glyph) \
((glyph) >= GLYPH_WARNING_OFF \
&& (glyph) < (GLYPH_WARNING_OFF + WARNCOUNT))
#define glyph_is_unexplored(glyph) ((glyph) == GLYPH_UNEXPLORED)
#define glyph_is_nothing(glyph) ((glyph) == GLYPH_NOTHING)
#endif /* DISPLAY_H */

View File

@@ -18,6 +18,7 @@
#define BOLT_LIM 8 /* from this distance ranged attacks will be made */
#define MAX_CARR_CAP 1000 /* so that boulders can be heavier */
#define DUMMY { 0 } /* array initializer, letting [1..N-1] default */
#define DEF_NOTHING ' ' /* default symbol for NOTHING and UNEXPLORED */
/* The UNDEFINED macros are used to initialize variables whose
initialized value is not relied upon.
@@ -93,6 +94,8 @@ enum dismount_types {
#define MG_BW_LAVA 0x0080 /* 'black & white lava': highlight lava if it
can't be distringuished from water by color */
#define MG_BW_ICE 0x0100 /* similar for ice vs floor */
#define MG_NOTHING 0x0200 /* char represents GLYPH_NOTHING */
#define MG_UNEXPL 0x0400 /* char represents GLYPH_UNEXPLORED */
/* sellobj_state() states */
#define SELL_NORMAL (0)

View File

@@ -264,11 +264,13 @@ struct symparse {
};
/* misc symbol definitions */
#define SYM_BOULDER 0
#define SYM_INVISIBLE 1
#define SYM_PET_OVERRIDE 2
#define SYM_HERO_OVERRIDE 3
#define MAXOTHER 4
#define SYM_NOTHING 0
#define SYM_UNEXPLORED 1
#define SYM_BOULDER 2
#define SYM_INVISIBLE 3
#define SYM_PET_OVERRIDE 4
#define SYM_HERO_OVERRIDE 5
#define MAXOTHER 6
/* linked list of symsets and their characteristics */
struct symsetentry {