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.150 by elmex, Wed Aug 12 18:41:39 2009 UTC vs.
Revision 1.156 by root, Sat Dec 19 05:06:57 2009 UTC

397 397
398sub scroll { 398sub scroll {
399 my ($self, $dx, $dy) = @_; 399 my ($self, $dx, $dy) = @_;
400 400
401 $::MAP->scroll ($dx, $dy); 401 $::MAP->scroll ($dx, $dy);
402
403 $self->movement_update; 402 $self->movement_update;
404 403
405 $self->{sdx} += $dx * $self->{tilesize}; # smooth displacement 404 $self->{sdx} += $dx * $self->{tilesize}; # smooth displacement
406 $self->{sdy} += $dy * $self->{tilesize}; 405 $self->{sdy} += $dy * $self->{tilesize};
406
407 $self->{last_fow_texture} = $self->{fow_texture};
408 $self->{ldx} = $self->{sdx};
409 $self->{ldy} = $self->{sdy};
410
407} 411}
408 412
409sub set_magicmap { 413sub set_magicmap {
410 my ($self, $w, $h, $x, $y, $data) = @_; 414 my ($self, $w, $h, $x, $y, $data) = @_;
411 415
482 486
483 my $dx = $self->{dx} = DC::ceil 0.5 * ($::MAP->w - $sw) - $sx; 487 my $dx = $self->{dx} = DC::ceil 0.5 * ($::MAP->w - $sw) - $sx;
484 my $dy = $self->{dy} = DC::ceil 0.5 * ($::MAP->h - $sh) - $sy; 488 my $dy = $self->{dy} = DC::ceil 0.5 * ($::MAP->h - $sh) - $sy;
485 489
486 if ($::CFG->{fow_enable}) { 490 if ($::CFG->{fow_enable}) {
487 $sdx_t = $sdy_t = 0;#d# 491 my ($sdx_t, $sdy_t);#d# do not anchor at player
492
488 my ($w, $h, $data) = $::MAP->fow_texture ( 493 my ($w, $h, $data) = $::MAP->fow_texture (
489 $dx + (min 0, $sdx_t), 494 $dx + (min 0, $sdx_t),
490 $dy + (min 0, $sdy_t), 495 $dy + (min 0, $sdy_t),
491 $sw + abs $sdx_t, 496 $sw + abs $sdx_t,
492 $sh + abs $sdy_t 497 $sh + abs $sdy_t
512 $::MAP->draw ($dx, $dy, $sw, $sh, 517 $::MAP->draw ($dx, $dy, $sw, $sh,
513 $self->{tilesize}, 518 $self->{tilesize},
514 $::CONN->{player}{tag}, 519 $::CONN->{player}{tag},
515 -$self->{sdx}, -$self->{sdy}); 520 -$self->{sdx}, -$self->{sdy});
516 521
517 #glTranslate -$self->{sdx}, -$self->{sdy}; # anchor fow at player 522 #d#glTranslate -$self->{sdx}, -$self->{sdy}; # anchor fow at player
518 glScale $self->{tilesize}, $self->{tilesize}; 523 glScale $self->{tilesize}, $self->{tilesize};
519 524
520 if (my $tex = $self->{fow_texture}) { 525 if (my $tex = $self->{fow_texture}) {
521 glPushMatrix; 526 if ($DC::OpenGL::GL_MULTITEX && $self->{last_fow_texture} && 0) {#d#
527 my $d1 = ($self->{sdx} ** 2 + $self->{sdy} ** 2) ** 0.5;
528 my $d2 = ($self->{ldx} ** 2 + $self->{ldy} ** 2) ** 0.5;
529
530 if ($d1 * $d2) {
531 DC::Texture::draw_fow_texture
532 $::CFG->{fow_intensity},
533 @{$self->{fow_texture}}{qw(name s t w h)},
534 $d1 / $d2,
535 $sdx_t - $self->{ldx} / $tilesize, $sdy_t - $self->{ldy} / $tilesize,
536 @{$self->{last_fow_texture}}{qw(name s t w h)};
537 } else {
538 delete $self->{last_fow_texture};
539
540 # same as a few lines below :/
541 DC::Texture::draw_fow_texture
542 $::CFG->{fow_intensity},
543 @{$self->{fow_texture}}{qw(name s t w h)};
544 }
545 } else {
522 glTranslate +(min 0, $sdx_t), (min 0, $sdy_t); 546 #d#glTranslate +(min 0, $sdx_t), (min 0, $sdy_t); # anchor at player
523 glScale 1/3, 1/3; 547 DC::Texture::draw_fow_texture
524 glEnable GL_TEXTURE_2D; 548 $::CFG->{fow_intensity},
525 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 549 @{$self->{fow_texture}}{qw(name s t w h)};
526 550 }
527 glColor +($::CFG->{fow_intensity}) x 3, 0.9;
528 $self->{fow_texture}->draw_quad_alpha (0, 0);
529
530 glDisable GL_TEXTURE_2D;
531 glPopMatrix;
532 } 551 }
533 552
534 if ($self->{magicmap}) { 553 if ($self->{magicmap}) {
535 my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} }; 554 my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} };
536 555

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines