diff options
author | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-15 04:07:07 +0000 |
---|---|---|
committer | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-15 04:07:07 +0000 |
commit | af3cd3ff34ef5da884b2c673afe1321f0cf372e7 (patch) | |
tree | a574c2155f571f216f29c44b29e333ea320322a6 /crawl-ref/source/directn.cc | |
parent | 71ed1a7fd6819916d79d194126c061ac1f087b11 (diff) | |
download | crawl-ref-af3cd3ff34ef5da884b2c673afe1321f0cf372e7.tar.gz crawl-ref-af3cd3ff34ef5da884b2c673afe1321f0cf372e7.zip |
Large tiles-related changes. Platform-specific rendering removed and replaced with SDL/OpenGL.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6550 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/directn.cc')
-rw-r--r-- | crawl-ref/source/directn.cc | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 746ac18bb3..c16b552c6b 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -121,16 +121,45 @@ void direction_choose_compass( dist& moves, targeting_behaviour *beh) moves.isCancel = false; moves.dx = moves.dy = 0; -#ifdef USE_TILE mouse_control mc(MOUSE_MODE_TARGET_DIR); -#endif beh->compass = true; +#ifdef USE_TILE + // Force update of mouse cursor to direction-compatible location. + tiles.place_cursor(CURSOR_MOUSE, tiles.get_cursor()); +#endif + do { const command_type key_command = beh->get_command(); +#ifdef USE_TILE + if (key_command == CMD_TARGET_MOUSE_MOVE) + { + continue; + } + else if (key_command == CMD_TARGET_MOUSE_SELECT) + { + const coord_def &gc = tiles.get_cursor(); + if (gc == Region::NO_CURSOR) + continue; + + coord_def delta = gc - you.pos(); + if (delta.x < -1 || delta.x > 1 + || delta.y < -1 || delta.y > 1) + { + // This shouldn't happen. + continue; + } + + moves.dx = delta.x; + moves.dy = delta.y; + moves.isMe = (delta.x == 0) && (delta.y == 0); + break; + } +#endif + if (key_command == CMD_TARGET_SELECT) { moves.dx = moves.dy = 0; @@ -597,9 +626,7 @@ void direction(dist& moves, targeting_type restricts, } else { -#ifdef USE_TILE mouse_control mc(MOUSE_MODE_TARGET); -#endif key_command = beh->get_command(); } @@ -608,8 +635,8 @@ void direction(dist& moves, targeting_type restricts, if (key_command == CMD_TARGET_MOUSE_MOVE || key_command == CMD_TARGET_MOUSE_SELECT) { - coord_def gc; - if (gui_get_mouse_grid_pos(gc)) + const coord_def &gc = tiles.get_cursor(); + if (gc != Region::NO_CURSOR) { moves.tx = gc.x; moves.ty = gc.y; @@ -2663,9 +2690,7 @@ targeting_behaviour::~targeting_behaviour() int targeting_behaviour::get_key() { -#ifdef USE_TILE mouse_control mc(MOUSE_MODE_TARGET_DIR); -#endif if (!crawl_state.is_replaying_keys()) flush_input_buffer(FLUSH_BEFORE_COMMAND); |