… | |
… | |
506 | } |
506 | } |
507 | |
507 | |
508 | sub feed_map1a { |
508 | sub feed_map1a { |
509 | my ($self, $data) = @_; |
509 | my ($self, $data) = @_; |
510 | |
510 | |
511 | $self->{map}->map1a_update ($data, $self->{setup}{extmap}); |
511 | my $missing = $self->{map}->map1a_update ($data, $self->{setup}{extmap}); |
|
|
512 | my $delay; |
|
|
513 | |
|
|
514 | for my $tile (@$missing) { |
|
|
515 | next if $self->{delay}{$tile}; |
|
|
516 | |
|
|
517 | $delay = 1; |
|
|
518 | |
|
|
519 | if (my $tex = $::CONN->{texture}[$tile]) { |
|
|
520 | $tex->upload; |
|
|
521 | } else { |
|
|
522 | $self->{delay}{$tile} = 1; |
|
|
523 | |
|
|
524 | # we assume the face is in-flight and will eventually come |
|
|
525 | push @{$self->{face_cb}{$tile}}, sub { |
|
|
526 | delete $self->{delay}{$tile}; |
|
|
527 | $_[0]->upload; |
|
|
528 | }; |
|
|
529 | } |
|
|
530 | } |
|
|
531 | |
|
|
532 | if ($delay) { |
|
|
533 | # delay the map drawing a tiny bit in the hope of getting the missing fetched |
|
|
534 | Event->timer (after => 0.03, cb => sub { |
|
|
535 | $_[0]->w->cancel; |
|
|
536 | $self->{map_widget}->update; |
|
|
537 | }); |
|
|
538 | } else { |
512 | $self->{map_widget}->update; |
539 | $self->{map_widget}->update; |
|
|
540 | } |
513 | } |
541 | } |
514 | |
542 | |
515 | sub magicmap { |
543 | sub magicmap { |
516 | my ($self, $w, $h, $x, $y, $data) = @_; |
544 | my ($self, $w, $h, $x, $y, $data) = @_; |
517 | |
545 | |
… | |
… | |
721 | $self->{map}->set_tileid ($facenum => $id); |
749 | $self->{map}->set_tileid ($facenum => $id); |
722 | |
750 | |
723 | CFPlus::DB::get tilecache => $id, $cb; |
751 | CFPlus::DB::get tilecache => $id, $cb; |
724 | |
752 | |
725 | } elsif ($face->{type} & 1) { # with metadata |
753 | } elsif ($face->{type} & 1) { # with metadata |
726 | #::message ({ markup => "starting to download song #$face/$pri, check your output-rate setting if your connection gets laggy." }); |
|
|
727 | CFPlus::DB::get res_meta => $face->{name}, $cb; |
754 | CFPlus::DB::get res_meta => $face->{name}, $cb; |
728 | } |
755 | } |
729 | } |
756 | } |
730 | |
757 | |
731 | sub face_update { |
758 | sub face_update { |
… | |
… | |
778 | sub have_tile { |
805 | sub have_tile { |
779 | my ($self, $tile) = @_; |
806 | my ($self, $tile) = @_; |
780 | |
807 | |
781 | return unless $self->{map}; |
808 | return unless $self->{map}; |
782 | |
809 | |
783 | $self->{texture}[$tile] ||= my $tex = |
810 | my $tex = $self->{texture}[$tile] ||= |
784 | new CFPlus::Texture |
811 | new CFPlus::Texture |
785 | tile => $tile, minify => 1, mipmap => 1, delay => 1; |
812 | tile => $tile, minify => 1, mipmap => 1, delay => 1; |
786 | |
813 | |
787 | $_->() for @{(delete $self->{face_cb}{$tile}) || []}; |
814 | $_->($tex) for @{(delete $self->{face_cb}{$tile}) || []}; |
788 | } |
815 | } |
789 | |
816 | |
790 | sub connect_face_update { |
817 | sub connect_face_update { |
791 | my ($self, $id, $cb) = @_; |
818 | my ($self, $id, $cb) = @_; |
792 | |
819 | |
… | |
… | |
987 | } |
1014 | } |
988 | |
1015 | |
989 | $::FLOORBOX->add_at (@add); |
1016 | $::FLOORBOX->add_at (@add); |
990 | }); |
1017 | }); |
991 | |
1018 | |
992 | $::WANT_REFRESH++; |
1019 | $::WANT_REFRESH->start; |
993 | } |
1020 | } |
994 | |
1021 | |
995 | sub set_opencont { |
1022 | sub set_opencont { |
996 | my ($conn, $tag, $name) = @_; |
1023 | my ($conn, $tag, $name) = @_; |
997 | $conn->{open_container} = $tag; |
1024 | $conn->{open_container} = $tag; |