diff options
-rw-r--r-- | crawl-ref/source/acr.cc | 38 | ||||
-rw-r--r-- | crawl-ref/source/defines.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/direct.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/libutil.cc | 11 | ||||
-rw-r--r-- | crawl-ref/source/output.cc | 17 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 6 |
6 files changed, 53 insertions, 22 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 3aa3b5cb76..1793552274 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1758,16 +1758,7 @@ void get_visible_monsters(std::vector<std::string>& describe) } if (mons.empty()) - { - mpr("There are no monsters in sight!"); - return; - } - else if (mons.size() == 1) - { - mprf("You can see %s.", - mons_type_name(mons[0]->type, DESC_NOCAP_A).c_str()); return; - } std::sort( mons.begin(), mons.end(), _compare_monsters_attitude ); @@ -1789,8 +1780,11 @@ void get_visible_monsters(std::vector<std::string>& describe) count++; } // handle last monster - if (_compare_monsters_attitude(mons[size-2], mons[size-1])) + if (mons.size() == 1 || + _compare_monsters_attitude(mons[size-2], mons[size-1])) + { describe.push_back(_get_monster_name(mons[size-1], true)); + } else { describe.push_back(number_in_words(count) + " " @@ -1802,11 +1796,25 @@ static void _mpr_monsters() { std::vector<std::string> describe; get_visible_monsters(describe); - std::string msg = "You can see "; - msg += comma_separated_line(describe.begin(), describe.end(), - ", and ", ", "); - msg += "."; - mpr(msg.c_str()); + + if (describe.empty()) + { + mpr("There are no monsters in sight!"); + } + else if (describe.size() == 1) + { + mprf("You can see %s.", describe[0].c_str()); + } + else + { + std::string msg = "You can see "; + msg += comma_separated_line(describe.begin(), + describe.end(), + ", and ", ", "); + msg += "."; + mpr(msg.c_str()); + } + } /* note that in some actions, you don't want to clear afterwards. diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h index d171254ade..a028036591 100644 --- a/crawl-ref/source/defines.h +++ b/crawl-ref/source/defines.h @@ -318,6 +318,7 @@ enum GotoRegion GOTO_MSG, // cprintf > message GOTO_STAT, // cprintf > character status GOTO_DNGN, // cprintf > dungeon screen + GOTO_MLIST,// cprintf > monster list GOTO_LAST // cprintf > last active region or CRT, if none }; diff --git a/crawl-ref/source/direct.h b/crawl-ref/source/direct.h index 857e51ab9b..8caedfa583 100644 --- a/crawl-ref/source/direct.h +++ b/crawl-ref/source/direct.h @@ -47,6 +47,8 @@ public: 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. + coord_def mlistsz; // Size of the monster list. crawl_view_buffer vbuf; // Buffer for drawing the main game map. diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc index 542bbbc162..1599ff1411 100644 --- a/crawl-ref/source/libutil.cc +++ b/crawl-ref/source/libutil.cc @@ -576,12 +576,23 @@ int snprintf( char *str, size_t size, const char *format, ... ) #ifndef USE_TILE void cgotoxy(int x, int y, int region) { + ASSERT(x >= 1); + ASSERT(y >= 1); switch(region) { + case GOTO_MLIST: + ASSERT(x <= crawl_view.mlistsz.x); + ASSERT(y <= crawl_view.mlistsz.y); + gotoxy_sys(x + crawl_view.mlistp.x - 1, y + crawl_view.mlistp.y - 1); + break; case GOTO_STAT: + ASSERT(x <= crawl_view.hudsz.x); + ASSERT(y <= crawl_view.hudsz.y); gotoxy_sys(x + crawl_view.hudp.x - 1, y + crawl_view.hudp.y - 1); break; case GOTO_MSG: + ASSERT(x <= crawl_view.msgsz.x); + ASSERT(y <= crawl_view.msgsz.y); gotoxy_sys(x + crawl_view.msgp.x - 1, y + crawl_view.msgp.y - 1); break; case GOTO_CRT: diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 9f5f00d271..03fad347f9 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -711,31 +711,31 @@ static void _print_stats_line3() textcolor( LIGHTGREY ); } -static void _print_stats_line4_monsters(int start_row) +static void _print_stats_line4_monsters() { // TODO: // - print monster glyph, in proper color // - get health and friendliness in there (using color and/or text) - // - don't squeeze down into the message area extern void get_visible_monsters(std::vector<std::string>& ); std::vector<std::string> describe; get_visible_monsters(describe); - const int max_print = get_number_of_lines()-start_row; + const int max_print = crawl_view.mlistsz.y; const int num_print = MIN(max_print, int(describe.size())); + // Print the visible monsters for (int i=0; i<num_print; i++) { - cgotoxy(1, start_row+i, GOTO_STAT); + cgotoxy(1, i+1, GOTO_MLIST); clear_to_end_of_line(); - cgotoxy(1, start_row+i, GOTO_STAT); + cgotoxy(1, i+1, GOTO_MLIST); cprintf(describe[i].c_str()); } // Clear out the rest for (int i=num_print; i<max_print; i++) { - cgotoxy(1, start_row+i, GOTO_STAT); + cgotoxy(1, i+1, GOTO_MLIST); clear_to_end_of_line(); } } @@ -807,8 +807,11 @@ void print_stats(void) if (you.redraw_status_flags & REDRAW_LINE_3_MASK) _print_stats_line3(); +#ifndef USE_TILE + // FIXME: implement this for tiles if (true /* xxx: expensive? */) - _print_stats_line4_monsters(18); + _print_stats_line4_monsters(); +#endif you.redraw_status_flags = 0; diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 8edb59cb73..14480e3631 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -4777,6 +4777,8 @@ crawl_view_geometry::crawl_view_geometry() : termsz(80, 24), viewp(1, 1), viewsz(33, 17), hudp(40, 1), hudsz(41, 17), msgp(1, viewp.y + viewsz.y), msgsz(80, 7), + mlistp(hudp.x, hudp.y + hudsz.y), + mlistsz(hudsz.x, msgp.y - mlistp.y), vbuf(), vgrdc(), viewhalfsz(), glos1(), glos2(), vlos1(), vlos2(), mousep(), last_player_pos() { @@ -4898,6 +4900,10 @@ void crawl_view_geometry::init_geometry() hudp.x += hudmarg > hud_increase_max? hud_increase_max : hudmarg; } + // Monster list takes up all space between the hud and the message pane + mlistp = coord_def(hudp.x, hudp.y + hudsz.y); + mlistsz = coord_def(termsz.x - mlistp.x, msgp.y - mlistp.y); + #ifdef USE_TILE // libgui may redefine these based on its own settings gui_init_view_params(termsz, viewsz, msgp, msgsz, hudp, hudsz); |