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.203 by root, Mon Aug 6 02:11:45 2007 UTC vs.
Revision 1.206 by root, Thu Aug 9 03:40:44 2007 UTC

217 my ($face) = @_; 217 my ($face) = @_;
218 218
219 $CFG->{effects_enable} 219 $CFG->{effects_enable}
220 or return; 220 or return;
221 221
222 $AUDIO_PLAY{$face}
223 or return;
224
222 if (my $chunk = $AUDIO_CHUNK{$face}) { 225 if (my $chunk = $AUDIO_CHUNK{$face}) {
223 for (grep $_->[0] >= Event::time, @{(delete $AUDIO_PLAY{$face}) || []}) { 226 for (grep $_->[0] >= Event::time, @{(delete $AUDIO_PLAY{$face}) || []}) {
224 my (undef, $dx, $dy, $vol) = @$_; 227 my (undef, $dx, $dy, $vol) = @$_;
225 228
226 my $channel = CFPlus::Channel::find; 229 my $channel = CFPlus::Channel::find;
248 } else { 251 } else {
249 # fetch from database 252 # fetch from database
250 CFPlus::DB::get res_data => $meta->{name}, sub { 253 CFPlus::DB::get res_data => $meta->{name}, sub {
251 my $rwops = new CFPlus::RW $_[0]; 254 my $rwops = new CFPlus::RW $_[0];
252 my $chunk = new CFPlus::MixChunk $rwops 255 my $chunk = new CFPlus::MixChunk $rwops
253 or Carp::confess "sound face $meta->{face} unloadable: " . CFPlus::Mix_GetError; 256 or Carp::confess "sound face " . (JSON::XS::to_json $meta) . " unloadable: " . CFPlus::Mix_GetError;
254 $chunk->volume (($meta->{meta}{volume} || 1) * 128); 257 $chunk->volume (($meta->{meta}{volume} || 1) * 128);
255 $AUDIO_CHUNK{$face} = $chunk; 258 $AUDIO_CHUNK{$face} = $chunk;
256 259
257 audio_sound_push ($face); 260 audio_sound_push ($face);
258 }; 261 };
419 422
420sub audio_shutdown { 423sub audio_shutdown {
421 undef $MUSIC_PLAYER; 424 undef $MUSIC_PLAYER;
422 undef $MUSIC_PLAYING_META; 425 undef $MUSIC_PLAYING_META;
423 undef $MUSIC_PLAYING_DATA; 426 undef $MUSIC_PLAYING_DATA;
424
425 audio_music_set_meta { };
426 427
427 $MUSIC_WANT = []; 428 $MUSIC_WANT = [];
428 @MUSIC_JINGLE = (); 429 @MUSIC_JINGLE = ();
429 %AUDIO_PLAY = (); 430 %AUDIO_PLAY = ();
430 %AUDIO_CHUNK = (); 431 %AUDIO_CHUNK = ();
879# $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume"); 880# $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume");
880# $table->add_at (1, 8, new CFPlus::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub { 881# $table->add_at (1, 8, new CFPlus::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub {
881# $CFG->{effects_volume} = $_[1]; 882# $CFG->{effects_volume} = $_[1];
882# }); 883# });
883 884
884 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume"); 885 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Sound Effects");
885 $table->add_at (1, $row, new CFPlus::UI::CheckBox 886 $table->add_at (1, $row, new CFPlus::UI::CheckBox
886 expand => 1, state => $CFG->{effects_enable}, 887 expand => 1, state => $CFG->{effects_enable},
887 tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.", 888 tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.",
889 on_changed => sub {
888 on_changed => sub { $CFG->{effects_enable} = $_[1]; 0 } 890 $CFG->{effects_enable} = $_[1];
891 $CONN->update_fx_want if $CONN;
892 0
893 }
889 ); 894 );
890 $table->add_at (2, $row++, new CFPlus::UI::Slider 895 $table->add_at (2, $row++, new CFPlus::UI::Slider
891 expand => 1, range => [$CFG->{effects_volume}, 0, 1, 0, 1/128], 896 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 " 897 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.", 898 . "is set highest (rightmost) and you use your operating system volume setting. Changes are instant.",
894 on_changed => sub { $CFG->{effects_volume} = $_[1]; 0 } 899 on_changed => sub { $CFG->{effects_volume} = $_[1]; 0 }
895 ); 900 );
896 901
897 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Background Music"); 902 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Background Music");
898 $table->add_at (1, $row, new CFPlus::UI::CheckBox 903 $table->add_at (1, $row, new CFPlus::UI::CheckBox
899 expand => 1, state => $CFG->{bgm_enable}, 904 expand => 1, state => $CFG->{bgm_enable},
900 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", 905 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.",
901 on_changed => sub { $CFG->{bgm_enable} = $_[1]; 0 } 906 on_changed => sub {
907 $CFG->{bgm_enable} = $_[1];
908 $CONN->update_fx_want if $CONN;
909 0
910 }
902 ); 911 );
903 $table->add_at (2, $row++, new CFPlus::UI::Slider 912 $table->add_at (2, $row++, new CFPlus::UI::Slider
904 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], 913 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128],
905 tooltip => "The volume of the background music. Changes are instant.", 914 tooltip => "The volume of the background music. Changes are instant.",
906 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } 915 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 }
2285Event::loop; 2294Event::loop;
2286#CFPlus::SDL_Quit; 2295#CFPlus::SDL_Quit;
2287#CFPlus::_exit 0; 2296#CFPlus::_exit 0;
2288 2297
2289END { 2298END {
2299 video_shutdown;
2300 audio_shutdown;
2290 CFPlus::SDL_Quit; 2301 CFPlus::SDL_Quit;
2291 CFPlus::DB::Server::stop; 2302 CFPlus::DB::Server::stop;
2292} 2303}
2293 2304
2294=head1 NAME 2305=head1 NAME
2295 2306
2296cfplus - A Crossfire+ and Crossfire game client 2307cfplus - A Crossfire TRT and Crossfire game client
2297 2308
2298=head1 SYNOPSIS 2309=head1 SYNOPSIS
2299 2310
2300Just run it - no commandline arguments are supported. 2311Just run it - no commandline arguments are supported.
2301 2312
2302=head1 USAGE 2313=head1 USAGE
2303 2314
2304cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used 2315cfplus utilises OpenGL for all UI elements and the game. It is supposed to
2305fullscreen and interactively. 2316be used in fullscreen mode and interactively.
2306 2317
2307=head1 DEBUGGING 2318=head1 DEBUGGING
2308 2319
2309 2320
2310CFPLUS_DEBUG - environment variable 2321CFPLUS_DEBUG - environment variable

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines