cmdassist for wishing
This commit is contained in:
@@ -196,7 +196,11 @@ extern NEARDATA struct window_procs windowprocs;
|
|||||||
#define WC_MAP_MODE 0x10000000L /* 29 map_mode option */
|
#define WC_MAP_MODE 0x10000000L /* 29 map_mode option */
|
||||||
#define WC_WINDOWCOLORS 0x20000000L /* 30 background color for message window */
|
#define WC_WINDOWCOLORS 0x20000000L /* 30 background color for message window */
|
||||||
#define WC_PLAYER_SELECTION 0x40000000L /* 31 background color for message window */
|
#define WC_PLAYER_SELECTION 0x40000000L /* 31 background color for message window */
|
||||||
|
#ifdef NHSTDC
|
||||||
|
#define WC_MOUSE_SUPPORT 0x80000000UL /* 32 mouse support */
|
||||||
|
#else
|
||||||
#define WC_MOUSE_SUPPORT 0x80000000L /* 32 mouse support */
|
#define WC_MOUSE_SUPPORT 0x80000000L /* 32 mouse support */
|
||||||
|
#endif
|
||||||
/* no free bits */
|
/* no free bits */
|
||||||
|
|
||||||
#define WC2_FULLSCREEN 0x01L /* 01 display full screen */
|
#define WC2_FULLSCREEN 0x01L /* 01 display full screen */
|
||||||
|
|||||||
@@ -4350,17 +4350,61 @@ int damage, tell;
|
|||||||
return(resisted);
|
return(resisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAXWISHTRY 5
|
||||||
|
|
||||||
|
STATIC_OVL void
|
||||||
|
wishcmdassist(tries)
|
||||||
|
int tries;
|
||||||
|
{
|
||||||
|
winid win;
|
||||||
|
char buf[BUFSZ];
|
||||||
|
|
||||||
|
win = create_nhwindow(NHW_TEXT);
|
||||||
|
if (!win) return;
|
||||||
|
Sprintf(buf, "cmdassist: wish mechanics");
|
||||||
|
putstr(win, 0, buf);
|
||||||
|
putstr(win, 0, "");
|
||||||
|
buf[0] = 0;
|
||||||
|
Sprintf(buf,
|
||||||
|
"You can enter 'nothing' explicitly to scratch this wish.");
|
||||||
|
putstr(win, 0, buf);
|
||||||
|
if (!u.uconduct.wishes) {
|
||||||
|
Sprintf(buf,"Entering 'nothing' will not alter your wishless status.");
|
||||||
|
putstr(win, 0, buf);
|
||||||
|
}
|
||||||
|
Sprintf(buf,
|
||||||
|
"You will by granted something random after %d more failed attempts.",
|
||||||
|
MAXWISHTRY - tries);
|
||||||
|
putstr(win, 0, buf);
|
||||||
|
putstr(win, 0, "");
|
||||||
|
putstr(win, 0,
|
||||||
|
"(Suppress this assistance with !cmdassist in config file.)");
|
||||||
|
display_nhwindow(win, FALSE);
|
||||||
|
destroy_nhwindow(win);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
makewish()
|
makewish()
|
||||||
{
|
{
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ], promptbuf[BUFSZ];
|
||||||
struct obj *otmp, nothing;
|
struct obj *otmp, nothing;
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
|
|
||||||
|
promptbuf[0] = '\0';
|
||||||
nothing = zeroobj; /* lint suppression; only its address matters */
|
nothing = zeroobj; /* lint suppression; only its address matters */
|
||||||
if (flags.verbose) You("may wish for an object.");
|
if (flags.verbose) You("may wish for an object.");
|
||||||
retry:
|
retry:
|
||||||
getlin("For what do you wish?", buf);
|
Strcpy(promptbuf,"For what do you wish");
|
||||||
|
if (iflags.cmdassist && tries > 0) {
|
||||||
|
Sprintf(eos(promptbuf),
|
||||||
|
" (enter 'help' for assistance)");
|
||||||
|
}
|
||||||
|
Strcat(promptbuf,"?");
|
||||||
|
getlin(promptbuf, buf);
|
||||||
|
if(iflags.cmdassist && !strcmpi(buf,"help")) {
|
||||||
|
wishcmdassist(tries);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
if(buf[0] == '\033') buf[0] = 0;
|
if(buf[0] == '\033') buf[0] = 0;
|
||||||
/*
|
/*
|
||||||
* Note: if they wished for and got a non-object successfully,
|
* Note: if they wished for and got a non-object successfully,
|
||||||
@@ -4371,7 +4415,7 @@ retry:
|
|||||||
otmp = readobjnam(buf, ¬hing);
|
otmp = readobjnam(buf, ¬hing);
|
||||||
if (!otmp) {
|
if (!otmp) {
|
||||||
pline("Nothing fitting that description exists in the game.");
|
pline("Nothing fitting that description exists in the game.");
|
||||||
if (++tries < 5) goto retry;
|
if (++tries < MAXWISHTRY) goto retry;
|
||||||
pline(thats_enough_tries);
|
pline(thats_enough_tries);
|
||||||
otmp = readobjnam((char *)0, (struct obj *)0);
|
otmp = readobjnam((char *)0, (struct obj *)0);
|
||||||
if (!otmp) return; /* for safety; should never happen */
|
if (!otmp) return; /* for safety; should never happen */
|
||||||
|
|||||||
Reference in New Issue
Block a user