diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-01-21 13:41:10 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-01-21 13:41:10 +0000 |
commit | cbb457d13f09655c81aa5a0e942fbb34f4a76712 (patch) | |
tree | 33ae292819a64b31a12a0b2209aa0bbbf6ad036e /crawl-ref/source | |
parent | b30aacda1fd2b82ae1436f3ac24e3c588d8209d1 (diff) | |
download | crawl-ref-cbb457d13f09655c81aa5a0e942fbb34f4a76712.tar.gz crawl-ref-cbb457d13f09655c81aa5a0e942fbb34f4a76712.zip |
Tiles: allow direct selection of corpse to be butchered from floor
or to drink blood from for vampires
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3313 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/food.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/food.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 21 | ||||
-rw-r--r-- | crawl-ref/source/item_use.h | 4 | ||||
-rw-r--r-- | crawl-ref/source/libgui.cc | 47 | ||||
-rw-r--r-- | crawl-ref/source/libgui.h | 2 |
6 files changed, 75 insertions, 15 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 2874c207c1..90197b4bba 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -195,7 +195,7 @@ static bool find_butchering_implement( bool fallback ) return (you.equip[EQ_WEAPON] != old_weapon); } -bool butchery() +bool butchery(int which_corpse) { bool new_cursed = false; int old_weapon = you.equip[EQ_WEAPON]; @@ -246,7 +246,8 @@ bool butchery() // First determine how many things there are to butcher. int num_corpses = 0; - int corpse_id = -1; + int corpse_id = -1; + bool prechosen = (which_corpse != -1); for (int o = igrd[you.x_pos][you.y_pos]; o != NON_ITEM; o = mitm[o].link) { if (mitm[o].base_type == OBJ_CORPSES && @@ -254,8 +255,15 @@ bool butchery() { corpse_id = o; num_corpses++; + + // return pre-chosen corpse if it exists + if (prechosen && corpse_id == which_corpse) + break; } } + // pre-chosen corpse not found? + if (prechosen && corpse_id != which_corpse) + prechosen = false; bool canceled_butcher = false; @@ -266,7 +274,7 @@ bool butchery() mpr("There isn't anything to dissect here."); return false; } - else if ( num_corpses > 1 || Options.always_confirm_butcher ) + else if ( !prechosen && (num_corpses > 1 || Options.always_confirm_butcher) ) { corpse_id = -1; for (int o=igrd[you.x_pos][you.y_pos]; o != NON_ITEM; o = mitm[o].link) diff --git a/crawl-ref/source/food.h b/crawl-ref/source/food.h index 1d4d3fa4b2..d06a5f73d8 100644 --- a/crawl-ref/source/food.h +++ b/crawl-ref/source/food.h @@ -46,7 +46,7 @@ enum food_type /* *********************************************************************** * called from: acr * *********************************************************************** */ -bool butchery(void); +bool butchery(int which_corpse = -1); // last updated 19jun2000 {dlb} diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 594201e9c7..30e53c6cc1 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -4448,6 +4448,27 @@ void tile_use_item(int idx, InvAction act) drop_item(idx, you.inv[idx].quantity); return; } + else if (act == INV_USE_FLOOR) + { + if (mitm[idx].base_type == OBJ_CORPSES + && you.inv[idx].sub_type != CORPSE_SKELETON + && !food_is_rotten(you.inv[idx])) + { + butchery(idx); + } + return; + } + else if (act == INV_EAT_FLOOR) + { + if (mitm[idx].base_type == OBJ_CORPSES + && you.species == SP_VAMPIRE + || mitm[idx].base_type == OBJ_FOOD + && you.species != SP_MUMMY && you.species != SP_VAMPIRE) + { + eat_floor_item(idx); + } + return; + } else if (act != INV_USE) { return; diff --git a/crawl-ref/source/item_use.h b/crawl-ref/source/item_use.h index 40d51f25ce..cc1c5b8820 100644 --- a/crawl-ref/source/item_use.h +++ b/crawl-ref/source/item_use.h @@ -187,8 +187,8 @@ bool wearing_slot(int inv_slot); #ifdef USE_TILE /* *********************************************************************** - * * called from: acr - * * *********************************************************************** */ + * called from: acr + * *********************************************************************** */ void tile_use_item(int idx, InvAction act); #endif diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc index 153d48f47d..7291d4db16 100644 --- a/crawl-ref/source/libgui.cc +++ b/crawl-ref/source/libgui.cc @@ -1226,7 +1226,7 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init) std::string desc; if (ix != -1) { - bool display_actions = mode == REGION_INV1; + bool display_actions = (mode == REGION_INV1); if (itemlist_iflag[cx] & TILEI_FLAG_FLOOR) { @@ -1238,6 +1238,22 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init) desc += mitm[ix].name(DESC_NOCAP_A); if (display_actions) desc += EOL "[L-Click] Pick up (g)"; + + if (mitm[ix].base_type == OBJ_CORPSES + && you.inv[ix].sub_type != CORPSE_SKELETON + && !food_is_rotten(you.inv[ix])) + { + desc += EOL "[Shift-L-Click] Dissect (D)"; + + if (you.species == SP_VAMPIRE) + desc += EOL "[Shift-R-Click] Drink blood (e)"; + } + else if (mitm[ix].base_type == OBJ_FOOD + && you.species != SP_VAMPIRE + && you.species != SP_MUMMY) + { + desc += EOL "[Shift-R-Click] Eat (e)"; + } } else { @@ -1248,10 +1264,13 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init) int type = you.inv[ix].base_type; desc += EOL; - if (type != OBJ_CORPSES - || you.species == SP_VAMPIRE - && you.inv[ix].sub_type != CORPSE_SKELETON - && you.inv[ix].special >= 100) + if ((type != OBJ_CORPSES + || you.species == SP_VAMPIRE + && you.inv[ix].sub_type != CORPSE_SKELETON + && you.inv[ix].special >= 100) + && (you.species != SP_MUMMY + || you.inv[ix].base_type != OBJ_POTIONS + && you.inv[ix].base_type != OBJ_FOOD)) { desc += "[L-Click] "; @@ -1542,20 +1561,30 @@ static int handle_mouse_button(int mx, int my, int button, { // describe item if (itemlist_iflag[cx] & TILEI_FLAG_FLOOR) - gui_set_mouse_inv(-ix, INV_VIEW); + { + if (shift) + { + gui_set_mouse_inv(ix, INV_EAT_FLOOR); + return CK_MOUSE_B1ITEM; + } + else + gui_set_mouse_inv(-ix, INV_VIEW); + } else gui_set_mouse_inv(ix, INV_VIEW); TileMoveInvCursor(-1); return CK_MOUSE_B2ITEM; } - else if(button == 1) + else if (button == 1) { // Floor item if (itemlist_iflag[cx] & TILEI_FLAG_FLOOR) { // try pick up one item - if (button != 1) return 0; - gui_set_mouse_inv(ix, INV_PICKUP); + if (!shift) + gui_set_mouse_inv(ix, INV_PICKUP); + else + gui_set_mouse_inv(ix, INV_USE_FLOOR); return CK_MOUSE_B1ITEM; } // use item diff --git a/crawl-ref/source/libgui.h b/crawl-ref/source/libgui.h index f258d1b4f3..ed820fde24 100644 --- a/crawl-ref/source/libgui.h +++ b/crawl-ref/source/libgui.h @@ -75,6 +75,8 @@ enum InvAction INV_USE, INV_PICKUP, INV_VIEW, + INV_USE_FLOOR, + INV_EAT_FLOOR, INV_SELECT, INV_NUMACTIONS }; |