Show stinking cloud valid positions

This commit is contained in:
Pasi Kallinen
2015-04-05 13:51:30 +03:00
parent 056565fe75
commit 2643a5c311
3 changed files with 41 additions and 7 deletions
+2 -2
View File
@@ -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 act as menu accelerators, toggleable via "menu_objsyms" option
show t-shirt text at end of game inventory disclose show t-shirt text at end of game inventory disclose
hitting with a polearm remembers the position of the last monster you hit 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 add messages for trying to pick up some terrain features
boomerang makes noise when hitting a sink boomerang makes noise when hitting a sink
non-pet rust monsters would eat rust-proofed non-digestibles but ignore non-pet rust monsters would eat rust-proofed non-digestibles but ignore
those non-digestibles otherwise those non-digestibles otherwise
kicking a grave may topple the gravestone 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 Platform- and/or Interface-Specific Fixes
+4 -2
View File
@@ -829,8 +829,10 @@ shieldeff(x,y)
* DISP_ALWAYS- Like DISP_FLASH, but vision is not taken into account. * DISP_ALWAYS- Like DISP_FLASH, but vision is not taken into account.
*/ */
#define TMP_AT_MAX_GLYPHS (COLNO*2)
static struct tmp_glyph { 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 sidx; /* index of next unused slot in saved[] */
int style; /* either DISP_BEAM or DISP_FLASH or DISP_ALWAYS */ int style; /* either DISP_BEAM or DISP_FLASH or DISP_ALWAYS */
int glyph; /* glyph to use when printing */ int glyph; /* glyph to use when printing */
@@ -900,7 +902,7 @@ tmp_at(x, y)
default: /* do it */ default: /* do it */
if (tglyph->style == DISP_BEAM || tglyph->style == DISP_ALL) { if (tglyph->style == DISP_BEAM || tglyph->style == DISP_ALL) {
if (tglyph->style != DISP_ALL && !cansee(x,y)) break; 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 */ /* save pos for later erasing */
tglyph->saved[tglyph->sidx].x = x; tglyph->saved[tglyph->sidx].x = x;
tglyph->saved[tglyph->sidx].y = y; tglyph->saved[tglyph->sidx].y = y;
+35 -3
View File
@@ -868,6 +868,39 @@ struct obj *sobj;
return 0; 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 /* 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 */ become discovered, 0 if caller should take care of those side-effects */
int int
@@ -1613,14 +1646,13 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
already_known ? "stinking " : ""); already_known ? "stinking " : "");
cc.x = u.ux; cc.x = u.ux;
cc.y = u.uy; cc.y = u.uy;
getpos_sethilite(display_stinking_cloud_positions);
if (getpos(&cc, TRUE, "the desired position") < 0) { if (getpos(&cc, TRUE, "the desired position") < 0) {
pline1(Never_mind); pline1(Never_mind);
break; break;
} }
if (!cansee(cc.x, cc.y) || distu(cc.x, cc.y) >= 32) { if (!is_valid_stinking_cloud_pos(cc.x, cc.y, TRUE))
You("smell rotten eggs.");
break; break;
}
(void) create_gas_cloud(cc.x, cc.y, 3+bcsign(sobj), (void) create_gas_cloud(cc.x, cc.y, 3+bcsign(sobj),
8+4*bcsign(sobj)); 8+4*bcsign(sobj));
break; break;