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.49 by root, Sat Jun 3 22:50:48 2006 UTC vs.
Revision 1.50 by root, Sat Jun 3 23:47:47 2006 UTC

57 my ($self, $ev, $x, $y) = @_; 57 my ($self, $ev, $x, $y) = @_;
58 58
59 $self->focus_in; 59 $self->focus_in;
60 60
61 if ($ev->{button} == 1) { 61 if ($ev->{button} == 1) {
62 my ($ox, $oy) = ($ev->{x}, $ev->{y}); 62 my $sw = int $::WIDTH / (32 * $::CFG->{map_scale}) + 0.99;
63 my $sh = int $::HEIGHT / (32 * $::CFG->{map_scale}) + 0.99;
63 64
64 my $fx = int ((($ev->{x} - $::CFG->{map_shift_x}) / (32 * $::CFG->{map_scale})) + 0.99); 65 my $fx = int +($ev->{x} - $::CFG->{map_shift_x}) / (32 * $::CFG->{map_scale}) - 0.5 * $sw + 0.99;
65 my $fy = int ((($ev->{y} - $::CFG->{map_shift_y}) / (32 * $::CFG->{map_scale})) + 0.99); 66 my $fy = int +($ev->{y} - $::CFG->{map_shift_y}) / (32 * $::CFG->{map_scale}) - 0.5 * $sh + 0.99;
66 $fx += $::MAP->x;
67 $fy += $::MAP->y;
68 67
69 $::CONN->send (sprintf "lookat %d %d", $fx, $fy); 68 $::CONN->send (sprintf "lookat %d %d", $fx, $fy);
70 69
71 warn "FOOX: $fx (".$::MAP->ox.")\n";
72 warn "FOOY: $fy (".$::MAP->oy.")\n";
73 } elsif ($ev->{button} == 2) { 70 } elsif ($ev->{button} == 2) {
74 my ($ox, $oy) = ($ev->{x}, $ev->{y}); 71 my ($ox, $oy) = ($ev->{x}, $ev->{y});
75 my ($bw, $bh) = ($::CFG->{map_shift_x}, $::CFG->{map_shift_y}); 72 my ($bw, $bh) = ($::CFG->{map_shift_x}, $::CFG->{map_shift_y});
76 73
77 $self->{motion} = sub { 74 $self->{motion} = sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines