diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-24 07:52:37 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-24 07:52:37 +0000 |
commit | ce05e64645f5e9ba07c5b8b72d0da8d5f8cecb28 (patch) | |
tree | 4e546f0e70ac9c88be6c39358089d783a96ec0f0 /crawl-ref/source | |
parent | eedd926a2de32ac965b9cae1dd30242f75c479f5 (diff) | |
download | crawl-ref-ce05e64645f5e9ba07c5b8b72d0da8d5f8cecb28.tar.gz crawl-ref-ce05e64645f5e9ba07c5b8b72d0da8d5f8cecb28.zip |
Change quiver output to that of the next item actually fired. Currently
updates correctly on firing and dropping quivered items. May be buggy.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6107 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/delay.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/invent.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/items.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/output.cc | 44 | ||||
-rw-r--r-- | crawl-ref/source/quiver.cc | 29 |
5 files changed, 56 insertions, 37 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 66b3c95ef1..d215c38e39 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -65,9 +65,9 @@ static bool _recite_mons_useless(const monsters *mon) return (mons_intel(mon->type) < I_NORMAL || holiness != MH_HOLY - || holiness != MH_NATURAL - || holiness != MH_UNDEAD - || holiness != MH_DEMONIC + && holiness != MH_NATURAL + && holiness != MH_UNDEAD + && holiness != MH_DEMONIC || mons_is_stationary(mon) || mons_is_fleeing(mon) || mons_is_sleeping(mon) @@ -79,7 +79,7 @@ static bool _recite_mons_useless(const monsters *mon) || mon->has_ench(ENCH_HASTE)); } -// power is maximum 50 +// Power is maximum 50. static int _recite_to_monsters(int x, int y, int pow, int unused) { UNUSED(unused); diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 3a3f6169d6..b623a73411 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -1287,7 +1287,7 @@ bool check_warning_inscriptions( const item_def& item, // // It returns PROMPT_ABORT if the player hits escape. // It returns PROMPT_GOT_SPECIAL if the player hits the "other_valid_char". -// It retursn PROMPT_NOTHING if there's no matching items +// It returns PROMPT_NOTHING if there are no matching items. // // Note: This function never checks if the item is appropriate. int prompt_invent_item( const char *prompt, @@ -1307,7 +1307,7 @@ int prompt_invent_item( const char *prompt, } unsigned char keyin = 0; - int ret = PROMPT_ABORT; + int ret = PROMPT_ABORT; bool need_redraw = false; bool need_prompt = true; diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 613c2dee8e..c5d298eb6d 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1568,7 +1568,7 @@ int move_item_to_player( int obj, int quant_got, bool quiet ) if (freeslot < 0 || freeslot >= ENDOFPACK || is_valid_item(you.inv[freeslot])) { - // Something is terribly wrong + // Something is terribly wrong. return (-1); } @@ -1577,12 +1577,12 @@ int move_item_to_player( int obj, int quant_got, bool quiet ) dgn_event(DET_ITEM_PICKUP, pos, 0, obj, -1), pos); item_def &item = you.inv[freeslot]; - // copy item + // Copy item. item = mitm[obj]; item.x = -1; item.y = -1; item.link = freeslot; - // remove "dropped by ally" flag + // Remove "dropped by ally" flag. item.flags &= ~(ISFLAG_DROPPED_BY_ALLY); if (!item.slot) @@ -1598,7 +1598,7 @@ int move_item_to_player( int obj, int quant_got, bool quiet ) { if (quant_got != mitm[obj].quantity) { - // remove oldest timers from original stack + // Remove oldest timers from original stack. for (int i = 0; i < quant_got; i++) remove_oldest_blood_potion(mitm[obj]); diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index c44a882701..c1dca948a5 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -495,14 +495,13 @@ static void _print_stats_qv(int y) textcolor(Options.status_caption_colour); cprintf("Qv: "); - const item_def* item; - int q; - you.m_quiver->get_desired_item(&item, &q); + std::string error_reason; + int q = you.m_quiver->get_fire_item(&error_reason); ASSERT(q >= -1 && q < ENDOFPACK); if (q != -1) { - const item_def& quiver = *item; + const item_def& quiver = you.inv[q]; textcolor(quiver.colour); const std::string prefix = menu_colour_item_prefix(quiver); @@ -516,18 +515,29 @@ static void _print_stats_qv(int y) .substr(0, crawl_view.hudsz.x - 4) .c_str()); } - else if (item != NULL && is_valid_item(*item)) - { - textcolor(item->colour); - cprintf("-) %s", item->name(DESC_PLAIN, true) - .substr(0, crawl_view.hudsz.x - 15).c_str()); - textcolor(RED); - cprintf(" (empty)"); - } else { textcolor(LIGHTGREY); cprintf("Nothing quivered"); + +/* + const item_def* item; + you.m_quiver->get_desired_item(&item, &q); + + if (item != NULL && is_valid_item(*item)) + { + textcolor(item->colour); + cprintf("-) %s", item->name(DESC_PLAIN, true) + .substr(0, crawl_view.hudsz.x - 15).c_str()); + textcolor(RED); + cprintf(" (empty)"); + } + else + { + textcolor(LIGHTGREY); + cprintf("Nothing quivered"); + } +*/ } textcolor(LIGHTGREY); @@ -826,9 +836,11 @@ void print_stats(void) if (you.redraw_dexterity) { you.redraw_dexterity = false; _print_stats_dex(19, 7); } int yhack = 0; + // If Options.show_gold_turns, line 8 is Gold and Turns if (Options.show_gold_turns) { + // Increase y-value for all following lines. yhack = 1; cgotoxy(1+6, 8, GOTO_STAT); textcolor(HUD_VALUE_COLOR); @@ -837,7 +849,7 @@ void print_stats(void) if (you.redraw_experience) { - cgotoxy(1,8+yhack, GOTO_STAT); + cgotoxy(1,8 + yhack, GOTO_STAT); textcolor(Options.status_caption_colour); cprintf("Exp Pool: "); textcolor(HUD_VALUE_COLOR); @@ -862,12 +874,12 @@ void print_stats(void) // Also, it's a little bogus to change simulation state in // render code. We should find a better place for this. you.m_quiver->on_weapon_changed(); - _print_stats_wp(9+yhack); + _print_stats_wp(9 + yhack); } if (you.redraw_quiver || you.wield_change) { - _print_stats_qv(10+yhack); + _print_stats_qv(10 + yhack); you.redraw_quiver = false; } you.wield_change = false; @@ -875,7 +887,7 @@ void print_stats(void) if (you.redraw_status_flags) { you.redraw_status_flags = 0; - _print_status_lights(11+yhack); + _print_status_lights(11 + yhack); } textcolor(LIGHTGREY); diff --git a/crawl-ref/source/quiver.cc b/crawl-ref/source/quiver.cc index 68f8b48e87..680fa465e2 100644 --- a/crawl-ref/source/quiver.cc +++ b/crawl-ref/source/quiver.cc @@ -2,7 +2,7 @@ * File: quiver.cc * Summary: Player quiver functionality * - * Last modified by $Author: $ on $Date: $ + * Modified for Crawl Reference by $Author: j-p-e-g $ on $Date: 2008-06-23 23:30:08 +0200 (Mo, 23 Jun 2008) $ * * - Only change last_used when actually using * - Not changing Qv; nobody knows about internals @@ -188,17 +188,20 @@ void player_quiver::on_inv_quantity_changed(int slot, int amt) _maybe_fill_empty_slot(); you.redraw_quiver = true; } - else if (m_last_used_of_type[m_last_used_type].base_type != - you.inv[slot].base_type) + else if (m_last_used_of_type[m_last_used_type].base_type + != you.inv[slot].base_type) { // Not our current stack; don't bother } else { // Maybe matches current stack. Redraw if so. - const item_def* desired; - int qv_slot; - get_desired_item(&desired, &qv_slot); +// const item_def* desired; +// int qv_slot; +// get_desired_item(&desired, &qv_slot); + + std::string error_reason; + int qv_slot = get_fire_item(&error_reason); if (qv_slot == slot) you.redraw_quiver = true; } @@ -209,13 +212,14 @@ void player_quiver::_maybe_fill_empty_slot() { const item_def* weapon = you.weapon(); const ammo_t slot = _get_weapon_ammo_type(weapon); + #ifdef DEBUG_QUIVER mprf(MSGCH_DIAGNOSTICS, "last quiver item: %s; link %d, wpn: %d", m_last_used_of_type[slot].name(DESC_PLAIN).c_str(), m_last_used_of_type[slot].link, you.equip[EQ_WEAPON]); #endif - bool unquiver_weapon = false; + bool unquiver_weapon = false; if (is_valid_item(m_last_used_of_type[slot])) { // If we're wielding an item previously quivered, the quiver may need @@ -230,14 +234,17 @@ void player_quiver::_maybe_fill_empty_slot() #ifdef DEBUG_QUIVER mpr("recalculating fire order...", MSGCH_DIAGNOSTICS); #endif - // const launch_retval desired_ret = - // (weapon && is_range_weapon(*weapon)) ? LRET_LAUNCHED : LRET_THROWN; + const launch_retval desired_ret = (slot == AMMO_THROW ? LRET_THROWN : LRET_LAUNCHED); - std::vector<int> order; _get_fire_order(order, false, weapon); + + std::vector<int> order; + _get_fire_order(order, false, weapon); + if (unquiver_weapon && order.empty()) { -// m_last_used_of_type[slot] = you.inv[order[i]]; + // Setting the quantity to zero will force the quiver to be empty, + // should nothing else be found. m_last_used_of_type[slot].quantity = 0; } else |