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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines