diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-01-29 10:42:36 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-01-29 10:42:36 +0000 |
commit | 77be5ae4a0b896e42f0169d880582f3842568c83 (patch) | |
tree | fa6f318b9c73fa998798942bee709b54e945df49 /crawl-ref/source | |
parent | 5d132a7fba202b7b19807d1058ac680bfbb1e0f3 (diff) | |
download | crawl-ref-77be5ae4a0b896e42f0169d880582f3842568c83.tar.gz crawl-ref-77be5ae4a0b896e42f0169d880582f3842568c83.zip |
Made default targeting an option (default_target, defaults to false.)
If default_target is set, direction() now starts on the closest
target (as if you pressed '+') if your previous target is invalid.
Removed old fizzle check option. Ctrl-T is now free.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@902 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/acr.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/clua.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/direct.cc | 74 | ||||
-rw-r--r-- | crawl-ref/source/enum.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/externs.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/initfile.cc | 11 | ||||
-rw-r--r-- | crawl-ref/source/travel.cc | 2 |
7 files changed, 47 insertions, 51 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index a1a5645d5a..7ead9ffbde 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1029,11 +1029,7 @@ void process_command( command_type cmd ) { case CMD_TOGGLE_AUTOPRAYER: toggle_flag( &Options.autoprayer_on, "Autoprayer" ); break; - - case CMD_TOGGLE_NOFIZZLE: - toggle_flag( &Options.fizzlecheck_on, "Fizzle confirmation" ); - break; - + case CMD_MAKE_NOTE: make_user_note(); break; @@ -2405,7 +2401,6 @@ command_type keycode_to_command( keycode_type key ) { case CONTROL('Q'): return CMD_NO_CMD; case CONTROL('R'): return CMD_REDRAW_SCREEN; case CONTROL('S'): return CMD_MARK_STASH; - case CONTROL('T'): return CMD_TOGGLE_NOFIZZLE; case CONTROL('V'): return CMD_TOGGLE_AUTOPRAYER; case CONTROL('W'): return CMD_FIX_WAYPOINT; case CONTROL('X'): return CMD_SAVE_GAME_NOW; diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc index be6a547d10..0a4d1f3d17 100644 --- a/crawl-ref/source/clua.cc +++ b/crawl-ref/source/clua.cc @@ -1884,6 +1884,7 @@ static option_handler handlers[] = { "terse_hand", &Options.terse_hand, option_hboolean }, { "increasing_skill_progress", &Options.increasing_skill_progress, option_hboolean }, { "confirm_self_target", &Options.confirm_self_target, option_hboolean }, + { "default_target", &Options.default_target, option_hboolean }, { "safe_autopickup", &Options.safe_autopickup, option_hboolean }, { "autopickup_no_burden", &Options.autopickup_no_burden, option_hboolean }, { "note_skill_max", &Options.note_skill_max, option_hboolean }, diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index cb5675884c..8ec14540df 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -244,6 +244,7 @@ void direction(struct dist& moves, targeting_type restricts, { // NOTE: Even if just_looking is set, moves is still interesting, // because we can travel there! + if ( restricts == DIR_DIR ) { direction_choose_compass( moves ); @@ -263,21 +264,26 @@ void direction(struct dist& moves, targeting_type restricts, moves.ty = you.y_pos; bool skip_iter = false; + bool found_autotarget = false; // Find a default target - if ( mode == TARG_ENEMY && - you.prev_targ != MHITNOT && you.prev_targ != MHITYOU ) + if ( Options.default_target && mode == TARG_ENEMY ) { - const monsters *montarget = &menv[you.prev_targ]; - if (mons_near(montarget) && player_monster_visible(montarget)) + skip_iter = true; // skip first iteration...XXX mega-hack + if ( you.prev_targ != MHITNOT && you.prev_targ != MHITYOU ) { - skip_iter = true; // skip first iteration...XXX mega-hack - moves.tx = montarget->x; - moves.ty = montarget->y; + const monsters *montarget = &menv[you.prev_targ]; + if (mons_near(montarget) && player_monster_visible(montarget)) + { + found_autotarget = true; + moves.tx = montarget->x; + moves.ty = montarget->y; + } } } - mpr(aim_prompt, MSGCH_PROMPT); + // Prompts get scrolled off. Argh - another hack. XXX + mpr(aim_prompt, (skip_iter ? MSGCH_PLAIN : MSGCH_PROMPT)); while (1) { @@ -296,18 +302,21 @@ void direction(struct dist& moves, targeting_type restricts, command_type key_command; if ( skip_iter ) - key_command = CMD_NO_CMD; + { + if ( found_autotarget ) + key_command = CMD_NO_CMD; + else + key_command = CMD_TARGET_CYCLE_FORWARD; // find closest enemy + } else key_command = read_direction_key(); bool need_beam_redraw = false; bool loop_done = false; - const int old_tx = moves.tx + (skip_iter ? 1 : 0); // hmmm...hack + const int old_tx = moves.tx + (skip_iter ? 500 : 0); // hmmm...hack const int old_ty = moves.ty; - skip_iter = false; // skip at most once - int i, mid; switch ( key_command ) @@ -540,6 +549,8 @@ void direction(struct dist& moves, targeting_type restricts, } } + // We'll go on looping. Redraw whatever is necessary. + // Tried to step out of bounds if ( !in_bounds(moves.tx, moves.ty) ) { @@ -562,7 +573,8 @@ void direction(struct dist& moves, targeting_type restricts, if ( show_beam ) need_beam_redraw = true; - mesclr(true); // maybe not completely necessary + if ( !skip_iter ) // don't clear before we get a chance to see + mesclr(true); // maybe not completely necessary if ( !in_vlos(grid2viewX(moves.tx), grid2viewY(moves.ty)) ) describe_oos_square(moves.tx, moves.ty); @@ -596,6 +608,7 @@ void direction(struct dist& moves, targeting_type restricts, textcolor(LIGHTGREY); } } + skip_iter = false; // only skip one iteration at most } moves.isMe = (moves.tx == you.x_pos && moves.ty == you.y_pos); } @@ -1256,9 +1269,7 @@ static void describe_cell(int mx, int my) const int mon_wep = menv[i].inv[MSLOT_WEAPON]; const int mon_arm = menv[i].inv[MSLOT_ARMOUR]; - strcpy(info, ptr_monam( &(menv[i]), DESC_CAP_A )); - strcat(info, "."); - mpr(info); + mprf("%s.", ptr_monam(&(menv[i]), DESC_CAP_A)); if (menv[i].type != MONS_DANCING_WEAPON && mon_wep != NON_ITEM) { @@ -1287,26 +1298,17 @@ static void describe_cell(int mx, int my) } if (mon_arm != NON_ITEM) - { - it_name( mon_arm, DESC_NOCAP_A, str_pass ); - snprintf( info, INFO_SIZE, "%s is wearing %s.", - mons_pronoun( menv[i].type, PRONOUN_CAP ), - str_pass ); - - mpr( info ); - } + mprf("%s is wearing %s.", + mons_pronoun(menv[i].type, PRONOUN_CAP), + it_name(mon_arm, DESC_NOCAP_A, str_pass)); if (menv[i].type == MONS_HYDRA) - { - snprintf( info, INFO_SIZE, "It has %d head%s.", - menv[i].number, (menv[i].number > 1? "s" : "") ); - mpr( info ); - } + mprf("It has %d head%s.", menv[i].number, + (menv[i].number > 1? "s" : ""));; print_wounds(&menv[i]); - if (mons_is_mimic( menv[i].type )) mimic_item = true; else if (!mons_class_flag(menv[i].type, M_NO_EXP_GAIN) @@ -1314,16 +1316,14 @@ static void describe_cell(int mx, int my) { if (menv[i].behaviour == BEH_SLEEP) { - strcpy(info, mons_pronoun(menv[i].type, PRONOUN_CAP)); - strcat(info, " doesn't appear to have noticed you."); - mpr(info); + mprf("%s doesn't appear to have noticed you.", + mons_pronoun(menv[i].type, PRONOUN_CAP)); } // Applies to both friendlies and hostiles else if (menv[i].behaviour == BEH_FLEE) { - strcpy(info, mons_pronoun(menv[i].type, PRONOUN_CAP)); - strcat(info, " is retreating."); - mpr(info); + mprf("%s is retreating.", + mons_pronoun(menv[i].type, PRONOUN_CAP)); } // hostile with target != you else if (!mons_friendly(&menv[i]) && menv[i].foe != MHITYOU) @@ -1414,7 +1414,7 @@ static void describe_cell(int mx, int my) { const char cloud_inspected = env.cgrid[mx][my]; - const cloud_type ctype = (cloud_type) env.cloud[ cloud_inspected ].type; + const cloud_type ctype = (cloud_type) env.cloud[cloud_inspected].type; mprf("There is a cloud of %s here.", cloud_name(ctype).c_str()); } diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 607e75ed5c..c9695b82bf 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -626,7 +626,6 @@ enum command_type CMD_CLEAR_MAP, CMD_INSCRIBE_ITEM, - CMD_TOGGLE_NOFIZZLE, CMD_TOGGLE_AUTOPRAYER, CMD_MAKE_NOTE, CMD_RESISTS_SCREEN, diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 7f8a74d87e..1458cac4c5 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -805,7 +805,6 @@ public: bool autopickup_on; bool autoprayer_on; - bool fizzlecheck_on; bool show_turns; // Show turns used in HUD. @@ -821,6 +820,7 @@ public: bool easy_butcher; // open doors with movement bool increasing_skill_progress; // skills go from 0-10 or 10-0 bool confirm_self_target; // require confirmation before selftarget + bool default_target; // start targeting on a real target bool safe_autopickup; // don't autopickup when monsters visible bool autopickup_no_burden; // don't autopickup if it changes burden bool note_skill_max; // take note when skills reach new max diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 6f00509838..2f80f9f424 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -552,7 +552,6 @@ void game_options::reset_options() autopickup_on = true; autoprayer_on = false; - fizzlecheck_on = false; show_turns = true; @@ -593,6 +592,7 @@ void game_options::reset_options() easy_quit_item_prompts = true; hp_warning = 10; confirm_self_target = true; + default_target = false; safe_autopickup = true; autopickup_no_burden = false; use_notes = true; @@ -1394,11 +1394,6 @@ void game_options::read_option_line(const std::string &str, bool runscript) // should autoprayer default to on or off? autoprayer_on = read_bool( field, autoprayer_on ); } - else if (key == "default_fizzlecheck") - { - // should fizzlecheck default to on or off? - fizzlecheck_on = read_bool( field, fizzlecheck_on ); - } else if (key == "detailed_stat_dump") { detailed_stat_dump = @@ -1727,6 +1722,10 @@ void game_options::read_option_line(const std::string &str, bool runscript) { confirm_self_target = read_bool( field, confirm_self_target ); } + else if (key == "default_target") + { + default_target = read_bool( field, default_target ); + } else if (key == "safe_autopickup") { safe_autopickup = read_bool( field, safe_autopickup ); diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 23c62094cc..38bff25688 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -84,7 +84,9 @@ static bool traps_inited = false; travel_distance_grid_t travel_point_distance; static unsigned char curr_waypoints[GXM][GYM]; +#ifdef CLUA_BINDINGS static signed char curr_traps[GXM][GYM]; +#endif static FixedArray< unsigned short, GXM, GYM > mapshadow; |