ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.97 by root, Fri Apr 6 08:09:43 2007 UTC vs.
Revision 1.98 by root, Fri Apr 6 19:17:25 2007 UTC

415 } while $self->{texture}[$id]; 415 } while $self->{texture}[$id];
416 416
417 CFPlus::DB::get tilecache => $id, sub { 417 CFPlus::DB::get tilecache => $id, sub {
418 my ($data) = @_; 418 my ($data) = @_;
419 419
420 return unless $self->{map}; # stop when destroyed
421
420 $self->set_texture ($id => $data) 422 $self->set_texture ($id => $data)
421 if defined $data; 423 if defined $data;
422 424
423 $self->bg_fetch; 425 $self->bg_fetch;
424 }; 426 };
433 if (defined $data) { 435 if (defined $data) {
434 $data = Compress::LZF::decompress $data; 436 $data = Compress::LZF::decompress $data;
435 #warn sprintf "LOADmap[%s,%d,%d] length %d\n", $hash, $x, $y, length $data;#d# 437 #warn sprintf "LOADmap[%s,%d,%d] length %d\n", $hash, $x, $y, length $data;#d#
436 438
437 my $inprogress = @{ $self->{bg_fetch} || [] }; 439 my $inprogress = @{ $self->{bg_fetch} || [] };
438 push @{ $self->{bg_fetch} }, $self->{map}->set_rect ($x, $y, $data); 440 unshift @{ $self->{bg_fetch} }, $self->{map}->set_rect ($x, $y, $data);
439 $self->bg_fetch unless $inprogress; 441 $self->bg_fetch unless $inprogress;
440 } 442 }
441 }; 443 };
442} 444}
443 445
586} 588}
587 589
588sub set_texture { 590sub set_texture {
589 my ($self, $id, $data) = @_; 591 my ($self, $id, $data) = @_;
590 592
591 $self->{texture}[$id] ||= do { 593 $self->{texture}[$id] = my $tex =
592 my $tex =
593 new_from_image CFPlus::Texture 594 new_from_image CFPlus::Texture
594 $data, minify => 1, mipmap => 1; 595 $data, minify => 1, mipmap => 1;
595 596
596 $self->{map}->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}}); 597 $self->{map}->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}});
597 $self->{map_widget}->update; 598 $self->{map_widget}->update;
598
599 $tex
600 };
601} 599}
602 600
603sub sound_play { 601sub sound_play {
604 my ($self, $x, $y, $soundnum, $type) = @_; 602 my ($self, $x, $y, $soundnum, $type) = @_;
605 603

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines