Add vision sanity checking, fix more vision
- Add a vision sanity checking routine - Recalc block point when digging a door for temporary clouds - Add recalc_block_point after cvt_sdoor_to_door, because doorways on the Rogue level have no doors, and otherwise the sanity checking would complain. This doesn't actually change how the Rogue level vision works, as it uses a different vision system - Monster using a trap in a secret corridor revealed the corridor, but didn't unblock the vision unless you saw the location
This commit is contained in:
@@ -452,6 +452,7 @@ use_stethoscope(struct obj *obj)
|
||||
Soundeffect(se_hollow_sound, 100);
|
||||
You_hear(hollow_str, "door");
|
||||
cvt_sdoor_to_door(lev); /* ->typ = DOOR */
|
||||
recalc_block_point(rx, ry);
|
||||
feel_newsym(rx, ry);
|
||||
return res;
|
||||
case SCORR:
|
||||
|
||||
@@ -1651,6 +1651,7 @@ findone(coordxy zx, coordxy zy, genericptr_t whatfound)
|
||||
|
||||
flash_glyph_at(zx, zy, cmap_to_glyph(sym), FOUND_FLASH_COUNT);
|
||||
cvt_sdoor_to_door(lev); /* set lev->typ = DOOR */
|
||||
recalc_block_point(zx, zy);
|
||||
magic_map_background(zx, zy, 0);
|
||||
foundone(zx, zy, back_to_glyph(zx, zy));
|
||||
found_p->num_sdoors++;
|
||||
@@ -2040,6 +2041,7 @@ dosearch0(int aflag) /* intrinsic autosearch vs explicit searching */
|
||||
if (rnl(7 - fund))
|
||||
continue;
|
||||
cvt_sdoor_to_door(&levl[x][y]); /* .typ = DOOR */
|
||||
recalc_block_point(x, y);
|
||||
exercise(A_WIS, TRUE);
|
||||
nomul(0);
|
||||
feel_location(x, y); /* make sure it shows up */
|
||||
|
||||
@@ -541,6 +541,7 @@ dig(void)
|
||||
if (IS_DOOR(lev->typ) && (lev->doormask & D_TRAPPED)) {
|
||||
lev->doormask = D_NODOOR;
|
||||
b_trapped("door", NO_PART);
|
||||
recalc_block_point(dpx, dpy);
|
||||
newsym(dpx, dpy);
|
||||
}
|
||||
cleanup:
|
||||
@@ -1682,7 +1683,7 @@ zap_dig(void)
|
||||
pline_The("door is razed!");
|
||||
watch_dig((struct monst *) 0, zx, zy, TRUE);
|
||||
room->doormask = D_NODOOR;
|
||||
unblock_point(zx, zy); /* vision */
|
||||
recalc_block_point(zx, zy); /* vision */
|
||||
digdepth -= 2;
|
||||
if (maze_dig)
|
||||
break;
|
||||
|
||||
@@ -758,8 +758,7 @@ reveal_trap(struct trap *t, boolean seeit)
|
||||
|
||||
if (lev->typ == SCORR) {
|
||||
lev->typ = CORR, lev->flags = 0; /* set_levltyp(,,CORR) */
|
||||
if (seeit)
|
||||
unblock_point(t->tx, t->ty);
|
||||
unblock_point(t->tx, t->ty);
|
||||
}
|
||||
if (seeit)
|
||||
seetrap(t);
|
||||
|
||||
@@ -2035,8 +2035,11 @@ seffect_magic_mapping(struct obj **sobjp)
|
||||
|
||||
for (x = 1; x < COLNO; x++)
|
||||
for (y = 0; y < ROWNO; y++)
|
||||
if (levl[x][y].typ == SDOOR)
|
||||
if (levl[x][y].typ == SDOOR) {
|
||||
cvt_sdoor_to_door(&levl[x][y]);
|
||||
if (Is_rogue_level(&u.uz))
|
||||
unblock_point(x, y);
|
||||
}
|
||||
/* do_mapping() already reveals secret passages */
|
||||
}
|
||||
gk.known = TRUE;
|
||||
|
||||
@@ -100,6 +100,15 @@ staticfn void rogue_vision(seenV **, coordxy *, coordxy *);
|
||||
#define sign(z) ((z) < 0 ? -1 : ((z) ? 1 : 0))
|
||||
#define v_abs(z) ((z) < 0 ? -(z) : (z)) /* don't use abs -- it may exist */
|
||||
|
||||
/* expose viz_clear[][] for sanity checking */
|
||||
boolean
|
||||
get_viz_clear(int x, int y)
|
||||
{
|
||||
if (isok(x,y) && !viz_clear[y][x])
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* vision_init()
|
||||
*
|
||||
|
||||
@@ -20,6 +20,7 @@ staticfn void mon_chain(winid, const char *, struct monst *, boolean, long *,
|
||||
staticfn void contained_stats(winid, const char *, long *, long *);
|
||||
staticfn void misc_stats(winid, long *, long *);
|
||||
staticfn void you_sanity_check(void);
|
||||
staticfn void levl_sanity_check(void);
|
||||
staticfn void makemap_unmakemon(struct monst *, boolean);
|
||||
staticfn int QSORTCALLBACK migrsort_cmp(const genericptr, const genericptr);
|
||||
staticfn void list_migrating_mons(d_level *);
|
||||
@@ -1437,6 +1438,22 @@ you_sanity_check(void)
|
||||
(void) check_invent_gold("invent");
|
||||
}
|
||||
|
||||
staticfn void
|
||||
levl_sanity_check(void)
|
||||
{
|
||||
coordxy x, y;
|
||||
|
||||
if (Underwater)
|
||||
return; /* Underwater uses different vision */
|
||||
|
||||
for (y = 0; y < ROWNO; y++) {
|
||||
for (x = 1; x < COLNO; x++) {
|
||||
if ((does_block(x, y, &levl[x][y]) ? 1 : 0) != get_viz_clear(x, y))
|
||||
impossible("levl[%i][%i] vision blocking", x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sanity_check(void)
|
||||
{
|
||||
@@ -1457,6 +1474,7 @@ sanity_check(void)
|
||||
bc_sanity_check();
|
||||
trap_sanity_check();
|
||||
engraving_sanity_check();
|
||||
levl_sanity_check();
|
||||
program_state.in_sanity_check--;
|
||||
}
|
||||
|
||||
|
||||
@@ -3707,6 +3707,7 @@ zap_map(
|
||||
/* secret door gets revealed, converted into regular door */
|
||||
if (ltyp == SDOOR) {
|
||||
cvt_sdoor_to_door(&levl[x][y]); /* .typ = DOOR */
|
||||
recalc_block_point(x, y);
|
||||
newsym(x, y);
|
||||
if (cansee(x, y)) {
|
||||
pline("Probing reveals a secret door.");
|
||||
@@ -5331,6 +5332,7 @@ zap_over_floor(
|
||||
/* secret door gets revealed, converted into regular door */
|
||||
if (levl[x][y].typ == SDOOR) {
|
||||
cvt_sdoor_to_door(&levl[x][y]); /* .typ = DOOR */
|
||||
recalc_block_point(x, y);
|
||||
/* target spot will now pass closed_door() test below
|
||||
(except on rogue level) */
|
||||
newsym(x, y);
|
||||
|
||||
Reference in New Issue
Block a user