Beispiel #1
0
static void
autopickup_rules_help(void)
{
    struct nh_menuitem items[] = {
        {0, MI_TEXT,
         "The autopickup rules are only active if autopickup is on."},
        {0, MI_TEXT,
         "If autopickup is on and you walk onto an item, the item is compared"},
        {0, MI_TEXT, "to each rule in turn until a matching rule is found."},
        {0, MI_TEXT,
         "If a match is found, the action specified in that rule is taken"},
        {0, MI_TEXT, "and no other rules are considered."},
        {0, MI_TEXT, ""},
        {0, MI_TEXT,
         "Each rule may match any combination of object name, object type,"},
        {0, MI_TEXT, "and object blessing (including unknown)."},
        {0, MI_TEXT, "A rule that specifies none of these matches everything."},
        {0, MI_TEXT, ""},
        {0, MI_TEXT, "Suppose your rules look like this:"},
        {0, MI_TEXT,
         " 1. IF name matches \"*lizard*\" AND type is \"food\": < GRAB"},
        {0, MI_TEXT,
         " 2. IF name matches \"*corpse*\" AND type is \"food\":   LEAVE >"},
        {0, MI_TEXT,
         " 3. IF type is \"food\":                             < GRAB"},
        {0, MI_TEXT, ""},
        {0, MI_TEXT,
         "A newt corpse will not match rule 1, but rule 2 applies, so"},
        {0, MI_TEXT, "it won't be picked up and rule 3 won't be considered."},
        {0, MI_TEXT,
         "(Strictly speaking, the \"type is food\" part of these rules is not"},
        {0, MI_TEXT, "necessary; it's purpose here is to make the example more "
         "interesting.)"},
        {0, MI_TEXT, ""},
        {0, MI_TEXT,
         "A dagger will not match any of these rules and so it won't"},
        {0, MI_TEXT, "be picked up either."},
        {0, MI_TEXT, ""},
        {0, MI_TEXT,
         "You may select any existing rule to edit it, change its position"},
        {0, MI_TEXT, "in the list, or delete it."},
    };
    curses_display_menu(STATIC_MENULIST(items), "Autopickup rules help:",
                        PICK_NONE, PLHINT_LEFT, NULL, null_menu_callback);
}
Beispiel #2
0
static enum nh_bucstatus
get_autopickup_buc(enum nh_bucstatus cur)
{
    struct nh_menuitem items[] = {
        {B_DONT_CARE + 1, MI_NORMAL, "all", 'a'},
        {B_BLESSED + 1, MI_NORMAL, "blessed", 'b'},
        {B_CURSED + 1, MI_NORMAL, "cursed", 'c'},
        {B_UNCURSED + 1, MI_NORMAL, "uncursed", 'u'},
        {B_UNKNOWN + 1, MI_NORMAL, "unknown", 'U'}
    };
    int selected[1];

    curses_display_menu(STATIC_MENULIST(items), "Beatitude match:",
                        PICK_ONE, PLHINT_RIGHT, selected, curses_menu_callback);
    if (*selected == CURSES_MENU_CANCELLED)
        return cur;
    return selected[0] - 1;
}
Beispiel #3
0
static void
mainmenu(void)
{
    int menuresult[1];
    int n = 1, logoheight, i;
    const char *const *copybanner = nh_get_copyright_banner();
    const char **nhlogo;
    char verstr[32];
    nh_bool first = TRUE;

    snprintf(verstr, ARRAY_SIZE(verstr), "Version %d.%d.%d", VERSION_MAJOR, VERSION_MINOR,
            PATCHLEVEL);

#if defined(NETCLIENT)
    if (ui_flags.connection_only) {
        netgame();
        return;
    }
#endif

    load_keymap(); /* netgame() assumes the keymap isn't loaded */

    while (n >= 0) {
        if (COLS >= 100) {
            nhlogo = nhlogo_large;
            logoheight = sizeof (nhlogo_large) / sizeof (nhlogo_large[0]);
        } else {
            nhlogo = nhlogo_small;
            logoheight = sizeof (nhlogo_small) / sizeof (nhlogo_small[0]);
        }
        wclear(basewin);
        wattron(basewin, A_BOLD | COLOR_PAIR(4));
        for (i = 0; i < logoheight; i++) {
            wmove(basewin, i, (COLS - strlen(nhlogo[0])) / 2);
            if (nhlogo[i])
                waddstr(basewin, nhlogo[i]);
        }
        wattroff(basewin, A_BOLD | COLOR_PAIR(4));
        mvwaddstr(basewin, LINES - 3, 0, copybanner[0]);
        mvwaddstr(basewin, LINES - 2, 0, copybanner[1]);
        mvwaddstr(basewin, LINES - 1, 0, copybanner[2]);
        mvwaddstr(basewin, LINES - 4, COLS - strlen(verstr), verstr);
        wnoutrefresh(basewin);

        if (first) {
            network_motd();
            first = FALSE;
        }

        menuresult[0] = EXITGAME;       /* default action */
        if (!override_hackdir)
            curses_display_menu_core(
                STATIC_MENULIST(mainmenu_items), NULL, PICK_ONE,
                menuresult, curses_menu_callback,
                0, logoheight - 1, COLS, LINES - 3, FALSE, NULL, FALSE);
        else
            curses_display_menu_core(
                STATIC_MENULIST(mainmenu_items_noclient), NULL, PICK_ONE,
                menuresult, curses_menu_callback,
                0, logoheight - 1, COLS, LINES - 3, FALSE, NULL, FALSE);

        if (*menuresult == CURSES_MENU_CANCELLED && !ui_flags.done_hup)
            continue;

        switch (menuresult[0]) {
        case NEWGAME:
            rungame(FALSE);
            break;

        case LOAD:
            loadgame();
            break;

        case REPLAY:
            replay();
            break;

        case OPTIONS:
            display_options(TRUE);
            break;

#if defined(NETCLIENT)
        case NETWORK:
            free_keymap(); /* don't use the local keymap for server play */
            netgame();
            load_keymap();
            break;
#endif

        case TOPTEN:
            show_topten(NULL, -1, FALSE, FALSE);
            break;

        case EXITGAME:
        case CURSES_MENU_CANCELLED: /* in case of hangup */
            n = -1;     /* simulate menu cancel */
            break;
        }
    }

    free_keymap();
}