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

Comparing deliantra/Deliantra-Client/bin/deliantra (file contents):
Revision 1.8 by root, Wed Dec 5 10:49:18 2007 UTC vs.
Revision 1.12 by root, Wed Dec 26 13:35:06 2007 UTC

344 return unless $SDL_MIXER; 344 return unless $SDL_MIXER;
345 345
346 my $fade_out; 346 my $fade_out;
347 347
348 if (@MUSIC_JINGLE) { 348 if (@MUSIC_JINGLE) {
349 $fade_out = 333;
349 @MUSIC_HAVE = $MUSIC_JINGLE[0]; 350 @MUSIC_HAVE = $MUSIC_JINGLE[0];
350 $fade_out = 333; 351
351 } else { 352 } else {
352 return unless $CFG->{bgm_enable}; 353 return unless $CFG->{bgm_enable};
353 354
354 my @have = 355 $fade_out = 700;
356
357 @MUSIC_HAVE =
355 grep $_ && $_->{data}, 358 grep $_ && $_->{data},
356 map $CONN->{face}[$_], 359 map $CONN->{face}[$_],
357 @$MUSIC_WANT; 360 @$MUSIC_WANT;
358 361
359 # randomize music a bit so that the order is not always the same 362 # randomize music a bit so that the order is not always the same
360 $_->{stop_time} ||= rand for @have; 363 $_->{stop_time} ||= rand for @MUSIC_HAVE;
361
362 @MUSIC_HAVE = @have
363 if @have;
364 364
365 # default MUSIC_HAVE == MUSIC_DEFAULT 365 # default MUSIC_HAVE == MUSIC_DEFAULT
366 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE; 366 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" }
367 $fade_out = 700; 367 unless @MUSIC_HAVE;
368 } 368 }
369 369
370 # if the currently playing song is acceptable, let it continue 370 # if the currently playing song is acceptable, let it continue
371 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE; 371 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE;
372 372
469 my ($conn, $flags, $prompt) = @_; 469 my ($conn, $flags, $prompt) = @_;
470 470
471 # FIXME: a very ugly hack to wait for stat update #d# 471 # FIXME: a very ugly hack to wait for stat update #d#
472 if ($prompt =~ /roll new stats/ and not $conn->{stat_change_with}) { 472 if ($prompt =~ /roll new stats/ and not $conn->{stat_change_with}) {
473 unless ($QUERY_TIMER) { 473 unless ($QUERY_TIMER) {
474 $QUERY_TIMER =
475 EV::timer 1, 0, sub { 474 $QUERY_TIMER = EV::timer 1, 0, sub {
476 server_query ($conn, $flags, $prompt, 1); 475 server_query ($conn, $flags, $prompt, 1);
477 $QUERY_TIMER = undef 476 $QUERY_TIMER = undef
478 }; 477 };
478
479 return; 479 return;
480 } 480 }
481 } 481 }
482 482
483 $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel 483 $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel
2270my $animate_timer; 2270my $animate_timer;
2271 2271
2272my $fps = 9; 2272my $fps = 9;
2273 2273
2274sub force_refresh { 2274sub force_refresh {
2275 $WANT_REFRESH->stop;
2276
2277 if ($ENV{CFPLUS_DEBUG} & 4) { 2275 if ($ENV{CFPLUS_DEBUG} & 4) {
2278 $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02; 2276 $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02;
2279 debug sprintf "%3.2f", $fps; 2277 debug sprintf "%3.2f", $fps;
2280 } 2278 }
2279
2280 $WANT_REFRESH->stop;
2281 2281
2282 $CFPlus::UI::ROOT->draw; 2282 $CFPlus::UI::ROOT->draw;
2283 CFPlus::SDL_GL_SwapBuffers; 2283 CFPlus::SDL_GL_SwapBuffers;
2284 $LAST_REFRESH = $NOW; 2284 $LAST_REFRESH = $NOW;
2285} 2285}
2316 }, 2316 },
2317 CFPlus::SDL_VIDEOEXPOSE => sub { 2317 CFPlus::SDL_VIDEOEXPOSE => sub {
2318 CFPlus::UI::full_refresh; 2318 CFPlus::UI::full_refresh;
2319 }, 2319 },
2320 CFPlus::SDL_ACTIVEEVENT => sub { 2320 CFPlus::SDL_ACTIVEEVENT => sub {
2321# not useful, as APPACTIVE include sonly iconified state, not unmapped 2321# not useful, as APPACTIVE includes only iconified state, not unmapped
2322# printf "active %x %x %x\n", $_[0]{gain}, $_[0]{state}, CFPlus::SDL_GetAppState;#d# 2322# printf "active %x %x %x\n", $_[0]{gain}, $_[0]{state}, CFPlus::SDL_GetAppState;#d#
2323# printf "a %x\n", CFPlus::SDL_GetAppState & CFPlus::SDL_APPACTIVE;#d# 2323# printf "a %x\n", CFPlus::SDL_GetAppState & CFPlus::SDL_APPACTIVE;#d#
2324# printf "A\n" if $_[0]{state} & CFPlus::SDL_APPACTIVE; 2324# printf "A\n" if $_[0]{state} & CFPlus::SDL_APPACTIVE;
2325# printf "K\n" if $_[0]{state} & CFPlus::SDL_APPINPUTFOCUS; 2325# printf "K\n" if $_[0]{state} & CFPlus::SDL_APPINPUTFOCUS;
2326# printf "M\n" if $_[0]{state} & CFPlus::SDL_APPMOUSEFOCUS; 2326# printf "M\n" if $_[0]{state} & CFPlus::SDL_APPMOUSEFOCUS;
2348 }, 2348 },
2349); 2349);
2350 2350
2351############################################################################# 2351#############################################################################
2352 2352
2353$SIG{INT} = $SIG{TERM} = sub { exit }; 2353$SIG{INT} = $SIG{TERM} = sub {
2354 EV::unloop;
2355 #d# TODO calling exit here hangs the process in some futex
2356};
2354 2357
2355{ 2358{
2356 CFPlus::read_cfg "$Crossfire::VARDIR/cfplusrc"; 2359 CFPlus::read_cfg "$Crossfire::VARDIR/cfplusrc";
2357 CFPlus::DB::Server::run; 2360 CFPlus::DB::Server::run;
2358 2361

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines