/* pick the context menu options appropiate for the item */ int context_menu_object(const object_type *o_ptr) { menu_type *m; rect_region r; int selected; int location = 0; char *labels; char header[120]; s16b *list; m = menu_dynamic_new(); if (!m || !o_ptr) { return 0; } object_desc(header, o_ptr, TRUE, 2, sizeof(header)); list = look_up_list((object_type*)o_ptr); if (list) { if (list == &(p_ptr->inventory)) { location = USE_INVEN; } else if (list == &(area(p_ptr->px, p_ptr->py)->o_idx)) { location = USE_FLOOR; } else { /* check if in a container */ location = USE_INVEN; } } else if (GET_ARRAY_INDEX(p_ptr->equipment, o_ptr) >= EQUIP_WIELD) { location = USE_EQUIP; } labels = (char*)string_make(lower_case); m->selections = labels; menu_dynamic_add_label(m, "Inspect", 'I', 1, labels); if (item_tester_hook_is_book(o_ptr)) { if (player_can_cast_from(o_ptr)) { if (player_can_cast()) { menu_dynamic_add_label(m, "Cast", 'm', 8, labels); } else { menu_dynamic_add_label(m, "$Cast", 'm', 8, labels); } if (player_can_study()) { menu_dynamic_add_label(m, "Study", 'G', 10, labels); } else { menu_dynamic_add_label(m, "$Study", 'G', 10, labels); } } if (player_is_caster() && player_can_read()) { menu_dynamic_add_label(m, "Browse", 'b', 9, labels); } } else if (item_tester_hook_useable(o_ptr)) { if (obj_is_wand(o_ptr)) { if (obj_has_charges(o_ptr)) { menu_dynamic_add_label(m, "Aim", 'a', 8, labels); } else { menu_dynamic_add_label(m, "$Aim", 'a', 8, labels); } } else if (obj_is_rod(o_ptr)) { if (obj_can_zap(o_ptr)) { menu_dynamic_add_label(m, "Zap", 'z', 8, labels); } else { menu_dynamic_add_label(m, "$Zap", 'z', 8, labels); } } else if (obj_is_staff(o_ptr)) { if (obj_has_charges(o_ptr)) { menu_dynamic_add_label(m, "Use", 'u', 8, labels); } else { menu_dynamic_add_label(m, "$Use", 'u', 8, labels); } } else if (obj_is_scroll(o_ptr)) { if (player_can_read()) { menu_dynamic_add_label(m, "Read", 'r', 8, labels); } else { menu_dynamic_add_label(m, "$Read", 'r', 8, labels); } } else if (obj_is_potion(o_ptr)) { menu_dynamic_add_label(m, "Quaff", 'q', 8, labels); } else if (obj_is_food(o_ptr)) { menu_dynamic_add_label(m, "Eat", 'E', 8, labels); } else if (item_tester_hook_activate(o_ptr)) { if (obj_is_activatable(o_ptr)) { menu_dynamic_add_label(m, "Activate", 'A', 8, labels); } else { menu_dynamic_add_label(m, "$Activate", 'A', 8, labels); } } else { menu_dynamic_add_label(m, "Use", 'U', 8, labels); } } else if (item_tester_hook_ammo(o_ptr)) { if (obj_can_fire(o_ptr)) { menu_dynamic_add_label(m, "Fire", 'f', 15, labels); } else { menu_dynamic_add_label(m, "$Fire", 'f', 15, labels); } } if (obj_can_refill(o_ptr)) { menu_dynamic_add_label(m, "Refill", 'F', 11, labels); } if (item_tester_hook_wear(o_ptr)) { if (location == USE_EQUIP) { menu_dynamic_add_label(m, "Take off", 't', 3, labels); } else if (location == USE_INVEN) { if (item_tester_hook_armour(o_ptr)) { menu_dynamic_add_label(m, "Wear", 'w', 2, labels); } else { menu_dynamic_add_label(m, "Wield", 'w', 2, labels); } /*menu_dynamic_add_label(m, "Equip", 'w', 2, labels);*/ } } if ((location == USE_INVEN) || (location == USE_EQUIP)) { menu_dynamic_add_label(m, "Drop", 'd', 6, labels); if (o_ptr->number > 1) { menu_dynamic_add_label(m, "Drop All", 'd', 13, labels); } } else if (location == USE_FLOOR) { if (inven_carry_okay(o_ptr)) { menu_dynamic_add_label(m, "Pickup", 'g', 7, labels); } else { menu_dynamic_add_label(m, "$Pickup", 'g', 7, labels); } } menu_dynamic_add_label(m, "Throw", 'v', 12, labels); /*if (obj_has_inscrip(o_ptr)) {*/ if (o_ptr->inscription) { menu_dynamic_add_label(m, "Uninscribe", '}', 5, labels); } else { menu_dynamic_add_label(m, "Inscribe", '{', 4, labels); } menu_dynamic_add_label(m, "Destroy", 'k', 14, labels); #if 0 if (object_is_squelched(o_ptr)) { menu_dynamic_add_label(m, "Unignore", 'k', 14, labels); } else { menu_dynamic_add_label(m, "Ignore", 'k', 14, labels); } #endif /* work out display region */ r.width = menu_dynamic_longest_entry(m) + 3 + 2; /* +3 for tag, 2 for pad */ r.col = Term->wid - r.width - 1; r.row = 1; r.page_rows = m->count; /* Hack -- no flush needed */ msg_flag = FALSE; screen_save(); button_backup_all(TRUE); /* Recall object */ roff_set_width(r.col); roff_obj_aux(o_ptr); roff_set_width(0); menu_layout(m, &r); rect_region_erase_bordered(&r); prtf(0, 0, "($UEnter to select$Y\n$V, $UESC$Y%c$V) Command for %s:", ESCAPE, header); selected = menu_dynamic_select(m); menu_dynamic_free(m); string_free(labels); button_restore(); screen_load(); if (selected == 1) { /* inspect it */ identify_fully_aux(o_ptr); return 2; } else if (selected == 2) { /* wield the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'w'; do_cmd_wield(); /*cmd_insert(CMD_WIELD); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 3) { /* take the item off */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 't'; do_cmd_takeoff(); /*cmd_insert(CMD_TAKEOFF); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 4) { /* inscribe the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = '{'; do_cmd_inscribe(); /*cmd_insert(CMD_INSCRIBE); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 5) { /* uninscribe the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = '}'; do_cmd_uninscribe(); /*cmd_insert(CMD_UNINSCRIBE); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 6) { /* drop the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'd'; do_cmd_drop(); /*cmd_insert(CMD_DROP); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 7) { /* pick the item up */ p_ptr->cmd.cmd = 'g'; if (inven_carry_okay(o_ptr)) { py_pickup_aux((object_type*)o_ptr); } else { carry(TRUE); } /*cmd_insert(CMD_PICKUP); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 8) { /* use the item */ bool full = item_tester_full; item_tester_full = FALSE; if (player_can_cast_from(o_ptr)) { set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'm'; do_cmd_cast(); } else { set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'u'; repeat_check(); do_cmd_use(); /*cmd_insert(CMD_USE_ANY); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } item_tester_full = full; } else if (selected == 9) { /* browse a spellbook */ p_ptr->cmd.cmd = 'b'; do_cmd_browse_aux(o_ptr); /* copied from textui_spell_browse */ /*textui_book_browse(o_ptr);*/ return 2; } else if (selected == 10) { /* study a spell book */ p_ptr->cmd.cmd = 'G'; do_cmd_study(FALSE, (object_type*)o_ptr); } else if (selected == 11) { /* use the item to refill a light source */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'F'; do_cmd_refill(); /*cmd_insert(CMD_REFILL); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 12) { /* throw the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'v'; repeat_check(); do_cmd_throw(); /*cmd_insert(CMD_THROW); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 13) { /* drop all of the item stack */ if (get_check(format("Drop %s? ", header))) { set_get_item_object(o_ptr); p_ptr->cmd.arg = o_ptr->number; p_ptr->cmd.cmd = 'd'; do_cmd_drop(); /*cmd_insert(CMD_DROP); cmd_set_arg_item(cmd_get_top(), 0, slot); cmd_set_arg_number(cmd_get_top(), 1, o_ptr->number);*/ } } else if (selected == 14) { /* squelch or unsquelch the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'k'; do_cmd_destroy(); /*textui_cmd_destroy_menu(slot);*/ } else if (selected == 15) { /* fire some ammo */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'f'; repeat_check(); do_cmd_fire(); } else if (selected == -1) { /* this menu was canceled, tell whatever called us to display its menu again */ return 3; } return 1; }
int context_menu_cave(int cy, int cx, int adjacent, int mx, int my) { menu_type *m; rect_region r; int selected; char *labels; cave_type *c_ptr = area(cx,cy); pcave_type *pc_ptr = parea(cx,cy); feature_type *feat; object_type *o_ptr; /* paranoia */ if (!in_boundsp(cx,cy)) return 0; m = menu_dynamic_new(); if (!m) { return 0; } labels = (char*)string_make(lower_case); m->selections = labels; feat = &(f_info[c_ptr->feat]); menu_dynamic_add_label(m, "Look At", 'l', 1, labels); if (c_ptr->m_idx) { menu_dynamic_add_label(m, "Recall Info", '/', 18, labels); } menu_dynamic_add_label(m, "Use Item On", 'u', 2, labels); if (player_can_cast()) { menu_dynamic_add_label(m, "Cast On", 'm', 3, labels); } if (adjacent) { if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml) { menu_dynamic_add_label(m, "Attack", '+', 4, labels); } else { menu_dynamic_add_label(m, "Alter", '+', 4, labels); } if (c_ptr->o_idx) { o_ptr = chest_check(cx,cy); if (o_ptr && o_ptr->pval) { //if (!squelch_item_ok(o_ptr)) { if (object_known_p(o_ptr)) { if (chest_traps[o_ptr->pval]) { menu_dynamic_add_label(m, "Disarm Chest", 'D', 5, labels); menu_dynamic_add_label(m, "Open Chest", 'o', 8, labels); } else { menu_dynamic_add_label(m, "Open Disarmed Chest", 'o', 8, labels); } } else { menu_dynamic_add_label(m, "Open Chest", 'o', 8, labels); } //} } } if (is_visible_trap(c_ptr)) { menu_dynamic_add_label(m, "Disarm", 'D', 5, labels); menu_dynamic_add_label(m, "Jump Onto", 'W', 6, labels); } if (pc_ptr->feat) { if ((feat->flags & FF_CLOSEABLE) || ((feat->flags & FF_BROKEN) && (feat->flags & FF_DOOR))) { menu_dynamic_add_label(m, "Close", 'c', 7, labels); } if (feat->flags & FF_CLOSED) { menu_dynamic_add_label(m, "Open", 'o', 8, labels); menu_dynamic_add_label(m, "Bash Open", 'B', 9, labels); menu_dynamic_add_label(m, "Lock", 'D', 5, labels); menu_dynamic_add_label(m, "Jam", 'j', 10, labels); } if (feat->flags & FF_DIG) { menu_dynamic_add_label(m, "Tunnel", 'T', 11, labels); } } menu_dynamic_add_label(m, "Search", 's', 12, labels); menu_dynamic_add_label(m, "Walk Towards", ';', 14, labels); } else { menu_dynamic_add_label(m, "Pathfind To", ',', 13, labels); menu_dynamic_add_label(m, "Walk Towards", ';', 14, labels); menu_dynamic_add_label(m, "Run Towards", '.', 15, labels); } if (player_can_fire()) { menu_dynamic_add_label(m, "Fire On", 'f', 16, labels); } if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml) { if (is_pet(&(m_list[c_ptr->m_idx]))) { menu_dynamic_add_label(m, "Pet Commands", 'p', 19, labels); } } menu_dynamic_add_label(m, "Throw To", 'v', 17, labels); /* work out display region */ r.width = menu_dynamic_longest_entry(m) + 3 + 2; /* +3 for tag, 2 for pad */ if (mx > Term->wid - r.width - 1) { r.col = Term->wid - r.width - 1; } else { r.col = mx + 1; } r.page_rows = m->count; if (my > Term->hgt - r.page_rows - 1) { if (my - r.page_rows - 1 <= 0) { /* menu has too many items, so put in upper right corner */ r.row = 1; r.col = Term->wid - r.width - 1; } else { r.row = Term->hgt - r.page_rows - 1; } } else { r.row = my + 1; } /* Hack -- no flush needed */ msg_flag = FALSE; screen_save(); button_backup_all(TRUE); /* if there is a monster, draw a target path, which will be erased by the * screen load below */ if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml) { sint path_n; coord path_g[2*MAX_RANGE+1]; /* Find the path. */ path_n = project_path(path_g, p_ptr->px, p_ptr->py, cx, cy, PROJECT_THRU); /* Draw the path. */ draw_path(path_n, path_g, NULL, NULL, p_ptr->px, p_ptr->py); } menu_layout(m, &r); rect_region_erase_bordered(&r); /* display the prompt for the context menu */ target_look_grid_prompt(0, 0, cx, cy, format("($UEnter to select command$Y\n$V, $UESC$ to cancel$Y%c$V) You see", ESCAPE)); /* Hack - redraw stuff to show the target health bar */ health_redraw(); /* show the menu and pick from it */ selected = menu_dynamic_select(m); menu_dynamic_free(m); string_free(labels); button_restore(); screen_load(); if (selected == 1) { /* look at the spot */ if (target_set_interactive(TARGET_LOOK, cx, cy)) { msgf("Target Selected."); } } else if (selected == 2) { /* use an item on the spot */ p_ptr->cmd.dir = 5; p_ptr->cmd.cmd = 'u'; repeat_check(); do_cmd_use(); /*cmd_insert(CMD_USE_AIMED); cmd_set_arg_target(cmd_get_top(), 1, DIR_TARGET);*/ } else if (selected == 3) { /* cast a spell on the spot */ p_ptr->cmd.dir = 5; p_ptr->cmd.cmd = 'm'; repeat_check(); do_cmd_cast_wrapper(); /*if (textui_obj_cast_ret() >= 0) { cmd_set_arg_target(cmd_get_top(), 1, DIR_TARGET); }*/ } else if (selected == 4) { /* attack a spot adjacent to the player */ p_ptr->cmd.dir = coords_to_dir(cx, cy); p_ptr->cmd.arg = 16; p_ptr->cmd.cmd = '+'; repeat_check(); do_cmd_alter(); /*cmd_insert(CMD_ALTER); cmd_set_arg_direction(cmd_get_top(), 0, coords_to_dir(cy,cx));*/ } else if (selected == 5) { /* disarm an adjacent trap or chest */ p_ptr->cmd.dir = coords_to_dir(cx, cy); p_ptr->cmd.arg = 1; p_ptr->cmd.cmd = 'D'; repeat_check(); do_cmd_disarm(); /*cmd_insert(CMD_DISARM); cmd_set_arg_direction(cmd_get_top(), 0, coords_to_dir(cy,cx));*/ } else if (selected == 6) { /* walk onto an adjacent spot even if there is a trap there */ bool orig_disarm = easy_disarm; easy_disarm = always_pickup; p_ptr->cmd.dir = coords_to_dir(cx, cy); p_ptr->cmd.arg = 1; p_ptr->cmd.cmd = 'W'; repeat_check(); do_cmd_walk(always_pickup); easy_disarm = orig_disarm; /*cmd_insert(CMD_JUMP); cmd_set_arg_direction(cmd_get_top(), 0, coords_to_dir(cy,cx));*/ } else if (selected == 7) { /* close a door */ p_ptr->cmd.dir = coords_to_dir(cx, cy); /*p_ptr->cmd.arg = 1;*/ p_ptr->cmd.cmd = 'c'; repeat_check(); do_cmd_close(); /*cmd_insert(CMD_CLOSE); cmd_set_arg_direction(cmd_get_top(), 0, coords_to_dir(cy,cx));*/ } else if (selected == 8) { /* open a door or chest */ p_ptr->cmd.dir = coords_to_dir(cx, cy); /*p_ptr->cmd.arg = 1;*/ p_ptr->cmd.cmd = 'o'; repeat_check(); do_cmd_open(); /*cmd_insert(CMD_OPEN); cmd_set_arg_direction(cmd_get_top(), 0, coords_to_dir(cy,cx));*/ } else if (selected == 9) { /* bash a door */ p_ptr->cmd.dir = coords_to_dir(cx, cy); /*p_ptr->cmd.arg = 1;*/ p_ptr->cmd.cmd = 'o'; repeat_check(); do_cmd_open(); /*p_ptr->cmd.cmd = 'B'; do_cmd_bash();*/ /*cmd_insert(CMD_BASH); cmd_set_arg_direction(cmd_get_top(), 0, coords_to_dir(cy,cx));*/ } else if (selected == 10) { /* jam a door */ p_ptr->cmd.dir = coords_to_dir(cx, cy); /*p_ptr->cmd.arg = 1;*/ p_ptr->cmd.cmd = 'j'; repeat_check(); do_cmd_spike(); /*cmd_insert(CMD_JAM); cmd_set_arg_direction(cmd_get_top(), 0, coords_to_dir(cy,cx));*/ } else if (selected == 11) { /* Tunnel in a direction */ p_ptr->cmd.dir = coords_to_dir(cx, cy); p_ptr->cmd.arg = 16; p_ptr->cmd.cmd = 'T'; repeat_check(); do_cmd_tunnel(); /*cmd_insert(CMD_TUNNEL); cmd_set_arg_direction(cmd_get_top(), 0, coords_to_dir(cy,cx));*/ } else if (selected == 12) { /* Search */ /*p_ptr->cmd.arg = 1;*/ p_ptr->cmd.cmd = 's'; repeat_check(); do_cmd_search(); /*cmd_insert(CMD_SEARCH);*/ } else if (selected == 13) { /* pathfind to the spot */ /*p_ptr->cmd.arg = 16;*/ p_ptr->cmd.cmd = ','; do_cmd_pathfind(cx,cy); /*cmd_insert(CMD_PATHFIND); cmd_set_arg_point(cmd_get_top(), 0, cx, cy);*/ } else if (selected == 14) { /* walk towards the spot */ p_ptr->cmd.dir = coords_to_dir(cx, cy); p_ptr->cmd.cmd = ';'; repeat_check(); do_cmd_walk(always_pickup); /*cmd_insert(CMD_WALK); cmd_set_arg_direction(cmd_get_top(), 0, coords_to_dir(cy,cx));*/ } else if (selected == 15) { /* run towards the spot */ p_ptr->cmd.dir = coords_to_dir(cx, cy); p_ptr->cmd.cmd = '.'; repeat_check(); do_cmd_run(); /*cmd_insert(CMD_RUN); cmd_set_arg_direction(cmd_get_top(), 0, coords_to_dir(cy,cx));*/ } else if (selected == 16) { /* Fire ammo towards the spot */ p_ptr->cmd.dir = 5; p_ptr->cmd.cmd = 'f'; repeat_check(); do_cmd_fire(); /*cmd_insert(CMD_FIRE); cmd_set_arg_target(cmd_get_top(), 1, DIR_TARGET);*/ } else if (selected == 17) { /* throw an item towards the spot */ p_ptr->cmd.dir = 5; p_ptr->cmd.cmd = 'v'; repeat_check(); do_cmd_throw(); /*cmd_insert(CMD_THROW); cmd_set_arg_target(cmd_get_top(), 1, DIR_TARGET);*/ } else if (selected == 18) { /* recall monster Info */ monster_type *m_ptr = &m_list[c_ptr->m_idx]; if (m_ptr) { /* Save screen */ screen_save(); button_backup_all(TRUE); /* Recall on screen */ screen_roff_mon(m_ptr->r_idx, 0); /* wait for a key or mouse press */ inkey(); /* Load screen */ button_restore(); screen_load(); } } else if (selected == 19) { /* issue a pet command */ p_ptr->cmd.cmd = 'p'; repeat_check(); do_cmd_pet(); } return 1; }
void commands_angband_keyset(int key_press, bool shift_key, bool alt_key, bool ctrl_key, bool meta_key) { bool using_mods = FALSE; if (shift_key || alt_key || ctrl_key || meta_key) using_mods = TRUE; // Normal mode switch (key_press) { // ESCAPE case Qt::Key_Escape: { ui_center(p_ptr->py, p_ptr->px); break; } // Move down case Qt::Key_2: case Qt::Key_Down: { process_move_key(2, shift_key, alt_key, ctrl_key, meta_key); break; } // Move up case Qt::Key_8: case Qt::Key_Up: { process_move_key(8, shift_key, alt_key, ctrl_key, meta_key); break; } // Move left case Qt::Key_4: case Qt::Key_Left: { process_move_key(4, shift_key, alt_key, ctrl_key, meta_key); break; } // Move right case Qt::Key_6: case Qt::Key_Right: { process_move_key(6, shift_key, alt_key, ctrl_key, meta_key); break; } // Move diagonally left and up case Qt::Key_7: case Qt::Key_Home: { process_move_key(7, shift_key, alt_key, ctrl_key, meta_key); break; } // Move diagonally right and up case Qt::Key_9: case Qt::Key_PageUp: { process_move_key(9, shift_key, alt_key, ctrl_key, meta_key); break; } // Move diagonally left and down case Qt::Key_1: case Qt::Key_End: { process_move_key(1, shift_key, alt_key, ctrl_key, meta_key); break; } // Move diagonally right and down case Qt::Key_3: case Qt::Key_PageDown: { process_move_key(3, shift_key, alt_key, ctrl_key, meta_key); break; } case Qt::Key_5: case Qt::Key_Clear: { do_cmd_hold(); break; } case Qt::Key_A: { if (alt_key) do_cmd_wizard_mode(); else if (shift_key) do_cmd_activate(); else if (!using_mods) do_cmd_aim_wand(); break; } case Qt::Key_B: { if (shift_key) do_cmd_bash(DIR_UNKNOWN); else if (!using_mods) do_cmd_browse(-1); break; } case Qt::Key_C: { if (shift_key && alt_key) save_character_file(); else if (shift_key) do_cmd_character_screen(); else if (!using_mods) do_cmd_close(DIR_UNKNOWN); break; } case Qt::Key_D: { if (shift_key) do_cmd_disarm(DIR_UNKNOWN); else if (!using_mods) do_cmd_drop(); break; } case Qt::Key_E: { if (shift_key) do_cmd_eat_food(); else if (!using_mods) do_cmd_all_objects(TAB_EQUIP); break; } case Qt::Key_F: { if (ctrl_key) do_cmd_feeling(); else if (shift_key) do_cmd_refuel(); else if (!using_mods) do_cmd_fire(); break; } case Qt::Key_G: { if (shift_key) do_cmd_study(-1); else if (!using_mods) do_cmd_pickup_from_pile(FALSE, TRUE); break; } case Qt::Key_H: { if (!using_mods) do_cmd_fire_at_nearest(); break; } case Qt::Key_I: { if (shift_key) do_cmd_examine(); else if (!using_mods) do_cmd_all_objects(TAB_INVEN); break; } case Qt::Key_J: { if (!using_mods) do_cmd_spike(DIR_UNKNOWN); break; } case Qt::Key_K: { if (!using_mods) do_cmd_destroy(); break; } case Qt::Key_L: { if (shift_key) ui_center(p_ptr->py, p_ptr->px); else if (!using_mods) do_cmd_look(); break; } case Qt::Key_M: { if (shift_key) break; // TODO - MAP else if (!using_mods) do_cmd_cast(-1); break; } case Qt::Key_N: case Qt::Key_0: case Qt::Key_Insert: { if (!using_mods) do_cmd_repeat(); break; } case Qt::Key_O: { if (shift_key) do_cmd_make_trap(DIR_UNKNOWN); else if (!using_mods) do_cmd_open(DIR_UNKNOWN); break; } case Qt::Key_P: { if (ctrl_key) display_message_log(); else if (!using_mods) do_cmd_cast(-1); break; } case Qt::Key_Q: { if (alt_key) do_cmd_quest_desc(); else if (shift_key) do_cmd_suicide(); else if (!using_mods) do_cmd_quaff_potion(); break; } case Qt::Key_R: { if (ctrl_key) ui_redraw_all(); else if (shift_key) do_cmd_rest(); else if (!using_mods) do_cmd_read_scroll(); break; } case Qt::Key_S: { if (shift_key) do_cmd_toggle_search(); else if (!using_mods) do_cmd_search(); break; } case Qt::Key_T: { if (shift_key) do_cmd_tunnel(DIR_UNKNOWN); else if (!using_mods) do_cmd_takeoff(); break; } case Qt::Key_U: { if (!using_mods) do_cmd_use_staff(); break; } case Qt::Key_V: { if (!using_mods) do_cmd_throw(); break; } case Qt::Key_W: { if (!using_mods) do_cmd_wield(); break; } case Qt::Key_X: { if (!using_mods) do_cmd_swap_weapon(); break; } case Qt::Key_Y: { break; } case Qt::Key_Z: { if (!using_mods) do_cmd_zap_rod(); break; } case Qt::Key_Apostrophe: case Qt::Key_Asterisk: { target_set_closest(TARGET_KILL); break; } case Qt::Key_BraceLeft: { do_cmd_inscribe(); break; } case Qt::Key_BraceRight: { do_cmd_uninscribe(); break; } case Qt::Key_Greater: { do_cmd_go_down(); break; } case Qt::Key_Less: { do_cmd_go_up(); break; } case Qt::Key_Period: { do_cmd_run(DIR_UNKNOWN); break; } case Qt::Key_Plus: { do_cmd_alter(DIR_UNKNOWN); break; } case Qt::Key_Minus: { do_cmd_walk(DIR_UNKNOWN, TRUE); break; } case Qt::Key_Underscore: case Qt::Key_Comma: { do_cmd_hold(); break; } case Qt::Key_Semicolon: { do_cmd_walk(DIR_UNKNOWN, FALSE); break; } case Qt::Key_Colon: { do_cmd_write_note(); break; } case Qt::Key_ParenRight: { save_screenshot(FALSE); break; } case Qt::Key_ParenLeft: { save_screenshot(TRUE); break; } case Qt::Key_AsciiTilde: { do_cmd_knowledge_screens(); break; } default: { break; } } }