--- deliantra/Deliantra-Client/DC/Protocol.pm 2007/04/06 08:09:43 1.97 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2007/04/10 09:39:48 1.99 @@ -19,7 +19,12 @@ sub new { my $class = shift; - my $self = $class->SUPER::new (@_, setup_req => { extmap => 1 }); + my $self = $class->SUPER::new (@_, + setup_req => { + extmap => 1, + smoothing => 1, + }, + ); $self->{map_widget}->clr_commands; @@ -417,6 +422,8 @@ CFPlus::DB::get tilecache => $id, sub { my ($data) = @_; + return unless $self->{map}; # stop when destroyed + $self->set_texture ($id => $data) if defined $data; @@ -435,7 +442,7 @@ #warn sprintf "LOADmap[%s,%d,%d] length %d\n", $hash, $x, $y, length $data;#d# my $inprogress = @{ $self->{bg_fetch} || [] }; - push @{ $self->{bg_fetch} }, $self->{map}->set_rect ($x, $y, $data); + unshift @{ $self->{bg_fetch} }, $self->{map}->set_rect ($x, $y, $data); $self->bg_fetch unless $inprogress; } }; @@ -585,19 +592,21 @@ $self->set_texture ($face->{id} => delete $face->{image}); } +sub smooth_update { + my ($self, $facenum, $face) = @_; + + $self->{map}->set_smooth ($facenum, $face->{smoothface}, $face->{smoothlevel}); +} + sub set_texture { my ($self, $id, $data) = @_; - $self->{texture}[$id] ||= do { - my $tex = - new_from_image CFPlus::Texture - $data, minify => 1, mipmap => 1; + $self->{texture}[$id] = my $tex = + new_from_image CFPlus::Texture + $data, minify => 1, mipmap => 1; - $self->{map}->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}}); - $self->{map_widget}->update; - - $tex - }; + $self->{map}->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}}); + $self->{map_widget}->update; } sub sound_play {