some changes tried while working on issue #1289

display.h -- bring an unused macro up to date
detect.c  -- always call newsym() when searching or secret door
  detection finds a trap rather than just when not blind
glyphs.c  -- some formatting
pager.c   -- lookat() behaves very strangely when single-stepping
  in the debugger (gdb); this didn't help
This commit is contained in:
PatR
2024-09-28 23:50:27 -07:00
parent 0128fcdf6c
commit 525c6744ee
4 changed files with 31 additions and 22 deletions

View File

@@ -981,9 +981,10 @@ enum glyph_offsets {
#if 0
#define glyph_is_piletop(glyph) \
(glyph_is_body_piletop(glyph) \
|| glyph_is_statue_piletop(glyph) \
|| glyph_is_fem_statue_piletop(glyph) \
|| glyph_is_male_statue_piletop(glyph) \
|| glyph_is_piletop_generic_obj(glyph) \
|| glyph_is_obj_piletop(glyph))
|| glyph_is_normal_piletop_obj(glyph))
#endif
/* mgflags for altering map_glyphinfo() internal behavior */

View File

@@ -1608,10 +1608,11 @@ foundone(coordxy zx, coordxy zy, int glyph)
if (glyph_is_cmap(glyph) || glyph_is_unexplored(glyph))
levl[zx][zy].seenv = SVALL;
if (!Blind) {
{
seenV save_viz = gv.viz_array[zy][zx];
gv.viz_array[zy][zx] = COULD_SEE | IN_SIGHT;
if (!Blind)
gv.viz_array[zy][zx] = COULD_SEE | IN_SIGHT;
newsym(zx, zy);
gv.viz_array[zy][zx] = save_viz;
}
@@ -1665,6 +1666,7 @@ findone(coordxy zx, coordxy zy, genericptr_t whatfound)
&& ttmp->ttyp != STATUE_TRAP) {
flash_glyph_at(zx, zy, trap_to_glyph(ttmp), FOUND_FLASH_COUNT);
ttmp->tseen = 1;
sense_trap(ttmp, zx, zy, 0); /* handles Hallucination */
foundone(zx, zy, trap_to_glyph(ttmp));
found_p->num_traps++;
}
@@ -1673,7 +1675,6 @@ findone(coordxy zx, coordxy zy, genericptr_t whatfound)
dummytrap.tx = zx, dummytrap.ty = zy;
flash_glyph_at(zx, zy, trap_to_glyph(&dummytrap), FOUND_FLASH_COUNT);
dummytrap.tseen = 1;
map_trap(&dummytrap, 1);
sense_trap(&dummytrap, zx, zy, 0); /* handles Hallucination */
foundone(zx, zy, trap_to_glyph(&dummytrap));
found_p->num_traps++;
@@ -2345,11 +2346,11 @@ reveal_terrain(
keep_objs = (which_subset & TER_OBJ) != 0,
keep_mons = (which_subset & TER_MON) != 0; /* not used */
unsigned swallowed = u.uswallow; /* before unconstrain_map() */
nhsym default_sym = svl.level.flags.arboreal ? S_tree : S_stone;
if (unconstrain_map())
docrt();
default_glyph = cmap_to_glyph(svl.level.flags.arboreal ? S_tree
: S_stone);
default_glyph = cmap_to_glyph(default_sym);
for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) {

View File

@@ -50,7 +50,9 @@ staticfn void shuffle_customizations(void);
/* staticfn void purge_custom_entries(enum graphics_sets which_set); */
staticfn void
to_custom_symset_entry_callback(int glyph, struct find_struct *findwhat)
to_custom_symset_entry_callback(
int glyph,
struct find_struct *findwhat)
{
int idx = gs.symset_which_set;
#ifdef ENHANCED_SYMBOLS
@@ -107,7 +109,9 @@ to_custom_symset_entry_callback(int glyph, struct find_struct *findwhat)
* 0 = failure
*/
int
glyphrep_to_custom_map_entries(const char *op, int *glyphptr)
glyphrep_to_custom_map_entries(
const char *op,
int *glyphptr)
{
to_custom_symbol_find = zero_find;
char buf[BUFSZ], *c_glyphid, *c_unicode, *c_colorval, *cp;
@@ -222,11 +226,13 @@ glyph_to_cmap(int glyph)
return glyph_to_explosion(glyph) + S_expl_tl;
else
return MAXPCHARS; /* MAXPCHARS is legal array index because
of trailing fencepost entry */
* of trailing fencepost entry */
}
staticfn int
glyph_find_core(const char *id, struct find_struct *findwhat)
glyph_find_core(
const char *id,
struct find_struct *findwhat)
{
int glyph;
boolean do_callback, end_find = FALSE;
@@ -492,7 +498,7 @@ add_custom_nhcolor_entry(
gdc->details_end = 0;
}
details = find_matching_customization(customization_name,
custom_nhcolor, which_set);
custom_nhcolor, which_set);
if (details) {
while (details) {
if (details->content.ccolor.glyphidx == glyphidx) {
@@ -503,8 +509,7 @@ add_custom_nhcolor_entry(
}
}
/* create new details entry */
newdetails = (struct customization_detail *) alloc(
sizeof (struct customization_detail));
newdetails = (struct customization_detail *) alloc(sizeof *newdetails);
newdetails->content.urep.glyphidx = glyphidx;
newdetails->content.ccolor.nhcolor = nhcolor;
newdetails->next = (struct customization_detail *) 0;
@@ -520,8 +525,8 @@ add_custom_nhcolor_entry(
void
apply_customizations(
enum graphics_sets which_set,
enum do_customizations docustomize)
enum graphics_sets which_set,
enum do_customizations docustomize)
{
glyph_map *gmap;
struct customization_detail *details;
@@ -802,7 +807,9 @@ wizcustom_glyphids(winid win)
}
staticfn int
parse_id(const char *id, struct find_struct *findwhat)
parse_id(
const char *id,
struct find_struct *findwhat)
{
FILE *fp = (FILE *) 0;
int i = 0, j, mnum, glyph,

View File

@@ -694,6 +694,8 @@ lookat(coordxy x, coordxy y, char *buf, char *monbuf)
int warnindx = glyph_to_warning(glyph);
Strcpy(buf, def_warnsyms[warnindx].explanation);
} else if (glyph_is_invisible(glyph)) {
Strcpy(buf, invisexplain); /* redundant; handled by caller */
} else if (glyph_is_nothing(glyph)) {
Strcpy(buf, "dark part of a room");
} else if (glyph_is_unexplored(glyph)) {
@@ -704,11 +706,7 @@ lookat(coordxy x, coordxy y, char *buf, char *monbuf)
} else {
Strcpy(buf, "unexplored area");
}
} else if (glyph_is_invisible(glyph)) {
/* already handled */
} else if (!glyph_is_cmap(glyph)) {
Strcpy(buf, "unexplored area");
} else {
} else if (glyph_is_cmap(glyph)) {
int amsk;
aligntyp algn;
short symidx = glyph_to_cmap(glyph);
@@ -767,6 +765,8 @@ lookat(coordxy x, coordxy y, char *buf, char *monbuf)
Strcpy(buf, defsyms[symidx].explanation);
break;
}
} else { /* not mon, obj, trap, or cmap */
Strcpy(buf, "unexplored area");
}
return (pm && !Hallucination) ? pm : (struct permonst *) 0;
}