From 1db9c68406e0892e1ac7331dfd3b412b31741cb7 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Fri, 5 Oct 2007 06:10:49 +0000 Subject: Shaft traps (trap doors) [1792195] and level annotation [1769009] added, with the shaft traps changed as per comments on SF; shafts aren't randomly generated yet, so this doesn't change gameplay. Changed DNGN_TRAP_III to DNGN_TRAP_NATURAL, of which trap type the shaft traps are the only current member. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2328 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/acr.cc') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 89ba2ed09d..96668a5f12 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1448,6 +1448,23 @@ static bool toggle_flag( bool* flag, const char* flagname ) return *flag; } +static bool can_go_down_shaft() +{ + // Not a shaft + if (trap_type_at_xy(you.x_pos, you.y_pos) != TRAP_SHAFT) + return (false); + + // Undiscovered shaft + if (grd[you.x_pos][you.y_pos] == DNGN_UNDISCOVERED_TRAP) + return (false); + + // Have to fly to dive through it. + if (you.flies() != FL_FLY) + return (false); + + return (true); +} + static void go_downstairs(); static void go_upstairs() { @@ -1491,6 +1508,14 @@ static void go_upstairs() static void go_downstairs() { + if (trap_at_xy(you.x_pos, you.y_pos) == TRAP_SHAFT + && grd[you.x_pos][you.y_pos] != DNGN_UNDISCOVERED_TRAP + && !can_go_down_shaft()) + { + mpr("You must have controlled flight to dive through a shaft."); + return; + } + if (grid_stair_direction(grd(you.pos())) != CMD_GO_DOWNSTAIRS) { if (grd(you.pos()) == DNGN_STONE_ARCH) @@ -1953,6 +1978,10 @@ void process_command( command_type cmd ) mesclr(); break; + case CMD_ANNOTATE_LEVEL: + annotate_level(); + break; + case CMD_EXPLORE: // Start exploring start_explore(Options.explore_greedy); @@ -3094,7 +3123,7 @@ command_type keycode_to_command( keycode_type key ) case CONTROL('E'): return CMD_FORGET_STASH; case CONTROL('F'): return CMD_SEARCH_STASHES; case CONTROL('G'): return CMD_INTERLEVEL_TRAVEL; - case CONTROL('I'): return CMD_NO_CMD; + case CONTROL('I'): return CMD_ANNOTATE_LEVEL; case CONTROL('M'): return CMD_NO_CMD; case CONTROL('O'): return CMD_EXPLORE; case CONTROL('P'): return CMD_REPLAY_MESSAGES; @@ -3186,7 +3215,8 @@ static void open_door(int move_x, int move_y, bool check_confused) return; } - if (grd[dx][dy] >= DNGN_TRAP_MECHANICAL && grd[dx][dy] <= DNGN_TRAP_III) + if (grd[dx][dy] >= DNGN_TRAP_MECHANICAL + && grd[dx][dy] <= DNGN_TRAP_NATURAL) { if (env.cgrid[dx][dy] != EMPTY_CLOUD) { -- cgit v1.2.3-54-g00ecf