… | |
… | |
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 | }); |
… | |
… | |
187 | $self->send_exti_msg (w_r => $rid, [map $w->{$_}, @$attr]); |
189 | $self->send_exti_msg (w_r => $rid, [map $w->{$_}, @$attr]); |
188 | }); |
190 | }); |
189 | |
191 | |
190 | # message window |
192 | # message window |
191 | $self->connect_ext (channel_info => sub { |
193 | $self->connect_ext (channel_info => sub { |
|
|
194 | my ($info) = @_; |
|
|
195 | $self->{channels}->{$info->{id}} = $info; |
192 | $::MESSAGE_WINDOW->add_channel ($_[0]); |
196 | $::MESSAGE_WINDOW->add_channel ($info); |
193 | }); |
197 | }); |
194 | |
198 | |
195 | # destroy widgets on logout |
199 | # destroy widgets on logout |
196 | $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 { |
197 | for my $ws (values %{delete $self->{widgetset} || {}}) { |
201 | for my $ws (values %{delete $self->{widgetset} || {}}) { |
… | |
… | |
812 | } |
816 | } |
813 | } |
817 | } |
814 | |
818 | |
815 | sub sound_play { |
819 | sub sound_play { |
816 | my ($self, $x, $y, $soundnum, $type) = @_; |
820 | my ($self, $x, $y, $soundnum, $type) = @_; |
|
|
821 | warn "sound play <@_>\n";#d# |
817 | |
822 | |
818 | $self->{sound_play}->($x, $y, $soundnum, $type); |
823 | #$self->{sound_play}->($x, $y, $soundnum, $type); |
819 | } |
824 | } |
820 | |
825 | |
821 | my $LAST_QUERY; # server is stupid, stupid, stupid |
826 | my $LAST_QUERY; # server is stupid, stupid, stupid |
822 | |
827 | |
823 | sub query { |
828 | sub query { |
… | |
… | |
894 | |
899 | |
895 | ## 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 |
896 | # no longer neecssary with TRT servers |
901 | # no longer neecssary with TRT servers |
897 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
902 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
898 | |
903 | |
899 | ::message ({ fg => $fg, markup => $_, type => $type }) |
904 | ::message ({ fg => $fg, markup => $_, type => $type, extra => [@extra] }) |
900 | for split /\n/, $text; |
905 | for split /\n/, $text; |
901 | |
906 | |
902 | $self->{statusbox}->add ($text, |
907 | $self->{statusbox}->add ($text, |
903 | group => $text, |
908 | group => $text, |
904 | fg => $fg, |
909 | fg => $fg, |
… | |
… | |
1160 | . "cfplus support $yesno[$self->{cfplus_ext} > 0]" |
1165 | . "cfplus support $yesno[$self->{cfplus_ext} > 0]" |
1161 | . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" |
1166 | . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" |
1162 | . "map size $self->{mapw}×$self->{maph}\n" |
1167 | . "map size $self->{mapw}×$self->{maph}\n" |
1163 | ); |
1168 | ); |
1164 | |
1169 | |
1165 | ::setup_build_button ($self->{editor_support}->{builder_ui}); |
|
|
1166 | } |
1170 | } |
1167 | |
1171 | |
1168 | sub logged_in { |
1172 | sub logged_in { |
1169 | my ($self) = @_; |
1173 | my ($self) = @_; |
1170 | |
1174 | |
… | |
… | |
1190 | |
1194 | |
1191 | $self->send_command ("output-sync $::CFG->{output_sync}"); |
1195 | $self->send_command ("output-sync $::CFG->{output_sync}"); |
1192 | $self->send_command ("output-count $::CFG->{output_count}"); |
1196 | $self->send_command ("output-count $::CFG->{output_count}"); |
1193 | $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; |
1194 | $self->send_command ("pickup $::CFG->{pickup}"); |
1198 | $self->send_command ("pickup $::CFG->{pickup}"); |
1195 | } |
|
|
1196 | |
|
|
1197 | sub buildat { |
|
|
1198 | my ($self, $builditem, $x, $y) = @_; |
|
|
1199 | |
|
|
1200 | if ($self->{cfplus_ext}) { |
|
|
1201 | $self->send_ext_msg (builder_build => dx => $x, dy => $y, (ref ($builditem) eq 'HASH') ? %$builditem : (item => $builditem)); |
|
|
1202 | } |
|
|
1203 | } |
1199 | } |
1204 | |
1200 | |
1205 | sub lookat { |
1201 | sub lookat { |
1206 | my ($self, $x, $y) = @_; |
1202 | my ($self, $x, $y) = @_; |
1207 | |
1203 | |