more not PR #1102 - reveal_terrain() args
From a comment w/ diff in the pull request by entrez, combine the show-full-map flag (available in wizard mode and explore mode) with the bitmask for map-only, map-and-traps, map-and-traps-and-objects flags for #terrain mode (and getpos() help) instead of passing that as a separate argument. No change in behavior unless I messed up.
This commit is contained in:
@@ -369,7 +369,7 @@ extern void sokoban_detect(void);
|
||||
#ifdef DUMPLOG
|
||||
extern void dump_map(void);
|
||||
#endif
|
||||
extern void reveal_terrain(int, int);
|
||||
extern void reveal_terrain(unsigned);
|
||||
extern int wiz_mgender(void);
|
||||
|
||||
/* ### dig.c ### */
|
||||
|
||||
@@ -207,23 +207,24 @@ struct instance_flags {
|
||||
int at_midnight; /* only valid during end of game disclosure */
|
||||
int at_night; /* also only valid during end of game disclosure */
|
||||
int failing_untrap; /* move_into_trap() -> spoteffects() -> dotrap() */
|
||||
int getdir_click; /* as input to getdir(): non-zero, accept simulated
|
||||
* click that's not adjacent to or on hero;
|
||||
* as output from getdir(): simulated button used
|
||||
* 0 (none) or CLICK_1 (left) or CLICK_2 (right) */
|
||||
int getloc_filter; /* GFILTER_foo */
|
||||
int in_lava_effects; /* hack for Boots_off() */
|
||||
int last_msg; /* indicator of last message player saw */
|
||||
int override_ID; /* true to force full identification of objects */
|
||||
int parse_config_file_src; /* hack for parse_config_line() */
|
||||
int purge_monsters; /* # of dead monsters still on fmon list */
|
||||
int suppress_price; /* controls doname() for unpaid objects */
|
||||
int terrainmode; /* for getpos()'s autodescribe when #terrain is active */
|
||||
#define TER_MAP 0x01
|
||||
#define TER_TRP 0x02
|
||||
#define TER_OBJ 0x04
|
||||
#define TER_MON 0x08
|
||||
#define TER_DETECT 0x10 /* detect_foo magic rather than #terrain */
|
||||
int getdir_click; /* as input to getdir(): non-zero, accept simulated
|
||||
* click that's not adjacent to or on hero;
|
||||
* as output from getdir(): simulated button used
|
||||
* 0 (none) or CLICK_1 (left) or CLICK_2 (right) */
|
||||
int getloc_filter; /* GFILTER_foo */
|
||||
unsigned terrainmode; /* for getpos()'s autodescribe during #terrain */
|
||||
#define TER_MAP 0x01U
|
||||
#define TER_TRP 0x02U
|
||||
#define TER_OBJ 0x04U
|
||||
#define TER_MON 0x08U
|
||||
#define TER_FULL 0x10U /* explore|wizard mode view full map */
|
||||
#define TER_DETECT 0x20U /* detect_foo magic rather than #terrain */
|
||||
boolean bgcolors; /* display background colors on a map position */
|
||||
boolean getloc_moveskip;
|
||||
boolean getloc_travelmode;
|
||||
|
||||
@@ -2241,16 +2241,16 @@ doterrain(void)
|
||||
|
||||
switch (which) {
|
||||
case 1: /* known map */
|
||||
reveal_terrain(0, TER_MAP);
|
||||
reveal_terrain(TER_MAP);
|
||||
break;
|
||||
case 2: /* known map with known traps */
|
||||
reveal_terrain(0, TER_MAP | TER_TRP);
|
||||
reveal_terrain(TER_MAP | TER_TRP);
|
||||
break;
|
||||
case 3: /* known map with known traps and objects */
|
||||
reveal_terrain(0, TER_MAP | TER_TRP | TER_OBJ);
|
||||
reveal_terrain(TER_MAP | TER_TRP | TER_OBJ);
|
||||
break;
|
||||
case 4: /* full map */
|
||||
reveal_terrain(1, TER_MAP);
|
||||
reveal_terrain(TER_MAP | TER_FULL);
|
||||
break;
|
||||
case 5: /* map internals */
|
||||
wiz_map_levltyp();
|
||||
|
||||
49
src/detect.c
49
src/detect.c
@@ -14,7 +14,7 @@
|
||||
static boolean unconstrain_map(void);
|
||||
static void reconstrain_map(void);
|
||||
static void map_redisplay(void);
|
||||
static void browse_map(int, const char *);
|
||||
static void browse_map(unsigned, const char *);
|
||||
static void map_monst(struct monst *, boolean);
|
||||
static void do_dknown_of(struct obj *);
|
||||
static boolean check_map_spot(coordxy, coordxy, char, unsigned);
|
||||
@@ -26,7 +26,7 @@ static int furniture_detect(void);
|
||||
static void findone(coordxy, coordxy, genericptr_t);
|
||||
static void openone(coordxy, coordxy, genericptr_t);
|
||||
static int mfind0(struct monst *, boolean);
|
||||
static int reveal_terrain_getglyph(coordxy, coordxy, int, unsigned, int, int);
|
||||
static int reveal_terrain_getglyph(coordxy, coordxy, unsigned, int, unsigned);
|
||||
|
||||
/* dummytrap: used when detecting traps finds a door or chest trap; the
|
||||
couple of fields that matter are always re-initialized during use so
|
||||
@@ -88,7 +88,7 @@ map_redisplay(void)
|
||||
|
||||
/* use getpos()'s 'autodescribe' to view whatever is currently shown on map */
|
||||
static void
|
||||
browse_map(int ter_typ, const char *ter_explain)
|
||||
browse_map(unsigned ter_typ, const char *ter_explain)
|
||||
{
|
||||
coord dummy_pos; /* don't care whether player actually picks a spot */
|
||||
boolean save_autodescribe;
|
||||
@@ -106,13 +106,13 @@ browse_map(int ter_typ, const char *ter_explain)
|
||||
static void
|
||||
map_monst(struct monst *mtmp, boolean showtail)
|
||||
{
|
||||
if (def_monsyms[(int) mtmp->data->mlet].sym == ' ')
|
||||
show_glyph(mtmp->mx, mtmp->my,
|
||||
detected_mon_to_glyph(mtmp, newsym_rn2));
|
||||
else
|
||||
show_glyph(mtmp->mx, mtmp->my, mtmp->mtame
|
||||
? pet_to_glyph(mtmp, newsym_rn2)
|
||||
: mon_to_glyph(mtmp, newsym_rn2));
|
||||
int glyph = (def_monsyms[(int) mtmp->data->mlet].sym == ' ')
|
||||
? detected_mon_to_glyph(mtmp, newsym_rn2)
|
||||
: mtmp->mtame
|
||||
? pet_to_glyph(mtmp, newsym_rn2)
|
||||
: mon_to_glyph(mtmp, newsym_rn2);
|
||||
|
||||
show_glyph(mtmp->mx, mtmp->my, glyph);
|
||||
|
||||
if (showtail && mtmp->data == &mons[PM_LONG_WORM])
|
||||
detect_wsegs(mtmp, 0);
|
||||
@@ -2004,14 +2004,18 @@ sokoban_detect(void)
|
||||
}
|
||||
|
||||
static int
|
||||
reveal_terrain_getglyph(coordxy x, coordxy y, int full, unsigned swallowed,
|
||||
int default_glyph, int which_subset)
|
||||
reveal_terrain_getglyph(
|
||||
coordxy x, coordxy y,
|
||||
unsigned swallowed,
|
||||
int default_glyph,
|
||||
unsigned which_subset)
|
||||
{
|
||||
int glyph, levl_glyph;
|
||||
uchar seenv;
|
||||
boolean keep_traps = (which_subset & TER_TRP) !=0,
|
||||
boolean keep_traps = (which_subset & TER_TRP) != 0,
|
||||
keep_objs = (which_subset & TER_OBJ) != 0,
|
||||
keep_mons = (which_subset & TER_MON) != 0;
|
||||
keep_mons = (which_subset & TER_MON) != 0,
|
||||
full = (which_subset & TER_FULL) != 0;
|
||||
struct monst *mtmp;
|
||||
struct trap *t;
|
||||
|
||||
@@ -2098,7 +2102,7 @@ dump_map(void)
|
||||
{
|
||||
coordxy x, y;
|
||||
int glyph, skippedrows, lastnonblank;
|
||||
int subset = TER_MAP | TER_TRP | TER_OBJ | TER_MON;
|
||||
unsigned subset = TER_MAP | TER_TRP | TER_OBJ | TER_MON;
|
||||
int default_glyph = cmap_to_glyph(gl.level.flags.arboreal ? S_tree
|
||||
: S_stone);
|
||||
char buf[COLBUFSZ];
|
||||
@@ -2121,7 +2125,7 @@ dump_map(void)
|
||||
int ch;
|
||||
glyph_info glyphinfo;
|
||||
|
||||
glyph = reveal_terrain_getglyph(x, y, FALSE, u.uswallow,
|
||||
glyph = reveal_terrain_getglyph(x, y, u.uswallow,
|
||||
default_glyph, subset);
|
||||
map_glyphinfo(x, y, glyph, 0, &glyphinfo);
|
||||
ch = glyphinfo.ttychar;
|
||||
@@ -2151,12 +2155,15 @@ dump_map(void)
|
||||
#endif /* DUMPLOG */
|
||||
|
||||
/* idea from crawl; show known portion of map without any monsters,
|
||||
objects, or traps occluding the view of the underlying terrain */
|
||||
objects, or traps occluding the view of the underlying terrain;
|
||||
in explore or wizard modes, can also display unexplored portion */
|
||||
void
|
||||
reveal_terrain(
|
||||
int full, /* wizard|explore modes allow player to request full map */
|
||||
int which_subset) /* if not full, whether to suppress objs and/or traps */
|
||||
unsigned which_subset) /* TER_TRP | TER_OBJ | TER_MON | TER_FULL */
|
||||
{
|
||||
/* 'full' overrides impairment and implies no-traps, no-objs, no-mons */
|
||||
boolean full = (which_subset & TER_FULL) != 0; /* show whole map */
|
||||
|
||||
if ((Hallucination || Stunned || Confusion) && !full) {
|
||||
You("are too disoriented for this.");
|
||||
} else {
|
||||
@@ -2164,7 +2171,7 @@ reveal_terrain(
|
||||
int glyph, default_glyph;
|
||||
char buf[BUFSZ];
|
||||
/* there is a TER_MAP bit too; we always show map regardless of it */
|
||||
boolean keep_traps = (which_subset & TER_TRP) !=0,
|
||||
boolean keep_traps = (which_subset & TER_TRP) != 0,
|
||||
keep_objs = (which_subset & TER_OBJ) != 0,
|
||||
keep_mons = (which_subset & TER_MON) != 0; /* not used */
|
||||
unsigned swallowed = u.uswallow; /* before unconstrain_map() */
|
||||
@@ -2176,7 +2183,7 @@ reveal_terrain(
|
||||
|
||||
for (x = 1; x < COLNO; x++)
|
||||
for (y = 0; y < ROWNO; y++) {
|
||||
glyph = reveal_terrain_getglyph(x,y, full, swallowed,
|
||||
glyph = reveal_terrain_getglyph(x,y, swallowed,
|
||||
default_glyph, which_subset);
|
||||
show_glyph(x, y, glyph);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user