summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-17 02:55:58 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-17 02:55:58 +0000
commit0bc00794625760f93f2d1fd20a78d02aaa7299f9 (patch)
tree871ae18ee6f478dc7c331bf95011a9efa183a6fc
parent27a123d67702ee2b24b29df5374cb9a95f53d5af (diff)
downloadcrawl-ref-0bc00794625760f93f2d1fd20a78d02aaa7299f9.tar.gz
crawl-ref-0bc00794625760f93f2d1fd20a78d02aaa7299f9.zip
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
-rw-r--r--crawl-ref/docs/crawl_options.txt48
-rw-r--r--crawl-ref/init.txt17
-rw-r--r--crawl-ref/source/abl-show.cc2
-rw-r--r--crawl-ref/source/command.cc47
-rw-r--r--crawl-ref/source/enum.h5
-rw-r--r--crawl-ref/source/externs.h7
-rw-r--r--crawl-ref/source/food.cc83
-rw-r--r--crawl-ref/source/initfile.cc23
-rw-r--r--crawl-ref/source/invent.h8
-rw-r--r--crawl-ref/source/itemname.cc51
-rw-r--r--crawl-ref/source/itemname.h5
-rw-r--r--crawl-ref/source/menu.cc8
-rw-r--r--crawl-ref/source/menu.h9
-rw-r--r--crawl-ref/source/notes.cc2
-rw-r--r--crawl-ref/source/output.cc90
-rw-r--r--crawl-ref/source/spl-book.cc2
-rw-r--r--crawl-ref/source/spl-cast.cc2
17 files changed, 355 insertions, 54 deletions
diff --git a/crawl-ref/docs/crawl_options.txt b/crawl-ref/docs/crawl_options.txt
index 96b7dc7aa9..54573741b9 100644
--- a/crawl-ref/docs/crawl_options.txt
+++ b/crawl-ref/docs/crawl_options.txt
@@ -54,9 +54,11 @@ The contents of this text are:
easy_exit_menu, default_autoprayer, sort_menus
4-j Message and Display Improvements.
hp_warning, mp_warning, hp_colour, mp_colour, always_greet,
- terse_hand, delay_message_clear, menu_colour, message_colour,
- increasing_skill_progress, show_inventory_weights,
- show_turns, show_beam, item_stack_summary_minimum
+ terse_hand, delay_message_clear, menu_colour,
+ menu_colour_prefix_id, menu_colour_prefix_class
+ message_colour, increasing_skill_progress,
+ show_inventory_weights, show_turns, show_beam,
+ item_stack_summary_minimum
4-k Missiles.
fire_items_start, fire_order
4-l Message Channels.
@@ -936,6 +938,9 @@ menu_colour = <colour>:<regex>
menu_colour = green:(worn|neck|hand|weapon)
menu_colour = red: cursed
+ To colour identified artefacts, try
+ menu_colour = white:( [-+] the)
+
If you frequently die because you forget to use emergency items, try
menu_colour = cyan:(potions? of heal wounds|teleportation)
menu_colour = lightcyan:(blinking|wand of (fire|cold|draining))
@@ -950,6 +955,33 @@ menu_colour = <colour>:<regex>
read with '?:'). The following line will show level ups in white:
menu_colour = white:Reached XP level
+menu_colour_prefix_id = false
+ Setting this option to true will prefix the string against
+ which menu_colour regexes are matched (not the string
+ displayed) with the item's identification state: "unidentified"
+ for unidentified, "known" for wands for which you know the type
+ but don't know the number of charges, and for rings with plusses
+ for which you know the type but don't know the plus value, and
+ "identified" for other identified items.
+
+ Note that the prefix is put before the the *entire* string which
+ is displayed, so if you're wielding a uncursed dagger which has
+ the 'a' slot, the string the regexes will match against is
+ "identified a - an uncursed dagger (weapon)".
+
+menu_colour_prefix_class = false
+ Setting this option to true will prefix the string against which
+ menu_colour regexes are matched (not the string displayed) with
+ the item's object type: armour, weapon, wand, etc. If both
+ this option and menu_colour_prefix_id are set to true, then
+ the identification string comes before the object type string
+ (i.e., "identified weapon", "known wand", etc).
+
+ Note that the prefix is put before the the *entire* string which
+ is displayed, so if you're wielding a uncursed dagger which has
+ the 'a' slot, the string the regexes will match against is
+ "weapon a - an uncursed dagger (weapon)".
+
message_colour = <colour>:[<channel>:]<regex>
message_colour allows you to override colours for individual messages.
For instance, if you find the low hp warning to be insufficiently
@@ -1184,6 +1216,10 @@ use_notes = true
- Dying
You can use the command ':' for manually adding notes.
+user_note_prefix = <string>
+ Prefixes manually added notes with the given string, to make
+ them easier to find.
+
note_items = <regexes>
When an item is identified, it will be noted if it is an artifact
(fixed, unrand, or random) or if its short description matches a regex.
@@ -1412,6 +1448,12 @@ classic_item_colours = false
This option will not affect the colour of existing items, only items
generated after the option is set.
+detailed_hunger = false
+ If set to true, then Crawl will tell you about three additional
+ hunger states: near starving, very hungry, and very full.
+ These hunger states are informational only, and have no effect
+ upon game play.
+
6-b DOS and Windows.
------------------------
diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt
index 3801452118..4a4108cb20 100644
--- a/crawl-ref/init.txt
+++ b/crawl-ref/init.txt
@@ -177,6 +177,8 @@ stab_brand = hi:blue
# show_turns = true
# show_beam = true
# item_stack_summary_minimum = 500
+# menu_colour_prefix_id = true
+# menu_colour_prefix_class = true
# Colouring for the inventory
menu_colour = lightred: cursed.*(worn|neck|hand|weapon)\)
@@ -184,6 +186,16 @@ menu_colour = green:(worn|neck|hand|weapon)\)
menu_colour = red: cursed
menu_colour = red: rotting
+# Identified artefacts
+menu_colour = white:( [-+] the)
+
+# These lines will colour ego items; they require that
+# menu_colour_prefix_id and menu_colour_prefix_class be set to true
+
+# menu_colour = green:(^identified armour .* pair of .* of )
+# menu_colour = lightgrey:(^identified armour .* pair of )
+# menu_colour = green:(^identified (weapon|armour) .* of )
+
# Colouring for the notes
menu_colour = white:Reached XP level
@@ -228,11 +240,12 @@ message_colour = lightcyan:LOW MAGIC WARNING
# dump_message_count = 7
# dump_order = header,hiscore,stats,misc,notes,inventory,turns_by_place,
# dump_order += skills,spells,overview,mutations,messages,screenshot
-# dump_order += kills_by_place,,kills
+# dump_order += kills_by_place,kills
##### 5-b Notes #################################
#
# use_notes = false
+# user_note_prefix=@@@
# note_items = rod,book,rune
# ood_interesting = 8
# note_hp_percent = 5
@@ -258,6 +271,8 @@ message_colour = lightcyan:LOW MAGIC WARNING
#
# classic_item_colours = true
#
+# detailed_hunger = true
+#
# See crawl_options.txt for the options
# char_set, cset_ascii, cset_ibm, cset_dec, cset_any, feature, mon_glyph
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index cf3ca6eece..5110941556 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -883,7 +883,7 @@ static bool activate_talent(const talent& tal)
break;
}
- if (hungerCheck && you.hunger_state < HS_HUNGRY)
+ if (hungerCheck && you.hunger_state <= HS_STARVING)
{
mpr("You're too hungry.");
return (false);
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)
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 63ac725453..d5b091f080 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1177,10 +1177,13 @@ enum hunger_state // you.hunger_state
{
HS_RAVENOUS, // 0: not used within code, really
HS_STARVING,
+ HS_NEAR_STARVING,
+ HS_VERY_HUNGRY,
HS_HUNGRY,
HS_SATIATED, // "not hungry" state
HS_FULL,
- HS_ENGORGED // 5
+ HS_VERY_FULL,
+ HS_ENGORGED // 8
};
enum item_status_flag_type // per item flags: ie. ident status, cursed status
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 326dee57b5..083c5c83ce 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1416,6 +1416,7 @@ public:
bool note_skill_max; // take note when skills reach new max
bool note_all_spells; // take note when learning any spell
bool use_notes; // take (and dump) notes
+ std::string user_note_prefix; // Prefix for user notes
int note_hp_percent; // percentage hp for notetaking
int ood_interesting; // how many levels OOD is noteworthy?
int easy_confirm; // make yesno() confirming easier
@@ -1439,6 +1440,7 @@ public:
bool no_dark_brand; // Attribute for branding friendly monsters
bool macro_meta_entry; // Allow user to use numeric sequences when
// creating macros
+ bool detailed_hunger; // Informational-only hunger levels
int fire_items_start; // index of first item for fire command
std::vector<unsigned> fire_order; // missile search order for 'f' command
@@ -1515,7 +1517,7 @@ public:
int explore_stop_prompt;
bool explore_greedy; // Explore goes after items as well.
-
+
// How much more eager greedy-explore is for items than to explore.
int explore_item_greed;
@@ -1523,6 +1525,9 @@ public:
std::vector<colour_mapping> menu_colour_mappings;
std::vector<message_colour_mapping> message_colour_mappings;
+ bool menu_colour_prefix_class; // Prefix item class to string
+ bool menu_colour_prefix_id; // Prefix id-status to string
+
std::vector<menu_sort_condition> sort_menus;
int dump_kill_places; // How to dump place information for kills.
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index f72ef2cf80..260100732d 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -543,37 +543,92 @@ static bool food_change(bool suppress_message)
// get new hunger state
if (you.hunger <= 1000)
newstate = HS_STARVING;
+ else if (you.hunger <= 1533)
+ newstate = HS_NEAR_STARVING;
+ else if (you.hunger <= 2066)
+ newstate = HS_VERY_HUNGRY;
else if (you.hunger <= 2600)
newstate = HS_HUNGRY;
else if (you.hunger < 7000)
newstate = HS_SATIATED;
- else if (you.hunger < 11000)
+ else if (you.hunger < 9000)
newstate = HS_FULL;
+ else if (you.hunger < 11000)
+ newstate = HS_VERY_FULL;
if (newstate != you.hunger_state)
{
+ char oldstate = you.hunger_state;
state_changed = true;
you.hunger_state = newstate;
set_redraw_status( REDRAW_HUNGER );
// Stop the travel command, if it's in progress and we just got hungry
- if (newstate < HS_SATIATED)
- interrupt_activity( AI_HUNGRY );
+ if (Options.detailed_hunger)
+ {
+ if (newstate < HS_SATIATED)
+ interrupt_activity( AI_HUNGRY );
+ }
+ else
+ {
+ // Don't interrupt on changing from hungry to very hungry
+ // or very hungry to near starving if they don't want
+ // detailed hunger info.
+ if (newstate == HS_STARVING ||
+ (newstate < HS_SATIATED && oldstate >= HS_SATIATED))
+ interrupt_activity( AI_HUNGRY );
+
+ // Don't inform user of changing from hungry to very hungry
+ // or very hungry to near starving if they don't want
+ // detailed hunger info.
+ if (newstate < HS_SATIATED && oldstate < HS_SATIATED &&
+ newstate != HS_STARVING)
+ suppress_message = true;
+ }
if (suppress_message == false)
{
- switch (you.hunger_state)
+ if (Options.detailed_hunger)
{
- case HS_STARVING:
- mpr("You are starving!", MSGCH_FOOD);
- learned_something_new(TUT_YOU_STARVING);
- break;
- case HS_HUNGRY:
- mpr("You are feeling hungry.", MSGCH_FOOD);
- learned_something_new(TUT_YOU_HUNGRY);
- break;
- default:
- break;
+ switch (you.hunger_state)
+ {
+ case HS_STARVING:
+ mpr("You are starving!", MSGCH_FOOD);
+ learned_something_new(TUT_YOU_STARVING);
+ break;
+ case HS_HUNGRY:
+ mpr("You are feeling hungry.", MSGCH_FOOD);
+ learned_something_new(TUT_YOU_HUNGRY);
+ break;
+ case HS_VERY_HUNGRY:
+ mpr("You are feeling very hungry.", MSGCH_FOOD);
+ learned_something_new(TUT_YOU_HUNGRY);
+ break;
+ case HS_NEAR_STARVING:
+ mpr("You are near starving.", MSGCH_FOOD);
+ learned_something_new(TUT_YOU_HUNGRY);
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch (you.hunger_state)
+ {
+ case HS_STARVING:
+ mpr("You are starving!", MSGCH_FOOD);
+ learned_something_new(TUT_YOU_STARVING);
+ break;
+ case HS_HUNGRY:
+ case HS_VERY_HUNGRY:
+ case HS_NEAR_STARVING:
+ mpr("You are feeling hungry.", MSGCH_FOOD);
+ learned_something_new(TUT_YOU_HUNGRY);
+ break;
+ default:
+ break;
+ }
}
}
}
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 1b885bddfd..76171d5d4f 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -610,6 +610,7 @@ void game_options::reset_options()
autopickup_no_burden = false;
use_notes = true;
+ user_note_prefix = "";
note_all_skill_levels = false;
note_skill_max = false;
note_all_spells = false;
@@ -661,6 +662,7 @@ void game_options::reset_options()
assign_item_slot = SS_FORWARD;
macro_meta_entry = true;
+ detailed_hunger = false;
// 10 was the cursor step default on Linux.
level_map_cursor_step = 7;
@@ -775,6 +777,8 @@ void game_options::reset_options()
travel_stop_message.clear();
sound_mappings.clear();
menu_colour_mappings.clear();
+ menu_colour_prefix_class = false;
+ menu_colour_prefix_id = false;
message_colour_mappings.clear();
drop_filter.clear();
map_file_name.clear();
@@ -2065,6 +2069,11 @@ void game_options::read_option_line(const std::string &str, bool runscript)
{
use_notes = read_bool( field, use_notes );
}
+ else if (key == "user_note_prefix")
+ {
+ // field is already cleaned up from trim_string()
+ user_note_prefix = field;
+ }
else if (key == "note_skill_max")
{
note_skill_max = read_bool( field, note_skill_max );
@@ -2302,6 +2311,10 @@ void game_options::read_option_line(const std::string &str, bool runscript)
{
macro_meta_entry = read_bool(field, macro_meta_entry);
}
+ else if (key == "detailed_hunger")
+ {
+ detailed_hunger = read_bool(field, detailed_hunger);
+ }
else if (key == "stop_travel" || key == "travel_stop_message")
{
std::vector<std::string> fragments = split_string(",", field);
@@ -2458,6 +2471,16 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
}
}
+ else if (key == "menu_colour_prefix_class" ||
+ key == "menu_color_prefix_class")
+ {
+ menu_colour_prefix_class = read_bool(field, menu_colour_prefix_class);
+ }
+ else if (key == "menu_colour_prefix_id" ||
+ key == "menu_color_prefix_id")
+ {
+ menu_colour_prefix_id = read_bool(field, menu_colour_prefix_id);
+ }
else if (key == "message_colour" || key == "message_color")
{
add_message_colour_mappings(field);
diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h
index d21379c22f..46b30a33c2 100644
--- a/crawl-ref/source/invent.h
+++ b/crawl-ref/source/invent.h
@@ -18,6 +18,7 @@
#include <vector>
#include "menu.h"
#include "enum.h"
+#include "itemname.h"
enum object_selector
{
@@ -85,6 +86,13 @@ public:
const bool is_item_equipped() const;
const int item_freshness() const;
+ virtual int highlight_colour() const
+ {
+ return menu_colour(get_text(),
+ menu_colour_item_prefix( *( (item_def*) item) ) );
+ }
+
+
private:
void add_class_hotkeys(const item_def &i);
};
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 0fa28e52c2..783951d8b9 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1986,3 +1986,54 @@ bool is_interesting_item( const item_def& item )
return (true);
return (false);
}
+
+const std::string menu_colour_item_prefix(const item_def &item)
+{
+ std::string str = "";
+
+ if (Options.menu_colour_prefix_id)
+ {
+ if (item_ident(item, ISFLAG_KNOW_TYPE)
+ || item.base_type == OBJ_FOOD
+ || item.base_type == OBJ_CORPSES)
+ {
+ str += "identified ";
+ }
+ else
+ {
+ if (get_ident_type(item.base_type,
+ item.sub_type) == ID_KNOWN_TYPE)
+ {
+ // Wands are only fully identified if we know the
+ // number of charges.
+ if (item.base_type == OBJ_WANDS)
+ str += "known ";
+ // Rings are fully identified simply by knowing their
+ // type, unless the ring has plusses, like a ring of
+ // dexterity.
+ else if (item.base_type == OBJ_JEWELLERY
+ && !jewellery_is_amulet(item))
+ {
+ if (item.plus == 0 && item.plus2 == 0)
+ str += "identified ";
+ else
+ str += "known ";
+ }
+ // All other types of magical items are fully identified
+ // simply by knowing the type
+ else
+ str += "identified ";
+ }
+ else
+ str += "unidentified ";
+ }
+ }
+
+ if (Options.menu_colour_prefix_class)
+ {
+ str += item_class_name(item.base_type, true) + " ";
+ }
+
+ return str;
+}
+
diff --git a/crawl-ref/source/itemname.h b/crawl-ref/source/itemname.h
index 33ce92f5fd..d0b47d9c0a 100644
--- a/crawl-ref/source/itemname.h
+++ b/crawl-ref/source/itemname.h
@@ -113,4 +113,9 @@ item_type_id_state_type get_ident_type(object_class_type basetype,
void set_ident_type( object_class_type basetype, int subtype,
item_type_id_state_type setting, bool force = false);
+/* ***********************************************************************
+ * called from: command - itemname - invent.h
+ * *********************************************************************** */
+const std::string menu_colour_item_prefix(const item_def &item);
+
#endif
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index c379460d8f..660786404e 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -991,12 +991,14 @@ bool slider_menu::line_up()
// Menu colouring
//
-int menu_colour(const std::string &text)
+int menu_colour(const std::string &text, const std::string &prefix)
{
+ std::string tmp_text = prefix + text;
+
for (int i = 0, size = Options.menu_colour_mappings.size(); i < size; ++i)
{
colour_mapping &cm = Options.menu_colour_mappings[i];
- if (cm.pattern.matches(text))
+ if (cm.pattern.matches(tmp_text))
return (cm.colour);
}
return (-1);
@@ -1004,7 +1006,7 @@ int menu_colour(const std::string &text)
int MenuHighlighter::entry_colour(const MenuEntry *entry) const
{
- return (::menu_colour(entry->get_text()));
+ return entry->highlight_colour();
}
///////////////////////////////////////////////////////////////////////
diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h
index f169263a98..f2fbc5b359 100644
--- a/crawl-ref/source/menu.h
+++ b/crawl-ref/source/menu.h
@@ -47,6 +47,9 @@ struct menu_letter
struct item_def;
+int menu_colour(const std::string &itemtext,
+ const std::string &prefix = "");
+
struct MenuEntry
{
std::string text;
@@ -103,6 +106,11 @@ struct MenuEntry
return text;
}
+ virtual int highlight_colour() const
+ {
+ return (menu_colour(get_text()));
+ }
+
virtual bool selected() const
{
return selected_qty > 0 && quantity;
@@ -403,7 +411,6 @@ protected:
bool jump_to( int linenum );
};
-int menu_colour(const std::string &itemtext);
int linebreak_string( std::string& s, int wrapcol, int maxcol );
int linebreak_string2( std::string& s, int maxcol );
void print_formatted_paragraph( std::string &s, int maxcol,
diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc
index 37fcc9a502..c675b30639 100644
--- a/crawl-ref/source/notes.cc
+++ b/crawl-ref/source/notes.cc
@@ -318,7 +318,7 @@ std::string Note::describe( bool when, bool where, bool what ) const
result << name;
break;
case NOTE_USER_NOTE:
- result << name;
+ result << Options.user_note_prefix << name;
break;
case NOTE_MESSAGE:
result << name;
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 5f080bf755..8a61126fc1 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -334,7 +334,8 @@ void print_stats(void)
const item_def& wpn = you.inv[you.equip[EQ_WEAPON]];
textcolor(wpn.colour);
- const int prefcol = menu_colour(wpn.name(DESC_INVENTORY));
+ const std::string prefix = menu_colour_item_prefix(wpn);
+ const int prefcol = menu_colour(wpn.name(DESC_INVENTORY), prefix);
if (prefcol != -1)
textcolor(prefcol);
@@ -390,30 +391,79 @@ void print_stats(void)
break;
}
- switch (you.hunger_state)
+ if (Options.detailed_hunger)
{
- case HS_ENGORGED:
- textcolor( LIGHTGREEN );
- cprintf( "Engorged" );
- break;
+ switch (you.hunger_state)
+ {
+ case HS_ENGORGED:
+ textcolor( LIGHTGREEN );
+ cprintf( "Engorged" );
+ break;
- case HS_FULL:
- textcolor( GREEN );
- cprintf( "Full" );
- break;
+ case HS_VERY_FULL:
+ textcolor( GREEN );
+ cprintf( "Very Full" );
+ break;
- case HS_SATIATED:
- break;
+ case HS_FULL:
+ textcolor( GREEN );
+ cprintf( "Full" );
+ break;
- case HS_HUNGRY:
- textcolor( YELLOW );
- cprintf( "Hungry" );
- break;
+ case HS_SATIATED:
+ break;
- case HS_STARVING:
- textcolor( RED );
- cprintf( "Starving" );
- break;
+ case HS_HUNGRY:
+ textcolor( YELLOW );
+ cprintf( "Hungry" );
+ break;
+
+ case HS_VERY_HUNGRY:
+ textcolor( YELLOW );
+ cprintf( "Very Hungry" );
+ break;
+
+ case HS_NEAR_STARVING:
+ textcolor( YELLOW );
+ cprintf( "Near Starving" );
+ break;
+
+ case HS_STARVING:
+ textcolor( RED );
+ cprintf( "Starving" );
+ break;
+ }
+ }
+ else
+ {
+ switch (you.hunger_state)
+ {
+ case HS_ENGORGED:
+ textcolor( LIGHTGREEN );
+ cprintf( "Engorged" );
+ break;
+
+ case HS_VERY_FULL:
+ case HS_FULL:
+ textcolor( GREEN );
+ cprintf( "Full" );
+ break;
+
+ case HS_SATIATED:
+ break;
+
+ case HS_HUNGRY:
+ case HS_VERY_HUNGRY:
+ case HS_NEAR_STARVING:
+ textcolor( YELLOW );
+ cprintf( "Hungry" );
+ break;
+
+ case HS_STARVING:
+ textcolor( RED );
+ cprintf( "Starving" );
+ break;
+ }
}
textcolor( LIGHTGREY );
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 69a88c8991..f4fe9263c6 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1474,7 +1474,7 @@ int staff_spell( int staff )
food = diff * 5;
}
- if (food && (you.hunger_state < HS_HUNGRY || you.hunger <= food))
+ if (food && (you.hunger_state <= HS_STARVING || you.hunger <= food))
{
mpr("You don't have the energy to cast that spell.");
return (-1);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 47099858e5..49600fab71 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -652,7 +652,7 @@ bool cast_a_spell()
}
if (you.is_undead != US_UNDEAD
- && (you.hunger_state < HS_HUNGRY
+ && (you.hunger_state <= HS_STARVING
|| you.hunger <= spell_hunger( spell )))
{
mpr("You don't have the energy to cast that spell.");