/* * Wizard routine for creating objects -RAK- * Heavily modified to allow magification and artifactification -Bernd- * * Note that wizards cannot create objects on top of other objects. * * Hack -- this routine always makes a "dungeon object", and applies * magic to it, and attempts to decline cursed items. */ static void wiz_create_item(void) { object_type forge; object_type *q_ptr; int k_idx; /* Save the screen */ screen_save(); /* Get object base type */ k_idx = wiz_create_itemtype(); /* Restore the screen */ screen_load(); /* Return if failed */ if (!k_idx) return; if (k_info[k_idx].gen_flags & TRG_INSTA_ART) { int i; /* Artifactify */ for (i = 1; i < max_a_idx; i++) { /* Ignore incorrect tval */ if (a_info[i].tval != k_info[k_idx].tval) continue; /* Ignore incorrect sval */ if (a_info[i].sval != k_info[k_idx].sval) continue; /* Create this artifact */ (void)create_named_art(i, py, px); /* All done */ msg_print("Allocated(INSTA_ART)."); return; } } /* Get local object */ q_ptr = &forge; /* Create the item */ object_prep(q_ptr, k_idx); /* Apply magic */ apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART); /* Drop the object from heaven */ (void)drop_near(q_ptr, -1, py, px); /* All done */ msg_print("Allocated."); }
/** * Run the spell menu to select a spell. */ static int spell_menu_select(menu_type *m, const char *noun, const char *verb) { struct spell_menu_data *d = menu_priv(m); screen_save(); region_erase_bordered(&m->active); prt(format("%^s which %s? ", verb, noun), 0, 0); screen_save(); menu_select(m, 0); screen_load(); screen_load(); return d->selected_spell; }
/* * Display the debug commands help file. */ static void do_cmd_wiz_help(void) { char buf[80]; strnfmt(buf, sizeof(buf), "debug.txt"); screen_save(); show_file(buf, NULL, 0, 0); screen_load(); }
/** * Display list of monster traps. */ bool trap_menu(void) { menu_type menu; menu_iter menu_f = { trap_tag, 0, trap_display, trap_action, 0 }; region area = { 15, 1, 48, -1 }; ui_event_data evt = { EVT_NONE, 0, 0, 0, 0 }; size_t i, num = 0; u16b *choice; /* See how many traps available */ if (player_has(PF_EXTRA_TRAP)) num = 1 + (p_ptr->lev / 4); else num = 1 + (p_ptr->lev / 6); /* Create the array */ choice = C_ZNEW(num, u16b); /* Obvious */ for (i = 0; i < num; i++) { choice[i] = i; } /* Clear space */ area.page_rows = num + 2; /* Return here if there are no traps */ if (!num) { FREE(choice); return FALSE; } /* Save the screen and clear it */ screen_save(); /* Help text */ /* Set up the menu */ WIPE(&menu, menu); menu_init(&menu, MN_SKIN_SCROLL, &menu_f); menu.title = "Choose an advanced monster trap (ESC to cancel):"; menu_setpriv(&menu, num, choice); menu_layout(&menu, &area); prt("", area.row + 1, area.col); /* Select an entry */ evt = menu_select(&menu, 0); /* Free memory */ FREE(choice); /* Load screen */ screen_load(); return (evt.type != EVT_ESCAPE); }
bool do_control_inven(void) { if (!p_ptr->control) return FALSE; screen_save(); prt("Carried items", 0, 0); // DGDGDGDG show_monster_inven(p_ptr->control, monst_list); inkey(); screen_load(); return TRUE; }
/* * Peruse the On-Line-Help */ void do_cmd_help(void) { /* Save screen */ screen_save(); /* Peruse the main help file */ (void)show_file("help.hlp", NULL, 0, 0); /* Load screen */ screen_load(); }
static void _on_browse(int which) { bool screen_hack = screen_is_saved(); if (screen_hack) screen_load(); display_weapon_mode = which; do_cmd_knowledge_weapon(); display_weapon_mode = 0; if (screen_hack) screen_save(); }
/* * Display the main-screen monster list. */ void do_cmd_monlist(void) { /* Save the screen and display the list */ screen_save(); display_monlist(); /* Wait */ anykey(); /* Return */ screen_load(); }
/** * Display the main-screen monster list. */ extern void do_cmd_itemlist(void) { /* Save the screen and display the list */ screen_save(); display_itemlist(); /* Wait */ inkey_ex(); /* Return */ screen_load(); }
/** * Display list of places to jump to. */ bool jump_menu(int level, int *location) { menu_type menu; menu_iter menu_f = { jump_tag, 0, jump_display, jump_action, 0 }; region area = { 15, 1, 48, -1 }; ui_event_data evt = { EVT_NONE, 0, 0, 0, 0 }; int cursor = 0, j = 0; size_t i; u16b *choice; /* Dungeon only is easy */ if (OPT(adult_dungeon)) { *location = level + 1; return TRUE; } /* Create the array */ choice = C_ZNEW(15, u16b); /* Get the possible stages */ for (i = 0; i < NUM_STAGES; i++) if ((stage_map[i][DEPTH] == level) && (stage_map[i][LOCALITY] != 0)) choice[j++] = i; /* Clear space */ area.page_rows = j + 2; /* Save the screen and clear it */ screen_save(); /* Set up the menu */ WIPE(&menu, menu); menu.title = "Which region do you want to be transported to?"; menu.cmd_keys = " \n\r"; menu_init(&menu, MN_SKIN_SCROLL, &menu_f); menu_setpriv(&menu, j, choice); menu_layout(&menu, &area); /* Select an entry */ evt = menu_select(&menu, cursor); /* Set it */ if (evt.type == EVT_SELECT) *location = place; /* Free memory */ FREE(choice); /* Load screen */ screen_load(); return (evt.type != EVT_ESCAPE); }
/** * Display list of svals to be ignored. */ static bool sval_menu(int tval, const char *desc) { struct menu *menu; region area = { 1, 2, -1, -1 }; ignore_choice *choices; int n_choices = ignore_collect_kind(tval, &choices); if (!n_choices) return false; /* Sort by name in ignore menus except for categories of items that are * aware from the start */ switch (tval) { case TV_LIGHT: case TV_MAGIC_BOOK: case TV_PRAYER_BOOK: case TV_DRAG_ARMOR: case TV_GOLD: /* leave sorted by sval */ break; default: /* sort by name */ sort(choices, n_choices, sizeof(*choices), cmp_ignore); } /* Save the screen and clear it */ screen_save(); clear_from(0); /* Help text */ prt(format("Ignore the following %s:", desc), 0, 0); /* Run menu */ menu = menu_new(MN_SKIN_COLUMNS, &ignore_sval_menu); menu_setpriv(menu, n_choices, choices); menu->cmd_keys = "Tt"; menu_layout(menu, &area); menu_set_cursor_x_offset(menu, 1); /* Place cursor in brackets. */ menu_select(menu, 0, false); /* Free memory */ mem_free(choices); /* Load screen */ screen_load(); return true; }
/** * Run the spell menu, without selections. */ static void spell_menu_browse(menu_type * m, const char *noun) { struct spell_menu_data *d = menu_priv(m); screen_save(); region_erase_bordered(&m->active); prt(format("Browsing %ss. Press Escape to exit.", noun), 0, 0); d->browse = TRUE; menu_select(m, 0, TRUE); screen_load(); }
/** * Run the spell menu, without selections. */ static void spell_menu_browse(struct menu *m, const char *noun) { struct spell_menu_data *d = menu_priv(m); screen_save(); region_erase_bordered(&m->active); prt(format("Browsing %ss. ('?' to toggle description)", noun), 0, 0); d->browse = TRUE; menu_select(m, 0, TRUE); screen_load(); }
/** * Create Spoiler files */ void do_cmd_spoilers(void) { if (!spoil_menu) { spoil_menu = menu_new_action(spoil_actions, N_ELEMENTS(spoil_actions)); spoil_menu->selections = lower_case; spoil_menu->title = "Create spoilers"; } screen_save(); clear_from(0); menu_layout(spoil_menu, &SCREEN_REGION); menu_select(spoil_menu, 0, false); screen_load(); }
/* * Special key actions for object inscription. */ static void o_xtra_act(struct keypress ch, int oid) { object_kind *k_ptr = &k_info[oid]; s16b idx = get_autoinscription_index(oid); /* Forget it if we've never seen the thing */ if (!k_ptr->everseen) return; /* Uninscribe */ if (ch.code == '}') { if (idx != -1) remove_autoinscription(oid); return; } /* Inscribe */ else if (ch.code == '{') { char note_text[80] = ""; /* Avoid the prompt getting in the way */ screen_save(); /* Prompt */ prt("Inscribe with: ", 0, 0); /* Default note */ if (idx != -1) strnfmt(note_text, sizeof(note_text), "%s", get_autoinscription(oid)); /* Get an inscription */ if (askfor_aux(note_text, sizeof(note_text), NULL)) { /* Remove old inscription if existent */ if (idx != -1) remove_autoinscription(oid); /* Add the autoinscription */ add_autoinscription(oid, note_text); /* Notice stuff (later) */ p_ptr->notice |= (PN_AUTOINSCRIBE); p_ptr->redraw |= (PR_INVEN | PR_EQUIP); } /* Reload the screen */ screen_load(); } }
static void wiz_gf_demo(void) { menu_type *m = menu_new(MN_SKIN_SCROLL, &gf_iter); region loc = { 0, 0, 0, 0 }; menu_setpriv(m, GF_MAX, NULL); m->title = "GF_ types display"; menu_layout(m, &loc); screen_save(); clear_from(0); menu_select(m, 0, FALSE); screen_load(); }
/* * Display list of svals to be squelched. */ static bool sval_menu(int tval, const char *desc) { menu_type *menu; region area = { 1, 2, -1, -1 }; squelch_choice *choices; int n_choices = squelch_collect_kind(tval, &choices); if (!n_choices) return false; /* sort by name in squelch menus except for categories of items that are aware from the start */ switch (tval) { case TV_LIGHT: case TV_MAGIC_BOOK: case TV_PRAYER_BOOK: case TV_DRAG_ARMOR: case TV_GOLD: /* leave sorted by sval */ break; default: /* sort by name */ sort(choices, n_choices, sizeof(*choices), cmp_squelch); } /* Save the screen and clear it */ screen_save(); clear_from(0); /* Help text */ prt(format("Squelch the following %s:", desc), 0, 0); /* Run menu */ menu = menu_new(MN_SKIN_COLUMNS, &squelch_sval_menu); menu_setpriv(menu, n_choices, choices); menu_layout(menu, &area); menu_select(menu, 0, false); /* Free memory */ FREE(choices); /* Load screen */ screen_load(); return true; }
/* * Choose and create an instance of an object kind */ static void wiz_create_item(void) { menu_type *menu = menu_new(MN_SKIN_COLUMNS, &wiz_create_item_menu); menu->selections = all_letters; menu->title = "What kind of object?"; screen_save(); clear_from(0); menu_setpriv(menu, N_ELEMENTS(tvals), tvals); menu_layout(menu, &wiz_create_item_area); menu_select(menu, 0); screen_load(); }
void browse_spells(spell_info* spells, int ct, cptr desc) { screen_save(); for(;;) { int choice = -1; choice = _choose_spell(spells, ct, desc, 10000); if (choice < 0 || choice >= ct) break; if (_describe_spell(&spells[choice], _col_height(ct))) break; } screen_load(); }
/********************************************************************** * Public **********************************************************************/ void gray_mage_browse_spell(void) { bool done = FALSE; screen_save(); _browse_choice = 0; while (!done) { _slot_info_ptr slot = _choose("Browse", _ALLOW_EXCHANGE | _SHOW_INFO | _SHOW_STATS); if (!slot) done = TRUE; else _browse_choice = slot - _spells; } _browse_choice = -1; screen_load(); }
/* * Display a "small-scale" map of the dungeon. * * Note that the "player" is always displayed on the map. */ void do_cmd_view_map(void) { int cy, cx; byte w, h; const char *prompt = "Hit any key to continue"; if (Term->view_map_hook) { (*(Term->view_map_hook))(Term); return; } /* Save screen */ screen_save(); /* Note */ prt("Please wait...", 0, 0); /* Flush */ Term_fresh(); /* Clear the screen */ Term_clear(); /* store the tile multipliers */ w = tile_width; h = tile_height; tile_width = 1; tile_height = 1; /* Display the map */ display_map(&cy, &cx); /* Show the prompt */ put_str(prompt, Term->hgt - 1, Term->wid / 2 - strlen(prompt) / 2); /* Highlight the player */ Term_gotoxy(cx, cy); /* Get any key */ (void)anykey(); /* Restore the tile multipliers */ tile_width = w; tile_height = h; /* Load screen */ screen_load(); }
bool send_world_score(bool do_send) { #ifdef WORLD_SCORE if(send_score && do_send) { if(easy_band) { #ifdef JP msg_print("初心者モードではワールドスコアに登録できません。"); #else msg_print("Since you are in the Easy Mode, you cannot send score to world score server."); #endif } #ifdef JP else if(get_check_strict("スコアをスコア・サーバに登録しますか? ", (CHECK_NO_ESCAPE | CHECK_NO_HISTORY))) #else else if(get_check_strict("Do you send score to the world score sever? ", (CHECK_NO_ESCAPE | CHECK_NO_HISTORY))) #endif { errr err; prt("",0,0); #ifdef JP prt("送信中..",0,0); #else prt("Sending...",0,0); #endif Term_fresh(); screen_save(); err = report_score(); screen_load(); if (err) { return FALSE; } #ifdef JP prt("完了。何かキーを押してください。", 0, 0); #else prt("Completed. Hit any key.", 0, 0); #endif (void)inkey(); } else return FALSE; } #endif return TRUE; }
/** * Interact with some options */ static void option_toggle_menu(const char *name, int page) { int i; struct menu *m = menu_new(MN_SKIN_SCROLL, &option_toggle_iter); /* for all menus */ m->prompt = "Set option (y/n/t), '?' for information"; m->cmd_keys = "?YyNnTt"; m->selections = "abcdefghijklmopqrsuvwxz"; m->flags = MN_DBL_TAP; /* We add 10 onto the page amount to indicate we're at birth */ if (page == OPT_PAGE_BIRTH) { m->prompt = "You can only modify these options at character birth. '?' for information"; m->cmd_keys = "?"; m->flags = MN_NO_TAGS; } else if (page == OPT_PAGE_BIRTH + 10) { page -= 10; } /* for this particular menu */ m->title = name; /* Find the number of valid entries */ for (i = 0; i < OPT_PAGE_PER; i++) { if (option_page[page][i] == OPT_none) break; } /* Set the data to the player's options */ menu_setpriv(m, OPT_MAX, &op_ptr->opt); menu_set_filter(m, option_page[page], i); menu_layout(m, &SCREEN_REGION); /* Run the menu */ screen_save(); clear_from(0); menu_select(m, 0, false); screen_load(); mem_free(m); }
static bool wiz_create_item_action(menu_type *m, const ui_event *e, int oid) { ui_event ret; menu_type *menu; char buf[80]; object_kind *choice[60]; int n_choices; int i; if (e->type != EVT_SELECT) return TRUE; for (n_choices = 0, i = 1; (n_choices < 60) && (i < z_info->k_max); i++) { object_kind *kind = &k_info[i]; if (kind->tval != oid || of_has(kind->flags, OF_INSTA_ART)) continue; choice[n_choices++] = kind; } screen_save(); clear_from(0); menu = menu_new(MN_SKIN_COLUMNS, &wiz_create_item_submenu); menu->selections = all_letters; object_base_name(buf, sizeof buf, oid, TRUE); menu->title = string_make(format("What kind of %s?", buf)); menu_setpriv(menu, n_choices, choice); menu_layout(menu, &wiz_create_item_area); ret = menu_select(menu, 0, FALSE); screen_load(); string_free((char *)menu->title); return (ret.type == EVT_ESCAPE); }
int menu_choose(menu_ptr menu) { int choice = -1; if (REPEAT_PULL(&choice)) { if (choice >= 0 && choice < menu->count) return choice; } screen_save(); choice = _choose(menu); REPEAT_PUSH(choice); screen_load(); return choice; }
int choose_spell(spell_info* spells, int ct, cptr desc, int max_cost) { int choice = -1; if (REPEAT_PULL(&choice)) { if (choice >= 0 && choice < ct) return choice; } screen_save(); choice = _choose_spell(spells, ct, desc, max_cost); REPEAT_PUSH(choice); screen_load(); return choice; }
void menu_refresh(menu_type *menu, bool reset_screen) { int oid = menu->cursor; rect_region *loc = &menu->active; if (reset_screen) { screen_load(); screen_save(); } if (menu->filter_list && menu->cursor >= 0) oid = menu->filter_list[oid]; if (menu->flags & MN_BORDER) { window_make(menu->boundary.col, menu->boundary.row, menu->boundary.col + menu->boundary.width, menu->boundary.row + menu->boundary.page_rows); } if (menu->title) { if (menu->flags & MN_BORDER) { put_cstr(menu->boundary.col+2, menu->boundary.row+2, menu->title, loc->width); } else { put_cstr(menu->boundary.col, menu->boundary.row, menu->title, loc->width); } } if (menu->header) put_cstr(loc->col, loc->row - 1, menu->header, loc->width); if (menu->prompt) { if (menu->flags & MN_BORDER) { put_cstr(menu->boundary.col+2, loc->row + loc->page_rows, menu->prompt, loc->width); } else { put_cstr(menu->boundary.col, loc->row + loc->page_rows, menu->prompt, loc->width); } } if (menu->browse_hook && oid >= 0) menu->browse_hook(oid, menu->menu_data, loc); menu->skin->display_list(menu, menu->cursor, &menu->top, loc); }
/** * Run the spell menu to select a spell. */ static int spell_menu_select(struct menu *m, const char *noun, const char *verb) { struct spell_menu_data *d = menu_priv(m); char buf[80]; screen_save(); region_erase_bordered(&m->active); /* Format, capitalise and display */ strnfmt(buf, sizeof buf, "%s which %s? ('?' to toggle description)", verb, noun); my_strcap(buf); prt(buf, 0, 0); menu_select(m, 0, TRUE); screen_load(); return d->selected_spell; }
/** * Display the options main menu. */ void do_cmd_options(void) { if (!option_menu) { /* Main option menu */ option_menu = menu_new_action(option_actions, N_ELEMENTS(option_actions)); option_menu->title = "Options Menu"; option_menu->flags = MN_CASELESS_TAGS; } screen_save(); clear_from(0); menu_layout(option_menu, &SCREEN_REGION); menu_select(option_menu, 0, false); screen_load(); }
/* * Display and handle the main squelching menu. */ void do_cmd_options_item(const char *title, int row) { menu_type menu; menu_init(&menu, MN_SKIN_SCROLL, &options_item_iter); menu_setpriv(&menu, N_ELEMENTS(sval_dependent) + N_ELEMENTS(extra_item_options) + 1, null); menu.title = title; menu_layout(&menu, &SCREEN_REGION); screen_save(); clear_from(0); menu_select(&menu, 0, false); screen_load(); p_ptr.notice |= PN_SQUELCH; return; }