summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-24 19:34:26 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-24 19:34:26 +0000
commit8a0b5443231c0f9740decdfef87a5f1d1cf38833 (patch)
tree0b2d850983da163868caa84b986b1d9c06176451 /crawl-ref
parent52b347d0433c143cbd2bf4f4df1a4da673681e1b (diff)
downloadcrawl-ref-8a0b5443231c0f9740decdfef87a5f1d1cf38833.tar.gz
crawl-ref-8a0b5443231c0f9740decdfef87a5f1d1cf38833.zip
[2458672] Fixing level map not using CMD_MAP_* commands or going through cmd-keys.h. This will allow these commands to be remapped correctly.
Also, fixing issue where cancelling the level map help screen in tiles wouldn't go back to viewing the dungeon. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7957 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/cmd-keys.h66
-rw-r--r--crawl-ref/source/cmd-name.h5
-rw-r--r--crawl-ref/source/enum.h4
-rw-r--r--crawl-ref/source/tilesdl.cc2
-rw-r--r--crawl-ref/source/view.cc206
5 files changed, 183 insertions, 100 deletions
diff --git a/crawl-ref/source/cmd-keys.h b/crawl-ref/source/cmd-keys.h
index 44894b846c..25c212a392 100644
--- a/crawl-ref/source/cmd-keys.h
+++ b/crawl-ref/source/cmd-keys.h
@@ -209,4 +209,70 @@
{CK_MOUSE_MOVE, CMD_TARGET_MOUSE_MOVE},
{CK_MOUSE_CLICK, CMD_TARGET_MOUSE_SELECT},
+{'?', CMD_MAP_HELP},
+{CONTROL('C'), CMD_MAP_CLEAR_MAP},
+{CONTROL('F'), CMD_MAP_FORGET},
+{CONTROL('W'), CMD_MAP_ADD_WAYPOINT},
+{'e', CMD_MAP_EXCLUDE_AREA},
+{CONTROL('E'), CMD_MAP_CLEAR_EXCLUDES},
+{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_SCROLL_UP},
+{CK_MOUSE_B4, CMD_MAP_SCROLL_UP},
+{'<', CMD_MAP_FIND_UPSTAIR},
+{'>', CMD_MAP_FIND_DOWNSTAIR},
+{'@', CMD_MAP_FIND_YOU},
+{'\t', CMD_MAP_FIND_PORTAL},
+{'^', CMD_MAP_FIND_TRAP},
+{'_', CMD_MAP_FIND_ALTAR},
+{'E', CMD_MAP_FIND_EXCLUDED},
+{'F', CMD_MAP_FIND_F},
+{'W', CMD_MAP_FIND_WAYPOINT},
+{'I', CMD_MAP_FIND_STASH},
+{'*', CMD_MAP_FIND_STASH},
+{'/', CMD_MAP_FIND_STASH_REVERSE},
+{'\'', CMD_MAP_FIND_STASH},
+{'.', CMD_MAP_GOTO_TARGET},
+{'\r', CMD_MAP_GOTO_TARGET},
+{'S', CMD_MAP_GOTO_TARGET},
+{',', CMD_MAP_GOTO_TARGET},
+{';', CMD_MAP_GOTO_TARGET},
+{ESCAPE, CMD_MAP_EXIT_MAP},
+
+#ifdef WIZARD
+{'T', CMD_MAP_WIZARD_TELEPORT},
+#endif
+
{'\0', CMD_NO_CMD}
diff --git a/crawl-ref/source/cmd-name.h b/crawl-ref/source/cmd-name.h
index af588cd2a9..71845c40e6 100644
--- a/crawl-ref/source/cmd-name.h
+++ b/crawl-ref/source/cmd-name.h
@@ -135,8 +135,11 @@
{CMD_MAP_FIND_F, "CMD_MAP_FIND_F"},
{CMD_MAP_FIND_WAYPOINT, "CMD_MAP_FIND_WAYPOINT"},
{CMD_MAP_FIND_STASH, "CMD_MAP_FIND_STASH"},
+{CMD_MAP_FIND_STASH_REVERSE, "CMD_MAP_FIND_STASH_REVERSE"},
{CMD_MAP_GOTO_TARGET, "CMD_MAP_GOTO_TARGET"},
{CMD_MAP_WIZARD_TELEPORT, "CMD_MAP_WIZARD_TELEPORT"},
+{CMD_MAP_HELP, "CMD_MAP_HELP"},
+{CMD_MAP_FORGET, "CMD_MAP_FORGET"},
{CMD_MAP_EXIT_MAP, "CMD_MAP_EXIT_MAP"},
{CMD_TARGET_DOWN_LEFT, "CMD_TARGET_DOWN_LEFT"},
{CMD_TARGET_DOWN, "CMD_TARGET_DOWN"},
@@ -190,6 +193,8 @@
{CMD_TARGET_WIZARD_PATHFIND, "CMD_TARGET_WIZARD_PATHFIND"},
{CMD_TARGET_WIZARD_GAIN_LEVEL, "CMD_TARGET_WIZARD_GAIN_LEVEL"},
{CMD_TARGET_WIZARD_MISCAST, "CMD_TARGET_WIZARD_MISCAST"},
+{CMD_TARGET_WIZARD_MAKE_SUMMONED, "CMD_TARGET_WIZARD_MAKE_SUMMONED"},
+{CMD_TARGET_WIZARD_POLYMORPH, "CMD_TARGET_WIZARD_POLYMORPH"},
{CMD_TARGET_MOUSE_MOVE, "CMD_TARGET_MOUSE_MOVE"},
{CMD_TARGET_MOUSE_SELECT, "CMD_TARGET_MOUSE_SELECT"},
{CMD_TARGET_HELP, "CMD_TARGET_HELP"},
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index d19abd8e92..8762ee968d 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -579,11 +579,15 @@ enum command_type
CMD_MAP_FIND_F,
CMD_MAP_FIND_WAYPOINT,
CMD_MAP_FIND_STASH,
+ CMD_MAP_FIND_STASH_REVERSE,
CMD_MAP_GOTO_TARGET,
CMD_MAP_WIZARD_TELEPORT,
+ CMD_MAP_HELP,
+ CMD_MAP_FORGET,
+
CMD_MAP_EXIT_MAP,
CMD_MAX_OVERMAP = CMD_MAP_EXIT_MAP,
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index 213022d969..2985abd18d 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -317,6 +317,8 @@ int TilesFramework::load_font(const char *font_file, int font_size,
void TilesFramework::load_dungeon(unsigned int *tileb, int gx, int gy)
{
+ m_active_layer = LAYER_NORMAL;
+
unsigned int ox = m_region_tile->mx/2;
unsigned int oy = m_region_tile->my/2;
m_region_tile->load_dungeon(tileb, gx - ox, gy - oy);
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index e9ec3cc37a..e92bd4bfcf 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -3337,7 +3337,6 @@ void show_map( coord_def &spec_place, bool travel_mode )
int i, j;
int move_x = 0, move_y = 0, scroll_y = 0;
- int getty = 0;
// Vector to track all features we can travel to, in order of distance.
std::vector<coord_def> features;
@@ -3404,7 +3403,7 @@ void show_map( coord_def &spec_place, bool travel_mode )
int curs_x = you.pos().x - start_x + 1;
int curs_y = you.pos().y - screen_y + half_screen + 1;
- int search_feat = 0, search_found = 0, anchor_x = -1, anchor_y = -1;
+ int search_found = 0, anchor_x = -1, anchor_y = -1;
bool map_alive = true;
bool redraw_map = true;
@@ -3453,32 +3452,53 @@ void show_map( coord_def &spec_place, bool travel_mode )
redraw_map = true;
c_input_reset(true);
- getty = unmangle_direction_keys(getchm(KC_LEVELMAP), KC_LEVELMAP,
- false, false);
-#ifdef USE_TILE
- if (getty == CK_MOUSE_B4)
- getty = '-';
- else if (getty == CK_MOUSE_B5)
- getty = '+';
-#endif
+ int key = unmangle_direction_keys(getchm(KC_LEVELMAP), KC_LEVELMAP,
+ false, false);
+ command_type cmd = key_to_command(key, KC_LEVELMAP);
+ if (cmd < CMD_MIN_OVERMAP || cmd > CMD_MAX_OVERMAP)
+ cmd = CMD_NO_CMD;
+
+ if (key == CK_MOUSE_CLICK)
+ {
+ const c_mouse_event cme = get_mouse_event();
+ const coord_def curp(start_x + curs_x - 1, start_y + curs_y - 1);
+ const coord_def grdp =
+ cme.pos + coord_def(start_x - 1, start_y - top);
+
+ if (cme.left_clicked() && in_bounds(grdp))
+ {
+ spec_place = grdp;
+ map_alive = false;
+ }
+ else if (cme.scroll_up())
+ scroll_y = -block_step;
+ else if (cme.scroll_down())
+ scroll_y = block_step;
+ else if (cme.right_clicked())
+ {
+ const coord_def delta = grdp - curp;
+ move_y = delta.y;
+ move_x = delta.x;
+ }
+ }
c_input_reset(false);
- switch (getty)
+ switch (cmd)
{
- case '?':
+ case CMD_MAP_HELP:
show_levelmap_help();
break;
- case CONTROL('C'):
+ case CMD_MAP_CLEAR_MAP:
clear_map();
break;
- case CONTROL('F'):
+ case CMD_MAP_FORGET:
forget_map(100, true);
break;
- case CONTROL('W'):
+ case CMD_MAP_ADD_WAYPOINT:
travel_cache.add_waypoint(start_x + curs_x - 1,
start_y + curs_y - 1);
// We need to do this all over again so that the user can jump
@@ -3490,7 +3510,7 @@ void show_map( coord_def &spec_place, bool travel_mode )
break;
// Cycle the radius of an exclude.
- case 'e':
+ case CMD_MAP_EXCLUDE_AREA:
{
const coord_def p(start_x + curs_x - 1, start_y + curs_y - 1);
if (is_exclude_root(p))
@@ -3502,143 +3522,160 @@ void show_map( coord_def &spec_place, bool travel_mode )
break;
}
- case CONTROL('E'):
+ case CMD_MAP_CLEAR_EXCLUDES:
clear_excludes();
_reset_travel_colours(features);
break;
- case 'b':
- case '1':
+ case CMD_MAP_MOVE_DOWN_LEFT:
move_x = -1;
move_y = 1;
break;
- case 'j':
- case '2':
+ case CMD_MAP_MOVE_DOWN:
move_y = 1;
move_x = 0;
break;
- case 'u':
- case '9':
+ case CMD_MAP_MOVE_UP_RIGHT:
move_x = 1;
move_y = -1;
break;
- case 'k':
- case '8':
+ case CMD_MAP_MOVE_UP:
move_y = -1;
move_x = 0;
break;
- case 'y':
- case '7':
+ case CMD_MAP_MOVE_UP_LEFT:
move_y = -1;
move_x = -1;
break;
- case 'h':
- case '4':
+ case CMD_MAP_MOVE_LEFT:
move_x = -1;
move_y = 0;
break;
- case 'n':
- case '3':
+ case CMD_MAP_MOVE_DOWN_RIGHT:
move_y = 1;
move_x = 1;
break;
- case 'l':
- case '6':
+ case CMD_MAP_MOVE_RIGHT:
move_x = 1;
move_y = 0;
break;
- case 'B':
+ case CMD_MAP_JUMP_DOWN_LEFT:
move_x = -block_step;
move_y = block_step;
break;
- case 'J':
+ case CMD_MAP_JUMP_DOWN:
move_y = block_step;
move_x = 0;
break;
- case 'U':
+ case CMD_MAP_JUMP_UP_RIGHT:
move_x = block_step;
move_y = -block_step;
break;
- case 'K':
+ case CMD_MAP_JUMP_UP:
move_y = -block_step;
move_x = 0;
break;
- case 'Y':
+ case CMD_MAP_JUMP_UP_LEFT:
move_y = -block_step;
move_x = -block_step;
break;
- case 'H':
+ case CMD_MAP_JUMP_LEFT:
move_x = -block_step;
move_y = 0;
break;
- case 'N':
+ case CMD_MAP_JUMP_DOWN_RIGHT:
move_y = block_step;
move_x = block_step;
break;
- case 'L':
+ case CMD_MAP_JUMP_RIGHT:
move_x = block_step;
move_y = 0;
break;
- case '+':
+ case CMD_MAP_SCROLL_DOWN:
move_y = 20;
move_x = 0;
scroll_y = 20;
break;
- case '-':
+ case CMD_MAP_SCROLL_UP:
move_y = -20;
move_x = 0;
scroll_y = -20;
break;
- case '<':
- case '>':
- case '@':
- case '\t':
- case '^':
- case '_':
- case 'E':
- case 'F':
- case 'W':
- case 'I':
- case '*':
- case '/':
- case '\'':
- {
- bool forward = true;
+ case CMD_MAP_FIND_YOU:
+ move_x = you.pos().x - (start_x + curs_x - 1);
+ move_y = you.pos().y - (start_y + curs_y - 1);
+ break;
- if (getty == '/' || getty == ';')
- forward = false;
+ case CMD_MAP_FIND_UPSTAIR:
+ case CMD_MAP_FIND_DOWNSTAIR:
+ case CMD_MAP_FIND_PORTAL:
+ case CMD_MAP_FIND_TRAP:
+ case CMD_MAP_FIND_ALTAR:
+ case CMD_MAP_FIND_EXCLUDED:
+ case CMD_MAP_FIND_F:
+ case CMD_MAP_FIND_WAYPOINT:
+ case CMD_MAP_FIND_STASH:
+ case CMD_MAP_FIND_STASH_REVERSE:
+ {
+ bool forward = (cmd != CMD_MAP_FIND_STASH_REVERSE);
- if (getty == '/' || getty == '*' || getty == ';' || getty == '\'')
+ int getty;
+ switch (cmd)
+ {
+ case CMD_MAP_FIND_UPSTAIR:
+ getty = '<';
+ break;
+ case CMD_MAP_FIND_DOWNSTAIR:
+ getty = '>';
+ break;
+ case CMD_MAP_FIND_PORTAL:
+ getty = '\t';
+ break;
+ case CMD_MAP_FIND_TRAP:
+ getty = '^';
+ break;
+ case CMD_MAP_FIND_ALTAR:
+ getty = '_';
+ break;
+ case CMD_MAP_FIND_EXCLUDED:
+ getty = 'E';
+ break;
+ case CMD_MAP_FIND_F:
+ getty = 'F';
+ break;
+ case CMD_MAP_FIND_WAYPOINT:
+ getty = 'W';
+ break;
+ default:
+ case CMD_MAP_FIND_STASH:
+ case CMD_MAP_FIND_STASH_REVERSE:
getty = 'I';
+ break;
+ }
if (anchor_x == -1)
{
anchor_x = start_x + curs_x - 1;
anchor_y = start_y + curs_y - 1;
}
- if (search_feat != getty)
- {
- search_feat = getty;
- search_found = 0;
- }
if (travel_mode)
{
search_found = _find_feature(features, getty, curs_x, curs_y,
@@ -3657,39 +3694,7 @@ void show_map( coord_def &spec_place, bool travel_mode )
break;
}
- case CK_MOUSE_MOVE:
- break;
-
- case CK_MOUSE_CLICK:
- {
- const c_mouse_event cme = get_mouse_event();
- const coord_def curp(start_x + curs_x - 1, start_y + curs_y - 1);
- const coord_def grdp =
- cme.pos + coord_def(start_x - 1, start_y - top);
-
- if (cme.left_clicked() && in_bounds(grdp))
- {
- spec_place = grdp;
- map_alive = false;
- }
- else if (cme.scroll_up())
- scroll_y = -block_step;
- else if (cme.scroll_down())
- scroll_y = block_step;
- else if (cme.right_clicked())
- {
- const coord_def delta = grdp - curp;
- move_y = delta.y;
- move_x = delta.x;
- }
- break;
- }
-
- case '.':
- case '\r':
- case 'S':
- case ',':
- case ';':
+ case CMD_MAP_GOTO_TARGET:
{
int x = start_x + curs_x - 1, y = start_y + curs_y - 1;
if (travel_mode && x == you.pos().x && y == you.pos().y)
@@ -3710,7 +3715,7 @@ void show_map( coord_def &spec_place, bool travel_mode )
}
#ifdef WIZARD
- case 'T':
+ case CMD_MAP_WIZARD_TELEPORT:
{
if (!you.wizard)
break;
@@ -3723,6 +3728,7 @@ void show_map( coord_def &spec_place, bool travel_mode )
}
#endif
+ case CMD_MAP_EXIT_MAP:
default:
if (travel_mode)
{