ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.50 by root, Sat Jun 3 23:47:47 2006 UTC vs.
Revision 1.53 by root, Sun Jun 11 17:30:53 2006 UTC

14 14
15 my $self = $class->SUPER::new ( 15 my $self = $class->SUPER::new (
16 z => -1, 16 z => -1,
17 can_focus => 1, 17 can_focus => 1,
18 list => glGenList, 18 list => glGenList,
19
20 smooth_matrix => [
21 0.05, 0.13, 0.05,
22 0.13, 0.30, 0.13,
23 0.05, 0.13, 0.05,
24 ],
25
19 @_ 26 @_
20 ); 27 );
21 28
22 $self->{completer} = new CFClient::MapWidget::Command:: 29 $self->{completer} = new CFClient::MapWidget::Command::
23 command => $self->{command}, 30 command => $self->{command},
63 my $sh = int $::HEIGHT / (32 * $::CFG->{map_scale}) + 0.99; 70 my $sh = int $::HEIGHT / (32 * $::CFG->{map_scale}) + 0.99;
64 71
65 my $fx = int +($ev->{x} - $::CFG->{map_shift_x}) / (32 * $::CFG->{map_scale}) - 0.5 * $sw + 0.99; 72 my $fx = int +($ev->{x} - $::CFG->{map_shift_x}) / (32 * $::CFG->{map_scale}) - 0.5 * $sw + 0.99;
66 my $fy = int +($ev->{y} - $::CFG->{map_shift_y}) / (32 * $::CFG->{map_scale}) - 0.5 * $sh + 0.99; 73 my $fy = int +($ev->{y} - $::CFG->{map_shift_y}) / (32 * $::CFG->{map_scale}) - 0.5 * $sh + 0.99;
67 74
68 $::CONN->send (sprintf "lookat %d %d", $fx, $fy); 75 $::CONN->send (sprintf "lookat %d %d", $fx, $fy)
76 if $::CONN;
69 77
70 } elsif ($ev->{button} == 2) { 78 } elsif ($ev->{button} == 2) {
71 my ($ox, $oy) = ($ev->{x}, $ev->{y}); 79 my ($ox, $oy) = ($ev->{x}, $ev->{y});
72 my ($bw, $bh) = ($::CFG->{map_shift_x}, $::CFG->{map_shift_y}); 80 my ($bw, $bh) = ($::CFG->{map_shift_x}, $::CFG->{map_shift_y});
73 81
252 glConvolutionFilter2D ( 260 glConvolutionFilter2D (
253 GL_CONVOLUTION_2D, 261 GL_CONVOLUTION_2D,
254 GL_ALPHA, 262 GL_ALPHA,
255 3, 3, 263 3, 3,
256 GL_ALPHA, GL_FLOAT, 264 GL_ALPHA, GL_FLOAT,
257 pack "f*", 265 (pack "f*", @{ $self->{smooth_matrix} }),
258 0.05, 0.13, 0.05,
259 0.13, 0.30, 0.13,
260 0.05, 0.13, 0.05,
261 ); 266 );
262 glEnable GL_CONVOLUTION_2D; 267 glEnable GL_CONVOLUTION_2D;
263 } 268 }
264 269
265 $self->{fow_texture_name} ||= glGenTexture; 270 $self->{fow_texture_name} ||= glGenTexture;
459 464
460 if ($ev->{sym} == 13) { 465 if ($ev->{sym} == 13) {
461 if (exists $self->{select}) { 466 if (exists $self->{select}) {
462 $self->{last_command} = $self->{select}; 467 $self->{last_command} = $self->{select};
463 $::CONN->user_send ($self->{select}); 468 $::CONN->user_send ($self->{select});
469
470 unshift @{$self->{history}}, $self->{select};
471 $self->{hist_ptr} = 0;
472
464 $self->hide; 473 $self->hide;
465 } 474 }
466 } elsif ($ev->{sym} == 27) { 475 } elsif ($ev->{sym} == 27) {
476 $self->{hist_ptr} = 0;
467 $self->hide; 477 $self->hide;
468 return; 478 return;
469 } elsif ($ev->{sym} == CFClient::SDLK_DOWN) { 479 } elsif ($ev->{sym} == CFClient::SDLK_DOWN) {
480 if ($self->{hist_ptr} > 1) {
481 $self->{hist_ptr}--;
482 $self->{entry}->set_text ($self->{history}->[$self->{hist_ptr} - 1]);
483 } elsif ($self->{hist_ptr} > 0) {
484 $self->{hist_ptr}--;
485 $self->{entry}->set_text ($self->{hist_saveback});
486 } else {
470 ++$self->{select_offset} 487 ++$self->{select_offset}
471 if $self->{select_offset} < $#{ $self->{last_match} || [] }; 488 if $self->{select_offset} < $#{ $self->{last_match} || [] };
489 }
472 $self->update_labels; 490 $self->update_labels;
473 } elsif ($ev->{sym} == CFClient::SDLK_UP) { 491 } elsif ($ev->{sym} == CFClient::SDLK_UP) {
492 if ($self->{select_offset}) {
474 --$self->{select_offset} 493 --$self->{select_offset}
494 } else {
495 unless ($self->{hist_ptr}) {
496 $self->{hist_saveback} = $self->{entry}->get_text;
497 }
498 if ($self->{hist_ptr} <= $#{$self->{history}}) {
475 if $self->{select_offset}; 499 $self->{hist_ptr}++;
500 }
501 $self->{entry}->set_text ($self->{history}->[$self->{hist_ptr} - 1])
502 if exists $self->{history}->[$self->{hist_ptr} - 1];
503 }
476 $self->update_labels; 504 $self->update_labels;
477 } else { 505 } else {
478 return 0; 506 return 0;
479 } 507 }
480 508

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines