diff options
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/direct.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/externs.h | 4 | ||||
-rw-r--r-- | crawl-ref/source/misc.cc | 36 | ||||
-rw-r--r-- | crawl-ref/source/misc.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/output.cc | 147 | ||||
-rw-r--r-- | crawl-ref/source/output.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 34 |
8 files changed, 124 insertions, 105 deletions
diff --git a/crawl-ref/source/direct.h b/crawl-ref/source/direct.h index 702d2ffd97..bf060d1d61 100644 --- a/crawl-ref/source/direct.h +++ b/crawl-ref/source/direct.h @@ -45,7 +45,7 @@ public: coord_def viewp; // Left-top pos of viewport. coord_def viewsz; // Size of the viewport (play area). coord_def hudp; // Left-top pos of status area. - const coord_def hudsz; // Size of the status area. + coord_def hudsz; // Size of the status area. coord_def msgp; // Left-top pos of the message pane. coord_def msgsz; // Size of the message pane. coord_def mlistp; // Left-top pos of the monster list. diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 2b296482e2..21cc715d54 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -499,8 +499,8 @@ private: class PlaceInfo { public: - int level_type; - int branch; + int level_type; // enum level_area_type + int branch; // enum branch_type if LEVEL_DUNGEON; otherwise -1 unsigned long num_visits; unsigned long levels_seen; diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 0c21d3394c..6e24395952 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -2286,44 +2286,10 @@ void trackers_init_new_level(bool transit) stash_init_new_level(); } -std::string level_description_string() -{ - 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"; - - if (you.level_type == LEVEL_PORTAL_VAULT) - { - if (you.level_type_name == "bazaar") - return "- a Bazaar"; - - return "- a Portal Chamber"; - } - - // 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) { take_note(Note(NOTE_DUNGEON_LEVEL_CHANGE)); - print_stats_level(level_description_string()); + print_stats_level(); #ifdef DGL_WHEREIS whereis_record(); #endif diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h index 2223757511..096c3f67e4 100644 --- a/crawl-ref/source/misc.h +++ b/crawl-ref/source/misc.h @@ -58,8 +58,6 @@ void merfolk_start_swimming(void); * *********************************************************************** */ void new_level(void); -std::string level_description_string(); - void trackers_init_new_level(bool transit); // last updated 12may2000 {dlb} diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index b931ff01bf..87d35de6df 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -24,6 +24,7 @@ #include "externs.h" #include "abl-show.h" +#include "branch.h" #include "describe.h" #include "direct.h" #include "format.h" @@ -41,6 +42,7 @@ #include "newgame.h" #include "ouch.h" #include "player.h" +#include "place.h" #include "quiver.h" #include "religion.h" #include "skills2.h" @@ -225,7 +227,7 @@ void update_turn_count() return; } - cgotoxy(19+6, 2, GOTO_STAT); + cgotoxy(19+6, 9, GOTO_STAT); textcolor(LIGHTGREY); // Show the turn count starting from 1. You can still quit on turn 0. @@ -293,7 +295,7 @@ static void _print_stats_mp(int x, int y) break; } } - cgotoxy(x+7, y, GOTO_STAT); + cgotoxy(x+8, y, GOTO_STAT); cprintf( "%d", you.magic_points); @@ -312,36 +314,39 @@ static void _print_stats_mp(int x, int y) static void _print_stats_hp(int x, int y) { const int max_max_hp = you.hp_max + player_rotted(); - int hp_percent; - if ( max_max_hp ) - hp_percent = (you.hp * 100) / max_max_hp; - else - hp_percent = 100; - for ( unsigned int i = 0; i < Options.hp_colour.size(); ++i ) + // Calculate colour + short hp_colour = LIGHTGREY; { - if ( i+1 == Options.hp_colour.size() || - hp_percent > Options.hp_colour[i+1].first ) + const int hp_percent = + (you.hp * 100) / (max_max_hp ? max_max_hp : you.hp); + + for ( unsigned int i = 0; i < Options.hp_colour.size(); ++i ) { - textcolor(Options.hp_colour[i].second); - break; + if ( i+1 == Options.hp_colour.size() || + hp_percent > Options.hp_colour[i+1].first ) + { + hp_colour = Options.hp_colour[i].second; + break; + } } } - cgotoxy(x+4, y, GOTO_STAT); - int col = -wherex(); - cprintf( "%d", you.hp ); + // 01234567890123456789 + // Health: xxx/yyy (zzz) + cgotoxy(x, y, GOTO_STAT); + textcolor(BROWN); + cprintf(max_max_hp != you.hp_max ? "HP: " : "Health: "); + textcolor(hp_colour); + cprintf( "%d", you.hp ); textcolor(LIGHTGREY); cprintf( "/%d", you.hp_max ); - if (max_max_hp != you.hp_max) cprintf( " (%d)", max_max_hp ); - col += wherex(); - if (max_max_hp != you.hp_max) - col += _count_digits(max_max_hp) + 3; - for (int i = 14-col; i > 0; i--) + int col = wherex() - crawl_view.hudp.x; + for (int i = 18-col; i > 0; i--) cprintf(" "); if (! Options.classic_hud) @@ -778,13 +783,18 @@ static void _print_status_lights(int y) you.redraw_status_flags = 0; std::vector<status_light> lights; + static int last_number_of_lights = 0; + _get_status_lights(lights); + if (lights.size() == 0 && last_number_of_lights == 0) + return; + size_t line_cur = y; const size_t line_end = crawl_view.hudsz.y+1; - size_t i_light = 0; - _get_status_lights(lights); cgotoxy(1, line_cur, GOTO_STAT); ASSERT(wherex()-crawl_view.hudp.x == 0); + + size_t i_light = 0; while (true) { const int end_x = (wherex() - crawl_view.hudp.x) + @@ -838,24 +848,25 @@ void print_stats(void) { cgotoxy(1,8, GOTO_STAT); textcolor(Options.status_caption_colour); - cprintf("Exp level: "); - textcolor(LIGHTGREY); - cprintf("%d", you.experience_level); - - cgotoxy(19,8, GOTO_STAT); - textcolor(Options.status_caption_colour); - cprintf("Pool: "); + cprintf("Exp Pool: "); textcolor(LIGHTGREY); #if DEBUG_DIAGNOSTICS - cprintf("%d/%d (%d)", + cprintf("%d/%d (%d) ", you.skill_cost_level, you.exp_available, you.experience); #else - cprintf("%d", you.exp_available); + cprintf("%-6d", you.exp_available); #endif - clear_to_end_of_line(); you.redraw_experience = false; } + // If Options.show_turns, line 9 is Gold and Turns + int yhack = 0; + if (Options.show_turns) + { + yhack = 1; + cgotoxy(1+6, 9, GOTO_STAT); cprintf("%d", you.gold); + } + if (you.wield_change) { // weapon_change is set in a billion places; probably not all @@ -868,12 +879,12 @@ void print_stats(void) // Also, it's a little bogus to change simulation state in // render code. We should find a better place for this. you.m_quiver->on_weapon_changed(); - _print_stats_wp(10); + _print_stats_wp(9+yhack); } if (you.redraw_quiver || you.wield_change) { - _print_stats_qv(11); + _print_stats_qv(10+yhack); } you.wield_change = false; you.redraw_quiver = false; @@ -881,21 +892,51 @@ void print_stats(void) if (you.redraw_status_flags) { you.redraw_status_flags = 0; - _print_status_lights(12); + _print_status_lights(11+yhack); } update_screen(); } +static std::string _level_description_string_hud() +{ + const PlaceInfo& place = you.get_place_info(); + std::string short_name = place.short_name(); + + if (place.level_type == LEVEL_DUNGEON + && branches[place.branch].depth > 1) + { + short_name += make_stringf(":%d", player_branch_depth()); + } + // Indefinite articles + else if ( place.level_type == LEVEL_PORTAL_VAULT + || place.level_type == LEVEL_LABYRINTH) + { + if (you.level_type_name == "bazaar") + short_name = "A Bazaar"; + else + short_name.insert(0, "A "); + } + // Definite articles + else if (place.level_type == LEVEL_ABYSS) + { + short_name.insert(0, "The "); + } + return short_name; +} + // For some odd reason, only redrawn on level change. -void print_stats_level(const std::string& description) +void print_stats_level() { - cgotoxy(7, 9, GOTO_STAT); + textcolor(BROWN); + cgotoxy(19, 8, GOTO_STAT); + cprintf("Level: "); + textcolor(LIGHTGREY); #if DEBUG_DIAGNOSTICS cprintf( "(%d) ", you.your_level + 1 ); #endif - cprintf("%s", description.c_str()); + cprintf("%s", _level_description_string_hud().c_str()); clear_to_end_of_line(); } @@ -920,20 +961,29 @@ void redraw_skill(const std::string &your_name, const std::string &class_name) title = trimmed_name + ", " + class_name; } + // Line 1: Foo the Bar *WIZARD* cgotoxy(1, 1, GOTO_STAT); - textcolor( YELLOW ); + if (title.size() > WIDTH) + title.resize(WIDTH, ' '); cprintf( "%-*s", WIDTH, title.c_str() ); - - cgotoxy(1, 2, GOTO_STAT); - cprintf("%s", species_name( you.species, you.experience_level ).c_str()); if (you.wizard) { textcolor( LIGHTBLUE ); - cgotoxy(1 + crawl_view.hudsz.x-9, 2, GOTO_STAT); + cgotoxy(1 + crawl_view.hudsz.x-9, 1, GOTO_STAT); cprintf(" *WIZARD*"); } + // Line 2: + // Level N Minotaur [of God] + textcolor( YELLOW ); + cgotoxy(1, 2, GOTO_STAT); + cprintf("Level %d %s", + you.experience_level, + species_name( you.species, you.experience_level ).c_str()); + if (you.religion != GOD_NO_GOD) + cprintf(" of %s", god_name(you.religion).c_str()); + textcolor( LIGHTGREY ); } @@ -945,23 +995,22 @@ void draw_border(void) textcolor(Options.status_caption_colour); - cgotoxy( 1, 3, GOTO_STAT); cprintf("HP:"); + //cgotoxy( 1, 3, GOTO_STAT); cprintf("Hp:"); cgotoxy( 1, 4, GOTO_STAT); cprintf("Magic:"); cgotoxy( 1, 5, GOTO_STAT); cprintf("Str:"); cgotoxy( 1, 6, GOTO_STAT); cprintf("Int:"); cgotoxy( 1, 7, GOTO_STAT); cprintf("Dex:"); - // cgotoxy( 1, 8, GOTO_STAT); cprintf("Exp level:"); cgotoxy(19, 5, GOTO_STAT); cprintf("AC:"); cgotoxy(19, 6, GOTO_STAT); cprintf("Sh:"); cgotoxy(19, 7, GOTO_STAT); cprintf("Ev:"); - //cgotoxy(19, 8, GOTO_STAT); cprintf("Pool:"); + + // Line 8 is exp pool, Level if (Options.show_turns) { - cgotoxy(19, 2, GOTO_STAT); cprintf("Turn:"); + cgotoxy( 1, 9, GOTO_STAT); cprintf("Gold:"); + cgotoxy(19, 9, GOTO_STAT); cprintf("Turn:"); } - textcolor(LIGHTGREY); - cgotoxy( 1,9, GOTO_STAT); cprintf("Level"); } // end draw_border() // ---------------------------------------------------------------------- diff --git a/crawl-ref/source/output.h b/crawl-ref/source/output.h index 899576e562..c1bc15b614 100644 --- a/crawl-ref/source/output.h +++ b/crawl-ref/source/output.h @@ -49,7 +49,7 @@ void update_message_status(); void update_turn_count(); void print_stats(); -void print_stats_level(const std::string& description); +void print_stats_level(); void draw_border(); void redraw_skill(const std::string &your_name, const std::string &class_name); void update_monster_pane(); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 3151449c10..0a0c8673c8 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -6614,7 +6614,7 @@ const std::string PlaceInfo::short_name() const return "Labyrinth"; case LEVEL_PORTAL_VAULT: - return "Portal Vault"; + return "Portal Chamber"; default: return "Bug"; diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 3c9870198c..ca82ad6af7 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -4941,9 +4941,6 @@ void crawl_view_buffer::size(const coord_def &sz) buffer = new screen_buffer_t [ sz.x * sz.y * 2 ]; } -////////////////////////////////////////////////////////////////////////////// -// crawl_view_geometry - // ---------------------------------------------------------------------- // Layout helper classes // ---------------------------------------------------------------------- @@ -4953,8 +4950,8 @@ void crawl_view_buffer::size(const coord_def &sz) // define VIEW_MAX_HEIGHT use Options.view_max_height // define VIEW_MIN_WIDTH defined elsewhere // define VIEW_MAX_WIDTH use Options.view_max_width -# define HUD_WIDTH 42 -# define HUD_HEIGHT 13 +#define HUD_WIDTH 42 +#define HUD_HEIGHT 12 #define MSG_MIN_HEIGHT 7 #define MSG_MAX_HEIGHT Options.msg_max_height #define MLIST_MIN_HEIGHT Options.mlist_min_height @@ -4973,10 +4970,10 @@ static void _increment(int& lvalue, int delta, int max_value) class _layout { public: - _layout(coord_def termsz_) : + _layout(coord_def termsz_, coord_def hudsz_) : termp(1,1), termsz(termsz_), viewp(-1,-1), viewsz(VIEW_MIN_WIDTH, VIEW_MIN_HEIGHT), - hudp(-1,-1), hudsz(HUD_WIDTH, HUD_HEIGHT), + hudp(-1,-1), hudsz(hudsz_), msgp(-1,-1), msgsz(0, MSG_MIN_HEIGHT), mlistp(-1,-1), mlistsz(MLIST_MIN_WIDTH, 0), hud_gutter(HUD_MIN_GUTTER), @@ -5007,7 +5004,7 @@ class _layout const coord_def termp, termsz; coord_def viewp, viewsz; coord_def hudp; - coord_def hudsz; + const coord_def hudsz; coord_def msgp, msgsz; coord_def mlistp, mlistsz; int hud_gutter; @@ -5022,7 +5019,9 @@ class _layout class _inline_layout : public _layout { public: - _inline_layout(coord_def c) : _layout(c) { valid = _init(); } + _inline_layout(coord_def termsz_, coord_def hudsz_) : + _layout(termsz_, hudsz_) + { valid = _init(); } bool _init() { // x: View gets leftover; then mlist; then hud gutter @@ -5089,7 +5088,9 @@ class _inline_layout : public _layout class _mlist_col_layout : public _layout { public: - _mlist_col_layout(coord_def c) : _layout(c) { valid = _init(); } + _mlist_col_layout(coord_def termsz_, coord_def hudsz_) + : _layout(termsz_, hudsz_) + { valid = _init(); } bool _init() { // Don't let the mlist column steal all the width. Up front, @@ -5136,10 +5137,14 @@ class _mlist_col_layout : public _layout } }; +// ---------------------------------------------------------------------- +// crawl_view_geometry +// ---------------------------------------------------------------------- + crawl_view_geometry::crawl_view_geometry() : termp(1, 1), termsz(80, 24), viewp(1, 1), viewsz(33, 17), - hudp(40, 1), hudsz(HUD_WIDTH, HUD_HEIGHT), + hudp(40, 1), hudsz(-1, -1), msgp(1, viewp.y + viewsz.y), msgsz(80, 7), mlistp(hudp.x, hudp.y + hudsz.y), mlistsz(hudsz.x, msgp.y - mlistp.y), @@ -5213,9 +5218,10 @@ void crawl_view_geometry::set_player_at(const coord_def &c, bool centre) void crawl_view_geometry::init_geometry() { termsz = coord_def( get_number_of_cols(), get_number_of_lines() ); + hudsz = coord_def(HUD_WIDTH, HUD_HEIGHT + (Options.show_turns ? 1 : 0)); - const _inline_layout lay_inline(termsz); - const _mlist_col_layout lay_mlist(termsz); + const _inline_layout lay_inline(termsz, hudsz); + const _mlist_col_layout lay_mlist(termsz, hudsz); if (! lay_inline.valid) { @@ -5244,7 +5250,7 @@ void crawl_view_geometry::init_geometry() viewp = winner->viewp; viewsz = winner->viewsz; hudp = winner->hudp; - // hudsz = winner->hudsz; size is constant + hudsz = winner->hudsz; mlistp = winner->mlistp; mlistsz = winner->mlistsz; |