From: Pasi Kallinen Date: Sun, 5 Apr 2015 10:47:59 +0000 (+0300) Subject: Show stinking cloud valid positions X-Git-Tag: NetHack-3.6.0_RC01~492^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2643a5c3110d792b6d7f18db4f9403f8c0de7ce9;p=nethack Show stinking cloud valid positions --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 5fa64755d..4e81689ee 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -887,13 +887,13 @@ show object symbols in menu headings in menus where those object symbols act as menu accelerators, toggleable via "menu_objsyms" option show t-shirt text at end of game inventory disclose hitting with a polearm remembers the position of the last monster you hit -allow showing legal polearm positions when asked for location to hit add messages for trying to pick up some terrain features boomerang makes noise when hitting a sink non-pet rust monsters would eat rust-proofed non-digestibles but ignore those non-digestibles otherwise kicking a grave may topple the gravestone -allow showing legal jumping positions when asked for location to jump to +allow showing legal positions for stinking cloud, jumping and polearms + when asked for a location Platform- and/or Interface-Specific Fixes diff --git a/src/display.c b/src/display.c index 87658aefa..da5c194e7 100644 --- a/src/display.c +++ b/src/display.c @@ -829,8 +829,10 @@ shieldeff(x,y) * DISP_ALWAYS- Like DISP_FLASH, but vision is not taken into account. */ +#define TMP_AT_MAX_GLYPHS (COLNO*2) + static struct tmp_glyph { - coord saved[COLNO]; /* previously updated positions */ + coord saved[TMP_AT_MAX_GLYPHS]; /* previously updated positions */ int sidx; /* index of next unused slot in saved[] */ int style; /* either DISP_BEAM or DISP_FLASH or DISP_ALWAYS */ int glyph; /* glyph to use when printing */ @@ -900,7 +902,7 @@ tmp_at(x, y) default: /* do it */ if (tglyph->style == DISP_BEAM || tglyph->style == DISP_ALL) { if (tglyph->style != DISP_ALL && !cansee(x,y)) break; - if (tglyph->sidx >= COLNO) break; /* too many locations */ + if (tglyph->sidx >= TMP_AT_MAX_GLYPHS) break; /* too many locations */ /* save pos for later erasing */ tglyph->saved[tglyph->sidx].x = x; tglyph->saved[tglyph->sidx].y = y; diff --git a/src/read.c b/src/read.c index 7d35620bc..d20c25606 100644 --- a/src/read.c +++ b/src/read.c @@ -868,6 +868,39 @@ struct obj *sobj; return 0; } +boolean +is_valid_stinking_cloud_pos(x,y, showmsg) +int x,y; +boolean showmsg; +{ + if (!cansee(x, y) || !ACCESSIBLE(levl[x][y].typ) || distu(x, y) >= 32) { + if (showmsg) You("smell rotten eggs."); + return FALSE; + } + return TRUE; +} + +void +display_stinking_cloud_positions(state) + int state; +{ + if (state == 0) { + tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam)); + } else if (state == 1) { + int x,y, dx, dy; + int dist = 6; + for (dx = -dist; dx <= dist; dx++) + for (dy = -dist; dy <= dist; dy++) { + x = u.ux + dx; + y = u.uy + dy; + if (isok(x,y) && is_valid_stinking_cloud_pos(x,y, FALSE)) + tmp_at(x,y); + } + } else { + tmp_at(DISP_END, 0); + } +} + /* scroll effects; return 1 if we use up the scroll and possibly make it become discovered, 0 if caller should take care of those side-effects */ int @@ -1613,14 +1646,13 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */ already_known ? "stinking " : ""); cc.x = u.ux; cc.y = u.uy; + getpos_sethilite(display_stinking_cloud_positions); if (getpos(&cc, TRUE, "the desired position") < 0) { pline1(Never_mind); break; } - if (!cansee(cc.x, cc.y) || distu(cc.x, cc.y) >= 32) { - You("smell rotten eggs."); + if (!is_valid_stinking_cloud_pos(cc.x, cc.y, TRUE)) break; - } (void) create_gas_cloud(cc.x, cc.y, 3+bcsign(sobj), 8+4*bcsign(sobj)); break;