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.155 by root, Thu Dec 17 02:49:38 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->{last_fow_texture} = $self->{fow_texture};
404 $self->{ldx} = $self->{sdx} + $dx * $self->{tilesize}; # smooth displacement
405 $self->{ldy} = $self->{sdy} + $dy * $self->{tilesize};
406
407 $self->movement_update; 402 $self->movement_update;
408 403
409 $self->{sdx} += $dx * $self->{tilesize}; # smooth displacement 404 $self->{sdx} += $dx * $self->{tilesize}; # smooth displacement
410 $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
411} 411}
412 412
413sub set_magicmap { 413sub set_magicmap {
414 my ($self, $w, $h, $x, $y, $data) = @_; 414 my ($self, $w, $h, $x, $y, $data) = @_;
415 415
499 499
500 $self->{fow_texture} = new DC::Texture 500 $self->{fow_texture} = new DC::Texture
501 w => $w, 501 w => $w,
502 h => $h, 502 h => $h,
503 data => $data, 503 data => $data,
504 internalformat => GL_INTENSITY, 504 internalformat => GL_ALPHA,
505 format => GL_LUMINANCE; 505 format => GL_ALPHA;
506 } else { 506 } else {
507 delete $self->{fow_texture}; 507 delete $self->{fow_texture};
508 } 508 }
509 509
510 glNewList ($self->{list} ||= glGenList); 510 glNewList ($self->{list} ||= glGenList);
521 521
522 #d#glTranslate -$self->{sdx}, -$self->{sdy}; # anchor fow at player 522 #d#glTranslate -$self->{sdx}, -$self->{sdy}; # anchor fow at player
523 glScale $self->{tilesize}, $self->{tilesize}; 523 glScale $self->{tilesize}, $self->{tilesize};
524 524
525 if (my $tex = $self->{fow_texture}) { 525 if (my $tex = $self->{fow_texture}) {
526 if (0 && $self->{last_fow_texture}) { 526 if ($DC::OpenGL::GL_MULTITEX && $self->{last_fow_texture} && 0) {#d#
527 my $d1 = ($self->{sdx} ** 2 + $self->{sdy} ** 2) ** 0.5; 527 my $d1 = ($self->{sdx} ** 2 + $self->{sdy} ** 2) ** 0.5;
528 my $d2 = ($self->{ldx} ** 2 + $self->{ldy} ** 2) ** 0.5; 528 my $d2 = ($self->{ldx} ** 2 + $self->{ldy} ** 2) ** 0.5;
529 529
530 if ($d1 * $d2) { 530 if ($d1 * $d2) {
531 DC::Texture::draw_fow_texture
532 $::CFG->{fow_intensity},
533 @{$self->{fow_texture}}{qw(name s t w h)},
531 my $a2 = $d1 / $d2; 534 $d1 / $d2,
532 my $a1 = 1 - $a2;
533
534 #$a1 *= 0.9;
535 #$a2 *= 0.9;
536
537 printf "%8g %8g %8g %8g\n", $d1, $d2, $a1, $a2;#d#
538
539 #$a1 = 1 - (1-$a1) * 0.707;
540 #$a2 = 1 - (1-$a2) * 0.707;
541
542 glColor 1,0,0,1;
543 glBegin GL_QUADS;
544 glVertex 10 + $sdx_t, 10;
545 glVertex 11 + $sdx_t, 10;
546 glVertex 11 + $sdx_t, 11;
547 glVertex 10 + $sdx_t, 11;
548 glEnd;
549
550 if(0){
551 glBlendFunc GL_ZERO, GL_DST_COLOR;
552 glColor +($::CFG->{fow_intensity}) x 3, $a2;
553 glPushMatrix;
554 glTranslate $sdx_t, $sdy_t; # anchor at player
555 glTranslate $self->{ldx} / -$tilesize, $self->{ldy} / -$tilesize; 535 $sdx_t - $self->{ldx} / $tilesize, $sdy_t - $self->{ldy} / $tilesize,
556 glScale 1/3, 1/3; 536 @{$self->{last_fow_texture}}{qw(name s t w h)};
557 $self->{last_fow_texture}->draw_quad_alpha (0, 0);
558 glPopMatrix;
559 }
560 } else { 537 } else {
561 delete $self->{last_fow_texture}; 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)};
562 } 544 }
563 } else { 545 } else {
546 #d#glTranslate +(min 0, $sdx_t), (min 0, $sdy_t); # anchor at player
564 DC::Texture::draw_fow_texture 547 DC::Texture::draw_fow_texture
565 $::CFG->{fow_intensity}, 548 $::CFG->{fow_intensity},
566 @{$self->{fow_texture}}{qw(name s t w h)}; 549 @{$self->{fow_texture}}{qw(name s t w h)};
567 #d#glTranslate +(min 0, $sdx_t), (min 0, $sdy_t); # anchor at player
568 } 550 }
569 } 551 }
570 552
571 if ($self->{magicmap}) { 553 if ($self->{magicmap}) {
572 my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} }; 554 my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines