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