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.100 by pippijn, Tue Jan 2 14:45:22 2007 UTC vs.
Revision 1.104 by root, Wed Apr 4 02:43:29 2007 UTC

21 21
22 my $self = $class->SUPER::new ( 22 my $self = $class->SUPER::new (
23 z => -1, 23 z => -1,
24 can_focus => 1, 24 can_focus => 1,
25 list => glGenList, 25 list => glGenList,
26 tilesize => 32,
26 27
27 smooth_matrix => [ 28 smooth_matrix => [
28 0.05, 0.13, 0.05, 29 0.05, 0.13, 0.05,
29 0.13, 0.30, 0.13, 30 0.13, 0.30, 0.13,
30 0.05, 0.13, 0.05, 31 0.05, 0.13, 0.05,
37 command => $self->{command}, 38 command => $self->{command},
38 tooltip => "#completer_help", 39 tooltip => "#completer_help",
39 ; 40 ;
40 41
41 $self 42 $self
43}
44
45sub set_tilesize {
46 my ($self, $tilesize) = @_;
47
48 $self->{tilesize} = $tilesize;
42} 49}
43 50
44sub add_command { 51sub add_command {
45 my ($self, $command, $tooltip, $widget, $cb) = @_; 52 my ($self, $command, $tooltip, $widget, $cb) = @_;
46 53
285 292
286 1 293 1
287} 294}
288 295
289sub size_request { 296sub size_request {
297 my ($self) = @_;
298
290 ( 299 (
291 32 * CFPlus::ceil $::WIDTH / 32, 300 $self->{tilesize} * CFPlus::ceil $::WIDTH / $self->{tilesize},
292 32 * CFPlus::ceil $::HEIGHT / 32, 301 $self->{tilesize} * CFPlus::ceil $::HEIGHT / $self->{tilesize},
293 ) 302 )
294} 303}
295 304
296sub update { 305sub update {
297 my ($self) = @_; 306 my ($self) = @_;
445 454
446 return 455 return
447 unless $focused || !$::FAST; 456 unless $focused || !$::FAST;
448 457
449 if (delete $self->{need_update}) { 458 if (delete $self->{need_update}) {
450 my $tilesize = $self->{tilesize} = int 32 * $::CFG->{map_scale}; 459 my $tilesize = $self->{tilesize} = int $self->{tilesize} * $::CFG->{map_scale};
451 460
452 my $sw = $self->{sw} = 1 + CFPlus::ceil $self->{w} / $tilesize; 461 my $sw = $self->{sw} = 1 + CFPlus::ceil $self->{w} / $tilesize;
453 my $sh = $self->{sh} = 1 + CFPlus::ceil $self->{h} / $tilesize; 462 my $sh = $self->{sh} = 1 + CFPlus::ceil $self->{h} / $tilesize;
454 463
455 my $sx = CFPlus::ceil $::CFG->{map_shift_x} / $tilesize; 464 my $sx = CFPlus::ceil $::CFG->{map_shift_x} / $tilesize;
492 501
493 glPushMatrix; 502 glPushMatrix;
494 glTranslate $sx0, $sy0; 503 glTranslate $sx0, $sy0;
495 glScale $::CFG->{map_scale}, $::CFG->{map_scale}; 504 glScale $::CFG->{map_scale}, $::CFG->{map_scale};
496 505
497 $::MAP->draw ($dx, $dy, $sw, $sh); 506 $::MAP->draw ($dx, $dy, $sw, $sh, $self->{tilesize});
498 507
499 glScale 32, 32; 508 glScale $self->{tilesize}, $self->{tilesize};
500 509
501 if (my $tex = $self->{fow_texture}) { 510 if (my $tex = $self->{fow_texture}) {
502 glEnable GL_TEXTURE_2D; 511 glEnable GL_TEXTURE_2D;
503 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 512 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
504 513
579 588
580 $::MAP or return; 589 $::MAP or return;
581 590
582 my ($w, $h) = @$self{qw(w h)}; 591 my ($w, $h) = @$self{qw(w h)};
583 592
584 my $sw = int $::WIDTH / (32 * $::CFG->{map_scale}) + 0.99; 593 my $sw = int $::WIDTH / ($::MAPWIDGET->{tilesize} * $::CFG->{map_scale}) + 0.99;
585 my $sh = int $::HEIGHT / (32 * $::CFG->{map_scale}) + 0.99; 594 my $sh = int $::HEIGHT / ($::MAPWIDGET->{tilesize} * $::CFG->{map_scale}) + 0.99;
586 595
587 my $sx = int $::CFG->{map_shift_x} / 32; 596 my $sx = int $::CFG->{map_shift_x} / $::MAPWIDGET->{tilesize};
588 my $sy = int $::CFG->{map_shift_y} / 32; 597 my $sy = int $::CFG->{map_shift_y} / $::MAPWIDGET->{tilesize};
589 598
590 my $ox = 0.5 * ($w - $sw); 599 my $ox = 0.5 * ($w - $sw);
591 my $oy = 0.5 * ($h - $sh); 600 my $oy = 0.5 * ($h - $sh);
592 601
593 glEnable GL_BLEND; 602 glEnable GL_BLEND;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines