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

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.152 by root, Thu Apr 20 08:11:57 2006 UTC vs.
Revision 1.153 by root, Thu Apr 20 09:13:32 2006 UTC

462sub video_shutdown { 462sub video_shutdown {
463 $CFClient::UI::ROOT->{children} = []; 463 $CFClient::UI::ROOT->{children} = [];
464 undef $SDL_ACTIVE; 464 undef $SDL_ACTIVE;
465} 465}
466 466
467my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d#
467my $bgmusic;#TODO#hack#d# 468my $bgmusic;#TODO#hack#d#
469
470sub audio_music_finished {
471 return unless $CFG->{bgm_enable};
472
473 # TODO: hack, do play loop and mood music
474 $bgmusic = new_from_file CFClient::MixMusic CFClient::find_rcfile "music/$bgmusic[0]";
475 $bgmusic->play (0);
476
477 push @bgmusic, shift @bgmusic;
478}
468 479
469sub audio_init { 480sub audio_init {
470 if ($CFG->{audio_enable}) { 481 if ($CFG->{audio_enable}) {
471 if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") { 482 if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") {
472 483
473 $SDL_MIXER = !CFClient::Mix_OpenAudio; 484 $SDL_MIXER = !CFClient::Mix_OpenAudio;
474 CFClient::Mix_AllocateChannels 8; 485 CFClient::Mix_AllocateChannels 8;
475 CFClient::MixMusic::volume $CFG->{bgm_volume} * 128; 486 CFClient::MixMusic::volume $CFG->{bgm_volume} * 128;
476 487
477 # TODO: hack, do play loop and mood music 488 audio_music_finished;
478 if ($CFG->{bgm_enable}) {
479 $bgmusic = new_from_file CFClient::MixMusic CFClient::find_rcfile "music/game3.ogg";
480 $bgmusic->play;
481 }
482 489
483 while (<$fh>) { 490 while (<$fh>) {
484 next if /^\s*#/; 491 next if /^\s*#/;
485 next if /^\s*$/; 492 next if /^\s*$/;
486 493
852 CFClient::SDL_QUIT => sub { 859 CFClient::SDL_QUIT => sub {
853 Event::unloop -1; 860 Event::unloop -1;
854 }, 861 },
855 CFClient::SDL_VIDEORESIZE => sub { 862 CFClient::SDL_VIDEORESIZE => sub {
856 }, 863 },
857 CFClient::SDL_VIDEOEXPOSE => sub { 864 CFClient::SDL_VIDEOEXPOSE => \&refresh,
858 refresh; 865 CFClient::SDL_ACTIVEEVENT => sub {
866# printf "active %x %x\n", $SDL_EV->active_gain, $SDL_EV->active_state;#d#
859 }, 867 },
860 CFClient::SDL_KEYDOWN => sub { 868 CFClient::SDL_KEYDOWN => sub {
861 if ($_[0]{mod} & CFClient::KMOD_ALT && $_[0]{sym} == 13) { 869 if ($_[0]{mod} & CFClient::KMOD_ALT && $_[0]{sym} == 13) {
862 # alt-enter 870 # alt-enter
863 video_shutdown; 871 video_shutdown;
865 video_init; 873 video_init;
866 } else { 874 } else {
867 CFClient::UI::feed_sdl_key_down_event ($_[0]); 875 CFClient::UI::feed_sdl_key_down_event ($_[0]);
868 } 876 }
869 }, 877 },
870 CFClient::SDL_KEYUP => sub { 878 CFClient::SDL_KEYUP => \&CFClient::UI::feed_sdl_key_up_event,
871 CFClient::UI::feed_sdl_key_up_event ($_[0]); 879 CFClient::SDL_MOUSEMOTION => \&CFClient::UI::feed_sdl_motion_event,
872 }, 880 CFClient::SDL_MOUSEBUTTONDOWN => \&CFClient::UI::feed_sdl_button_down_event,
873 CFClient::SDL_MOUSEMOTION => sub { 881 CFClient::SDL_MOUSEBUTTONUP => \&CFClient::UI::feed_sdl_button_up_event,
874 CFClient::UI::feed_sdl_motion_event ($_[0]); 882 CFClient::SDL_USEREVENT => \&audio_music_finished,
875 },
876 CFClient::SDL_MOUSEBUTTONDOWN => sub {
877 CFClient::UI::feed_sdl_button_down_event ($_[0]);
878 },
879 CFClient::SDL_MOUSEBUTTONUP => sub {
880 CFClient::UI::feed_sdl_button_up_event ($_[0]);
881 },
882 CFClient::SDL_ACTIVEEVENT => sub {
883# printf "active %x %x\n", $SDL_EV->active_gain, $SDL_EV->active_state;#d#
884 },
885); 883);
886 884
887############################################################################# 885#############################################################################
888 886
889$SIG{INT} = $SIG{TERM} = sub { exit }; 887$SIG{INT} = $SIG{TERM} = sub { exit };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines