Split direction key showing into separate function

This commit is contained in:
Pasi Kallinen
2016-06-03 21:08:43 +03:00
parent cc839a56c6
commit 4d594f77c2

View File

@@ -183,6 +183,7 @@ static const char *readchar_queue = "";
static coord clicklook_cc;
STATIC_DCL char *NDECL(parse);
STATIC_DCL void FDECL(show_direction_keys, (winid, boolean));
STATIC_DCL boolean FDECL(help_dir, (CHAR_P, const char *));
STATIC_PTR int
@@ -3790,6 +3791,37 @@ retry:
return 1;
}
STATIC_OVL void
show_direction_keys(win, nodiag)
winid win;
boolean nodiag;
{
char buf[BUFSZ];
if (nodiag) {
Sprintf(buf, " %c ", Cmd.move_N);
putstr(win, 0, buf);
putstr(win, 0, " | ");
Sprintf(buf, " %c- . -%c", Cmd.move_W, Cmd.move_E);
putstr(win, 0, buf);
putstr(win, 0, " | ");
Sprintf(buf, " %c ", Cmd.move_S);
putstr(win, 0, buf);
} else {
Sprintf(buf, " %c %c %c", Cmd.move_NW, Cmd.move_N,
Cmd.move_NE);
putstr(win, 0, buf);
putstr(win, 0, " \\ | / ");
Sprintf(buf, " %c- . -%c", Cmd.move_W, Cmd.move_E);
putstr(win, 0, buf);
putstr(win, 0, " / | \\ ");
Sprintf(buf, " %c %c %c", Cmd.move_SW, Cmd.move_S,
Cmd.move_SE);
putstr(win, 0, buf);
};
}
STATIC_OVL boolean
help_dir(sym, msg)
char sym;
@@ -3828,29 +3860,12 @@ const char *msg;
putstr(win, 0, "");
}
}
if (NODIAG(u.umonnum)) {
putstr(win, 0, "Valid direction keys in your current form are:");
Sprintf(buf, " %c ", Cmd.move_N);
putstr(win, 0, buf);
putstr(win, 0, " | ");
Sprintf(buf, " %c- . -%c", Cmd.move_W, Cmd.move_E);
putstr(win, 0, buf);
putstr(win, 0, " | ");
Sprintf(buf, " %c ", Cmd.move_S);
putstr(win, 0, buf);
} else {
putstr(win, 0, "Valid direction keys are:");
Sprintf(buf, " %c %c %c", Cmd.move_NW, Cmd.move_N,
Cmd.move_NE);
putstr(win, 0, buf);
putstr(win, 0, " \\ | / ");
Sprintf(buf, " %c- . -%c", Cmd.move_W, Cmd.move_E);
putstr(win, 0, buf);
putstr(win, 0, " / | \\ ");
Sprintf(buf, " %c %c %c", Cmd.move_SW, Cmd.move_S,
Cmd.move_SE);
putstr(win, 0, buf);
};
Sprintf(buf, "Valid direction keys %sare:",
NODIAG(u.umonnum) ? "in your current form " : "");
putstr(win, 0, buf);
show_direction_keys(win, NODIAG(u.umonnum));
putstr(win, 0, "");
putstr(win, 0, " < up");
putstr(win, 0, " > down");