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
Platform- and/or Interface-Specific Fixes
/* ### do_name.c ### */
E int FDECL(getpos, (coord *,BOOLEAN_P,const char *));
+E void FDECL(getpos_sethilite, (void (*f)(int) ));
E void FDECL(new_mname, (struct monst *,int));
E void FDECL(free_mname, (struct monst *));
E void FDECL(new_oname, (struct obj *,int));
return TRUE;
}
+int polearm_range_min = -1;
+int polearm_range_max = -1;
+
+void
+display_polearm_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;
+ for (dx = -4; dx <= 4; dx++)
+ for (dy = -4; dy <= 4; dy++) {
+ x = dx + (int)u.ux;
+ y = dy + (int)u.uy;
+ if (isok(x, y) &&
+ distu(x, y) >= polearm_range_min &&
+ distu(x, y) <= polearm_range_max) {
+ tmp_at(x, y);
+ }
+ }
+ } else {
+ tmp_at(DISP_END, 0);
+ }
+}
+
/* Distance attacks by pole-weapons */
STATIC_OVL int
use_pole(obj)
else if (P_SKILL(typ) == P_SKILLED) max_range = 5;
else max_range = 8; /* (P_SKILL(typ) >= P_EXPERT) */
+ polearm_range_min = min_range;
+ polearm_range_max = max_range;
+
/* Prompt for a location */
pline(where_to_hit);
- if (hitm && !DEADMONSTER(hitm) && cansee(hitm->mx, hitm->my)) {
+ cc.x = u.ux;
+ cc.y = u.uy;
+ if (!find_poleable_mon(&cc, min_range, max_range) &&
+ hitm && !DEADMONSTER(hitm) && cansee(hitm->mx, hitm->my) &&
+ distu(hitm->mx,hitm->my) <= max_range &&
+ distu(hitm->mx,hitm->my) >= min_range) {
cc.x = hitm->mx;
cc.y = hitm->my;
- } else if (!find_poleable_mon(&cc, min_range, max_range)) {
- cc.x = u.ux;
- cc.y = u.uy;
}
+ getpos_sethilite(display_polearm_positions);
if (getpos(&cc, TRUE, "the spot to hit") < 0)
return res; /* ESC; uses turn iff polearm became wielded */
return bufs[bufidx];
}
+/* function for getpos() to highlight desired map locations.
+ * parameter value 0 = initialize, 1 = highlight, 2 = done
+ */
+void (*getpos_hilitefunc)(int) = NULL;
+void
+getpos_sethilite(f)
+void (*f)(int);
+{
+ getpos_hilitefunc = f;
+}
+
/* the response for '?' help request in getpos() */
STATIC_OVL void
getpos_help(force, goal)
putstr(tmpwin, 0, "Use [HJKL] to move the cursor 8 units at a time.");
putstr(tmpwin, 0, "Or enter a background symbol (ex. <).");
putstr(tmpwin, 0, "Use @ to move the cursor on yourself.");
+ if (getpos_hilitefunc != NULL)
+ putstr(tmpwin, 0, "Use $ to display valid locations.");
putstr(tmpwin, 0, "Use # to toggle automatic description.");
/* disgusting hack; the alternate selection characters work for any
getpos call, but they only matter for dowhatis (and doquickwhatis) */
boolean show_goal_msg = FALSE;
static const char pick_chars[] = ".,;:";
const char *cp;
+ boolean hilite_state = FALSE;
if (!goal) goal = "desired location";
if (flags.verbose) {
curs(WIN_MAP, cx, cy);
flush_screen(0);
show_goal_msg = FALSE;
- } else if (auto_msg && !msg_given) {
+ } else if (auto_msg && !msg_given && !hilite_state) {
coord cc;
int sym = 0;
char tmpbuf[BUFSZ];
c = nh_poskey(&tx, &ty, &sidx);
+ if (hilite_state) {
+ (*getpos_hilitefunc)(2);
+ hilite_state = FALSE;
+ curs(WIN_MAP, cx, cy);
+ flush_screen(0);
+ }
+
if (auto_msg)
msg_given = FALSE;
/* update message window to reflect that we're still targetting */
show_goal_msg = TRUE;
msg_given = TRUE;
+ } else if ((c == '$') && (getpos_hilitefunc != NULL)) {
+ if (!hilite_state) {
+ (*getpos_hilitefunc)(0);
+ (*getpos_hilitefunc)(1);
+ hilite_state = TRUE;
+ }
+ goto nxtc;
} else if (c == '#') {
auto_msg = !auto_msg;
pline("Automatic description %sis %s.",
if (msg_given) clear_nhwindow(WIN_MESSAGE);
ccp->x = cx;
ccp->y = cy;
+ getpos_hilitefunc = NULL;
return result;
}