… | |
… | |
57 | if $ev->{play}; |
57 | if $ev->{play}; |
58 | }); |
58 | }); |
59 | |
59 | |
60 | $self->connect_ext (capabilities => sub { |
60 | $self->connect_ext (capabilities => sub { |
61 | my (%cap) = @_; |
61 | my (%cap) = @_; |
|
|
62 | |
|
|
63 | #$self->send ("setup sound 0"); # we use a different protocol |
62 | |
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 | }); |
… | |
… | |
183 | |
185 | |
184 | my $w = $self->{widget}{$id} |
186 | my $w = $self->{widget}{$id} |
185 | or return; |
187 | or return; |
186 | |
188 | |
187 | $self->send_exti_msg (w_r => $rid, [map $w->{$_}, @$attr]); |
189 | $self->send_exti_msg (w_r => $rid, [map $w->{$_}, @$attr]); |
|
|
190 | }); |
|
|
191 | |
|
|
192 | # message window |
|
|
193 | $self->connect_ext (channel_info => sub { |
|
|
194 | my ($info) = @_; |
|
|
195 | $self->{channels}->{$info->{id}} = $info; |
|
|
196 | $::MESSAGE_WINDOW->add_channel ($info); |
188 | }); |
197 | }); |
189 | |
198 | |
190 | # destroy widgets on logout |
199 | # destroy widgets on logout |
191 | $self->{on_stop_game_guard} = $self->{map_widget}{root}->connect (stop_game => sub { |
200 | $self->{on_stop_game_guard} = $self->{map_widget}{root}->connect (stop_game => sub { |
192 | for my $ws (values %{delete $self->{widgetset} || {}}) { |
201 | for my $ws (values %{delete $self->{widgetset} || {}}) { |
… | |
… | |
734 | |
743 | |
735 | sub face_update { |
744 | sub face_update { |
736 | my ($self, $facenum, $face, $changed) = @_; |
745 | my ($self, $facenum, $face, $changed) = @_; |
737 | |
746 | |
738 | if ($face->{type} == 0) { # FT_FACE |
747 | if ($face->{type} == 0) { # FT_FACE |
739 | CFPlus::DB::put tilecache => $face->{id} => $face->{image}, sub { } |
748 | CFPlus::DB::put tilecache => $face->{id} => $face->{data}, sub { } |
740 | if $changed; |
749 | if $changed; |
741 | |
750 | |
742 | $self->set_texture ($face->{id} => delete $face->{data}); |
751 | $self->set_texture ($face->{id} => delete $face->{data}); |
743 | |
752 | |
744 | } elsif ($face->{type} & 1) { # split metadata |
753 | } elsif ($face->{type} & 1) { # split metadata |
… | |
… | |
807 | } |
816 | } |
808 | } |
817 | } |
809 | |
818 | |
810 | sub sound_play { |
819 | sub sound_play { |
811 | my ($self, $x, $y, $soundnum, $type) = @_; |
820 | my ($self, $x, $y, $soundnum, $type) = @_; |
|
|
821 | warn "sound play <@_>\n";#d# |
812 | |
822 | |
813 | $self->{sound_play}->($x, $y, $soundnum, $type); |
823 | #$self->{sound_play}->($x, $y, $soundnum, $type); |
814 | } |
824 | } |
815 | |
825 | |
816 | my $LAST_QUERY; # server is stupid, stupid, stupid |
826 | my $LAST_QUERY; # server is stupid, stupid, stupid |
817 | |
827 | |
818 | sub query { |
828 | sub query { |
… | |
… | |
889 | |
899 | |
890 | ## try to create single paragraphs of multiple lines sent by the server |
900 | ## try to create single paragraphs of multiple lines sent by the server |
891 | # no longer neecssary with TRT servers |
901 | # no longer neecssary with TRT servers |
892 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
902 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
893 | |
903 | |
894 | ::message ({ fg => $fg, markup => $_ }) |
904 | ::message ({ fg => $fg, markup => $_, type => $type, extra => [@extra] }) |
895 | for split /\n/, $text; |
905 | for split /\n/, $text; |
896 | |
906 | |
897 | $self->{statusbox}->add ($text, |
907 | $self->{statusbox}->add ($text, |
898 | group => $text, |
908 | group => $text, |
899 | fg => $fg, |
909 | fg => $fg, |
… | |
… | |
1155 | . "cfplus support $yesno[$self->{cfplus_ext} > 0]" |
1165 | . "cfplus support $yesno[$self->{cfplus_ext} > 0]" |
1156 | . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" |
1166 | . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" |
1157 | . "map size $self->{mapw}×$self->{maph}\n" |
1167 | . "map size $self->{mapw}×$self->{maph}\n" |
1158 | ); |
1168 | ); |
1159 | |
1169 | |
1160 | ::setup_build_button ($self->{editor_support}->{builder_ui}); |
|
|
1161 | } |
1170 | } |
1162 | |
1171 | |
1163 | sub logged_in { |
1172 | sub logged_in { |
1164 | my ($self) = @_; |
1173 | my ($self) = @_; |
1165 | |
1174 | |
… | |
… | |
1185 | |
1194 | |
1186 | $self->send_command ("output-sync $::CFG->{output_sync}"); |
1195 | $self->send_command ("output-sync $::CFG->{output_sync}"); |
1187 | $self->send_command ("output-count $::CFG->{output_count}"); |
1196 | $self->send_command ("output-count $::CFG->{output_count}"); |
1188 | $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; |
1197 | $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; |
1189 | $self->send_command ("pickup $::CFG->{pickup}"); |
1198 | $self->send_command ("pickup $::CFG->{pickup}"); |
1190 | } |
|
|
1191 | |
|
|
1192 | sub buildat { |
|
|
1193 | my ($self, $builditem, $x, $y) = @_; |
|
|
1194 | |
|
|
1195 | if ($self->{cfplus_ext}) { |
|
|
1196 | $self->send_ext_msg (builder_build => dx => $x, dy => $y, (ref ($builditem) eq 'HASH') ? %$builditem : (item => $builditem)); |
|
|
1197 | } |
|
|
1198 | } |
1199 | } |
1199 | |
1200 | |
1200 | sub lookat { |
1201 | sub lookat { |
1201 | my ($self, $x, $y) = @_; |
1202 | my ($self, $x, $y) = @_; |
1202 | |
1203 | |