From 47824cdfc7c6cba04b91336e2a91abaac8c558b8 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 24 Jan 2008 13:10:35 +0000 Subject: Add mouseclick handling for menus in tiles: L-click will page down, R-click is treated like Escape. Change L-click on player from single turn search to (the more useful, I think) pickup, and add L-click to list of alternatives to call the pickup menu, so that clicking on the player icon twice will directly open the pickup menu. This is getting complicated: there are so few combinations of mouseclicks possible, but because they do different things under different circumstances this *really* needs to be documented somehow. Fix coloured hp/mp bars not updating during running. (During travel the map needs to be redrawn anyway, so also having to redraw the bars doesn't hurt any.) Also fix list_rotten to be readable from init.txt (and default to true). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3316 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/docs/crawl_options.txt | 4 ++-- crawl-ref/init.txt | 2 +- crawl-ref/source/acr.cc | 4 ++-- crawl-ref/source/initfile.cc | 6 +++++- crawl-ref/source/items.cc | 13 ++++++++++++- crawl-ref/source/libgui.cc | 25 +++++++++++++++++-------- crawl-ref/source/menu.cc | 6 ++++++ crawl-ref/source/output.cc | 2 +- crawl-ref/wininit.txt | 4 ++-- 9 files changed, 48 insertions(+), 18 deletions(-) diff --git a/crawl-ref/docs/crawl_options.txt b/crawl-ref/docs/crawl_options.txt index f6db0d72d0..51f2eb8742 100644 --- a/crawl-ref/docs/crawl_options.txt +++ b/crawl-ref/docs/crawl_options.txt @@ -75,7 +75,7 @@ The contents of this text are: tile_monster_col, tile_friendly_col, tile_item_col, tile_unseen_col, tile_floor_col, tile_wall_col, tile_mapped_wall_col, tile_door_col, tile_downstairs_col, - tile_upstairs_col, tile_spec_feature_col, tile_trap_col, + tile_upstairs_col, tile_feature_col, tile_trap_col, tile_water_col, tile_lava_col, tile_excluded_col 5- Character Dump. 5-a Items and Kills. @@ -1005,7 +1005,7 @@ item_stack_summary_minimum = 5 items will be in white, unless you already know that they are not ego items. -list_rotten = false +list_rotten = true Setting this to true will print a list of inventory slots for all corpses and chunks that have become rotten along with the rotting message, in the form of diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt index 82ed0db105..6c0cfd8398 100644 --- a/crawl-ref/init.txt +++ b/crawl-ref/init.txt @@ -176,7 +176,7 @@ stab_brand = hi:blue # show_turns = true # show_beam = true # item_stack_summary_minimum = 5 -# list_rotten = true +# list_rotten = false # Colouring for the inventory menu_colour = inventory:lightred: cursed.*(worn|neck|hand|weapon)\) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 1aeb3e30e1..bad82f21bd 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3339,9 +3339,9 @@ keycode_type get_next_keycode() #ifdef USE_TILE tile_draw_inv(-1, REGION_INV1); -#ifdef USE_X11 + #ifdef USE_X11 update_screen(); -#endif + #endif mouse_set_mode(MOUSE_MODE_COMMAND); keyin = unmangle_direction_keys(getch_with_command_macros()); mouse_set_mode(MOUSE_MODE_NORMAL); diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 552bec13fd..b9dd3f493e 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -651,7 +651,7 @@ void game_options::reset_options() easy_unequip = true; easy_butcher = true; always_confirm_butcher = false; - list_rotten = false; + list_rotten = true; easy_confirm = CONFIRM_SAFE_EASY; easy_quit_item_prompts = true; hp_warning = 10; @@ -1778,6 +1778,10 @@ void game_options::read_option_line(const std::string &str, bool runscript) { always_confirm_butcher = read_bool( field, always_confirm_butcher ); } + else if (key == "list_rotten") + { + list_rotten = read_bool( field, list_rotten ); + } else if (key == "lua_file" && runscript) { #ifdef CLUA_BINDINGS diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index fcf3b7da03..8e31a5e8ff 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -20,6 +20,9 @@ #include "AppHdr.h" #include "items.h" +#ifdef USE_TILE + #include "cio.h" +#endif #include "clua.h" #include @@ -1220,10 +1223,18 @@ void pickup() { mprf(MSGCH_PROMPT, "Pick up %s? (y/n/a/*?g,/q)", mitm[o].name(DESC_NOCAP_A).c_str() ); +#ifndef USE_TILE keyin = get_ch(); +#else + keyin = getch_ck(); +#endif } - if (keyin == '*' || keyin == '?' || keyin == ',' || keyin == 'g') + if (keyin == '*' || keyin == '?' || keyin == ',' || keyin == 'g' +#ifdef USE_TILE + || keyin == CK_MOUSE_B1 +#endif + ) { pickup_menu(o); break; diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc index bf0b31b6c1..6f064957a4 100644 --- a/crawl-ref/source/libgui.cc +++ b/crawl-ref/source/libgui.cc @@ -1362,8 +1362,14 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init) desc += "Remove (R)"; break; case OBJ_MISSILES: - desc += "Throw (t)"; + { + const item_def *weapon = you.weapon(); + if (weapon && you.inv[ix].launched_by(*weapon)) + desc += "Fire (f)"; + else + desc += "Throw (t)"; break; + } case OBJ_WANDS: desc += "Zap (z)"; break; @@ -1455,9 +1461,10 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init) desc += " ("; desc += get_species_abbrev(you.species); desc += get_class_abbrev(you.char_class); - desc += ")" EOL; - - desc += EOL "[L-Click] Search 1 turn"; + desc += ")"; + + if (igrd[you.x_pos][you.y_pos] != NON_ITEM) + desc += EOL "[L-Click] Pick up items (g)"; if (grid_stair_direction( grd[gx][gy] ) != CMD_NO_CMD) desc += EOL "[Shift-L-Click] use stairs ()"; @@ -1649,9 +1656,9 @@ static int handle_mouse_button(int mx, int my, int button, { if (button == 1 && cx == DCX && cy == DCY) { - // spend one turn resting/searching + // pick up items if (!shift) - return 's'; + return 'g'; // else attempt to use stairs on square const int gx = view2gridX(cx) + 1; @@ -1837,9 +1844,11 @@ int getch() int keyin = getch_ck(); if (keyin >= CK_UP && keyin <= CK_CTRL_PGDN) - return ck_tr[ keyin - CK_UP ]; + return ck_tr[ keyin - CK_UP ]; + if (keyin == CK_DELETE) - return '.'; + return '.'; + return keyin; } diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc index 48aa0100bc..1b2b658ab0 100644 --- a/crawl-ref/source/menu.cc +++ b/crawl-ref/source/menu.cc @@ -176,10 +176,16 @@ bool Menu::process_key( int keyin ) case CK_ENTER: return false; case CK_ESCAPE: +#ifdef USE_TILE + case CK_MOUSE_B2: +#endif sel.clear(); lastch = keyin; return false; case ' ': case CK_PGDN: case '>': case '\'': +#ifdef USE_TILE + case CK_MOUSE_B1: +#endif nav = true; repaint = page_down(); if (!repaint && !is_set(MF_EASY_EXIT) && !is_set(MF_NOWRAP)) diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 475ca9db31..be59b14ad6 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -119,7 +119,7 @@ int draw_colour_bar(int val, int max_val, int old_val, int old_disp, // Don't redraw colour bars during running/resting // *unless* we'll stop doing so after that - if (you.running > 1 && val != max_val) + if (you.running > 1 && is_resting() && val != max_val) return -1; const int width = crawl_view.hudsz.x - ox - 1; diff --git a/crawl-ref/wininit.txt b/crawl-ref/wininit.txt index f04dd132e9..56465c2cc6 100644 --- a/crawl-ref/wininit.txt +++ b/crawl-ref/wininit.txt @@ -13,8 +13,8 @@ Tile:DngnY=17 Tile:MapPx=4 Tile:MsgX=73 Tile:MsgY=10 -Tile:WindowTop=40 -Tile:WindowLeft=193 +Tile:WindowTop=64 +Tile:WindowLeft=273 Tile:FontName=8x13 Tile:FontSize=16 -- cgit v1.2.3-54-g00ecf