'tips' fix and enhancement
When 'tips' are enabled, the farlook tip displays some text at the start of getpos(). But it clobbered the initial prompt, leaving the screen in an ambiguous state (seemingly a normal map display, but it is actually waiting for player to move the cursor) after removing the tip's popup window. Reissue the prompt. farlook's short but misleading prompt of "Pick an object" is changed to "Pick a monster, object or location". I would normally include a comma before "or" but omitting it makes the longer text seem slightly less cluttered. The other tips are all one-line, delivered via pline(). Prefix all of their messages with "Tip:" (which the farlook one already uses) as a hint for using OPTIONS=!tips to shut them off.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
extern const char what_is_an_unknown_object[]; /* from pager.c */
|
||||
extern const char what_is_a_location[]; /* from pager.c */
|
||||
|
||||
staticfn void getpos_toggle_hilite_state(void);
|
||||
staticfn void getpos_getvalids_selection(struct selectionvar *,
|
||||
@@ -265,7 +265,7 @@ getpos_help(boolean force, const char *goal)
|
||||
/* disgusting hack; the alternate selection characters work for any
|
||||
getpos call, but only matter for dowhatis (and doquickwhatis,
|
||||
also for dotherecmdmenu's simulated mouse) */
|
||||
doing_what_is = (goal == what_is_an_unknown_object);
|
||||
doing_what_is = (goal == what_is_a_location);
|
||||
if (doing_what_is) {
|
||||
Sprintf(kbuf, "'%s' or '%s' or '%s' or '%s'",
|
||||
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_PICK]),
|
||||
@@ -816,7 +816,8 @@ getpos(coord *ccp, boolean force, const char *goal)
|
||||
mMoOdDxX[i] = gc.Cmd.spkeys[mMoOdDxX_def[i]];
|
||||
mMoOdDxX[SIZE(mMoOdDxX_def)] = '\0';
|
||||
|
||||
handle_tip(TIP_GETPOS);
|
||||
if (handle_tip(TIP_GETPOS))
|
||||
show_goal_msg = TRUE; /* tip has overwritten prompt in mesg window */
|
||||
|
||||
if (!goal)
|
||||
goal = "desired location";
|
||||
|
||||
24
src/hack.c
24
src/hack.c
@@ -1760,25 +1760,26 @@ u_simple_floortyp(coordxy x, coordxy y)
|
||||
return ROOM;
|
||||
}
|
||||
|
||||
/* maybe show a helpful gameplay tip? */
|
||||
void
|
||||
/* maybe show a helpful gameplay tip? returns True if tip gets shown */
|
||||
boolean
|
||||
handle_tip(int tip)
|
||||
{
|
||||
if (!flags.tips)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
if (tip >= 0 && tip < NUM_TIPS && !svc.context.tips[tip]) {
|
||||
svc.context.tips[tip] = TRUE;
|
||||
/* the "Tip:" prefix is a hint to use of OPTIONS=!tips to suppress */
|
||||
switch (tip) {
|
||||
case TIP_ENHANCE:
|
||||
pline("(Use the #enhance command to advance them.)");
|
||||
pline("(Tip: use the #enhance command to advance them.)");
|
||||
break;
|
||||
case TIP_SWIM:
|
||||
pline("(Use '%s' prefix to step in if you really want to.)",
|
||||
pline("(Tip: use '%s' prefix to step in if you really want to.)",
|
||||
visctrl(cmd_from_func(do_reqmenu)));
|
||||
break;
|
||||
case TIP_UNTRAP_MON:
|
||||
pline("(Perhaps #untrap would help?)");
|
||||
pline("(Tip: perhaps #untrap would help?)");
|
||||
break;
|
||||
case TIP_GETPOS:
|
||||
l_nhcore_call(NHCORE_GETPOS_TIP);
|
||||
@@ -1787,7 +1788,9 @@ handle_tip(int tip)
|
||||
impossible("Unknown tip in handle_tip(%i)", tip);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Is it dangerous for hero to move to x,y due to water or lava? */
|
||||
@@ -1823,7 +1826,7 @@ swim_move_danger(coordxy x, coordxy y)
|
||||
You("avoid %s into the %s.",
|
||||
ing_suffix(u_locomotion("step")),
|
||||
waterbody_name(x, y));
|
||||
handle_tip(TIP_SWIM);
|
||||
(void) handle_tip(TIP_SWIM);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -2056,7 +2059,7 @@ domove_swap_with_pet(struct monst *mtmp, coordxy x, coordxy y)
|
||||
which = just_an(anbuf, what); /* "a " or "an " */
|
||||
}
|
||||
You("stop. %s can't move out of %s%s.", YMonnam(mtmp), which, what);
|
||||
handle_tip(TIP_UNTRAP_MON);
|
||||
(void) handle_tip(TIP_UNTRAP_MON);
|
||||
didnt_move = TRUE;
|
||||
} else if (mtmp->mpeaceful
|
||||
&& (!goodpos(u.ux0, u.uy0, mtmp, 0)
|
||||
@@ -2687,6 +2690,11 @@ domove_core(void)
|
||||
/* check for discovered trap */
|
||||
&& (trap = t_at(x, y)) != 0 && trap->tseen
|
||||
/* check whether attempted move will be viable */
|
||||
/*
|
||||
* FIXME:
|
||||
* this will result in "Really step into trap?" if there is a
|
||||
* peaceful or tame monster already there.
|
||||
*/
|
||||
&& test_move(u.ux, u.uy, u.dx, u.dy, TEST_MOVE)
|
||||
/* override confirmation if the trap is harmless to the hero */
|
||||
&& (immune_to_trap(&gy.youmonst, trap->ttyp) != TRAP_CLEARLY_IMMUNE
|
||||
|
||||
@@ -1627,7 +1627,7 @@ add_quoted_engraving(coordxy x, coordxy y, char *buf)
|
||||
}
|
||||
|
||||
/* also used by getpos hack in getpos.c */
|
||||
const char what_is_an_unknown_object[] = "an unknown object";
|
||||
const char what_is_a_location[] = "a monster, object or location";
|
||||
|
||||
int
|
||||
do_look(int mode, coord *click_cc)
|
||||
@@ -1833,11 +1833,11 @@ do_look(int mode, coord *click_cc)
|
||||
if (from_screen) {
|
||||
if (flags.verbose)
|
||||
pline("Please move the cursor to %s.",
|
||||
what_is_an_unknown_object);
|
||||
what_is_a_location);
|
||||
else
|
||||
pline("Pick an object.");
|
||||
pline("Pick %s.", what_is_a_location);
|
||||
|
||||
ans = getpos(&cc, quick, what_is_an_unknown_object);
|
||||
ans = getpos(&cc, quick, what_is_a_location);
|
||||
if (ans < 0 || cc.x < 0)
|
||||
break; /* done */
|
||||
flags.verbose = FALSE; /* only print long question once */
|
||||
|
||||
@@ -79,7 +79,7 @@ give_may_advance_msg(int skill)
|
||||
: (skill <= P_LAST_WEAPON) ? "weapon "
|
||||
: (skill <= P_LAST_SPELL) ? "spell casting "
|
||||
: "fighting ");
|
||||
handle_tip(TIP_ENHANCE);
|
||||
(void) handle_tip(TIP_ENHANCE);
|
||||
}
|
||||
|
||||
/* weapon's skill category name for use as generalized description of weapon;
|
||||
|
||||
Reference in New Issue
Block a user