diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-06-02 17:51:08 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-06-02 17:51:08 +0000 |
commit | 77bd894ea2391d0575ff39afac149ee4e54adc2c (patch) | |
tree | d89a4935818020cb6931869618753c701bd3d5a6 /crawl-ref/source/direct.cc | |
parent | 882095e2a137991f94fb71584a9290bbc333d42b (diff) | |
download | crawl-ref-77bd894ea2391d0575ff39afac149ee4e54adc2c.tar.gz crawl-ref-77bd894ea2391d0575ff39afac149ee4e54adc2c.zip |
Highlight monsters in the path of a beam (with :).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1512 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/direct.cc')
-rw-r--r-- | crawl-ref/source/direct.cc | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 0b746910d5..9b6407c8be 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -271,6 +271,25 @@ static const char *target_mode_help_text(int mode) } } +static void draw_ray_glyph(const coord_def &pos, int colour, + int glych, int mcol) +{ + int mid = mgrd(pos); + if (mid != NON_MONSTER) + { + const monsters *mons = &menv[mid]; + if (mons->alive() && player_monster_visible(mons)) + { + glych = get_screen_glyph(pos.x, pos.y); + colour = mcol; + } + } + const coord_def vp = grid2view(pos); + gotoxy(vp.x, vp.y); + textcolor( real_colour(colour) ); + putch(glych); +} + //--------------------------------------------------------------- // // direction @@ -731,22 +750,21 @@ void direction(dist& moves, targeting_type restricts, { viewwindow(true, false); if ( show_beam && - in_vlos(grid2viewX(moves.tx), grid2viewY(moves.ty)) ) + in_vlos(grid2viewX(moves.tx), grid2viewY(moves.ty)) && + moves.target() != you.pos() ) { // Draw the new ray with magenta '*'s, not including // your square or the target square. ray_def raycopy = ray; // temporary copy to work with - textcolor(MAGENTA); - while ( raycopy.x() != moves.tx || raycopy.y() != moves.ty ) + while ( raycopy.pos() != moves.target() ) { - if ( raycopy.x() != you.x_pos || raycopy.y() != you.y_pos ) + if ( raycopy.pos() != you.pos() ) { // Sanity: don't loop forever if the ray is problematic if ( !in_los(raycopy.x(), raycopy.y()) ) break; - gotoxy( grid2viewX(raycopy.x()), - grid2viewY(raycopy.y())); - cprintf("*"); + draw_ray_glyph(raycopy.pos(), MAGENTA, '*', + MAGENTA | COLFLAG_REVERSE); } raycopy.advance_through(moves.target()); } |