Skip to content

Commit

Permalink
Fix quick-look. Fix calref#512
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios committed Dec 1, 2024
1 parent 684edd3 commit a8b8d5e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/game/boe.actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1468,14 +1468,22 @@ bool handle_action(const sf::Event& event, cFramerateLimiter& fps_limiter) {
int i = (the_point.x - 32) / 28;
int j = (the_point.y - 20) / 36;
location destination = cur_loc;

auto look_destination = [i, j, destination]() {
location look_dest = destination;
if (overall_mode == MODE_LOOK_OUTDOORS) look_dest = univ.party.out_loc;
look_dest.x = look_dest.x + i - 4;
look_dest.y = look_dest.y + j - 4;
return look_dest;
};

// Check for quick look
if(right_button) {
handle_begin_look(right_button, need_redraw, need_reprint);
handle_begin_look(true, need_redraw, need_reprint);
handle_look(look_destination(), true, current_key_mod(), need_redraw, need_reprint);
}

// Moving/pausing
if(overall_mode == MODE_OUTDOORS || overall_mode == MODE_TOWN || overall_mode == MODE_COMBAT) {
else if(overall_mode == MODE_OUTDOORS || overall_mode == MODE_TOWN || overall_mode == MODE_COMBAT) {
if((i == 4) & (j == 4)) handle_pause(did_something, need_redraw);
else {
cur_direction = get_cur_direction(the_point);
Expand All @@ -1487,10 +1495,7 @@ bool handle_action(const sf::Event& event, cFramerateLimiter& fps_limiter) {

// Looking at something
else if(overall_mode == MODE_LOOK_OUTDOORS || overall_mode == MODE_LOOK_TOWN || overall_mode == MODE_LOOK_COMBAT) {
if(overall_mode == MODE_LOOK_OUTDOORS) destination = univ.party.out_loc;
destination.x = destination.x + i - 4;
destination.y = destination.y + j - 4;
handle_look(destination, right_button, current_key_mod(), need_redraw, need_reprint);
handle_look(look_destination(), false, current_key_mod(), need_redraw, need_reprint);
}

// Talking to someone
Expand Down

0 comments on commit a8b8d5e

Please sign in to comment.