ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.195 by root, Tue Jul 31 01:03:52 2007 UTC vs.
Revision 1.203 by root, Mon Aug 6 02:11:45 2007 UTC

144our $SETUP_KEYBOARD; 144our $SETUP_KEYBOARD;
145 145
146our $PL_NOTEBOOK; 146our $PL_NOTEBOOK;
147our $PL_WINDOW; 147our $PL_WINDOW;
148 148
149our $MUSIC_PLAYING_WIDGET;
150our $LICENSE_WIDGET;
151
149our $INVENTORY_PAGE; 152our $INVENTORY_PAGE;
150our $STATS_PAGE; 153our $STATS_PAGE;
151our $SKILL_PAGE; 154our $SKILL_PAGE;
152our $SPELL_PAGE; 155our $SPELL_PAGE;
153our $SPELL_LIST; 156our $SPELL_LIST;
159our $STATWIDS; 162our $STATWIDS;
160 163
161our $SDL_ACTIVE; 164our $SDL_ACTIVE;
162our %SDL_CB; 165our %SDL_CB;
163 166
167our $ALT_ENTER_MESSAGE;
168our $STATUSBOX;
169our $DEBUG_STATUS;
170
171our $INV;
172our $INVR;
173our $INV_RIGHT_HB;
174
175our $PICKUP_CFG;
176
177#############################################################################
178
179sub status {
180 $STATUSBOX->add (CFPlus::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
181}
182
183sub debug {
184 $DEBUG_STATUS->set_text ($_[0]);
185}
186
187sub message {
188 my ($para) = @_;
189 $MESSAGE_WINDOW->message ($para);
190}
191
192#############################################################################
193#TODO: maybe move into own audio module...
194
164our $SDL_MIXER; 195our $SDL_MIXER;
196
165our $MUSIC_DEFAULT = "in_a_heartbeat.ogg"; 197our $MUSIC_DEFAULT = "in_a_heartbeat.ogg";
166our @MUSIC_WANT; 198our $MUSIC_WANT; # arryref of ambient music we want to play
199our @MUSIC_HAVE; # ambient music we have on disk
167our $MUSIC_START; 200our $MUSIC_START;
201our @MUSIC_JINGLE; # which jingles to play next
168our $MUSIC_PLAYING_DATA; 202our $MUSIC_PLAYING_DATA;
169our $MUSIC_PLAYING_META; 203our $MUSIC_PLAYING_META;
170our $MUSIC_PLAYER; 204our $MUSIC_PLAYER;
171our $MUSIC_RESUME = 30; # resume music when players less than these many seconds before 205our $MUSIC_RESUME = 30; # resume music when played less than these many seconds before
172our @SOUNDS; # event => file mapping 206
173our %AUDIO_CHUNK; # audio files 207our %AUDIO_CHUNK; # audio "files"
174 208our %AUDIO_PLAY; # which audio faces should be played
175our $ALT_ENTER_MESSAGE;
176our $STATUSBOX;
177our $DEBUG_STATUS;
178
179our $INV;
180our $INVR;
181our $INV_RIGHT_HB;
182
183our $PICKUP_CFG;
184
185#############################################################################
186#TODO: maybe move into own audio module...
187 209
188sub audio_channel_finished { 210sub audio_channel_finished {
189 my ($channel) = @_; 211 my ($channel) = @_;
190 212
191# warn "channel $channel finished\n";#d# 213# warn "channel $channel finished\n";#d#
192} 214}
193 215
194our %AUDIO_PLAY;
195our %AUDIO_CHUNK;
196
197sub audio_sound_push($) { 216sub audio_sound_push($) {
198 my ($face) = @_; 217 my ($face) = @_;
218
219 $CFG->{effects_enable}
220 or return;
199 221
200 if (my $chunk = $AUDIO_CHUNK{$face}) { 222 if (my $chunk = $AUDIO_CHUNK{$face}) {
201 for (grep $_->[0] >= Event::time, @{(delete $AUDIO_PLAY{$face}) || []}) { 223 for (grep $_->[0] >= Event::time, @{(delete $AUDIO_PLAY{$face}) || []}) {
202 my (undef, $dx, $dy, $vol) = @$_; 224 my (undef, $dx, $dy, $vol) = @$_;
203 225
204 my $channel = CFPlus::Channel::find; 226 my $channel = CFPlus::Channel::find;
205 $channel->volume (128 + $vol); 227 $channel->volume ($vol * $CFG->{effects_volume} * 128 / 255);
206 $dx = $dx / 10 * 255; 228 $dx = $dx / 10 * 255;
207 $channel->set_panning ((min 255, 255 - $dx), (min 255, 255 + $dx)); 229 $channel->set_panning (255 - $dx, 255 + $dx);
208 230
209# my $angle = $dx ? : $dx < 0 ? 231# my $angle = $dx ? : $dx < 0 ?
210# my $distance = -$vol; 232# my $distance = -$vol;
211# $channel->set_position ($angle, $distance); 233# $channel->set_position ($angle, $distance);
212 234
215 } else { 237 } else {
216 # sound_meta not set means data is in flight either way 238 # sound_meta not set means data is in flight either way
217 my $meta = $CONN->{sound_meta}{$face} 239 my $meta = $CONN->{sound_meta}{$face}
218 or return; 240 or return;
219 241
242 # if its a jingle, play it as ambient music
243 if ($meta->{meta}{jingle}) {
244 if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue
245 push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue
246 &audio_music_push ($face);
247 }
248 } else {
220 # fetch from database 249 # fetch from database
221 CFPlus::DB::get res_data => $meta->{name}, sub { 250 CFPlus::DB::get res_data => $meta->{name}, sub {
222 my $vol = $meta->{meta}{volume} || 1;
223 my $rwops = new CFPlus::RW $_[0]; 251 my $rwops = new CFPlus::RW $_[0];
224 my $chunk = new CFPlus::MixChunk $rwops; 252 my $chunk = new CFPlus::MixChunk $rwops
225 $chunk->volume ($vol * 128); 253 or Carp::confess "sound face $meta->{face} unloadable: " . CFPlus::Mix_GetError;
254 $chunk->volume (($meta->{meta}{volume} || 1) * 128);
226 $AUDIO_CHUNK{$face} = $chunk; 255 $AUDIO_CHUNK{$face} = $chunk;
227 256
228 audio_sound_push ($face); 257 audio_sound_push ($face);
258 };
229 }; 259 }
230 } 260 }
231} 261}
232 262
233sub audio_sound_play { 263sub audio_sound_play {
234 my ($face, $dx, $dy, $vol) = @_; 264 my ($face, $dx, $dy, $vol) = @_;
235 265
236 $SDL_MIXER 266 $SDL_MIXER
267 or return;
268 $CFG->{effects_enable}
237 or return; 269 or return;
238 270
239 my $queue = $AUDIO_PLAY{$face} ||= []; 271 my $queue = $AUDIO_PLAY{$face} ||= [];
240 push @$queue, [Event::time + 0.2, $dx, $dy, $vol]; # delay sound by max. 0.2s 272 push @$queue, [Event::time + 0.2, $dx, $dy, $vol]; # delay sound by max. 0.2s
241 audio_sound_push $face 273 audio_sound_push $face
242 unless @$queue > 1; 274 unless @$queue > 1;
243} 275}
244 276
277sub audio_music_set_meta {
278 my ($meta) = @_;
279
280 $MUSIC_PLAYING_META = $meta;
281 $MUSIC_PLAYING_WIDGET->set_markup (
282 "<b>Name</b>: " . (CFPlus::asxml $meta->{meta}{name}) . "\n"
283 . "<b>Author</b>: " . (CFPlus::asxml $meta->{meta}{author}) . "\n"
284 . "<b>Source</b>: " . (CFPlus::asxml $meta->{meta}{source}) . "\n"
285 . "<b>License</b>: " . (CFPlus::asxml $meta->{meta}{license})
286 );
287}
288
245sub audio_music_update_volume { 289sub audio_music_update_volume {
246 return unless $MUSIC_PLAYING_META; 290 return unless $MUSIC_PLAYING_META;
247 my $volume = $MUSIC_PLAYING_META->{meta}{volume} || 1; 291 my $volume = $MUSIC_PLAYING_META->{meta}{volume} || 1;
248 my $base = $CFG->{bgm_volume}; 292 my $base = $MUSIC_PLAYING_META->{meta}{jingle} ? 1 : $CFG->{bgm_volume};
249 CFPlus::MixMusic::volume $base * $volume * 128; 293 CFPlus::MixMusic::volume $base * $volume * 128;
250}
251
252sub audio_music_set_ambient {
253 my ($songs) = @_;
254
255 my @want =
256 grep $_,
257 map $CONN->{music_meta}{$_},
258 @$songs;
259
260 if (@want) {
261 @MUSIC_WANT = @want;
262 &audio_music_changed ();
263 }
264} 294}
265 295
266sub audio_music_start { 296sub audio_music_start {
267 my $meta = $MUSIC_PLAYING_META; 297 my $meta = $MUSIC_PLAYING_META;
268 298
280 my $rwops = $meta->{path} 310 my $rwops = $meta->{path}
281 ? new_from_file CFPlus::RW $meta->{path} 311 ? new_from_file CFPlus::RW $meta->{path}
282 : new CFPlus::RW $$MUSIC_PLAYING_DATA; 312 : new CFPlus::RW $$MUSIC_PLAYING_DATA;
283 313
284 $MUSIC_PLAYER = new CFPlus::MixMusic $rwops 314 $MUSIC_PLAYER = new CFPlus::MixMusic $rwops
285 or ((warn CFPlus::Mix_GetError), return); # pretty fatal error 315 or Carp::confess "music face $meta->{face} unloadable: " . CFPlus::Mix_GetError;
286 316
287 my $NOW = time; 317 my $NOW = time;
288 318
289 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) { 319 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) {
290 my $pos = $MUSIC_PLAYING_META->{stop_pos}; 320 my $pos = $MUSIC_PLAYING_META->{stop_pos};
293 } else { 323 } else {
294 $MUSIC_PLAYER->play (0); 324 $MUSIC_PLAYER->play (0);
295 $MUSIC_START = time; 325 $MUSIC_START = time;
296 } 326 }
297 327
298 delete $MUSIC_PLAYING_META->{stop_time}; 328 delete $meta->{stop_time};
299 delete $MUSIC_PLAYING_META->{stop_pos}; 329 delete $meta->{stop_pos};
300 } 330 }
301} 331}
302 332
303sub audio_music_changed { 333sub audio_music_push {
304 return unless $CFG->{bgm_enable};
305 return unless $SDL_MIXER; 334 return unless $SDL_MIXER;
306 335
336 my $fade_out;
337
338 if (@MUSIC_JINGLE) {
339 @MUSIC_HAVE = $MUSIC_JINGLE[0];
340 $fade_out = 333;
341 } else {
342 return unless $CFG->{bgm_enable};
343
344 my @have =
345 grep $_,
346 map $CONN->{music_meta}{$_},
347 @$MUSIC_WANT;
348
349 @MUSIC_HAVE = @have
350 if @have;
351
307 # default MUSIC_WANT == MUSIC_DEFAULT 352 # default MUSIC_HAVE == MUSIC_DEFAULT
308 @MUSIC_WANT = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_WANT; 353 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE;
354 $fade_out = 1000;
355 }
309 356
310 # if the currently playing song is acceptable, let it continue 357 # if the currently playing song is acceptable, let it continue
311 return if $MUSIC_PLAYING_META
312 && grep $MUSIC_PLAYING_META == $_, @MUSIC_WANT; 358 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE;
313 359
314 my $NOW = time; 360 my $NOW = time;
315 361
316 if ($MUSIC_PLAYING_META) { 362 if ($MUSIC_PLAYING_META) {
317 $MUSIC_PLAYING_META->{stop_time} = $NOW; 363 $MUSIC_PLAYING_META->{stop_time} = $NOW;
318 $MUSIC_PLAYING_META->{stop_pos} = $NOW - $MUSIC_START; 364 $MUSIC_PLAYING_META->{stop_pos} = $NOW - $MUSIC_START;
319 CFPlus::MixMusic::fade_out 1000; 365 CFPlus::MixMusic::fade_out $fade_out;
320 } else { 366 } else {
321 # sort by stop time, oldest first 367 # sort by stop time, oldest first
322 @MUSIC_WANT = sort { $a->{stop_time} <=> $b->{stop_time} } @MUSIC_WANT; 368 @MUSIC_HAVE = sort { $a->{stop_time} <=> $b->{stop_time} } @MUSIC_HAVE;
323 369
324 # if the most recently-played piece played very recently, 370 # if the most recently-played piece played very recently,
325 # resume it, else choose the oldest piece for rotation. 371 # resume it, else choose the oldest piece for rotation.
326 $MUSIC_PLAYING_META = 372 audio_music_set_meta
327 $MUSIC_WANT[-1]{stop_time} > $NOW - $MUSIC_RESUME 373 $MUSIC_HAVE[-1]{stop_time} > $NOW - $MUSIC_RESUME
328 ? $MUSIC_WANT[-1] 374 ? $MUSIC_HAVE[-1]
329 : $MUSIC_WANT[0]; 375 : $MUSIC_HAVE[0];
330 376
331 audio_music_start; 377 audio_music_start;
332 } 378 }
333} 379}
334 380
381sub audio_music_set_ambient {
382 my ($songs) = @_;
383
384 $MUSIC_WANT = $songs;
385 audio_music_push;
386}
387
335sub audio_music_finished { 388sub audio_music_finished {
389 # we compress multiple jingles of the same type
390 shift @MUSIC_JINGLE
391 while @MUSIC_JINGLE && $MUSIC_PLAYING_META == $MUSIC_JINGLE[0];
392
393 $MUSIC_PLAYING_WIDGET->clear;
394
336 undef $MUSIC_PLAYER; 395 undef $MUSIC_PLAYER;
337 undef $MUSIC_PLAYING_META; 396 undef $MUSIC_PLAYING_META;
338 undef $MUSIC_PLAYING_DATA; 397 undef $MUSIC_PLAYING_DATA;
339 398
340 audio_music_changed; 399 audio_music_push;
400}
401
402sub audio_init {
403 if ($CFG->{audio_enable}) {
404 $ENV{MIX_EFFECTSMAXSPEED} = 1;
405 $SDL_MIXER = !CFPlus::Mix_OpenAudio;
406
407 unless ($SDL_MIXER) {
408 status "Unable to open sound device: there will be no sound";
409 return;
410 }
411
412 CFPlus::Mix_AllocateChannels 16;
413
414 audio_music_finished;
415 } else {
416 undef $SDL_MIXER;
417 }
418}
419
420sub audio_shutdown {
421 undef $MUSIC_PLAYER;
422 undef $MUSIC_PLAYING_META;
423 undef $MUSIC_PLAYING_DATA;
424
425 audio_music_set_meta { };
426
427 $MUSIC_WANT = [];
428 @MUSIC_JINGLE = ();
429 %AUDIO_PLAY = ();
430 %AUDIO_CHUNK = ();
431
432 CFPlus::Mix_CloseAudio if $SDL_MIXER;
433 undef $SDL_MIXER;
341} 434}
342 435
343############################################################################# 436#############################################################################
344
345sub status {
346 $STATUSBOX->add (CFPlus::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
347}
348
349sub debug {
350 $DEBUG_STATUS->set_text ($_[0]);
351}
352
353sub message {
354 my ($para) = @_;
355 $MESSAGE_WINDOW->message ($para);
356}
357 437
358sub destroy_query_dialog { 438sub destroy_query_dialog {
359 (delete $_[0]{query_dialog})->destroy 439 (delete $_[0]{query_dialog})->destroy
360 if $_[0]{query_dialog}; 440 if $_[0]{query_dialog};
361} 441}
784} 864}
785 865
786sub audio_setup { 866sub audio_setup {
787 my $vbox = new CFPlus::UI::VBox; 867 my $vbox = new CFPlus::UI::VBox;
788 868
789 $vbox->add (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]); 869 $vbox->add (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 0, 1]);
790 870
791 my $row = 0; 871 my $row = 0;
792 872
793 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Audio Enable"); 873 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Audio Enable");
794 $table->add_at (1, $row++, new CFPlus::UI::CheckBox 874 $table->add_at (1, $row++, new CFPlus::UI::CheckBox
798 ); 878 );
799# $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume"); 879# $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume");
800# $table->add_at (1, 8, new CFPlus::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub { 880# $table->add_at (1, 8, new CFPlus::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub {
801# $CFG->{effects_volume} = $_[1]; 881# $CFG->{effects_volume} = $_[1];
802# }); 882# });
883
884 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume");
885 $table->add_at (1, $row, new CFPlus::UI::CheckBox
886 expand => 1, state => $CFG->{effects_enable},
887 tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.",
888 on_changed => sub { $CFG->{effects_enable} = $_[1]; 0 }
889 );
890 $table->add_at (2, $row++, new CFPlus::UI::Slider
891 expand => 1, range => [$CFG->{effects_volume}, 0, 1, 0, 1/128],
892 tooltip => "The relative volume of sound effects. Best audio quality is achieved if this "
893 . "is set highest and you use your operating system volume setting. Changes are instant.",
894 on_changed => sub { $CFG->{effects_volume} = $_[1]; 0 }
895 );
896
803 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Background Music"); 897 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Background Music");
804 $table->add_at (1, $row++, my $hbox = new CFPlus::UI::HBox); 898 $table->add_at (1, $row, new CFPlus::UI::CheckBox
805 $hbox->add (new CFPlus::UI::CheckBox
806 expand => 1, state => $CFG->{bgm_enable}, 899 expand => 1, state => $CFG->{bgm_enable},
807 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", 900 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.",
808 on_changed => sub { $CFG->{bgm_enable} = $_[1]; 0 } 901 on_changed => sub { $CFG->{bgm_enable} = $_[1]; 0 }
809 ); 902 );
810 $hbox->add (new CFPlus::UI::Slider 903 $table->add_at (2, $row++, new CFPlus::UI::Slider
811 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], 904 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128],
812 tooltip => "The volume of the background music. Changes are instant.", 905 tooltip => "The volume of the background music. Changes are instant.",
813 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } 906 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 }
814 ); 907 );
815 908
816 $table->add_at (1, $row++, new CFPlus::UI::Button 909 $table->add_at (1, $row++, new CFPlus::UI::Button
817 expand => 1, align => 0, text => "Apply", 910 c_colspan => 2, expand => 1, align => 0, text => "Apply",
818 tooltip => "Apply the audio settings", 911 tooltip => "Apply the audio settings",
819 on_activate => sub { 912 on_activate => sub {
820 audio_shutdown (); 913 audio_shutdown ();
821 audio_init (); 914 audio_init ();
822 0 915 0
893 $table->add_at (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { &CFPlus::debug() } ); 986 $table->add_at (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { &CFPlus::debug() } );
894 987
895 $table->add_at (0, 5, new CFPlus::UI::TextEdit text => "line1\0152\0153");#d# 988 $table->add_at (0, 5, new CFPlus::UI::TextEdit text => "line1\0152\0153");#d#
896 989
897 $table->add_at (7,7, my $t = new CFPlus::UI::Table expand => 0); 990 $table->add_at (7,7, my $t = new CFPlus::UI::Table expand => 0);
898 $t->add_at (0,0, new CFPlus::UI::Label text => "a a a a", rowspan => 1, colspan => 2); 991 $t->add_at (0,0, new CFPlus::UI::Label text => "a a a a", c_rowspan => 1, c_colspan => 2);
899 $t->add_at (2,0, new CFPlus::UI::Label text => "b\nb", rowspan => 2, colspan => 1); 992 $t->add_at (2,0, new CFPlus::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1);
900 $t->add_at (1,2, new CFPlus::UI::Label text => "c c c c", rowspan => 1, colspan => 2); 993 $t->add_at (1,2, new CFPlus::UI::Label text => "c c c c", c_rowspan => 1, c_colspan => 2);
901 $t->add_at (0,1, new CFPlus::UI::Label text => "d\nd", rowspan => 2, colspan => 1); 994 $t->add_at (0,1, new CFPlus::UI::Label text => "d\nd", c_rowspan => 2, c_colspan => 1);
902 $t->add_at (1,1, new CFPlus::UI::Label text => "e"); 995 $t->add_at (1,1, new CFPlus::UI::Label text => "e");
903 996
904 $table->add_at (7, 6, my $c = new CFPlus::UI::Canvas); 997 $table->add_at (7, 6, my $c = new CFPlus::UI::Canvas);
905 998
906 $c->add_items ({ 999 $c->add_items ({
1513 CFPlus::Protocol::set_opencont ($::CONN, 0, "Floor"); 1606 CFPlus::Protocol::set_opencont ($::CONN, 0, "Floor");
1514 1607
1515 $hb 1608 $hb
1516} 1609}
1517 1610
1611sub media_window {
1612 my $vb = new CFPlus::UI::VBox;
1613
1614 $vb->add (new CFPlus::UI::FancyFrame
1615 label => "Currently playing music",
1616 child => new CFPlus::UI::ScrolledWindow scroll_x => 1, scroll_y => 0,
1617 child => ($MUSIC_PLAYING_WIDGET = new CFPlus::UI::Label ellipsise => 0, fontsize => 0.8),
1618 );
1619
1620 $vb->add (new CFPlus::UI::FancyFrame
1621 label => "Other media used in this session",
1622 expand => 1,
1623 child => ($LICENSE_WIDGET = new CFPlus::UI::TextScroller
1624 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4),
1625 );
1626
1627 $vb
1628}
1629
1630sub add_license {
1631 my ($meta) = @_;
1632
1633 $meta = $meta->{meta}
1634 or return;
1635
1636 $meta->{license} || $meta->{author} || $meta->{source}
1637 or return;
1638
1639 $LICENSE_WIDGET->add_paragraph ({
1640 fg => [1, 1, 1, 1],
1641 markup => "<small>"
1642 . "<b>Name:</b> " . (CFPlus::asxml $meta->{name}) . "\n"
1643 . "<b>Author:</b> " . (CFPlus::asxml $meta->{author}) . "\n"
1644 . "<b>Source:</b> " . (CFPlus::asxml $meta->{source}) . "\n"
1645 . "<b>License:</b> " . (CFPlus::asxml $meta->{license}) . "\n"
1646 . "</small>",
1647 });
1648 $LICENSE_WIDGET->scroll_to_bottom;
1649}
1650
1518sub toggle_player_page { 1651sub toggle_player_page {
1519 my ($widget) = @_; 1652 my ($widget) = @_;
1520 1653
1521 if ($PL_WINDOW->{visible} && $PL_NOTEBOOK->get_current_page == $widget) { 1654 if ($PL_WINDOW->{visible} && $PL_NOTEBOOK->get_current_page == $widget) {
1522 $PL_WINDOW->hide; 1655 $PL_WINDOW->hide;
1559 $ntb->add_tab ( 1692 $ntb->add_tab (
1560 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, 1693 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget,
1561 "Toggles the inventory window, where you can manage your loot (or treasures :). " 1694 "Toggles the inventory window, where you can manage your loot (or treasures :). "
1562 . "You can also hit the <b>Tab</b>-key to show/hide the Inventory." 1695 . "You can also hit the <b>Tab</b>-key to show/hide the Inventory."
1563 ); 1696 );
1564 $ntb->add_tab (Pickup => autopickup_setup, 1697 $ntb->add_tab (Pickup => autopickup_setup,
1565 "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them."); 1698 "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them.");
1699
1700 $ntb->add_tab (Media => media_window,
1701 "License, Author and Source info for media sent by the server.");
1566 1702
1567 $ntb->set_current_page ($INVENTORY_PAGE); 1703 $ntb->set_current_page ($INVENTORY_PAGE);
1568 1704
1569 $plwin->add ($ntb); 1705 $plwin->add ($ntb);
1570 $plwin 1706 $plwin
1945 2081
1946sub video_shutdown { 2082sub video_shutdown {
1947 CFPlus::OpenGL::shutdown; 2083 CFPlus::OpenGL::shutdown;
1948 2084
1949 undef $SDL_ACTIVE; 2085 undef $SDL_ACTIVE;
1950}
1951
1952sub audio_init {
1953 if ($CFG->{audio_enable}) {
1954 $ENV{MIX_EFFECTSMAXSPEED} = 1;
1955 $SDL_MIXER = !CFPlus::Mix_OpenAudio;
1956
1957 unless ($SDL_MIXER) {
1958 status "Unable to open sound device: there will be no sound";
1959 return;
1960 }
1961
1962 CFPlus::Mix_AllocateChannels 16;
1963
1964 audio_music_finished;
1965 } else {
1966 undef $SDL_MIXER;
1967 }
1968}
1969
1970sub audio_shutdown {
1971 CFPlus::Mix_CloseAudio if $SDL_MIXER;
1972 undef $SDL_MIXER;
1973 @SOUNDS = ();
1974 %AUDIO_CHUNK = ();
1975} 2086}
1976 2087
1977my %animate_object; 2088my %animate_object;
1978my $animate_timer; 2089my $animate_timer;
1979 2090
2083 gauge_fontsize => 1, 2194 gauge_fontsize => 1,
2084 gauge_size => 0.35, 2195 gauge_size => 0.35,
2085 stat_fontsize => 0.7, 2196 stat_fontsize => 0.7,
2086 mapsize => 100, 2197 mapsize => 100,
2087 audio_enable => 1, 2198 audio_enable => 1,
2199 effects_enable => 1,
2200 effects_volume => 1,
2088 bgm_enable => 1, 2201 bgm_enable => 1,
2089 bgm_volume => 0.25, 2202 bgm_volume => 0.5,
2090 output_sync => 1, 2203 output_sync => 1,
2091 output_count => 1, 2204 output_count => 1,
2092 output_rate => "", 2205 output_rate => "",
2093 pickup => 0, 2206 pickup => 0,
2094 inv_sort => "mtime", 2207 inv_sort => "mtime",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines