diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-06-02 16:54:20 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-06-02 16:54:20 +0000 |
commit | 882095e2a137991f94fb71584a9290bbc333d42b (patch) | |
tree | 3f626430f1b76875efaf35e83ea13394c5aa4afd /crawl-ref/source/direct.cc | |
parent | 35f7fe0aa994262518157cae2c4fc22e19939806 (diff) | |
download | crawl-ref-882095e2a137991f94fb71584a9290bbc333d42b.tar.gz crawl-ref-882095e2a137991f94fb71584a9290bbc333d42b.zip |
This is an experimental attempt at selecting more intuitive beams for
targeting (see 1725723):
- The default beam selected for targeting is the shortest available beam
that is closest to the Bresenham line between src->targ.
- Targeting beams convert aliased perpendiculars into diagonals, which
look better. This requires an immortal fudge to make sure the diagonal
conversion doesn't happen at the wrong places (when the conversion
would cause the beam to miss the target square).
- Tweaked beam bounce behaviour to look more natural.
Comments and suggestions welcome.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1511 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/direct.cc')
-rw-r--r-- | crawl-ref/source/direct.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 77d3a80d16..0b746910d5 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -291,7 +291,7 @@ static const char *target_mode_help_text(int mode) // dx,dy direction delta for DIR_DIR // //--------------------------------------------------------------- -void direction(struct dist& moves, targeting_type restricts, +void direction(dist& moves, targeting_type restricts, int mode, bool just_looking, const char *prompt) { // NOTE: Even if just_looking is set, moves is still interesting, @@ -466,8 +466,17 @@ void direction(struct dist& moves, targeting_type restricts, break; case CMD_TARGET_HIDE_BEAM: - show_beam = false; - need_beam_redraw = true; + if (show_beam) + { + show_beam = false; + need_beam_redraw = true; + } + else + { + show_beam = find_ray(you.x_pos, you.y_pos, moves.tx, moves.ty, + true, ray, 0, true); + need_beam_redraw = show_beam; + } break; case CMD_TARGET_FIND_YOU: @@ -696,7 +705,8 @@ void direction(struct dist& moves, targeting_type restricts, { have_moved = true; show_beam = show_beam && - find_ray(you.x_pos, you.y_pos, moves.tx, moves.ty, true, ray); + find_ray(you.x_pos, you.y_pos, moves.tx, moves.ty, true, ray, + 0, true); } if ( force_redraw ) @@ -738,7 +748,7 @@ void direction(struct dist& moves, targeting_type restricts, grid2viewY(raycopy.y())); cprintf("*"); } - raycopy.advance(); + raycopy.advance_through(moves.target()); } textcolor(LIGHTGREY); } @@ -762,7 +772,7 @@ static void extend_move_to_edge(dist &moves) int mx = 0, my = 0; if (moves.dx > 0) - mx = (GXM - 1) - you.x_pos; + mx = (GXM - 1) - you.x_pos; if (moves.dx < 0) mx = you.x_pos; |