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.151 by root, Mon Nov 16 00:47:56 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
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 glEnable GL_TEXTURE_2D; 526 if ($DC::OpenGL::GL_MULTITEX && $self->{last_fow_texture} && 0) {#d#
527 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
528
529 my $a1 = 0.9;
530
531 if (0 && $self->{last_fow_texture}) {
532 my $d1 = ($self->{sdx} ** 2 + $self->{sdy} ** 2) ** 0.5; 527 my $d1 = ($self->{sdx} ** 2 + $self->{sdy} ** 2) ** 0.5;
533 my $d2 = ($self->{ldx} ** 2 + $self->{ldy} ** 2) ** 0.5; 528 my $d2 = ($self->{ldx} ** 2 + $self->{ldy} ** 2) ** 0.5;
534 529
535 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)},
536 my $a2 = $d1 / $d2; 534 $d1 / $d2,
537
538 $a1 = 1 - $a2;
539
540 $a1 *= 0.9;
541 #$a2 *= 0.9;
542
543 printf "%4g %4g %4g\n", $d1, $d2, $a1+$a2;#d#
544
545 #$a1 = 1 - (1-$a1) * 0.707;
546 #$a2 = 1 - (1-$a2) * 0.707;
547
548 glColor 1,0,0,1;
549 glBegin GL_QUADS;
550 glVertex 10 + $sdx_t, 10;
551 glVertex 11 + $sdx_t, 10;
552 glVertex 11 + $sdx_t, 11;
553 glVertex 10 + $sdx_t, 11;
554 glEnd;
555
556 glColor +($::CFG->{fow_intensity}) x 3, $a2;
557 glPushMatrix;
558 glTranslate $sdx_t, $sdy_t; # anchor at player
559 glTranslate $self->{ldx} / -$tilesize, $self->{ldy} / -$tilesize; 535 $sdx_t - $self->{ldx} / $tilesize, $sdy_t - $self->{ldy} / $tilesize,
560 glScale 1/3, 1/3; 536 @{$self->{last_fow_texture}}{qw(name s t w h)};
561 $self->{last_fow_texture}->draw_quad_alpha (0, 0);
562 glPopMatrix;
563 } else { 537 } else {
564 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)};
565 } 544 }
545 } else {
546 #d#glTranslate +(min 0, $sdx_t), (min 0, $sdy_t); # anchor at player
547 DC::Texture::draw_fow_texture
548 $::CFG->{fow_intensity},
549 @{$self->{fow_texture}}{qw(name s t w h)};
566 } 550 }
567
568 glColor +($::CFG->{fow_intensity}) x 3, $a1;
569 glPushMatrix;
570 #d#glTranslate +(min 0, $sdx_t), (min 0, $sdy_t); # anchor at player
571 glScale 1/3, 1/3;
572 $self->{fow_texture}->draw_quad_alpha (0, 0);
573 glPopMatrix;
574
575 glDisable GL_TEXTURE_2D;
576 } 551 }
577 552
578 if ($self->{magicmap}) { 553 if ($self->{magicmap}) {
579 my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} }; 554 my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} };
580 555

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines