--- deliantra/Deliantra-Client/DC/MapWidget.pm 2007/04/04 02:43:29 1.104 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2007/07/17 17:39:07 1.109 @@ -26,9 +26,9 @@ tilesize => 32, smooth_matrix => [ - 0.05, 0.13, 0.05, - 0.13, 0.30, 0.13, - 0.05, 0.13, 0.05, + 0.30, 0.50, 0.30, + 0.50, 0.50, 0.50, + 0.30, 0.50, 0.30, ], @_ @@ -186,8 +186,8 @@ $self->grab_focus; return unless $::CONN; - my $x = $self->{dx} + CFPlus::floor +($ev->{x} - $self->{sx0}) / $self->{tilesize}; - my $y = $self->{dy} + CFPlus::floor +($ev->{y} - $self->{sy0}) / $self->{tilesize}; + my $x = $self->{dx} + CFPlus::floor +($ev->{x} - $self->{sx0}) / $self->{ctilesize}; + my $y = $self->{dy} + CFPlus::floor +($ev->{y} - $self->{sy0}) / $self->{ctilesize}; $x -= CFPlus::floor $::MAP->w * 0.5; $y -= CFPlus::floor $::MAP->h * 0.5; @@ -310,6 +310,7 @@ } my %DIR = ( + CFPlus::SDLK_KP5, [0, "stay fire"], CFPlus::SDLK_KP8, [1, "north"], CFPlus::SDLK_KP9, [2, "northeast"], CFPlus::SDLK_KP6, [3, "east"], @@ -351,8 +352,6 @@ } elsif (!$::CONN) { return 0; # bindings further down need a valid connection - } elsif ($sym == CFPlus::SDLK_KP5 && !$mod) { - $::CONN->user_send ("stay fire"); } elsif ($uni == ord ",") { $::CONN->user_send ("take"); } elsif ($uni == ord " ") { @@ -456,7 +455,7 @@ unless $focused || !$::FAST; if (delete $self->{need_update}) { - my $tilesize = $self->{tilesize} = int $self->{tilesize} * $::CFG->{map_scale}; + my $tilesize = $self->{ctilesize} = (int $self->{tilesize} * $::CFG->{map_scale}) || 1; my $sw = $self->{sw} = 1 + CFPlus::ceil $self->{w} / $tilesize; my $sh = $self->{sh} = 1 + CFPlus::ceil $self->{h} / $tilesize; @@ -471,19 +470,11 @@ my $dy = $self->{dy} = CFPlus::ceil 0.5 * ($::MAP->h - $sh) - $sy; if ($::CFG->{fow_enable}) { - my ($w, $h, $data) = $::MAP->fow_texture ($dx, $dy, $sw, $sh); - - if ($::CFG->{fow_smooth} && $CFPlus::OpenGL::GL_VERSION >= 1.2) { # smooth fog of war - glConvolutionParameter (GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER); - glConvolutionFilter2D ( - GL_CONVOLUTION_2D, - GL_ALPHA, - 3, 3, - GL_ALPHA, GL_FLOAT, - (pack "f*", @{ $self->{smooth_matrix} }), - ); - glEnable GL_CONVOLUTION_2D; - } + my ($w, $h, $data) = $::MAP->fow_texture ( + $dx, $dy, $sw, $sh, + $::CFG->{fow_smooth}, + pack "f*", @{ $self->{smooth_matrix} }, + ); $self->{fow_texture} = new CFPlus::Texture w => $w, @@ -491,8 +482,6 @@ data => $data, internalformat => GL_ALPHA, format => GL_ALPHA; - - glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth}; } else { delete $self->{fow_texture}; } @@ -508,6 +497,8 @@ glScale $self->{tilesize}, $self->{tilesize}; if (my $tex = $self->{fow_texture}) { + glPushMatrix; + #glScale 1/3, 1/3 if $::CFG->{fow_smooth}; glEnable GL_TEXTURE_2D; glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; @@ -515,6 +506,7 @@ $self->{fow_texture}->draw_quad_alpha (0, 0); glDisable GL_TEXTURE_2D; + glPopMatrix; } if ($self->{magicmap}) { @@ -559,6 +551,9 @@ package CFPlus::MapWidget::MapMap; +use strict; +use utf8; + our @ISA = CFPlus::UI::Base::; use Time::HiRes qw(time);