newbie in-game assistance with Guidebook notation
Provide some command assistance for newbies, but suppress it with !cmdassist in the config file. If someone misinterprets the Guidebook ^D, ^T type command notation, this will pop up some further information to possibly assist them and explain the notation.
This commit is contained in:
@@ -1646,6 +1646,9 @@ Check free disk space before writing files to disk (default on).
|
|||||||
You may have to turn this off if you have more than 2 GB free space
|
You may have to turn this off if you have more than 2 GB free space
|
||||||
on the partition used for your save and level files.
|
on the partition used for your save and level files.
|
||||||
Only applies when MFLOPPY was defined during compilation.
|
Only applies when MFLOPPY was defined during compilation.
|
||||||
|
.lp cmdassist
|
||||||
|
Have the game provide some additional command assistance for
|
||||||
|
new players if it detects some anticipated mistakes (default on).
|
||||||
.lp "confirm "
|
.lp "confirm "
|
||||||
Have user confirm attacks on pets, shopkeepers, and other
|
Have user confirm attacks on pets, shopkeepers, and other
|
||||||
peaceable creatures (default on).
|
peaceable creatures (default on).
|
||||||
|
|||||||
+5
-1
@@ -27,7 +27,7 @@
|
|||||||
\begin{document}
|
\begin{document}
|
||||||
%
|
%
|
||||||
% input file: guidebook.mn
|
% input file: guidebook.mn
|
||||||
% $Revision: 1.45 $ $Date: 2002/07/23 05:10:28 $
|
% $Revision: 1.46 $ $Date: 2002/07/28 10:45:46 $
|
||||||
%
|
%
|
||||||
%.ds h0 "
|
%.ds h0 "
|
||||||
%.ds h1 %.ds h2 \%
|
%.ds h1 %.ds h2 \%
|
||||||
@@ -2066,6 +2066,10 @@ You may have to turn this off if you have more than 2 GB free space
|
|||||||
on the partition used for your save and level files.
|
on the partition used for your save and level files.
|
||||||
Only applies when MFLOPPY was defined during compilation.
|
Only applies when MFLOPPY was defined during compilation.
|
||||||
%.lp
|
%.lp
|
||||||
|
\item[\ib{cmdassist}]
|
||||||
|
Have the game provide some additional command assistance for new
|
||||||
|
players if it detects some anticipated mistakes (default on).
|
||||||
|
%.lp
|
||||||
\item[\ib{confirm}]
|
\item[\ib{confirm}]
|
||||||
Have user confirm attacks on pets, shopkeepers, and other
|
Have user confirm attacks on pets, shopkeepers, and other
|
||||||
peaceable creatures (default on).
|
peaceable creatures (default on).
|
||||||
|
|||||||
@@ -1369,6 +1369,7 @@ E int NDECL(dowhatis);
|
|||||||
E int NDECL(doquickwhatis);
|
E int NDECL(doquickwhatis);
|
||||||
E int NDECL(doidtrap);
|
E int NDECL(doidtrap);
|
||||||
E int NDECL(dowhatdoes);
|
E int NDECL(dowhatdoes);
|
||||||
|
E char *FDECL(dowhatdoes_core,(CHAR_P, char *));
|
||||||
E int NDECL(dohelp);
|
E int NDECL(dohelp);
|
||||||
E int NDECL(dohistory);
|
E int NDECL(dohistory);
|
||||||
|
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ struct instance_flags {
|
|||||||
boolean wc_eight_bit_input; /* allow eight bit input */
|
boolean wc_eight_bit_input; /* allow eight bit input */
|
||||||
boolean wc_mouse_support; /* allow mouse support */
|
boolean wc_mouse_support; /* allow mouse support */
|
||||||
|
|
||||||
|
boolean cmdassist; /* provide detailed assistance for some commands */
|
||||||
/* Items which belong in flags, but are here to allow save compatibility */
|
/* Items which belong in flags, but are here to allow save compatibility */
|
||||||
boolean lootabc; /* use "a/b/c" rather than "o/i/b" when looting */
|
boolean lootabc; /* use "a/b/c" rather than "o/i/b" when looting */
|
||||||
boolean showrace; /* show hero glyph by race rather than by role */
|
boolean showrace; /* show hero glyph by race rather than by role */
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ static void NDECL(end_of_input);
|
|||||||
static const char* readchar_queue="";
|
static const char* readchar_queue="";
|
||||||
|
|
||||||
STATIC_DCL char *NDECL(parse);
|
STATIC_DCL char *NDECL(parse);
|
||||||
|
STATIC_DCL boolean FDECL(help_control, (CHAR_P, char *));
|
||||||
|
|
||||||
#ifdef OVL1
|
#ifdef OVL1
|
||||||
|
|
||||||
@@ -1899,7 +1900,7 @@ const char *s;
|
|||||||
dirsym = readchar();
|
dirsym = readchar();
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
dirsym = yn_function (s ? s : "In what direction?",
|
dirsym = yn_function ((s && *s != '^') ? s : "In what direction?",
|
||||||
(char *)0, '\0');
|
(char *)0, '\0');
|
||||||
#ifdef REDO
|
#ifdef REDO
|
||||||
savech(dirsym);
|
savech(dirsym);
|
||||||
@@ -1907,14 +1908,55 @@ const char *s;
|
|||||||
if(dirsym == '.' || dirsym == 's')
|
if(dirsym == '.' || dirsym == 's')
|
||||||
u.dx = u.dy = u.dz = 0;
|
u.dx = u.dy = u.dz = 0;
|
||||||
else if(!movecmd(dirsym) && !u.dz) {
|
else if(!movecmd(dirsym) && !u.dz) {
|
||||||
if(!index(quitchars, dirsym))
|
boolean did_control = FALSE;
|
||||||
pline("What a strange direction!");
|
if(!index(quitchars, dirsym)) {
|
||||||
|
if (s && *s == '^' && iflags.cmdassist)
|
||||||
|
did_control = help_control(dirsym, "Invalid direction key!");
|
||||||
|
if (!did_control) pline("What a strange direction!");
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(!u.dz && (Stunned || (Confusion && !rn2(5)))) confdir();
|
if(!u.dz && (Stunned || (Confusion && !rn2(5)))) confdir();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC_OVL boolean
|
||||||
|
help_control(sym, msg)
|
||||||
|
char sym;
|
||||||
|
char *msg;
|
||||||
|
{
|
||||||
|
char ctrl;
|
||||||
|
winid win;
|
||||||
|
char buf[BUFSZ], buf2[BUFSZ], *expl;
|
||||||
|
if (letter(sym)) {
|
||||||
|
sym = highc(sym);
|
||||||
|
ctrl = (sym - 'A') + 1;
|
||||||
|
if ((expl = dowhatdoes_core(ctrl, buf2))) {
|
||||||
|
win = create_nhwindow(NHW_TEXT);
|
||||||
|
putstr(win, 0, "cmdassist");
|
||||||
|
if (msg) putstr(win, 0, msg);
|
||||||
|
putstr(win, 0, "");
|
||||||
|
Sprintf(buf,
|
||||||
|
"Are you trying to use ^%c as specified in the Guidebook?",
|
||||||
|
sym);
|
||||||
|
putstr(win, 0, buf);
|
||||||
|
putstr(win, 0, "");
|
||||||
|
putstr(win, 0, expl);
|
||||||
|
putstr(win, 0, "");
|
||||||
|
putstr(win, 0, "To use that command, you press");
|
||||||
|
Sprintf(buf,
|
||||||
|
"the <Ctrl> key, and the <%c> key at the same time.", sym);
|
||||||
|
putstr(win, 0, buf);
|
||||||
|
putstr(win, 0, "");
|
||||||
|
putstr(win, 0, "(Suppress this message with !cmdassist in config file.)");
|
||||||
|
display_nhwindow(win, FALSE);
|
||||||
|
destroy_nhwindow(win);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* OVL1 */
|
#endif /* OVL1 */
|
||||||
#ifdef OVLB
|
#ifdef OVLB
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ static struct Bool_Opt
|
|||||||
#else
|
#else
|
||||||
{"checkspace", (boolean *)0, FALSE, SET_IN_FILE},
|
{"checkspace", (boolean *)0, FALSE, SET_IN_FILE},
|
||||||
#endif
|
#endif
|
||||||
|
{"cmdassist", &iflags.cmdassist, TRUE, SET_IN_GAME},
|
||||||
# if defined(MICRO) || defined(WIN32)
|
# if defined(MICRO) || defined(WIN32)
|
||||||
{"color", &iflags.wc_color,TRUE, SET_IN_GAME}, /*WC*/
|
{"color", &iflags.wc_color,TRUE, SET_IN_GAME}, /*WC*/
|
||||||
# else /* systems that support multiple terminals, many monochrome */
|
# else /* systems that support multiple terminals, many monochrome */
|
||||||
|
|||||||
+32
-16
@@ -739,7 +739,7 @@ doidtrap()
|
|||||||
register struct trap *trap;
|
register struct trap *trap;
|
||||||
int x, y, tt;
|
int x, y, tt;
|
||||||
|
|
||||||
if (!getdir((char *)0)) return 0;
|
if (!getdir("^")) return 0;
|
||||||
x = u.ux + u.dx;
|
x = u.ux + u.dx;
|
||||||
y = u.uy + u.dy;
|
y = u.uy + u.dy;
|
||||||
for (trap = ftrap; trap; trap = trap->ntrap)
|
for (trap = ftrap; trap; trap = trap->ntrap)
|
||||||
@@ -765,12 +765,14 @@ doidtrap()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
char *
|
||||||
dowhatdoes()
|
dowhatdoes_core(q, cbuf)
|
||||||
|
char q;
|
||||||
|
char *cbuf;
|
||||||
{
|
{
|
||||||
dlb *fp;
|
dlb *fp;
|
||||||
char bufr[BUFSZ+6];
|
char bufr[BUFSZ];
|
||||||
register char *buf = &bufr[6], *ep, q, ctrl, meta;
|
register char *buf = &bufr[6], *ep, ctrl, meta;
|
||||||
|
|
||||||
fp = dlb_fopen(CMDHELPFILE, "r");
|
fp = dlb_fopen(CMDHELPFILE, "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
@@ -778,16 +780,9 @@ dowhatdoes()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(UNIX) || defined(VMS)
|
|
||||||
introff();
|
|
||||||
#endif
|
|
||||||
q = yn_function("What command?", (char *)0, '\0');
|
|
||||||
#if defined(UNIX) || defined(VMS)
|
|
||||||
intron();
|
|
||||||
#endif
|
|
||||||
ctrl = ((q <= '\033') ? (q - 1 + 'A') : 0);
|
ctrl = ((q <= '\033') ? (q - 1 + 'A') : 0);
|
||||||
meta = ((0x80 & q) ? (0x7f & q) : 0);
|
meta = ((0x80 & q) ? (0x7f & q) : 0);
|
||||||
while(dlb_fgets(buf,BUFSZ,fp))
|
while(dlb_fgets(buf,BUFSZ-6,fp)) {
|
||||||
if ((ctrl && *buf=='^' && *(buf+1)==ctrl) ||
|
if ((ctrl && *buf=='^' && *(buf+1)==ctrl) ||
|
||||||
(meta && *buf=='M' && *(buf+1)=='-' && *(buf+2)==meta) ||
|
(meta && *buf=='M' && *(buf+1)=='-' && *(buf+2)==meta) ||
|
||||||
*buf==q) {
|
*buf==q) {
|
||||||
@@ -806,12 +801,33 @@ dowhatdoes()
|
|||||||
buf[0] = q;
|
buf[0] = q;
|
||||||
(void) strncpy(buf+1, " ", 7);
|
(void) strncpy(buf+1, " ", 7);
|
||||||
}
|
}
|
||||||
pline("%s", buf);
|
|
||||||
(void) dlb_fclose(fp);
|
(void) dlb_fclose(fp);
|
||||||
return 0;
|
Strcpy(cbuf, buf);
|
||||||
|
return cbuf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pline("I've never heard of such commands.");
|
|
||||||
(void) dlb_fclose(fp);
|
(void) dlb_fclose(fp);
|
||||||
|
return (char *)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
dowhatdoes()
|
||||||
|
{
|
||||||
|
char bufr[BUFSZ];
|
||||||
|
char q, *reslt;
|
||||||
|
|
||||||
|
#if defined(UNIX) || defined(VMS)
|
||||||
|
introff();
|
||||||
|
#endif
|
||||||
|
q = yn_function("What command?", (char *)0, '\0');
|
||||||
|
#if defined(UNIX) || defined(VMS)
|
||||||
|
intron();
|
||||||
|
#endif
|
||||||
|
reslt = dowhatdoes_core(q, bufr);
|
||||||
|
if (reslt)
|
||||||
|
pline("%s", reslt);
|
||||||
|
else
|
||||||
|
pline("I've never heard of such commands.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user