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.111 by root, Mon Apr 12 02:46:55 2010 UTC vs.
Revision 1.118 by root, Mon Dec 26 03:58:12 2011 UTC

5 use Coro; 5 use Coro;
6 use Coro::EV; 6 use Coro::EV;
7 use Coro::Debug; 7 use Coro::Debug;
8 our $debug = new_unix_server Coro::Debug "/tmp/dc"; 8 our $debug = new_unix_server Coro::Debug "/tmp/dc";
9 '; 9 ';
10 die if $@;
10} 11}
11 12
12# do splash-screen thingy on win32 13# do splash-screen thingy on win32
13my $startup_done = sub { }; 14my $startup_done = sub { };
14BEGIN { 15BEGIN {
17 $zip->extractMember ("SPLASH.bmp", "$ENV{PAR_TEMP}/SPLASH.bmp"); 18 $zip->extractMember ("SPLASH.bmp", "$ENV{PAR_TEMP}/SPLASH.bmp");
18 } 19 }
19 20
20 require Win32::GUI::SplashScreen; 21 require Win32::GUI::SplashScreen;
21 22
22 # initialise the resolver now, as vista forces us back to the desktop
23 # when doing this.
24 use AnyEvent::DNS ();
25 AnyEvent::DNS::resolver;
26
27 Win32::GUI::SplashScreen::Show ( 23 Win32::GUI::SplashScreen::Show (
28 -file => "$ENV{PAR_TEMP}/SPLASH.bmp", 24 -file => "$ENV{PAR_TEMP}/SPLASH.bmp",
29 ); 25 );
26
27 # initialise the resolver now, as vista forces us back to the desktop
28 # when doing this later.
29 require AnyEvent::DNS;
30 AnyEvent::DNS::resolver ();
30 31
31 $startup_done = sub { 32 $startup_done = sub {
32 Win32::GUI::SplashScreen::Done (1); 33 Win32::GUI::SplashScreen::Done (1);
33 }; 34 };
34 } 35 }
518 audio_music_push; 519 audio_music_push;
519} 520}
520 521
521sub audio_init { 522sub audio_init {
522 if ($CFG->{audio_enable}) { 523 if ($CFG->{audio_enable}) {
524 if (length $CFG->{audio_driver}) {
525 local $ENV{SDL_AUDIODRIVER} = $CFG->{audio_driver};
526 DC::SDL_Init DC::SDL_INIT_AUDIO
527 and die "SDL::Init failed!\n";
528 } else {
529 DC::SDL_Init DC::SDL_INIT_AUDIO
530 and die "SDL::Init failed!\n";
531 }
532
523 $ENV{MIX_EFFECTSMAXSPEED} = 1; 533 $ENV{MIX_EFFECTSMAXSPEED} = 1;
524 $SDL_MIXER = !DC::Mix_OpenAudio 534 $SDL_MIXER = !DC::Mix_OpenAudio
525 $CFG->{audio_hw_frequency}, 535 $CFG->{audio_hw_frequency},
526 DC::MIX_DEFAULT_FORMAT, 536 DC::MIX_DEFAULT_FORMAT,
527 $CFG->{audio_hw_channels}, 537 $CFG->{audio_hw_channels},
557 %AUDIO_PLAY = (); 567 %AUDIO_PLAY = ();
558 %AUDIO_CHUNK = (); 568 %AUDIO_CHUNK = ();
559 569
560 DC::Mix_CloseAudio if $SDL_MIXER; 570 DC::Mix_CloseAudio if $SDL_MIXER;
561 undef $SDL_MIXER; 571 undef $SDL_MIXER;
572
573 DC::SDL_QuitSubSystem DC::SDL_INIT_AUDIO;
562} 574}
563 575
564############################################################################# 576#############################################################################
565 577
566sub destroy_query_dialog { 578sub destroy_query_dialog {
1145 ]); 1157 ]);
1146 1158
1147 my $text = !$freq 1159 my $text = !$freq
1148 ? "audio is off" 1160 ? "audio is off"
1149 : "audio is enabled\n" 1161 : "audio is enabled\n"
1162 . "driver: " . DC::SDL_AudioDriverName . "\n"
1150 . "frequency (Hz): $freq\n" 1163 . "frequency (Hz): $freq\n"
1151 . "channels: $chans\n" 1164 . "channels: $chans\n"
1152 . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n" 1165 . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n"
1153 . "music decoders available: " . (join ", ", DC::MixMusic::decoders); 1166 . "music decoders available: " . (join ", ", DC::MixMusic::decoders);
1154 1167
1155 $AUDIO_INFO->set_text ($text); 1168 $AUDIO_INFO->set_text ($text);
1156} 1169}
1157 1170
1158sub audio_setup { 1171sub audio_setup {
1161 $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]); 1174 $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]);
1162 1175
1163 my $row = 0; 1176 my $row = 0;
1164 1177
1165 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable"); 1178 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable");
1166 $table->add_at (1, $row++, new DC::UI::CheckBox 1179 $table->add_at (1, $row, new DC::UI::CheckBox
1167 state => $CFG->{audio_enable}, 1180 state => $CFG->{audio_enable},
1168 tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", 1181 tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.",
1169 on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } 1182 on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 }
1183 );
1184 $table->add_at (2, $row++, my $driver = new DC::UI::HBox expand => 1);
1185
1186 $driver->add (new DC::UI::Label align => 1, text => " Audio driver override");
1187 $driver->add (new DC::UI::Entry
1188 text => $CFG->{audio_driver},
1189 template => "dsound1234",
1190 tooltip => "You can override the audio driver to use here. Leaving it empty will result "
1191 . "in Deliantra picking one automatically. GNU/Linux users often prefer specific "
1192 . "drivers though, and can experiment with <b>alsa</b>, <b>dsp</b>, <b>esd</b>, <b>pulse</b>, <b>arts</b>, <b>nas</b> "
1193 . "or other system-specific drivers. Selecting the wrong driver here will simply result"
1194 . "in no sound.",
1195 on_changed => sub { my ($self, $value) = @_; $CFG->{audio_driver} = $value; 1 }
1170 ); 1196 );
1171 1197
1172 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects"); 1198 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects");
1173 $table->add_at (1, $row, new DC::UI::CheckBox 1199 $table->add_at (1, $row, new DC::UI::CheckBox
1174 expand => 1, state => $CFG->{effects_enable}, 1200 expand => 1, state => $CFG->{effects_enable},
1208 c_colspan => 2, expand => 1, 1234 c_colspan => 2, expand => 1,
1209 value => $CFG->{audio_hw_frequency}, 1235 value => $CFG->{audio_hw_frequency},
1210 options => [ 1236 options => [
1211 [ 0, "default" , "Use System Default"], 1237 [ 0, "default" , "Use System Default"],
1212 [11025, "11 kHz" , "11kHz (low quality)"], 1238 [11025, "11 kHz" , "11kHz (low quality)"],
1213 [22050, "22 kHz" , "22kHz (reduced quality)"], 1239 [22050, "22 kHz" , "22kHz (reduced quality, recommended)"],
1214 [44100, "44.1 kHz", "44.1kHz (cd quality)"], 1240 [44100, "44.1 kHz", "44.1kHz (cd quality)"],
1215 [48000, "48 kHz" , "48kHz (studio quality)"], 1241 [48000, "48 kHz" , "48kHz (studio quality, not recommended)"],
1216 ], 1242 ],
1217 tooltip => "The sampling frequency to use. Higher sounds better, but also more cpu-intensive and might cause stuttering.", 1243 tooltip => "The sampling frequency to use. Higher sounds better, but also more cpu-intensive and might cause stuttering.",
1218 on_changed => sub { 1244 on_changed => sub {
1219 $CFG->{audio_hw_frequency} = $_[1]; 1245 $CFG->{audio_hw_frequency} = $_[1];
1220 audio_tab_update; 1246 audio_tab_update;
1244 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Latency"); 1270 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Latency");
1245 $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector 1271 $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector
1246 c_colspan => 2, expand => 1, 1272 c_colspan => 2, expand => 1,
1247 value => $CFG->{audio_hw_chunksize}, 1273 value => $CFG->{audio_hw_chunksize},
1248 tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " 1274 tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback "
1249 . "is stuttering, increase this value. Values of 50-100ms are optimal.", 1275 . "is stuttering, increase this value. Values of 50-150ms are optimal.",
1250 on_changed => sub { 1276 on_changed => sub {
1251 $CFG->{audio_hw_chunksize} = $_[1]; 1277 $CFG->{audio_hw_chunksize} = $_[1];
1252 audio_tab_update; 1278 audio_tab_update;
1253 1 1279 1
1254 } 1280 }
1497 para => ["Paralysation", 1523 para => ["Paralysation",
1498 "<b>Paralysation</b> (this resistance affects the chance you get paralysed)"], 1524 "<b>Paralysation</b> (this resistance affects the chance you get paralysed)"],
1499 deat => ["Death", 1525 deat => ["Death",
1500 "<b>Death</b> (resistance against death spells)"], 1526 "<b>Death</b> (resistance against death spells)"],
1501 phys => ["Physical", 1527 phys => ["Physical",
1502 "<b>Physical</b> (this is the resistance against physical attacks, like when a monster hit you in melee combat. The value displayed here is also displayed in the 'Arm' field on the left.)"], 1528 "<b>Physical</b> (this is the resistance against physical attacks, like when a monster hit you in melee combat. The value displayed here is also displayed as the 'Arm' secondary stat.)"],
1503 blind => ["Blind", 1529 blind => ["Blind",
1504 "<b>Blind</b> (blind resistance affects the chance of a successful blinding attack)"], 1530 "<b>Blind</b> (blind resistance affects the chance of a successful blinding attack)"],
1505 fear => ["Fear", 1531 fear => ["Fear",
1506 "<b>Fear</b> (this attack will drive you away from monsters who cast this and hit you successfully, being resistant to this helps a lot when fighting those monsters)"], 1532 "<b>Fear</b> (this attack will drive you away from monsters who cast this and hit you successfully, being resistant to this helps a lot when fighting those monsters)"],
1507 tund => ["Turn undead", 1533 tund => ["Turn undead",
2436 }, 2462 },
2437 ); 2463 );
2438 2464
2439 $dialog->show; 2465 $dialog->show;
2440 }; 2466 };
2441}
2442
2443sub sdl_init {
2444 DC::SDL_Init DC::SDL_INIT_AUDIO #| DC::SDL_NOPARACHUTE
2445 and die "SDL::Init failed!\n";
2446} 2467}
2447 2468
2448sub video_init { 2469sub video_init {
2449 DC::set_theme $CFG->{uitheme}; 2470 DC::set_theme $CFG->{uitheme};
2450 2471
2812 $CFG->{$k} = $v unless exists $CFG->{$k}; 2833 $CFG->{$k} = $v unless exists $CFG->{$k};
2813 } 2834 }
2814 2835
2815 my @args = @ARGV; 2836 my @args = @ARGV;
2816 2837
2838 # OS X passes some process serial number of other shit. they
2839 # could have used an env var or any other sane mechanism. but
2840 # would it be os x then? no...
2841 shift @args if $args[0] =~ /^-psn_/;
2842
2817 my $profile = 'default'; 2843 my $profile = 'default';
2818 2844
2819 for (my $i = 0; $i < @args; $i++) { 2845 for (my $i = 0; $i < @args; $i++) {
2820 if ($args[$i] =~ /^--?profile$/) { 2846 if ($args[$i] =~ /^--?profile$/) {
2821 $profile = $args[$i + 1]; 2847 $profile = $args[$i + 1];
2844 action => $cmds, 2870 action => $cmds,
2845 }; 2871 };
2846 } 2872 }
2847 } 2873 }
2848 } 2874 }
2849
2850 sdl_init;
2851 2875
2852 $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf"; 2876 $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf";
2853 $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts"; 2877 $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts";
2854 2878
2855 { 2879 {
2886# } 2910# }
2887# my $t2 = Time::HiRes::time; 2911# my $t2 = Time::HiRes::time;
2888# warn $t2-$t1; 2912# warn $t2-$t1;
2889# } 2913# }
2890 2914
2915 DC::IMG_Init;
2891 video_init; 2916 video_init;
2892 audio_init; 2917 audio_init;
2893 } 2918 }
2894 2919
2895 show_tip_of_the_day if $CFG->{show_tips}; 2920 show_tip_of_the_day if $CFG->{show_tips};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines