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.12 by root, Mon Apr 24 06:05:35 2006 UTC vs.
Revision 1.16 by root, Mon Apr 24 13:04:31 2006 UTC

1package CFClient::MapWidget; 1package CFClient::MapWidget;
2 2
3use strict; 3use strict;
4use utf8;
4 5
5use List::Util qw(min max); 6use List::Util qw(min max);
6 7
7use CFClient::OpenGL; 8use CFClient::OpenGL;
8 9
83 84
84 if ($::MAP) { 85 if ($::MAP) {
85 my $sw = int $::WIDTH / (32 * $::CFG->{map_scale}); 86 my $sw = int $::WIDTH / (32 * $::CFG->{map_scale});
86 my $sh = int $::HEIGHT / (32 * $::CFG->{map_scale}); 87 my $sh = int $::HEIGHT / (32 * $::CFG->{map_scale});
87 88
89 glPushMatrix;
88 glScale $::CFG->{map_scale}, $::CFG->{map_scale}; 90 glScale $::CFG->{map_scale}, $::CFG->{map_scale};
89 91
90 my $sx = $::CFG->{map_shift_x} / $::CFG->{map_scale}; my $sx0 = $sx & 31; $sx = ($sx - $sx0) / 32; 92 my $sx = $::CFG->{map_shift_x} / $::CFG->{map_scale}; my $sx0 = $sx & 31; $sx = ($sx - $sx0) / 32;
91 my $sy = $::CFG->{map_shift_y} / $::CFG->{map_scale}; my $sy0 = $sy & 31; $sy = ($sy - $sy0) / 32; 93 my $sy = $::CFG->{map_shift_y} / $::CFG->{map_scale}; my $sy0 = $sy & 31; $sy = ($sy - $sy0) / 32;
92 94
143 glEnable GL_BLEND; 145 glEnable GL_BLEND;
144 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 146 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
145 glEnable GL_TEXTURE_2D; 147 glEnable GL_TEXTURE_2D;
146 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 148 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
147 149
150 glPopMatrix;
151
148 $self->{mapmap_texture} = 152 $self->{mapmap_texture} =
149 new CFClient::Texture 153 new CFClient::Texture
150 w => $w, 154 w => $w,
151 h => $h, 155 h => $h,
152 data => $::MAP->mapmap (- $w * 0.5, - $h * 0.5, $w, $h), 156 data => $::MAP->mapmap (- $w * 0.5, - $h * 0.5, $w, $h),
214 my $mod = $ev->{mod}; 218 my $mod = $ev->{mod};
215 my $sym = $ev->{sym}; 219 my $sym = $ev->{sym};
216 220
217 if ($sym == CFClient::SDLK_KP5) { 221 if ($sym == CFClient::SDLK_KP5) {
218 $::CONN->user_send ("stay fire"); 222 $::CONN->user_send ("stay fire");
223 } elsif ($sym == ord ",") {
224 $::CONN->user_send ("take");
219 } elsif ($sym == ord "a") { 225 } elsif ($sym == ord "a") {
220 $::CONN->user_send ("apply"); 226 $::CONN->user_send ("apply");
221 } elsif ($sym == ord "'") { 227 } elsif ($sym == ord "'") {
222 $self->emit ('activate_console'); 228 $self->emit ('activate_console');
223 } elsif ($sym == ord "/") { 229 } elsif ($sym == ord "/") {
317 my @found; 323 my @found;
318 324
319 for (@$command) { 325 for (@$command) {
320 if ($_->[0] =~ $search_abbrev) { 326 if ($_->[0] =~ $search_abbrev) {
321 push @found, [$_->[0], $_]; 327 push @found, [$_->[0], $_];
322 } elsif ($_[1] =~ $search_full) { 328 } elsif ($_->[1] =~ $search_full) {
323 push @found, [$_->[1], $_]; 329 push @found, [$_->[1], $_];
324 } 330 }
325 } 331 }
326 332
327 @found = sort { $a->[0] cmp $b->[0] } @found; 333 @found = sort { $a->[0] cmp $b->[0] } @found;
354 $self->emit (execute => $self->{select}); 360 $self->emit (execute => $self->{select});
355 $self->emit ("close"); 361 $self->emit ("close");
356 } 362 }
357 } elsif ($ev->{sym} == 27) { 363 } elsif ($ev->{sym} == 27) {
358 $self->emit ("close"); 364 $self->emit ("close");
365 return;
359 } elsif ((chr $ev->{unicode}) =~ /^[[:alpha:]]$/) { 366 } elsif ((chr $ev->{unicode}) =~ /^[[:alpha:]]$/) {
360 $self->{search} .= chr $ev->{unicode}; 367 $self->{search} .= chr $ev->{unicode};
361 $self->update_labels; 368 $self->update_labels;
362 } 369 }
363 370

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines