From 7a242f8e4ab1ab615cadcbf280de0ddd99754b0a Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Tue, 3 Jun 2008 13:55:43 +0000 Subject: Fix a bug with swap_when_safe, and experimentally default chunks_autopickup, swap_when_safe, and show_beam to true. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5457 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 8 +++++++- crawl-ref/source/delay.cc | 11 +++++++++-- crawl-ref/source/food.cc | 16 ++++++++++++++-- crawl-ref/source/initfile.cc | 24 ++++++++++++------------ crawl-ref/source/it_use2.cc | 27 ++++++++++++--------------- crawl-ref/source/item_use.cc | 15 +++++++-------- crawl-ref/source/misc.cc | 4 ++-- 7 files changed, 63 insertions(+), 42 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 5b62dabf80..6a93a94b73 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1416,9 +1416,15 @@ static void _input() if (need_to_autoinscribe()) autoinscribe(); + // XXX: Is there some smart way to avoid autoswitching back if we're + // just about to continue butchering? if (i_feel_safe() && you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED]) { - weapon_switch(you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED]); + int weap = you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED]; + if (weap == ENDOFPACK) + weap = -1; + + weapon_switch(weap); print_stats(); // To prevent spam in case the weapon can't be switched back to. diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 5c149ad9da..151fa3947e 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -377,7 +377,7 @@ void stop_delay( bool stop_stair_travel ) delay.type == DELAY_BOTTLE_BLOOD ? "bottling blood from" : "sacrificing"); - // Corpse keeps track of work in plus2 field, see handle_delay() -- bwr + // Corpse keeps track of work in plus2 field, see handle_delay(). -- bwr if (butcher_swap_warn) { std::string weapon; @@ -393,12 +393,19 @@ void stop_delay( bool stop_stair_travel ) (multiple_corpses ? "s" : ""), weapon.c_str()); if (Options.swap_when_safe) + { + // XXX: This is a hack! + // (Necessary because attributes are unsigned chars.) you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] - = butcher_swap_weapon; + = (butcher_swap_weapon == -1 ? ENDOFPACK + : butcher_swap_weapon); + } } else + { mprf("You stop %s the corpse%s.", butcher_verb.c_str(), multiple_corpses ? "s" : ""); + } pop_delay(); break; diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 16e4271503..f030f9af06 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -132,15 +132,27 @@ void set_hunger( int new_hunger_level, bool suppress_msg ) // More of a "weapon_switch back from butchering" function, switching // to a weapon is done using the wield_weapon code. // special cases like staves of power or other special weps are taken -// care of by calling wield_effects() {gdl} +// care of by calling wield_effects(). {gdl} void weapon_switch( int targ ) { - if (targ == -1) + if (targ == -1) // Unarmed Combat. { + // Already unarmed? + if (you.equip[EQ_WEAPON] == -1) + return; + mpr( "You switch back to your bare hands." ); } else { + // Possibly not valid anymore (dropped etc.) + if (!is_valid_item(you.inv[targ])) + return; + + // Already wielding this weapon? + if (you.equip[EQ_WEAPON] == you.inv[targ].link) + return; + mprf("Switching back to %s.", you.inv[targ].name(DESC_INVENTORY).c_str()); } diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 6665a7a096..5b414e5158 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -630,23 +630,23 @@ void game_options::reset_options() show_more_prompt = true; show_gold_turns = false; - show_beam = false; + show_beam = true; use_old_selection_order = false; - prev_race = 0; - prev_cls = 0; - prev_ck = GOD_NO_GOD; - prev_dk = DK_NO_SELECTION; - prev_pr = GOD_NO_GOD; - prev_weapon = WPN_UNKNOWN; - prev_book = SBT_NO_SELECTION; + prev_race = 0; + prev_cls = 0; + prev_ck = GOD_NO_GOD; + prev_dk = DK_NO_SELECTION; + prev_pr = GOD_NO_GOD; + prev_weapon = WPN_UNKNOWN; + prev_book = SBT_NO_SELECTION; prev_randpick = false; remember_name = true; #ifdef USE_ASCII_CHARACTERS - char_set = CSET_ASCII; + char_set = CSET_ASCII; #else - char_set = CSET_IBM; + char_set = CSET_IBM; #endif // set it to the .crawlrc default @@ -668,8 +668,8 @@ void game_options::reset_options() easy_unequip = true; easy_butcher = true; always_confirm_butcher = false; - chunks_autopickup = false; - swap_when_safe = false; + chunks_autopickup = true; + swap_when_safe = true; list_rotten = true; easy_confirm = CONFIRM_SAFE_EASY; easy_quit_item_prompts = true; diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index 575815ff27..69b29c372b 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -383,7 +383,7 @@ bool potion_effect( potion_type pot_eff, int pow, bool was_known ) bool unwield_item(bool showMsgs) { const int unw = you.equip[EQ_WEAPON]; - if ( unw == -1 ) + if (unw == -1) return (false); if (you.duration[DUR_BERSERKER]) @@ -396,20 +396,19 @@ bool unwield_item(bool showMsgs) return (false); you.equip[EQ_WEAPON] = -1; - you.special_wield = SPWLD_NONE; - you.wield_change = true; + you.special_wield = SPWLD_NONE; + you.wield_change = true; you.m_quiver->on_weapon_changed(); item_def &item(you.inv[unw]); - if ( item.base_type == OBJ_MISCELLANY && - item.sub_type == MISC_LANTERN_OF_SHADOWS ) + if (item.base_type == OBJ_MISCELLANY + && item.sub_type == MISC_LANTERN_OF_SHADOWS ) { you.current_vision += 2; setLOSRadius(you.current_vision); } - - if (item.base_type == OBJ_WEAPONS) + else if (item.base_type == OBJ_WEAPONS) { if (is_fixed_artefact( item )) { @@ -485,9 +484,6 @@ bool unwield_item(bool showMsgs) mpr("You feel the strange hunger wane."); break; - /* case 8: draining - case 9: speed, 10 slicing etc */ - case SPWPN_DISTORTION: // Removing the translocations skill reduction of effect, // it might seem sensible, but this brand is supposed @@ -503,18 +499,19 @@ bool unwield_item(bool showMsgs) "distortion unwield" ); break; - // when more are added here, *must* duplicate unwielding - // effect in vorpalise weapon scroll effect in read_scoll - } // end switch + // NOTE: When more are added here, *must* duplicate unwielding + // effect in vorpalise weapon scroll effect in read_scoll. + } if (you.duration[DUR_WEAPON_BRAND]) { you.duration[DUR_WEAPON_BRAND] = 0; set_item_ego_type( item, OBJ_WEAPONS, SPWPN_NORMAL ); - // we're letting this through even if hiding messages + + // We're letting this through even if hiding messages. mpr("Your branding evaporates."); } - } // end if + } } if (item.base_type == OBJ_STAVES && item.sub_type == STAFF_POWER) diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index c660210e59..34c11516dd 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -473,10 +473,9 @@ int item_special_wield_effect(const item_def &item) } } -// provide a function for handling initial wielding of 'special' +// Provide a function for handling initial wielding of 'special' // weapons, or those whose function is annoying to reproduce in -// other places *cough* auto-butchering *cough* {gdl} - +// other places *cough* auto-butchering *cough*. {gdl} void wield_effects(int item_wield_2, bool showMsgs) { unsigned char i_dam = 0; @@ -484,7 +483,7 @@ void wield_effects(int item_wield_2, bool showMsgs) const bool known_cursed = item_known_cursed(you.inv[item_wield_2]); item_def &item = you.inv[item_wield_2]; - // and here we finally get to the special effects of wielding {dlb} + // And here we finally get to the special effects of wielding. {dlb} switch (item.base_type) { case OBJ_MISCELLANY: @@ -511,9 +510,9 @@ void wield_effects(int item_wield_2, bool showMsgs) } else if (!maybe_identify_staff(item)) { - // Give curse status when wielded. - // Right now that's always "uncursed". -- bwr - set_ident_flags( item, ISFLAG_KNOW_CURSE ); + // Give curse status when wielded. + // Right now that's always "uncursed". -- bwr + set_ident_flags( item, ISFLAG_KNOW_CURSE ); } break; } @@ -528,7 +527,7 @@ void wield_effects(int item_wield_2, bool showMsgs) const bool was_known = item_type_known(item); - // only used for Singing Sword introducing itself + // Only used for Singing Sword introducing itself // (could be extended to other talking weapons...) const char *old_desc = item.name(DESC_CAP_THE).c_str(); diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index edc211f8f1..4224889d69 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1153,10 +1153,10 @@ static void maybe_bloodify_square(int x, int y, int amount, bool spatter = false continue; // Spattering onto walls etc. less likely. - if (grd[x+i][y+j] < DNGN_MINMOVE && one_chance_in(3)) + if (grd[x+i][y+j] < DNGN_MINMOVE && !one_chance_in(3)) continue; - maybe_bloodify_square(x+i, y+j, amount/10); + maybe_bloodify_square(x+i, y+j, amount/15); } } } -- cgit v1.2.3-54-g00ecf