… | |
… | |
183 | |
183 | |
184 | $x -= CFPlus::floor $::MAP->w * 0.5; |
184 | $x -= CFPlus::floor $::MAP->w * 0.5; |
185 | $y -= CFPlus::floor $::MAP->h * 0.5; |
185 | $y -= CFPlus::floor $::MAP->h * 0.5; |
186 | |
186 | |
187 | if ($::CONN) { |
187 | if ($::CONN) { |
188 | if ($::IN_BUILD_MODE) { |
|
|
189 | $::CONN->buildat ($::IN_BUILD_MODE, $x, $y); |
|
|
190 | } else { |
|
|
191 | $::CONN->lookat ($x, $y) |
188 | $::CONN->lookat ($x, $y) |
192 | } |
|
|
193 | } |
189 | } |
194 | |
190 | |
195 | } elsif ($ev->{button} == 2) { |
191 | } elsif ($ev->{button} == 2) { |
196 | $self->grab_focus; |
192 | $self->grab_focus; |
197 | return unless $::CONN; |
193 | return unless $::CONN; |
… | |
… | |
343 | ::toggle_player_page ($::SPELL_PAGE); |
339 | ::toggle_player_page ($::SPELL_PAGE); |
344 | } elsif ($sym == CFPlus::SDLK_F5 && !$mod) { |
340 | } elsif ($sym == CFPlus::SDLK_F5 && !$mod) { |
345 | ::toggle_player_page ($::INVENTORY_PAGE); |
341 | ::toggle_player_page ($::INVENTORY_PAGE); |
346 | } elsif ($sym == CFPlus::SDLK_F9 && !$mod) { |
342 | } elsif ($sym == CFPlus::SDLK_F9 && !$mod) { |
347 | $::SETUP_DIALOG->toggle_visibility; |
343 | $::SETUP_DIALOG->toggle_visibility; |
|
|
344 | } elsif ($uni >= ord "0" && $uni <= ord "9" && $mod & CFPlus::KMOD_ALT) { |
|
|
345 | $::MESSAGE_WINDOW->user_switch_to_page (chr $uni); |
348 | } elsif (!$::CONN) { |
346 | } elsif (!$::CONN) { |
349 | return 0; # bindings further down need a valid connection |
347 | return 0; # bindings further down need a valid connection |
350 | |
348 | |
351 | } elsif ($uni == ord ",") { |
349 | } elsif ($uni == ord ",") { |
352 | $::CONN->user_send ("take"); |
350 | $::CONN->user_send ("take"); |
353 | } elsif ($uni == ord " ") { |
351 | } elsif ($uni == ord " ") { |
354 | $::CONN->user_send ("apply"); |
352 | $::CONN->user_send ("apply"); |
355 | } elsif ($uni == 13) { |
353 | } elsif ($uni == 13) { |
356 | $::CONN->user_send ("examine"); |
354 | $::MESSAGE_WINDOW->activate_current; |
357 | } elsif ($uni == ord ".") { |
355 | } elsif ($uni == ord ".") { |
358 | $::CONN->user_send ($self->{completer}{last_command}) |
356 | $::CONN->user_send ($self->{completer}{last_command}) |
359 | if exists $self->{completer}{last_command}; |
357 | if exists $self->{completer}{last_command}; |
360 | } elsif (my @macros = CFPlus::Macro::match_event $ev) { |
358 | } elsif (my @macros = CFPlus::Macro::match_event $ev) { |
361 | $::CONN->macro_send ($_) for @macros; |
359 | $::CONN->macro_send ($_) for @macros; |
… | |
… | |
448 | } |
446 | } |
449 | |
447 | |
450 | sub refresh_hook { |
448 | sub refresh_hook { |
451 | my ($self) = @_; |
449 | my ($self) = @_; |
452 | |
450 | |
453 | if ($::MAP) { |
451 | if ($::MAP && $::CONN) { |
454 | if (delete $self->{need_update}) { |
452 | if (delete $self->{need_update}) { |
455 | my $tilesize = $self->{ctilesize} = (int $self->{tilesize} * $::CFG->{map_scale}) || 1; |
453 | my $tilesize = $self->{ctilesize} = (int $self->{tilesize} * $::CFG->{map_scale}) || 1; |
456 | |
454 | |
457 | my $sw = $self->{sw} = 1 + CFPlus::ceil $self->{w} / $tilesize; |
455 | my $sw = $self->{sw} = 1 + CFPlus::ceil $self->{w} / $tilesize; |
458 | my $sh = $self->{sh} = 1 + CFPlus::ceil $self->{h} / $tilesize; |
456 | my $sh = $self->{sh} = 1 + CFPlus::ceil $self->{h} / $tilesize; |