From 0bc00794625760f93f2d1fd20a78d02aaa7299f9 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Mon, 17 Sep 2007 02:55:58 +0000 Subject: A handful of new game options: menu_colour_prefix_id, if set to true, causes the identification state of an object to be prefixed to the string menu colour regexes are matched against (but does not alter the string displayed on the screen). menu_colour_prefix_class, if set to true, prefixes the object's base type to the string menu colour regexes are matched against. user_note_prefix can be set to a string which will be prefixed to manual user notes when they are displayed, to make them easier to find. detailed_hunger, if set to true, will cause three new informational-only hunger states to be displayed: near starving, very hungry and very full. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2121 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/command.cc | 47 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) (limited to 'crawl-ref/source/command.cc') diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 604d77cad3..eb4c5fee51 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -361,6 +361,7 @@ void list_armour() for (int i = EQ_CLOAK; i <= EQ_BODY_ARMOUR; i++) { const int armour_id = you.equip[i]; + int colour = MSGCOL_BLACK; estr.str(""); estr.clear(); @@ -376,7 +377,11 @@ void list_armour() << " : "; if (armour_id != -1) + { estr << you.inv[armour_id].name(DESC_INVENTORY); + colour = menu_colour(estr.str(), + menu_colour_item_prefix(you.inv[armour_id])); + } else if (!you_can_wear(i,true)) estr << " (unavailable)"; else if (!you_tran_can_wear(i, true)) @@ -386,7 +391,10 @@ void list_armour() else estr << " none"; - mpr( estr.str().c_str(), MSGCH_EQUIPMENT, menu_colour(estr.str()) ); + if (colour == MSGCOL_BLACK) + colour = menu_colour(estr.str()); + + mpr( estr.str().c_str(), MSGCH_EQUIPMENT, colour); } } // end list_armour() @@ -397,6 +405,7 @@ void list_jewellery(void) for (int i = EQ_LEFT_RING; i <= EQ_AMULET; i++) { const int jewellery_id = you.equip[i]; + int colour = MSGCOL_BLACK; jstr.str(""); jstr.clear(); @@ -408,15 +417,23 @@ void list_jewellery(void) << " : "; if (jewellery_id != -1) + { jstr << you.inv[jewellery_id].name(DESC_INVENTORY); + std::string + prefix = menu_colour_item_prefix(you.inv[jewellery_id]); + colour = menu_colour(jstr.str(), prefix); + } else if (!you_tran_can_wear(i)) jstr << " (currently unavailable)"; else jstr << " none"; - mpr( jstr.str().c_str(), MSGCH_EQUIPMENT, menu_colour(jstr.str()) ); + if (colour == MSGCOL_BLACK) + colour = menu_colour(jstr.str()); + + mpr( jstr.str().c_str(), MSGCH_EQUIPMENT, colour); } -} // end list_jewellery() +} void list_weapons(void) { @@ -427,10 +444,13 @@ void list_weapons(void) // Yes, this is already on the screen... I'm outputing it // for completeness and to avoid confusion. std::string wstring = "Current : "; + int colour; if (weapon_id != -1) { wstring += you.inv[weapon_id].name(DESC_INVENTORY_EQUIP); + colour = menu_colour(wstring, + menu_colour_item_prefix(you.inv[weapon_id])); } else { @@ -440,9 +460,10 @@ void list_weapons(void) wstring += " (currently unavailable)"; else wstring += " empty hands"; + colour = menu_colour(wstring); } - mpr(wstring.c_str(), MSGCH_EQUIPMENT, menu_colour(wstring)); + mpr(wstring.c_str(), MSGCH_EQUIPMENT, colour); // Print out the swap slots for (int i = 0; i <= 1; i++) @@ -457,17 +478,23 @@ void list_weapons(void) else wstring = "Secondary : "; + colour = MSGCOL_BLACK; if (is_valid_item( you.inv[i]) && (you.inv[i].base_type == OBJ_WEAPONS || you.inv[i].base_type == OBJ_STAVES || you.inv[i].base_type == OBJ_MISCELLANY)) { wstring += you.inv[i].name(DESC_INVENTORY_EQUIP); + colour = menu_colour(wstring, + menu_colour_item_prefix(you.inv[i])); } else wstring += " none"; - mpr(wstring.c_str(), MSGCH_EQUIPMENT, menu_colour(wstring)); + if (colour == MSGCOL_BLACK) + colour = menu_colour(wstring); + + mpr(wstring.c_str(), MSGCH_EQUIPMENT, colour); } // Now we print out the current default fire weapon @@ -475,12 +502,20 @@ void list_weapons(void) const int item = get_fire_item_index(); + colour = MSGCOL_BLACK; if (item == ENDOFPACK) wstring += " nothing"; else + { wstring += you.inv[item].name(DESC_INVENTORY_EQUIP); + colour = menu_colour(wstring, + menu_colour_item_prefix(you.inv[item])); + } + + if (colour == MSGCOL_BLACK) + colour = menu_colour(wstring); - mpr( wstring.c_str(), MSGCH_EQUIPMENT, menu_colour(wstring) ); + mpr( wstring.c_str(), MSGCH_EQUIPMENT, colour ); } // end list_weapons() static bool cmdhelp_textfilter(const std::string &tag) -- cgit v1.2.3-54-g00ecf