本文整理汇总了C++中screen_save函数的典型用法代码示例。如果您正苦于以下问题:C++ screen_save函数的具体用法?C++ screen_save怎么用?C++ screen_save使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了screen_save函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _choose
static _slot_info_ptr _choose(cptr verb, int options)
{
_slot_info_ptr result = NULL;
int slot = 0;
int cmd;
rect_t r = _menu_rect();
string_ptr prompt = NULL;
bool done = FALSE;
bool exchange = FALSE;
int slot1 = _INVALID_SLOT, slot2 = _INVALID_SLOT;
if (REPEAT_PULL(&cmd))
{
slot = A2I(cmd);
if (0 <= slot && slot < _MAX_SLOTS)
return &_spells[slot];
}
prompt = string_alloc();
screen_save();
while (!done)
{
string_clear(prompt);
if (exchange)
{
if (slot1 == _INVALID_SLOT)
string_append_s(prompt, "Select the first spell:");
else
string_append_s(prompt, "Select the second spell:");
}
else
{
string_printf(prompt, "%s which spell", verb);
if (options & _ALLOW_EXCHANGE)
string_append_s(prompt, " [Press 'X' to Exchange]");
string_append_c(prompt, ':');
}
prt(string_buffer(prompt), 0, 0);
_display(r, options);
cmd = inkey_special(FALSE);
if (cmd == ESCAPE || cmd == 'q' || cmd == 'Q')
done = TRUE;
if (options & _ALLOW_EXCHANGE)
{
if (!exchange && (cmd == 'x' || cmd == 'X'))
{
exchange = TRUE;
slot1 = slot2 = _INVALID_SLOT;
}
}
if ('a' <= cmd && cmd < 'a' + _MAX_SLOTS)
{
slot = A2I(cmd);
if (exchange)
{
if (slot1 == _INVALID_SLOT)
slot1 = slot;
else
{
slot2 = slot;
if (slot1 != slot2)
{
_slot_info_t tmp = _spells[slot1];
_spells[slot1] = _spells[slot2];
_spells[slot2] = tmp;
}
exchange = FALSE;
slot1 = slot2 = _INVALID_SLOT;
}
}
else
{
if (_spells[slot].realm != REALM_NONE || (options & _ALLOW_EMPTY))
{
result = &_spells[slot];
done = TRUE;
}
}
}
}
if (result)
{
REPEAT_PUSH(I2A(slot));
}
screen_load();
string_free(prompt);
return result;
}
示例2: do_cmd_wiz_play
/*!
* @brief アイテム検査のメインルーチン /
* Play with an item. Options include:
* @return なし
* @details
* - Output statistics (via wiz_roll_item)<br>
* - Reroll item (via wiz_reroll_item)<br>
* - Change properties (via wiz_tweak_item)<br>
* - Change the number of items (via wiz_quantity_item)<br>
*/
static void do_cmd_wiz_play(void)
{
int item;
object_type forge;
object_type *q_ptr;
object_type *o_ptr;
char ch;
bool changed;
cptr q, s;
item_tester_no_ryoute = TRUE;
/* Get an item */
q = "Play with which object? ";
s = "You have nothing to play with.";
if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
/* Get the item (in the pack) */
if (item >= 0)
{
o_ptr = &inventory[item];
}
/* Get the item (on the floor) */
else
{
o_ptr = &o_list[0 - item];
}
/* The item was not changed */
changed = FALSE;
/* Save the screen */
screen_save();
/* Get local object */
q_ptr = &forge;
/* Copy object */
object_copy(q_ptr, o_ptr);
/* The main loop */
while (TRUE)
{
/* Display the item */
wiz_display_item(q_ptr);
/* Get choice */
if (!get_com("[a]ccept [s]tatistics [r]eroll [t]weak [q]uantity? ", &ch, FALSE))
{
changed = FALSE;
break;
}
if (ch == 'A' || ch == 'a')
{
changed = TRUE;
break;
}
if (ch == 's' || ch == 'S')
{
wiz_statistics(q_ptr);
}
if (ch == 'r' || ch == 'r')
{
wiz_reroll_item(q_ptr);
}
if (ch == 't' || ch == 'T')
{
wiz_tweak_item(q_ptr);
}
if (ch == 'q' || ch == 'Q')
{
wiz_quantity_item(q_ptr);
}
}
/* Restore the screen */
//.........这里部分代码省略.........
示例3: death_messages
/**
* Menu command: peruse pre-death messages.
*/
static void death_messages(const char *title, int row)
{
screen_save();
do_cmd_messages();
screen_load();
}
示例4: get_item
//.........这里部分代码省略.........
if ((p_ptr->command_wrk == USE_EQUIP) && allow_equip)
p_ptr->command_wrk = USE_EQUIP;
else if ((p_ptr->command_wrk == USE_INVEN) && allow_inven)
p_ptr->command_wrk = USE_INVEN;
else if ((p_ptr->command_wrk == USE_FLOOR) && allow_floor)
p_ptr->command_wrk = USE_FLOOR;
/* If we are using the quiver then start on equipment */
else if (use_quiver && allow_equip)
p_ptr->command_wrk = USE_EQUIP;
/* Use inventory if allowed */
else if (use_inven && allow_inven)
p_ptr->command_wrk = USE_INVEN;
/* Use equipment if allowed */
else if (use_equip && allow_equip)
p_ptr->command_wrk = USE_EQUIP;
/* Use floor if allowed */
else if (use_floor && allow_floor)
p_ptr->command_wrk = USE_FLOOR;
/* Hack -- Use (empty) inventory */
else
p_ptr->command_wrk = USE_INVEN;
}
/* Start out in "display" mode */
if (show_list)
{
/* Save screen */
screen_save();
}
/* Repeat until done */
while (!done)
{
int ni = 0;
int ne = 0;
/* Scan windows */
for (j = 0; j < ANGBAND_TERM_MAX; j++)
{
/* Unused */
if (!angband_term[j]) continue;
/* Count windows displaying inven */
if (op_ptr->window_flag[j] & (PW_INVEN)) ni++;
/* Count windows displaying equip */
if (op_ptr->window_flag[j] & (PW_EQUIP)) ne++;
}
/* Toggle if needed */
if (((p_ptr->command_wrk == USE_EQUIP) && ni && !ne) ||
((p_ptr->command_wrk == USE_INVEN) && !ni && ne))
{
/* Toggle */
toggle_inven_equip();
/* Track toggles */
toggle = !toggle;
}
示例5: py_pickup
//.........这里部分代码省略.........
if (!can_pickup)
p = "have no room for";
else if (blind)
p = "feel";
/* Get the object */
o_ptr = &o_list[floor_o_idx];
/* Describe the object. Less detail if blind. */
if (blind)
object_desc(o_name, sizeof(o_name), o_ptr,
ODESC_PREFIX | ODESC_BASE);
else
object_desc(o_name, sizeof(o_name), o_ptr,
ODESC_PREFIX | ODESC_FULL);
/* Message */
message_flush();
msg("You %s %s.", p, o_name);
} else {
/* Display more information about floor items */
ui_event e;
if (!can_pickup)
p = "have no room for the following objects";
else if (blind)
p = "feel something on the floor";
/* Scan all marked objects in the grid */
floor_num =
scan_floor(floor_list, N_ELEMENTS(floor_list), y, x, 0x03);
/* Save screen */
screen_save();
/* Display objects on the floor */
show_floor(floor_list, floor_num, (OLIST_WEIGHT));
/* Display prompt */
prt(format("You %s: ", p), 0, 0);
/* Wait for it. Use key as next command. */
e = inkey_ex();
Term_event_push(&e);
/* Restore screen */
screen_load();
}
/* Done */
return (objs_picked_up);
}
/* We can pick up objects. Menus are not requested (yet). */
if (pickup == 1) {
/* Scan floor (again) */
floor_num =
scan_floor(floor_list, N_ELEMENTS(floor_list), y, x, 0x03);
/* Use a menu interface for multiple objects, or get single objects */
if (floor_num > 1)
pickup = 2;
else
this_o_idx = floor_o_idx;
}
示例6: do_cmd_options_win
/*
* Modify the "window" options
*/
static void do_cmd_options_win(const char *name, int row)
{
int i, j, d;
int y = 0;
int x = 0;
ui_event ke;
u32b new_flags[ANGBAND_TERM_MAX];
/* Set new flags to the old values */
for (j = 0; j < ANGBAND_TERM_MAX; j++)
{
new_flags[j] = op_ptr.window_flag[j];
}
/* Clear screen */
screen_save();
clear_from(0);
/* Interact */
while (1)
{
/* Prompt */
prt("Window flags (<dir> to move, 't'/Enter to toggle, or ESC)", 0, 0);
/* Display the windows */
for (j = 0; j < ANGBAND_TERM_MAX; j++)
{
byte a = TERM_WHITE;
const char *s = angband_term_name[j];
/* Use color */
if (j == x) a = TERM_L_BLUE;
/* Window name, staggered, centered */
Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
}
/* Display the options */
for (i = 0; i < PW_MAX_FLAGS; i++)
{
byte a = TERM_WHITE;
const char *str = window_flag_desc[i];
/* Use color */
if (i == y) a = TERM_L_BLUE;
/* Unused option */
if (!str) str = "(Unused option)";
/* Flag name */
Term_putstr(0, i + 5, -1, a, str);
/* Display the windows */
for (j = 0; j < ANGBAND_TERM_MAX; j++)
{
char c = '.';
a = TERM_WHITE;
/* Use color */
if ((i == y) && (j == x)) a = TERM_L_BLUE;
/* Active flag */
if (new_flags[j] & (1L << i)) c = 'X';
/* Flag value */
Term_putch(35 + j * 5, i + 5, a, c);
}
}
/* Place Cursor */
Term_gotoxy(35 + x * 5, y + 5);
/* Get key */
ke = inkey_ex();
/* Mouse interaction */
if (ke.type == EVT_MOUSE)
{
int choicey = ke.mouse.y - 5;
int choicex = (ke.mouse.x - 35)/5;
if ((choicey >= 0) && (choicey < PW_MAX_FLAGS)
&& (choicex > 0) && (choicex < ANGBAND_TERM_MAX)
&& !(ke.mouse.x % 5))
{
y = choicey;
x = (ke.mouse.x - 35)/5;
}
}
//.........这里部分代码省略.........
示例7: get_class_power
//.........这里部分代码省略.........
flag = FALSE;
/* No redraw yet */
redraw = FALSE;
for (i = 0; i < MAX_CLASS_POWERS; i++)
{
if (mind_ptr->info[i].min_lev <= plev)
{
num++;
}
}
/* Build a prompt (accept all spells) */
(void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
p, I2A(0), I2A(num - 1), p);
/* Get a spell from the user */
while (!flag && get_com(out_val, &choice))
{
/* Request redraw */
if ((choice == ' ') || (choice == '*') || (choice == '?'))
{
/* Show the list */
if (!redraw)
{
char psi_desc[80];
/* Show list */
redraw = TRUE;
/* Save the screen */
screen_save();
prt("", y, x);
put_str("Name", y, x + 5);
put_str(format("Lv MP Fail Info"), y, x + 35);
/* Dump the spells */
for (i = 0; i < MAX_CLASS_POWERS; i++)
{
/* Access the spell */
spell = mind_ptr->info[i];
if (spell.min_lev > plev) break;
chance = spell.fail;
/* Reduce failure rate by "effective" level adjustment */
chance -= 3 * (plev - spell.min_lev);
/* Reduce failure rate by INT/WIS adjustment */
chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[cp_ptr->spell_stat]] - 1);
/* Not enough mana to cast */
if (spell.mana_cost > p_ptr->csp)
{
chance += 5 * (spell.mana_cost - p_ptr->csp);
}
/* Extract the minimum failure rate */
minfail = adj_mag_fail[p_ptr->stat_ind[cp_ptr->spell_stat]];
示例8: do_cmd_query_symbol
//.........这里部分代码省略.........
FREE(who);
return;
}
/* Sort if needed */
if (why)
{
/* Select the sort method */
ang_sort_comp = ang_sort_comp_hook;
ang_sort_swap = ang_sort_swap_hook;
/* Sort the array */
ang_sort(who, &why, n);
}
/* Start at the end */
i = n - 1;
/* Scan the monster memory */
while (1)
{
/* Extract a race */
r_idx = who[i];
/* Hack -- Auto-recall */
monster_race_track(r_idx);
/* Hack -- Handle stuff */
handle_stuff();
/* Hack -- Begin the prompt */
roff_top(r_idx);
/* Hack -- Complete the prompt */
Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]");
/* Interact */
while (1)
{
/* Recall */
if (recall)
{
/* Save screen */
screen_save();
/* Recall on screen */
screen_roff(who[i]);
/* Hack -- Complete the prompt (again) */
Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]");
}
/* Command */
query = inkey();
/* Unrecall */
if (recall)
{
/* Load screen */
screen_load();
}
/* Normal commands */
if (query != 'r') break;
/* Toggle recall */
recall = !recall;
}
/* Stop scanning */
if (query == ESCAPE) break;
/* Move to "prev" monster */
if (query == '-')
{
if (++i == n)
{
i = 0;
}
}
/* Move to "next" monster */
else
{
if (i-- == 0)
{
i = n - 1;
}
}
}
/* Re-display the identity */
prt(buf, 0, 0);
/* Free the "who" array */
FREE(who);
}
示例9: do_cmd_debug
//.........这里部分代码省略.........
do_cmd_wiz_look();
break;
}
/* Magic Mapping */
case 'm':
{
map_area();
break;
}
/* Summon Named Monster */
case 'n':
{
char prompt[80];
char buf[80];
sprintf(prompt, "%s", "Index: ");
sprintf(buf, "%d", 0);
if(term_get_string(prompt, buf, 0))
do_cmd_wiz_named(atoi(buf), TRUE);
break;
}
/* Object playing routines */
case 'o':
{
do_cmd_wiz_play();
break;
}
/* Debug Options */
case 'O':
{
screen_save();
do_cmd_options_aux(6, "Debug Options");
screen_load();
break;
}
/* Phase Door */
case 'p':
{
teleport_player(10);
break;
}
/* Query the dungeon */
case 'q':
{
do_cmd_wiz_query();
break;
}
/* Summon Random Monster(s) */
case 's':
{
if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1;
do_cmd_wiz_summon(p_ptr->command_arg);
break;
}
/* Teleport */
case 't':
{
teleport_player(100);
break;
示例10: textui_cmd_ignore_menu
void textui_cmd_ignore_menu(struct object *obj)
{
char out_val[160];
struct menu *m;
region r;
int selected;
byte value;
int type;
if (!obj)
return;
m = menu_dynamic_new();
m->selections = lower_case;
/* Basic ignore option */
if (!(obj->known->notice & OBJ_NOTICE_IGNORE)) {
menu_dynamic_add(m, "This item only", IGNORE_THIS_ITEM);
} else {
menu_dynamic_add(m, "Unignore this item", UNIGNORE_THIS_ITEM);
}
/* Flavour-aware ignore */
if (ignore_tval(obj->tval) &&
(!obj->artifact || !object_flavor_is_aware(obj))) {
bool ignored = kind_is_ignored_aware(obj->kind) ||
kind_is_ignored_unaware(obj->kind);
char tmp[70];
object_desc(tmp, sizeof(tmp), obj,
ODESC_NOEGO | ODESC_BASE | ODESC_PLURAL);
if (!ignored) {
strnfmt(out_val, sizeof out_val, "All %s", tmp);
menu_dynamic_add(m, out_val, IGNORE_THIS_FLAVOR);
} else {
strnfmt(out_val, sizeof out_val, "Unignore all %s", tmp);
menu_dynamic_add(m, out_val, UNIGNORE_THIS_FLAVOR);
}
}
/* Ego ignoring */
if (obj->known->ego) {
struct ego_desc choice;
struct ego_item *ego = obj->ego;
char tmp[80] = "";
choice.e_idx = ego->eidx;
choice.itype = ignore_type_of(obj);
choice.short_name = "";
(void) ego_item_name(tmp, sizeof(tmp), &choice);
if (!ego_is_ignored(choice.e_idx, choice.itype)) {
strnfmt(out_val, sizeof out_val, "All %s", tmp + 4);
menu_dynamic_add(m, out_val, IGNORE_THIS_EGO);
} else {
strnfmt(out_val, sizeof out_val, "Unignore all %s", tmp + 4);
menu_dynamic_add(m, out_val, UNIGNORE_THIS_EGO);
}
}
/* Quality ignoring */
value = ignore_level_of(obj);
type = ignore_type_of(obj);
if (tval_is_jewelry(obj) && ignore_level_of(obj) != IGNORE_BAD)
value = IGNORE_MAX;
if (value != IGNORE_MAX && type != ITYPE_MAX) {
strnfmt(out_val, sizeof out_val, "All %s %s",
quality_values[value].name, ignore_name_for_type(type));
menu_dynamic_add(m, out_val, IGNORE_THIS_QUALITY);
}
/* Work out display region */
r.width = menu_dynamic_longest_entry(m) + 3 + 2; /* +3 for tag, 2 for pad */
r.col = 80 - r.width;
r.row = 1;
r.page_rows = m->count;
screen_save();
menu_layout(m, &r);
region_erase_bordered(&r);
prt("(Enter to select, ESC) Ignore:", 0, 0);
selected = menu_dynamic_select(m);
screen_load();
if (selected == IGNORE_THIS_ITEM) {
obj->known->notice |= OBJ_NOTICE_IGNORE;
} else if (selected == UNIGNORE_THIS_ITEM) {
obj->known->notice &= ~(OBJ_NOTICE_IGNORE);
} else if (selected == IGNORE_THIS_FLAVOR) {
object_ignore_flavor_of(obj);
} else if (selected == UNIGNORE_THIS_FLAVOR) {
kind_ignore_clear(obj->kind);
} else if (selected == IGNORE_THIS_EGO) {
ego_ignore(obj);
} else if (selected == UNIGNORE_THIS_EGO) {
//.........这里部分代码省略.........
示例11: do_cmd_debug
/*
* Ask for and parse a "debug command"
*
* The "p_ptr->command_arg" may have been set.
*/
void do_cmd_debug(void)
{
int py = p_ptr->py;
int px = p_ptr->px;
struct keypress cmd;
const monster_race *r_ptr;
/* Get a "debug command" */
if (!get_com("Debug Command: ", &cmd)) return;
/* Analyze the command */
switch (cmd.code)
{
/* Ignore */
case ESCAPE:
case ' ':
case KC_ENTER:
{
break;
}
#ifdef ALLOW_SPOILERS
/* Hack -- Generate Spoilers */
case '"':
{
do_cmd_spoilers();
break;
}
#endif
/* Hack -- Help */
case '?':
{
do_cmd_wiz_help();
break;
}
/* Cure all maladies */
case 'a':
{
do_cmd_wiz_cure_all();
break;
}
/* Make the player powerful */
case 'A':
{
do_cmd_wiz_advance();
break;
}
/* Teleport to target */
case 'b':
{
do_cmd_wiz_bamf();
break;
}
/* Create any object */
case 'c':
{
wiz_create_item();
break;
}
/* Create an artifact */
case 'C':
{
if (p_ptr->command_arg > 0)
{
wiz_create_artifact(p_ptr->command_arg);
}
else
{
char name[80] = "";
int a_idx = -1;
/* Avoid the prompt getting in the way */
screen_save();
/* Prompt */
prt("Create which artifact? ", 0, 0);
/* Get the name */
if (askfor_aux(name, sizeof(name), NULL))
{
/* See if an a_idx was entered */
a_idx = get_idx_from_name(name);
//.........这里部分代码省略.........
示例12: textui_get_item
//.........这里部分代码省略.........
int ne = 0;
/* If inven or equip is on the main screen, and only one of them
* is slated for a subwindow, we should show the opposite there */
for (j = 0; j < ANGBAND_TERM_MAX; j++) {
/* Unused */
if (!angband_term[j]) continue;
/* Count windows displaying inven */
if (window_flag[j] & (PW_INVEN)) ni++;
/* Count windows displaying equip */
if (window_flag[j] & (PW_EQUIP)) ne++;
}
/* Are we in the situation where toggling makes sense? */
if ((ni && !ne) || (!ni && ne)) {
if (player->upkeep->command_wrk == USE_EQUIP) {
if ((ne && !toggle) || (ni && toggle)) {
/* Main screen is equipment, so is subwindow */
toggle_inven_equip();
toggle = !toggle;
}
} else if (player->upkeep->command_wrk == USE_INVEN) {
if ((ni && !toggle) || (ne && toggle)) {
/* Main screen is inventory, so is subwindow */
toggle_inven_equip();
toggle = !toggle;
}
} else {
/* Quiver or floor, go back to the original */
if (toggle) {
toggle_inven_equip();
toggle = !toggle;
}
}
}
/* Redraw */
player->upkeep->redraw |= (PR_INVEN | PR_EQUIP);
/* Redraw windows */
redraw_stuff(player);
/* Save screen */
screen_save();
/* Build object list */
wipe_obj_list();
if (player->upkeep->command_wrk == USE_INVEN)
build_obj_list(i2, player->upkeep->inven, tester_m, olist_mode);
else if (player->upkeep->command_wrk == USE_EQUIP)
build_obj_list(e2, NULL, tester_m, olist_mode);
else if (player->upkeep->command_wrk == USE_QUIVER)
build_obj_list(q2, player->upkeep->quiver, tester_m,olist_mode);
else if (player->upkeep->command_wrk == USE_FLOOR)
build_obj_list(f2, floor_list, tester_m, olist_mode);
/* Show the prompt */
menu_header();
if (pmt) {
prt(pmt, 0, 0);
prt(header, 0, strlen(pmt) + 1);
}
/* No menu change request */
newmenu = false;
/* Get an item choice */
*choice = item_menu(cmd, MAX(pmt ? strlen(pmt) : 0, 15), mode);
/* Fix the screen */
screen_load();
/* Update */
player->upkeep->redraw |= (PR_INVEN | PR_EQUIP);
redraw_stuff(player);
/* Clear the prompt line */
prt("", 0, 0);
/* We have a selection, or are backing out */
if (*choice || !newmenu) {
if (toggle) toggle_inven_equip();
break;
}
}
} else {
/* Warning if needed */
if (str) msg("%s", str);
*choice = NULL;
}
/* Clean up */
player->upkeep->command_wrk = 0;
mem_free(floor_list);
/* Result */
return (*choice != NULL) ? true : false;
}
示例13: wiz_create_item_action
bool wiz_create_item_action(menu_type * m, const ui_event * e, int oid)
{
ui_event ret;
menu_type *menu;
int choice[60];
int n_choices;
int i;
char buf[60];
if (e->type != EVT_SELECT)
return TRUE;
/* Artifacts */
if (choose_artifact) {
struct tval_desc *a_tvals = menu_priv(m);
/* ...We have to search the whole artifact list. */
for (n_choices = 0, i = 1; (n_choices < 60) && (i < z_info->a_max);
i++) {
artifact_type *a_ptr = &a_info[i];
/* Analyze matching items */
if (a_ptr->tval == a_tvals[oid].tval) {
/* Remember the artifact index */
choice[n_choices++] = i;
}
}
}
/* Regular objects */
else {
for (n_choices = 0, i = 1; (n_choices < 60) && (i < z_info->k_max);
i++) {
object_kind *kind = &k_info[i];
if (kind->tval != tvals[oid].tval ||
kf_has(kind->flags_kind, KF_INSTA_ART))
continue;
choice[n_choices++] = i;
}
}
screen_save();
clear_from(0);
menu = menu_new(MN_SKIN_COLUMNS, &wiz_create_item_submenu);
menu->selections = all_letters;
if (m->count == N_ELEMENTS(tvals))
strnfmt(buf, sizeof(buf), "What kind of %s?", tvals[oid].desc);
else
strnfmt(buf, sizeof(buf), "Which artifact %s? ", tvals[oid].desc);
menu->title = buf;
menu_setpriv(menu, n_choices, choice);
menu_layout(menu, &wiz_create_item_area);
ret = menu_select(menu, 0, FALSE);
screen_load();
return (ret.type == EVT_ESCAPE);
}
示例14: do_cmd_wiz_play
/**
* Play with an item. Options include:
* - Output statistics (via wiz_roll_item)
* - Reroll item (via wiz_reroll_item)
* - Change properties (via wiz_tweak_item)
* - Change the number of items (via wiz_quantity_item)
*/
static void do_cmd_wiz_play(void)
{
int item;
object_type *i_ptr;
object_type object_type_body;
object_type *o_ptr;
struct keypress ch;
const char *q, *s;
bool changed;
/* Get an item */
q = "Play with which object? ";
s = "You have nothing to play with.";
if (!get_item(&item, q, s, 0, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
return;
/* Get the item (in the pack) */
if (item >= 0) {
o_ptr = &p_ptr->inventory[item];
}
/* Get the item (on the floor) */
else {
o_ptr = &o_list[0 - item];
}
/* The item was not changed */
changed = FALSE;
/* Save screen */
screen_save();
/* Get local object */
i_ptr = &object_type_body;
/* Copy object */
object_copy(i_ptr, o_ptr);
/* The main loop */
while (TRUE) {
/* Display the item */
wiz_display_item(i_ptr);
/* Get choice */
if (!get_com
("[a]ccept [s]tatistics [r]eroll [t]weak [q]uantity? ", &ch)) {
changed = FALSE;
break;
}
if (ch.code == 'A' || ch.code == 'a') {
changed = TRUE;
break;
}
if (ch.code == 's' || ch.code == 'S') {
wiz_statistics(i_ptr);
}
if (ch.code == 'r' || ch.code == 'R') {
wiz_reroll_item(i_ptr);
}
if (ch.code == 't' || ch.code == 'T') {
wiz_tweak_item(i_ptr);
}
if (ch.code == 'q' || ch.code == 'Q') {
wiz_quantity_item(i_ptr);
}
}
/* Load screen */
screen_load();
/* Accept change */
if (changed) {
/* Message */
msg("Changes accepted.");
/* Change */
//.........这里部分代码省略.........
示例15: do_cmd_wiz_play
/*
* Play with an item. Options include:
* - Output statistics (via wiz_roll_item)
* - Reroll item (via wiz_reroll_item)
* - Change properties (via wiz_tweak_item)
* - Change the number of items (via wiz_quantity_item)
*/
static void do_cmd_wiz_play(void)
{
int item;
object_type *i_ptr;
object_type object_type_body;
object_type *o_ptr;
char ch;
cptr q, s;
bool changed = FALSE;
bool all = TRUE;
/* Get an item */
q = "Play with which object? ";
s = "You have nothing to play with.";
if (!get_item(&item, q, s, 0, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
o_ptr = object_from_item_idx(item);
/* Save screen */
screen_save();
/* Get local object */
i_ptr = &object_type_body;
/* Copy object */
object_copy(i_ptr, o_ptr);
/* The main loop */
while (TRUE)
{
/* Display the item */
wiz_display_item(i_ptr, all);
/* Get choice */
if (!get_com("[a]ccept [s]tatistics [r]eroll [t]weak [c]urse [q]uantity [k]nown? ", &ch))
break;
if (ch == 'A' || ch == 'a')
{
changed = TRUE;
break;
}
else if (ch == 'c' || ch == 'C')
wiz_tweak_curse(i_ptr);
else if (ch == 's' || ch == 'S')
wiz_statistics(i_ptr, p_ptr->depth);
else if (ch == 'r' || ch == 'r')
wiz_reroll_item(i_ptr);
else if (ch == 't' || ch == 'T')
wiz_tweak_item(i_ptr);
else if (ch == 'k' || ch == 'K')
all = !all;
else if (ch == 'q' || ch == 'Q')
{
bool carried = (item >= 0) ? TRUE : FALSE;
wiz_quantity_item(i_ptr, carried);
}
}
/* Load screen */
screen_load();
/* Accept change */
if (changed)
{
/* Message */
msg_print("Changes accepted.");
/* Change */
object_copy(o_ptr, i_ptr);
/* Recalculate bonuses */
p_ptr->update |= (PU_BONUS);
/* Combine / Reorder the pack (later) */
p_ptr->notice |= (PN_COMBINE | PN_REORDER);
/* Window stuff */
p_ptr->redraw |= (PR_INVEN | PR_EQUIP );
}
/* Ignore change */
else
//.........这里部分代码省略.........