--- deliantra/Deliantra-Client/DC/MapWidget.pm 2009/11/21 05:17:28 1.152 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2009/12/19 05:06:57 1.156 @@ -399,15 +399,15 @@ my ($self, $dx, $dy) = @_; $::MAP->scroll ($dx, $dy); - - $self->{last_fow_texture} = $self->{fow_texture}; - $self->{ldx} = $self->{sdx} + $dx * $self->{tilesize}; # smooth displacement - $self->{ldy} = $self->{sdy} + $dy * $self->{tilesize}; - $self->movement_update; $self->{sdx} += $dx * $self->{tilesize}; # smooth displacement $self->{sdy} += $dy * $self->{tilesize}; + + $self->{last_fow_texture} = $self->{fow_texture}; + $self->{ldx} = $self->{sdx}; + $self->{ldy} = $self->{sdy}; + } sub set_magicmap { @@ -523,56 +523,31 @@ glScale $self->{tilesize}, $self->{tilesize}; if (my $tex = $self->{fow_texture}) { - glEnable GL_TEXTURE_2D; - glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; - - my $a1 = 0.9; - - if (0 && $self->{last_fow_texture}) { + if ($DC::OpenGL::GL_MULTITEX && $self->{last_fow_texture} && 0) {#d# my $d1 = ($self->{sdx} ** 2 + $self->{sdy} ** 2) ** 0.5; my $d2 = ($self->{ldx} ** 2 + $self->{ldy} ** 2) ** 0.5; if ($d1 * $d2) { - my $a2 = $d1 / $d2; - - $a1 = (1/$a2); - - #$a1 *= 0.9; - #$a2 *= 0.9; - - printf "%4g %4g %4g\n", $d1, $d2, $a1+$a2;#d# - - #$a1 = 1 - (1-$a1) * 0.707; - #$a2 = 1 - (1-$a2) * 0.707; - - glColor 1,0,0,1; - glBegin GL_QUADS; - glVertex 10 + $sdx_t, 10; - glVertex 11 + $sdx_t, 10; - glVertex 11 + $sdx_t, 11; - glVertex 10 + $sdx_t, 11; - glEnd; - - glColor +($::CFG->{fow_intensity}) x 3, $a2; - glPushMatrix; - glTranslate $sdx_t, $sdy_t; # anchor at player - glTranslate $self->{ldx} / -$tilesize, $self->{ldy} / -$tilesize; - glScale 1/3, 1/3; - $self->{last_fow_texture}->draw_quad_alpha (0, 0); - glPopMatrix; + DC::Texture::draw_fow_texture + $::CFG->{fow_intensity}, + @{$self->{fow_texture}}{qw(name s t w h)}, + $d1 / $d2, + $sdx_t - $self->{ldx} / $tilesize, $sdy_t - $self->{ldy} / $tilesize, + @{$self->{last_fow_texture}}{qw(name s t w h)}; } else { delete $self->{last_fow_texture}; + + # same as a few lines below :/ + DC::Texture::draw_fow_texture + $::CFG->{fow_intensity}, + @{$self->{fow_texture}}{qw(name s t w h)}; } + } else { + #d#glTranslate +(min 0, $sdx_t), (min 0, $sdy_t); # anchor at player + DC::Texture::draw_fow_texture + $::CFG->{fow_intensity}, + @{$self->{fow_texture}}{qw(name s t w h)}; } - - glColor +($::CFG->{fow_intensity}) x 3, $a1; - glPushMatrix; - #d#glTranslate +(min 0, $sdx_t), (min 0, $sdy_t); # anchor at player - glScale 1/3, 1/3; - $self->{fow_texture}->draw_quad_alpha (0, 0); - glPopMatrix; - - glDisable GL_TEXTURE_2D; } if ($self->{magicmap}) {