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.201 by root, Fri Aug 3 02:20:32 2007 UTC vs.
Revision 1.204 by root, Mon Aug 6 05:06:33 2007 UTC

239 my $meta = $CONN->{sound_meta}{$face} 239 my $meta = $CONN->{sound_meta}{$face}
240 or return; 240 or return;
241 241
242 # if its a jingle, play it as ambient music 242 # if its a jingle, play it as ambient music
243 if ($meta->{meta}{jingle}) { 243 if ($meta->{meta}{jingle}) {
244 delete $AUDIO_PLAY{$face}; # take the jingle out of the sound queue 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 245 push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue
246 &audio_music_push ($face); 246 &audio_music_push ($face);
247 }
247 } else { 248 } else {
248 # fetch from database 249 # fetch from database
249 CFPlus::DB::get res_data => $meta->{name}, sub { 250 CFPlus::DB::get res_data => $meta->{name}, sub {
250 my $rwops = new CFPlus::RW $_[0]; 251 my $rwops = new CFPlus::RW $_[0];
251 my $chunk = new CFPlus::MixChunk $rwops; 252 my $chunk = new CFPlus::MixChunk $rwops
253 or Carp::confess "sound face $meta->{face} unloadable: " . CFPlus::Mix_GetError;
252 $chunk->volume (($meta->{meta}{volume} || 1) * 128); 254 $chunk->volume (($meta->{meta}{volume} || 1) * 128);
253 $AUDIO_CHUNK{$face} = $chunk; 255 $AUDIO_CHUNK{$face} = $chunk;
254 256
255 audio_sound_push ($face); 257 audio_sound_push ($face);
256 }; 258 };
308 my $rwops = $meta->{path} 310 my $rwops = $meta->{path}
309 ? new_from_file CFPlus::RW $meta->{path} 311 ? new_from_file CFPlus::RW $meta->{path}
310 : new CFPlus::RW $$MUSIC_PLAYING_DATA; 312 : new CFPlus::RW $$MUSIC_PLAYING_DATA;
311 313
312 $MUSIC_PLAYER = new CFPlus::MixMusic $rwops 314 $MUSIC_PLAYER = new CFPlus::MixMusic $rwops
313 or ((warn CFPlus::Mix_GetError), return); # pretty fatal error 315 or Carp::confess "music face $meta->{face} unloadable: " . CFPlus::Mix_GetError;
314 316
315 my $NOW = time; 317 my $NOW = time;
316 318
317 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) { 319 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) {
318 my $pos = $MUSIC_PLAYING_META->{stop_pos}; 320 my $pos = $MUSIC_PLAYING_META->{stop_pos};
351 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE; 353 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE;
352 $fade_out = 1000; 354 $fade_out = 1000;
353 } 355 }
354 356
355 # if the currently playing song is acceptable, let it continue 357 # if the currently playing song is acceptable, let it continue
356 return if $MUSIC_PLAYING_META
357 && grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE; 358 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE;
358 359
359 my $NOW = time; 360 my $NOW = time;
360 361
361 if ($MUSIC_PLAYING_META) { 362 if ($MUSIC_PLAYING_META) {
362 $MUSIC_PLAYING_META->{stop_time} = $NOW; 363 $MUSIC_PLAYING_META->{stop_time} = $NOW;
418 419
419sub audio_shutdown { 420sub audio_shutdown {
420 undef $MUSIC_PLAYER; 421 undef $MUSIC_PLAYER;
421 undef $MUSIC_PLAYING_META; 422 undef $MUSIC_PLAYING_META;
422 undef $MUSIC_PLAYING_DATA; 423 undef $MUSIC_PLAYING_DATA;
423
424 audio_music_set_meta { };
425 424
426 $MUSIC_WANT = []; 425 $MUSIC_WANT = [];
427 @MUSIC_JINGLE = (); 426 @MUSIC_JINGLE = ();
428 %AUDIO_PLAY = (); 427 %AUDIO_PLAY = ();
429 %AUDIO_CHUNK = (); 428 %AUDIO_CHUNK = ();
2284Event::loop; 2283Event::loop;
2285#CFPlus::SDL_Quit; 2284#CFPlus::SDL_Quit;
2286#CFPlus::_exit 0; 2285#CFPlus::_exit 0;
2287 2286
2288END { 2287END {
2288 video_shutdown;
2289 audio_shutdown;
2289 CFPlus::SDL_Quit; 2290 CFPlus::SDL_Quit;
2290 CFPlus::DB::Server::stop; 2291 CFPlus::DB::Server::stop;
2291} 2292}
2292 2293
2293=head1 NAME 2294=head1 NAME
2294 2295
2295cfplus - A Crossfire+ and Crossfire game client 2296cfplus - A Crossfire TRT and Crossfire game client
2296 2297
2297=head1 SYNOPSIS 2298=head1 SYNOPSIS
2298 2299
2299Just run it - no commandline arguments are supported. 2300Just run it - no commandline arguments are supported.
2300 2301
2301=head1 USAGE 2302=head1 USAGE
2302 2303
2303cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used 2304cfplus utilises OpenGL for all UI elements and the game. It is supposed to
2304fullscreen and interactively. 2305be used in fullscreen mode and interactively.
2305 2306
2306=head1 DEBUGGING 2307=head1 DEBUGGING
2307 2308
2308 2309
2309CFPLUS_DEBUG - environment variable 2310CFPLUS_DEBUG - environment variable

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines