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/food.cc | 83 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 14 deletions(-) (limited to 'crawl-ref/source/food.cc') 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; + } } } } -- cgit v1.2.3-54-g00ecf