From a6e153fdce02d271899d8b71ecd82fffcbf0fbc2 Mon Sep 17 00:00:00 2001 From: pauldubois Date: Tue, 4 Mar 2008 08:21:26 +0000 Subject: 1903543: % screen improvements * Show inscriptions. * Weapon enchantments (eg +1,+1) compressed like they are on the main screen. * Remove the slot name ("Ring: ") so there's more room for the item text. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3519 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/output.cc | 150 +++++++++++++++++++++++++-------------------- 1 file changed, 85 insertions(+), 65 deletions(-) (limited to 'crawl-ref/source/output.cc') diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 75fd87be11..9968401de6 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1115,6 +1115,90 @@ std::vector get_full_detail(bool calc_unid, long sc) static std::string status_mut_abilities(void); +// helper for print_verview_screen +static void _print_overview_screen_equip( + column_composer& cols, + std::vector equip_chars) +{ + const int e_order[] = + { + EQ_WEAPON, EQ_BODY_ARMOUR, EQ_SHIELD, EQ_HELMET, EQ_CLOAK, + EQ_GLOVES, EQ_BOOTS, EQ_AMULET, EQ_RIGHT_RING, EQ_LEFT_RING + }; + + char buf[100]; + for(int i = 0; i < NUM_EQUIP; i++) + { + int eqslot = e_order[i]; + + char slot_name_lwr[15]; + snprintf(slot_name_lwr, sizeof slot_name_lwr, "%s", equip_slot_to_name(eqslot)); + strlwr(slot_name_lwr); + + char slot[15] = ""; + // uncomment (and change 42 to 33) to bring back slot names + // snprintf(slot, sizeof slot, "%-7s: ", equip_slot_to_name(eqslot); + + if ( you.equip[ e_order[i] ] != -1) + { + const int item_idx = you.equip[e_order[i]]; + const item_def& item = you.inv[item_idx]; + const char* colname = colour_to_str(item.colour); + const char equip_char = index_to_letter(item_idx); + + char buf2[50]; + if (item.inscription.empty()) + buf2[0] = 0; + else + snprintf(buf2, sizeof buf2, " {%s}", item.inscription.c_str()); + + snprintf(buf, sizeof buf, + "%s%c - <%s>%s%s", + slot, + equip_char, + colname, + item.name(DESC_PLAIN, true).substr(0,42).c_str(), + colname, + buf2); + equip_chars.push_back(equip_char); + } + else if (e_order[i] == EQ_WEAPON + && you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS) + { + snprintf(buf, sizeof buf, "%s - Blade Hands", slot); + } + else if (e_order[i] == EQ_WEAPON + && you.skills[SK_UNARMED_COMBAT]) + { + snprintf(buf, sizeof buf, "%s - Unarmed", slot); + } + else if (!you_can_wear(e_order[i], true)) + { + snprintf(buf, sizeof buf, + "%s(%s unavailable)", + slot, slot_name_lwr); + } + else if (!you_tran_can_wear(e_order[i], true)) + { + snprintf(buf, sizeof buf, + "%s(%s currently unavailable)", + slot, slot_name_lwr); + } + else if (!you_can_wear(e_order[i])) + { + snprintf(buf, sizeof buf, + "%s(%s restricted)", + slot, slot_name_lwr); + } + else + { + snprintf(buf, sizeof buf, + "(no %s)", slot_name_lwr); + } + cols.add_formatted(2, buf, false); + } +} + // new scrollable status overview screen, // including stats, mutations etc. void print_overview_screen() @@ -1365,71 +1449,7 @@ void print_overview_screen() cols.add_formatted(1, buf, false); std::vector equip_chars; - { - const int e_order[] = - { - EQ_WEAPON, EQ_BODY_ARMOUR, EQ_SHIELD, EQ_HELMET, EQ_CLOAK, - EQ_GLOVES, EQ_BOOTS, EQ_AMULET, EQ_RIGHT_RING, EQ_LEFT_RING - }; - - for(i = 0; i < NUM_EQUIP; i++) - { - int eqslot = e_order[i]; - const char *slot = equip_slot_to_name( eqslot ); - - if ( you.equip[ e_order[i] ] != -1) - { - const int item_idx = you.equip[e_order[i]]; - const item_def& item = you.inv[item_idx]; - const char* colname = colour_to_str(item.colour); - const char equip_char = index_to_letter(item_idx); - snprintf(buf, sizeof buf, "%-7s: %c - <%s>%s", - slot, equip_char, colname, - item.name(DESC_PLAIN).substr(0,33).c_str(), colname); - equip_chars.push_back(equip_char); - } - else - { - if (e_order[i] == EQ_WEAPON) - { - if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS) - snprintf(buf, sizeof buf, "%-7s: Blade Hands", slot); - else if (you.skills[SK_UNARMED_COMBAT]) - snprintf(buf, sizeof buf, "%-7s: Unarmed", slot); - else if (!you_tran_can_wear(EQ_WEAPON)) - { - snprintf(buf, sizeof buf, "%-7s: " - "(currently unavailable)", - slot); - } - else - snprintf(buf, sizeof buf, "%-7s:", slot); - } - else if (!you_can_wear(e_order[i], true)) - { - snprintf(buf, sizeof buf, - "%-7s: (unavailable)", slot); - } - else if (!you_tran_can_wear(e_order[i], true)) - { - snprintf(buf, sizeof buf, "%-7s: " - "(currently unavailable)", - slot); - } - else if (!you_can_wear(e_order[i])) - { - snprintf(buf, sizeof buf, - "%-7s: (restricted)", - slot); - } - else - { - snprintf(buf, sizeof buf, "%-7s:", slot); - } - } - cols.add_formatted(2, buf, false); - } - } + _print_overview_screen_equip(cols, equip_chars); blines = cols.formatted_lines(); -- cgit v1.2.3-54-g00ecf