From 689dba0985490d701f4b9a5ef2e9a1c93f93e999 Mon Sep 17 00:00:00 2001 From: haranp Date: Tue, 16 Jan 2007 15:42:01 +0000 Subject: Added level_map_title option per 1598159. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@855 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/docs/crawl_options.txt | 5 ++++- crawl-ref/init.txt | 1 + crawl-ref/source/externs.h | 1 + crawl-ref/source/initfile.cc | 6 ++++++ crawl-ref/source/misc.cc | 42 +++++++++++++++++++++++++++++----------- crawl-ref/source/misc.h | 2 ++ crawl-ref/source/view.cc | 19 +++++++++++++++--- 7 files changed, 61 insertions(+), 15 deletions(-) diff --git a/crawl-ref/docs/crawl_options.txt b/crawl-ref/docs/crawl_options.txt index 8cb063da4a..e59dc216a0 100644 --- a/crawl-ref/docs/crawl_options.txt +++ b/crawl-ref/docs/crawl_options.txt @@ -32,7 +32,7 @@ The contents of this text are: 4-d Branding (Item and Monster Highlighting). heap_brand, friend_brand, stab_brand, may_stab_brand 4-e Level Map Functions. - level_map_cursor_step, item_colour + level_map_cursor_step, level_map_title, item_colour 4-f Travel and Exploration. travel_delay, travel_avoid_terrain, travel_exclude_radius2, travel_stop_message, @@ -444,6 +444,9 @@ level_map_cursor_step = 7 How many squares the cursor moves on the level map when using Shift-direction or * direction. +level_map_title = true + Whether to show the level name at the top of the level map screen. + item_colour = true Colours items on level-map. diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt index 868715cff7..831a045b42 100644 --- a/crawl-ref/init.txt +++ b/crawl-ref/init.txt @@ -105,6 +105,7 @@ stab_brand = hi:blue ##### 4-e Level Map Functions ################### # # level_map_cursor_step = 7 +# level_map_title = false # item_colour = false ##### 4-f Travel and Exploration ################# diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index f8f55cace4..c5a3009723 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -927,6 +927,7 @@ public: // Order of sections in the character dump. std::vector dump_order; + bool level_map_title; // Show title in level map bool safe_zero_exp; // If true, you feel safe around 0xp monsters bool target_zero_exp; // If true, targeting targets zero-exp // monsters. diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 58bc9105e9..7b385849dd 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -637,6 +637,8 @@ void game_options::reset_options() dos_use_background_intensity = true; #endif + level_map_title = true; + assign_item_slot = SS_FORWARD; macro_meta_entry = true; @@ -2169,6 +2171,10 @@ void game_options::read_option_line(const std::string &str, bool runscript) if (dump_item_origin_price < -1) dump_item_origin_price = -1; } + else if (key == "level_map_title") + { + level_map_title = read_bool(field, level_map_title); + } else if (key == "safe_zero_exp") { safe_zero_exp = read_bool(field, safe_zero_exp); diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index a709611da4..83573538c4 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1087,10 +1087,34 @@ static char fix_colour(char incol ) return incol; } -void new_level(void) +std::string level_description_string() { - const int curr_subdungeon_level = player_branch_depth(); + if (you.level_type == LEVEL_PANDEMONIUM) + return "- Pandemonium"; + + if (you.level_type == LEVEL_ABYSS) + return "- The Abyss"; + + if (you.level_type == LEVEL_LABYRINTH) + return "- a Labyrinth"; + + // level_type == LEVEL_DUNGEON + char buf[200]; + const int youbranch = you.where_are_you; + if ( branches[youbranch].depth == 1 ) + snprintf(buf, sizeof buf, "- %s", branches[youbranch].longname); + else + { + const int curr_subdungeon_level = player_branch_depth(); + snprintf(buf, sizeof buf, "%d of %s", curr_subdungeon_level, + branches[youbranch].longname); + } + return buf; +} + +void new_level(void) +{ textcolor(LIGHTGREY); gotoxy(46, 12); @@ -1100,21 +1124,20 @@ void new_level(void) #endif take_note(Note(NOTE_DUNGEON_LEVEL_CHANGE)); + cprintf("%s", level_description_string().c_str()); + if (you.level_type == LEVEL_PANDEMONIUM) { - cprintf("- Pandemonium "); env.floor_colour = fix_colour(mcolour[env.mons_alloc[9]]); env.rock_colour = fix_colour(mcolour[env.mons_alloc[8]]); } else if (you.level_type == LEVEL_ABYSS) { - cprintf("- The Abyss "); env.floor_colour = fix_colour(mcolour[env.mons_alloc[9]]); env.rock_colour = fix_colour(mcolour[env.mons_alloc[8]]); } else if (you.level_type == LEVEL_LABYRINTH) { - cprintf("- a Labyrinth "); env.floor_colour = LIGHTGREY; env.rock_colour = BROWN; } @@ -1122,12 +1145,6 @@ void new_level(void) { // level_type == LEVEL_DUNGEON const int youbranch = you.where_are_you; - if ( branches[youbranch].depth == 1 ) - cprintf( "- %s", branches[youbranch].longname ); - else - cprintf( "%d of %s", curr_subdungeon_level, - branches[youbranch].longname ); - env.floor_colour = branches[youbranch].floor_colour; env.rock_colour = branches[youbranch].rock_colour; @@ -1138,6 +1155,9 @@ void new_level(void) LIGHTBLUE, MAGENTA }; const char rockcolours_zot[] = { LIGHTGREY, BLUE, LIGHTBLUE, MAGENTA, LIGHTMAGENTA }; + + const int curr_subdungeon_level = player_branch_depth(); + if ( curr_subdungeon_level > 5 || curr_subdungeon_level < 1 ) mpr("Odd colouring!"); else diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h index 2ae9ebad77..5d24f2dbac 100644 --- a/crawl-ref/source/misc.h +++ b/crawl-ref/source/misc.h @@ -86,6 +86,8 @@ void itrap(struct bolt &pbolt, int trapped); * *********************************************************************** */ void new_level(void); +std::string level_description_string(); + void init_new_level(bool transit); // last updated 12may2000 {dlb} diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 810706bb41..d6c4820850 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -1887,17 +1887,30 @@ static int cset_adjust(int raw) } #endif +static int get_number_of_lines_levelmap() +{ + return get_number_of_lines() - (Options.level_map_title ? 1 : 0); +} + static void draw_level_map( int start_x, int start_y, int screen_y, bool travel_mode) { int bufcount2 = 0; screen_buffer_t buffer2[GYM * GXM * 2]; - const int num_lines = get_number_of_lines(); + const int num_lines = get_number_of_lines_levelmap(); cursor_control cs(false); #ifdef PLAIN_TERM - gotoxy(1, 1); + if ( Options.level_map_title ) + { + gotoxy(1,1); + textcolor(WHITE); + cprintf("Level %s", level_description_string().c_str()); + gotoxy(1,2); + } + else + gotoxy(1, 1); #endif for (int j = 0; j < num_lines; j++) @@ -2015,7 +2028,7 @@ void show_map( FixedVector &spec_place, bool travel_mode ) char min_x = 80, max_x = 0, min_y = 0, max_y = 0; bool found_y = false; - const int num_lines = get_number_of_lines(); + const int num_lines = get_number_of_lines_levelmap(); const int half_screen = num_lines / 2 - 1; for (j = 0; j < GYM; j++) -- cgit v1.2.3-54-g00ecf