summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-12 14:25:50 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-12 14:25:50 +0000
commit71e8cf1a93945211047ab78c851290e92938f6d1 (patch)
tree9231eb554aadafece148fabbcbf6e4d6d696ecda /crawl-ref/source
parent682e94e3c1534de75cc217733aa669798b9065ab (diff)
downloadcrawl-ref-71e8cf1a93945211047ab78c851290e92938f6d1.tar.gz
crawl-ref-71e8cf1a93945211047ab78c851290e92938f6d1.zip
Fix new firing interface to also apply when selecting items via tile inventory.
(This will also change the quiver, so that tile players no longer need to repeatedly choose the same stack of darts to fire: ff will work nicely.) Implement first part of FR 1911866: merging W/T, R/P The existing option "easy_unequip" now also allows direct choice of which armour to take off from the 'W' menu, and same for jewellery for 'P'. Warning inscriptions are respected. Now we only need to add a new sorting option sort_equipped that takes care of equipped stuff being listed first in the inventory. Last time I tried something like this (chunk sorting by age) I failed miserably, so I'm making no promises. Also tweak my recent {tried} modification to only apply to jewellery since for some reasons all unidentified randart weapons show {tried} where jewellery is really picky about which randarts have been tried and which haven't. Probably still needs fixing. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3607 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/invent.cc32
-rw-r--r--crawl-ref/source/item_use.cc51
-rw-r--r--crawl-ref/source/itemname.cc7
-rw-r--r--crawl-ref/source/libgui.cc8
-rw-r--r--crawl-ref/source/monspeak.cc19
-rw-r--r--crawl-ref/source/tile1.cc10
6 files changed, 87 insertions, 40 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index bda888740b..c0351d28e1 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -1144,6 +1144,38 @@ bool check_warning_inscriptions( const item_def& item,
{
if (is_valid_item( item ) && has_warning_inscription(item, oper) )
{
+ if (oper == OPER_WEAR)
+ {
+ if (item.base_type != OBJ_ARMOUR)
+ return (true);
+
+ // don't ask if item already worn
+ int equip = you.equip[get_armour_slot(item)];
+ if (equip != -1 && item.link == equip)
+ return (check_old_item_warning(item, oper));
+ }
+ else if (oper == OPER_PUTON)
+ {
+ if (item.base_type != OBJ_JEWELLERY)
+ return (true);
+
+ // don't ask if item already worn
+ int equip = -1;
+ if (jewellery_is_amulet(item))
+ equip = you.equip[EQ_AMULET];
+ else
+ {
+ equip = you.equip[EQ_LEFT_RING];
+ if (equip != -1 && item.link == equip)
+ return (check_old_item_warning(item, oper));
+ // or maybe the other ring?
+ equip = you.equip[EQ_RIGHT_RING];
+ }
+
+ if (equip != -1 && item.link == equip)
+ return (check_old_item_warning(item, oper));
+ }
+
std::string prompt = "Really " + operation_verb(oper) + " ";
prompt += item.name(DESC_INVENTORY);
prompt += "? ";
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 7bcd5e685f..f0d61637e2 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -753,7 +753,7 @@ static bool cloak_is_being_removed( void )
// wear_armour
//
//---------------------------------------------------------------
-void wear_armour( int slot )
+void wear_armour( int slot ) // slot is for tiles
{
int armour_wear_2 = 0;
@@ -982,6 +982,9 @@ bool do_wear_armour( int item, bool quiet )
if ( wearing_slot(item) )
{
+ if (Options.easy_unequip)
+ return (!takeoff_armour(item));
+
if (!quiet)
mpr("You are already wearing that!");
@@ -1495,6 +1498,11 @@ command_type fire_target_behaviour::get_command(int key)
static bool _fire_choose_item_and_target(int& item, dist& target)
{
fire_target_behaviour beh;
+ bool was_chosen = (item != -1);
+
+ if (was_chosen)
+ beh.item = item; // force item to be the prechosen one
+
beh.message_ammo_prompt();
message_current_target(); // XXX: this stuff should be done by direction()
direction( target, DIR_NONE, TARG_ENEMY, false, true, NULL, &beh );
@@ -1512,7 +1520,8 @@ static bool _fire_choose_item_and_target(int& item, dist& target)
}
// Okay, valid target; if the user chose different ammo, quiver it.
- if (beh.item != item)
+ // Same for items selected in tile mode.
+ if (was_chosen || beh.item != item)
{
item = beh.item;
if (you.inv[beh.item].quantity > 1)
@@ -1646,11 +1655,8 @@ void fire_thing(int item)
Options.tut_throw_counter++;
dist target;
- if (item == -1)
- {
- if (! _fire_choose_item_and_target(item, target))
- return;
- }
+ if (!_fire_choose_item_and_target(item, target))
+ return;
if (check_warning_inscriptions(you.inv[item], OPER_FIRE))
{
@@ -2416,8 +2422,10 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
// for launchers. Hand-thrown stones and darts do only half
// base damage. Yet another evil 4.0ism.
if (wepClass == OBJ_MISSILES
- && (wepType == MI_DART || wepType == MI_STONE))
+ && (wepType == MI_DART || wepType == MI_STONE))
+ {
baseDam = div_rand_round(baseDam, 2);
+ }
// exercise skill
if (coinflip())
@@ -2873,7 +2881,7 @@ static int prompt_ring_to_remove(int new_ring)
if (c == ESCAPE || c == ' ')
return (-1);
- const int eqslot = c == lslot? EQ_LEFT_RING : EQ_RIGHT_RING;
+ const int eqslot = (c == lslot)? EQ_LEFT_RING : EQ_RIGHT_RING;
if (!check_warning_inscriptions(you.inv[you.equip[eqslot]], OPER_REMOVE))
return -1;
@@ -2987,6 +2995,9 @@ bool puton_item(int item_slot, bool prompt_finger)
|| item_slot == you.equip[EQ_RIGHT_RING]
|| item_slot == you.equip[EQ_AMULET])
{
+ if (Options.easy_unequip)
+ return (!remove_ring(item_slot));
+
mpr("You've already put that on!");
return (true);
}
@@ -3015,15 +3026,19 @@ bool puton_item(int item_slot, bool prompt_finger)
}
if (you.equip[EQ_LEFT_RING] != -1
- && you.equip[EQ_RIGHT_RING] != -1)
+ && you.equip[EQ_RIGHT_RING] != -1)
+ {
return swap_rings(item_slot);
+ }
}
else if (you.equip[EQ_AMULET] != -1)
{
if (!check_warning_inscriptions(you.inv[you.equip[EQ_AMULET]],
- OPER_REMOVE) ||
- !remove_ring( you.equip[EQ_AMULET], true ))
+ OPER_REMOVE)
+ || !remove_ring( you.equip[EQ_AMULET], true ))
+ {
return false;
+ }
if (!safe_to_remove_or_wear(you.inv[item_slot], false))
return (false);
@@ -3241,11 +3256,11 @@ bool remove_ring(int slot, bool announce)
if (hand_used == EQ_NONE)
{
const int equipn =
- slot == -1? prompt_invent_item( "Remove which piece of jewellery?",
- MT_INVLIST,
- OBJ_JEWELLERY, true, true, true,
- 0, NULL, OPER_REMOVE)
- : slot;
+ (slot == -1)? prompt_invent_item( "Remove which piece of jewellery?",
+ MT_INVLIST,
+ OBJ_JEWELLERY, true, true, true,
+ 0, NULL, OPER_REMOVE)
+ : slot;
if (equipn == PROMPT_ABORT)
{
@@ -3271,7 +3286,7 @@ bool remove_ring(int slot, bool announce)
return (false);
}
}
- else if (!check_warning_inscriptions(you.inv[you.equip[hand_used]],
+ if (!check_warning_inscriptions(you.inv[you.equip[hand_used]],
OPER_REMOVE))
{
canned_msg(MSG_OK);
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 2c87e39c97..93a016f00b 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -236,9 +236,10 @@ std::string item_def::name(description_level_type descrip,
if (descrip != DESC_PLAIN && descrip != DESC_BASENAME)
{
- const bool tried = (!ident && !equipped
- && (is_artefact && !item_type_known(*this)
- || item_type_tried(*this)));
+ const bool tried = !ident && !equipped
+ && (item_type_tried(*this)
+ || this->base_type == OBJ_JEWELLERY
+ && is_artefact && !item_type_known(*this));
std::string tried_str = "";
if (tried)
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index c9d67e7f72..56343fdaa3 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -1361,14 +1361,8 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init)
desc += "Remove (R)";
break;
case OBJ_MISSILES:
- {
- const item_def *weapon = you.weapon();
- if (weapon && you.inv[ix].launched_by(*weapon))
- desc += "Fire (f)";
- else
- desc += "Throw (t)";
+ desc += "Fire (f)";
break;
- }
case OBJ_WANDS:
desc += "Zap (z)";
break;
diff --git a/crawl-ref/source/monspeak.cc b/crawl-ref/source/monspeak.cc
index 8528276860..7d99bb3317 100644
--- a/crawl-ref/source/monspeak.cc
+++ b/crawl-ref/source/monspeak.cc
@@ -255,10 +255,6 @@ bool mons_speaks(const monsters *monster)
if (monster->has_ench(ENCH_CONFUSION))
prefixes.push_back("confused");
- // only look at the current player form
- if (is_player_same_species(monster->type, true))
- prefixes.push_back("related");
-
// Add Beogh to list of prefixes for orcs (hostile and friendly) if you
// worship Beogh. (This assumes you being a Hill Orc, so might have odd
// results in wizard mode.) Don't count charmed orcs.
@@ -267,10 +263,17 @@ bool mons_speaks(const monsters *monster)
{
prefixes.push_back("beogh");
}
- else if (is_good_god(you.religion))
- prefixes.push_back("good god");
- else if (is_evil_god(you.religion))
- prefixes.push_back("evil god");
+ else
+ {
+ // only look at the current player form
+ if (is_player_same_species(monster->type, true))
+ prefixes.push_back("related"); // overkill for Beogh
+
+ if (is_good_god(you.religion))
+ prefixes.push_back("good god");
+ else if (is_evil_god(you.religion))
+ prefixes.push_back("evil god");
+ }
#ifdef DEBUG_MONSPEAK
{
diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc
index 0e5279c9b3..0b76f5fcea 100644
--- a/crawl-ref/source/tile1.cc
+++ b/crawl-ref/source/tile1.cc
@@ -4225,13 +4225,15 @@ void finish_inven_data(int n, int *tiles, int *num, int *idx, int *iflag)
int type = itm->base_type;
if (type == OBJ_FOOD || type == OBJ_SCROLLS
- || type == OBJ_POTIONS || type == OBJ_MISSILES)
+ || type == OBJ_POTIONS || type == OBJ_MISSILES)
+ {
q = itm->quantity;
+ }
if (q==1) q = -1;
- if (type == OBJ_WANDS &&
- ((itm->flags & ISFLAG_KNOW_PLUSES )!= 0
- || itm->plus2 == ZAPCOUNT_EMPTY))
+ if ( type == OBJ_WANDS
+ && (!(itm->flags & ISFLAG_KNOW_PLUSES )
+ || itm->plus2 == ZAPCOUNT_EMPTY) )
{
q = itm->plus;
}