fix targeting line drawing for one frame after ranged attack

This commit is contained in:
2025-05-07 17:30:54 -05:00
parent 9edc2a0633
commit 62ebe0c9f1
4 changed files with 16 additions and 2 deletions

View File

@@ -848,6 +848,12 @@ void handle_target_space(location destination, bool& did_something, bool& need_r
info["num_targets_left"] = boost::lexical_cast<std::string>(num_targets_left);
record_action("handle_target_space", info);
}
// Fix the targeting line drawing for one frame after the casting animation finishes:
if(overall_mode != MODE_FANCY_TARGET){
extern bool targeting_line_visible;
targeting_line_visible = false;
}
if(overall_mode == MODE_SPELL_TARGET)
do_combat_cast(destination);
else if(overall_mode == MODE_THROWING || overall_mode == MODE_FIRING)
@@ -2914,6 +2920,8 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
case ' ':
if(overall_mode == MODE_FANCY_TARGET) {
extern bool targeting_line_visible;
targeting_line_visible = false;
// cast multi-target spell, set # targets to 0 so that space clicked doesn't matter
num_targets_left = 0;
handle_target_space(center, did_something, need_redraw, need_reprint);

View File

@@ -838,6 +838,8 @@ void place_target(location target) {
}
if(num_targets_left == 0) {
extern bool targeting_line_visible;
targeting_line_visible = false;
do_combat_cast(spell_targets[0]);
overall_mode = MODE_COMBAT;
}

View File

@@ -1687,8 +1687,9 @@ void draw_targeting_line() {
if(overall_mode >= MODE_COMBAT)
from_loc = univ.current_pc().combat_pos;
else from_loc = univ.party.town_loc;
if((overall_mode == MODE_SPELL_TARGET) || (overall_mode == MODE_FIRING) || (overall_mode == MODE_THROWING) || (overall_mode == MODE_FANCY_TARGET)
|| ((overall_mode == MODE_TOWN_TARGET) && (current_pat[4][4] != 0))) {
extern bool targeting_line_visible;
if(targeting_line_visible && ((overall_mode == MODE_SPELL_TARGET) || (overall_mode == MODE_FIRING) || (overall_mode == MODE_THROWING) || (overall_mode == MODE_FANCY_TARGET)
|| ((overall_mode == MODE_TOWN_TARGET) && (current_pat[4][4] != 0)))) {
if(mouse_to_terrain_coords(which_space, false)) {
int xBound = (short) (from_loc.x - center.x + 4);

View File

@@ -1062,8 +1062,11 @@ short scan_for_response(const char *str) {
return -1;
}
bool targeting_line_visible = false;
void handle_target_mode(eGameMode target_mode, int range, eSpell spell) {
overall_mode = target_mode;
targeting_line_visible = true;
// Lock on to enemies in range:
if(has_feature_flag("target-lock", "V1") && get_bool_pref("TargetLock", true)){
// Skip this for spells that don't target enemies