… | |
… | |
58 | }); |
58 | }); |
59 | |
59 | |
60 | $self->connect_ext (capabilities => sub { |
60 | $self->connect_ext (capabilities => sub { |
61 | my (%cap) = @_; |
61 | my (%cap) = @_; |
62 | |
62 | |
|
|
63 | #$self->send ("setup sound 0"); # we use a different protocol |
|
|
64 | |
63 | $self->send_exti_msg (fx_want => { |
65 | $self->send_exti_msg (fx_want => { |
64 | 3 => !!$::CFG->{bgm_enable}, # FT_MUSIC |
66 | 3 => !!$::CFG->{bgm_enable}, # FT_MUSIC |
65 | 5 => !!$::CFG->{audio_enable}, # FT_SOUND |
67 | #5 => !!$::CFG->{audio_enable}, # FT_SOUND |
66 | }); |
68 | }); |
67 | |
69 | |
68 | if (my $ts = $cap{tileset}) { |
70 | if (my $ts = $cap{tileset}) { |
69 | if (my ($default) = grep $_->[2] & 1, @$ts) { |
71 | if (my ($default) = grep $_->[2] & 1, @$ts) { |
70 | $self->{tileset} = $default; |
72 | $self->{tileset} = $default; |
… | |
… | |
760 | |
762 | |
761 | &::audio_music_set ($self->{songs}); |
763 | &::audio_music_set ($self->{songs}); |
762 | }; |
764 | }; |
763 | } |
765 | } |
764 | |
766 | |
|
|
767 | my $path = CFPlus::DB::path_of_res $face->{name}; |
|
|
768 | |
765 | if ($changed) { # new data |
769 | if ($changed) { # new data |
766 | my ($meta_json, $data) = unpack "(w/a*)*", delete $face->{data}; |
770 | my ($meta_json, $data) = unpack "(w/a*)*", delete $face->{data}; |
767 | my $path = CFPlus::DB::path_of_res $face->{name}; |
|
|
768 | |
771 | |
769 | CFPlus::DB::write_file $path, $data, sub { |
772 | CFPlus::DB::write_file $path, $data, sub { |
770 | CFPlus::DB::put "res-metadata" => $face->{name} => $meta_json, sub { |
773 | CFPlus::DB::put "res-metadata" => $face->{name} => $meta_json, sub { |
771 | $face->{meta} = $self->{json_coder}->decode ($meta_json); |
774 | $face->{meta} = $self->{json_coder}->decode ($meta_json); |
772 | $face->{path} = $path; |
775 | $face->{path} = $path; |
… | |
… | |
774 | $cb->(); |
777 | $cb->(); |
775 | }; |
778 | }; |
776 | }; |
779 | }; |
777 | } else { |
780 | } else { |
778 | $face->{meta} = $self->{json_coder}->decode (delete $face->{data}); |
781 | $face->{meta} = $self->{json_coder}->decode (delete $face->{data}); |
|
|
782 | $face->{path} = $path; |
779 | $cb->(); |
783 | $cb->(); |
780 | } |
784 | } |
781 | } |
785 | } |
782 | } |
786 | } |
783 | |
787 | |
… | |
… | |
814 | } |
818 | } |
815 | } |
819 | } |
816 | |
820 | |
817 | sub sound_play { |
821 | sub sound_play { |
818 | my ($self, $x, $y, $soundnum, $type) = @_; |
822 | my ($self, $x, $y, $soundnum, $type) = @_; |
|
|
823 | warn "sound play <@_>\n";#d# |
819 | |
824 | |
820 | $self->{sound_play}->($x, $y, $soundnum, $type); |
825 | #$self->{sound_play}->($x, $y, $soundnum, $type); |
821 | } |
826 | } |
822 | |
827 | |
823 | my $LAST_QUERY; # server is stupid, stupid, stupid |
828 | my $LAST_QUERY; # server is stupid, stupid, stupid |
824 | |
829 | |
825 | sub query { |
830 | sub query { |
… | |
… | |
890 | $self->{$type} = $text; |
895 | $self->{$type} = $text; |
891 | } else { |
896 | } else { |
892 | $self->logprint ("msg: ", $text); |
897 | $self->logprint ("msg: ", $text); |
893 | return if $color < 0; # negative color == ignore if not understood |
898 | return if $color < 0; # negative color == ignore if not understood |
894 | |
899 | |
895 | my $fg = $CF_COLOR[$color % @CF_COLOR]; |
900 | my $fg = $CF_COLOR[$color & 0x1f] || [1, 0, 0]; |
896 | |
901 | |
897 | ## try to create single paragraphs of multiple lines sent by the server |
902 | ## try to create single paragraphs of multiple lines sent by the server |
898 | # no longer neecssary with TRT servers |
903 | # no longer neecssary with TRT servers |
899 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
904 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
900 | |
905 | |