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.103 by elmex, Sat Mar 20 01:01:16 2010 UTC vs.
Revision 1.119 by root, Mon Dec 26 22:30:21 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 }
35} 36}
36 37
37use strict; 38use common::sense;
38use utf8;
39 39
40use Carp 'verbose'; 40use Carp 'verbose';
41 41
42# do things only needed for single-binary version (par) 42# do things only needed for single-binary version (par)
43BEGIN { 43BEGIN {
144our $NOW; 144our $NOW;
145 145
146our $CFG; 146our $CFG;
147our $PROFILE; # current profile 147our $PROFILE; # current profile
148our $FAST; # fast, low-quality mode, possibly useful for software-rendering 148our $FAST; # fast, low-quality mode, possibly useful for software-rendering
149our $DELIANTRA_DEBUG = $ENV{DELIANTRA_DEBUG} * 1;
149 150
150our $WANT_REFRESH; 151our $WANT_REFRESH;
151 152
152our $MODE_SLIDER; 153our $MODE_SLIDER;
153our $CAVEAT_LABEL; 154our $CAVEAT_LABEL;
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 {
807 user => $PROFILE->{user}, 819 user => $PROFILE->{user},
808 pass => $PROFILE->{password}, 820 pass => $PROFILE->{password},
809 mapw => $mapw, 821 mapw => $mapw,
810 maph => $maph, 822 maph => $maph,
811 823
824 c_version => {
825 client => "deliantra",
812 client => "$DC::VERSION $] $^O", 826 clientver => $DC::VERSION,
827 gl_vendor => DC::OpenGL::gl_vendor,
828 gl_version => DC::OpenGL::gl_version,
829 },
813 830
814 map_widget => $MAPWIDGET, 831 map_widget => $MAPWIDGET,
815 statusbox => $STATUSBOX, 832 statusbox => $STATUSBOX,
816 map => $MAP, 833 map => $MAP,
817 mapmap => $MAPMAP, 834 mapmap => $MAPMAP,
849 866
850 # hack to make SURE we find the IP address all right 867 # hack to make SURE we find the IP address all right
851 # can be removed once AnyEvent::DNS is proven stable. 868 # can be removed once AnyEvent::DNS is proven stable.
852 if ($host eq "gameserver.deliantra.net") { 869 if ($host eq "gameserver.deliantra.net") {
853 AnyEvent::DNS::a "dnstest.deliantra.net", sub { 870 AnyEvent::DNS::a "dnstest.deliantra.net", sub {
854 if ($_[0] ne "80.101.114.108") { # Perl 871 if ($_[0] ne "80.101.114.108") { # P-e-r-l
855 status "dns failure, trying differently"; 872 status "dns failure, trying differently";
856 $host = eval { Socket::inet_ntoa Socket::inet_aton "gameserver.deliantra.net" }; 873 $host = eval { Socket::inet_ntoa Socket::inet_aton "gameserver.deliantra.net" };
857 unless (defined $host) { 874 unless (defined $host) {
858 status "dns failure, using hardcoded address"; 875 status "dns failure, using hardcoded address";
859 $host = "129.13.162.95"; 876 $host = "194.126.175.154";
860 } 877 }
861 } 878 }
862 879
863 dc_connect $host, $port; 880 dc_connect $host, $port;
864 }; 881 };
1140 ]); 1157 ]);
1141 1158
1142 my $text = !$freq 1159 my $text = !$freq
1143 ? "audio is off" 1160 ? "audio is off"
1144 : "audio is enabled\n" 1161 : "audio is enabled\n"
1162 . "driver: " . DC::SDL_AudioDriverName . "\n"
1145 . "frequency (Hz): $freq\n" 1163 . "frequency (Hz): $freq\n"
1146 . "channels: $chans\n" 1164 . "channels: $chans\n"
1147 . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n" 1165 . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n"
1148 . "music decoders available: " . (join ", ", DC::MixMusic::decoders); 1166 . "music decoders available: " . (join ", ", DC::MixMusic::decoders);
1149 1167
1150 $AUDIO_INFO->set_text ($text); 1168 $AUDIO_INFO->set_text ($text);
1151} 1169}
1152 1170
1153sub audio_setup { 1171sub audio_setup {
1156 $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]);
1157 1175
1158 my $row = 0; 1176 my $row = 0;
1159 1177
1160 $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");
1161 $table->add_at (1, $row++, new DC::UI::CheckBox 1179 $table->add_at (1, $row, new DC::UI::CheckBox
1162 state => $CFG->{audio_enable}, 1180 state => $CFG->{audio_enable},
1163 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.",
1164 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 }
1165 ); 1196 );
1166 1197
1167 $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");
1168 $table->add_at (1, $row, new DC::UI::CheckBox 1199 $table->add_at (1, $row, new DC::UI::CheckBox
1169 expand => 1, state => $CFG->{effects_enable}, 1200 expand => 1, state => $CFG->{effects_enable},
1182 ); 1213 );
1183 1214
1184 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music"); 1215 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music");
1185 $table->add_at (1, $row, new DC::UI::CheckBox 1216 $table->add_at (1, $row, new DC::UI::CheckBox
1186 expand => 1, state => $CFG->{bgm_enable}, 1217 expand => 1, state => $CFG->{bgm_enable},
1187 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", 1218 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played. Needs server reconnect to take effect.",
1188 on_changed => sub { 1219 on_changed => sub {
1189 $CFG->{bgm_enable} = $_[1]; 1220 $CFG->{bgm_enable} = $_[1];
1190 $CONN->update_fx_want if $CONN; 1221 $CONN->update_fx_want if $CONN;
1191 audio_music_push; 1222 audio_music_push;
1192 1 1223 1
1203 c_colspan => 2, expand => 1, 1234 c_colspan => 2, expand => 1,
1204 value => $CFG->{audio_hw_frequency}, 1235 value => $CFG->{audio_hw_frequency},
1205 options => [ 1236 options => [
1206 [ 0, "default" , "Use System Default"], 1237 [ 0, "default" , "Use System Default"],
1207 [11025, "11 kHz" , "11kHz (low quality)"], 1238 [11025, "11 kHz" , "11kHz (low quality)"],
1208 [22050, "22 kHz" , "22kHz (reduced quality)"], 1239 [22050, "22 kHz" , "22kHz (reduced quality, recommended)"],
1209 [44100, "44.1 kHz", "44.1kHz (cd quality)"], 1240 [44100, "44.1 kHz", "44.1kHz (cd quality)"],
1210 [48000, "48 kHz" , "48kHz (studio quality)"], 1241 [48000, "48 kHz" , "48kHz (studio quality, not recommended)"],
1211 ], 1242 ],
1212 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.",
1213 on_changed => sub { 1244 on_changed => sub {
1214 $CFG->{audio_hw_frequency} = $_[1]; 1245 $CFG->{audio_hw_frequency} = $_[1];
1215 audio_tab_update; 1246 audio_tab_update;
1239 $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");
1240 $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
1241 c_colspan => 2, expand => 1, 1272 c_colspan => 2, expand => 1,
1242 value => $CFG->{audio_hw_chunksize}, 1273 value => $CFG->{audio_hw_chunksize},
1243 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 "
1244 . "is stuttering, increase this value. Values of 50-100ms are optimal.", 1275 . "is stuttering, increase this value. Values of 50-150ms are optimal.",
1245 on_changed => sub { 1276 on_changed => sub {
1246 $CFG->{audio_hw_chunksize} = $_[1]; 1277 $CFG->{audio_hw_chunksize} = $_[1];
1247 audio_tab_update; 1278 audio_tab_update;
1248 1 1279 1
1249 } 1280 }
1329 &set_gauge_window_fontsize; 1360 &set_gauge_window_fontsize;
1330 1361
1331 $win 1362 $win
1332} 1363}
1333 1364
1365our $BW_WATCHER;
1366
1367sub debug_toggle($) {
1368 $DELIANTRA_DEBUG ^= $_[0];
1369
1370 if ($DELIANTRA_DEBUG & 16) {
1371 $BW_WATCHER = EV::periodic 0, 1, 0, sub {
1372 return unless $CONN;
1373 debug sprintf "%8.2gKB/s", $CONN->{octets_in} / 1e3;
1374 $CONN->{octets_in} = 0;
1375 };
1376 } else {
1377 undef $BW_WATCHER;
1378 }
1379
1380}
1381
1334sub debug_setup { 1382sub debug_setup {
1335 my $table = new DC::UI::Table; 1383 my $table = new DC::UI::Table;
1336 1384
1337 $table->add_at (0, 0, new DC::UI::Label text => "Widget Borders"); 1385 $table->add_at (0, 0, new DC::UI::Label text => "Widget Borders");
1338 $table->add_at (1, 0, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1; 0 }); 1386 $table->add_at (1, 0, new DC::UI::CheckBox on_changed => sub { debug_toggle 1; 0 });
1339 $table->add_at (0, 1, new DC::UI::Label text => "Tooltip Widget Info"); 1387 $table->add_at (0, 1, new DC::UI::Label text => "Tooltip Widget Info");
1340 $table->add_at (1, 1, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 }); 1388 $table->add_at (1, 1, new DC::UI::CheckBox on_changed => sub { debug_toggle 2; 0 });
1341 $table->add_at (0, 2, new DC::UI::Label text => "Show FPS"); 1389 $table->add_at (0, 2, new DC::UI::Label text => "Show FPS");
1342 $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); 1390 $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { debug_toggle 4; 0 });
1343 $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips"); 1391 $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips");
1344 $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); 1392 $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { debug_toggle 8; 0 });
1393 $table->add_at (0, 4, new DC::UI::Label text => "Show Bandwidth");
1394 $table->add_at (1, 4, new DC::UI::CheckBox on_changed => sub { debug_toggle 16; 0 });
1395
1345 $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); 1396 $table->add_at (0, 6, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } );
1346
1347 $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d# 1397 $table->add_at (0, 7, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d#
1348 1398
1349 $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); 1399 $table->add_at (7,7, my $t = new DC::UI::Table expand => 0);
1350 $t->add_at (0,0, new DC::UI::Label text => "a a", c_rowspan => 1, c_colspan => 2); 1400 $t->add_at (0,0, new DC::UI::Label text => "a a", c_rowspan => 1, c_colspan => 2);
1351 $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1, ellipsise => 0 ); 1401 $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1, ellipsise => 0 );
1352 $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2); 1402 $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2);
1473 para => ["Paralysation", 1523 para => ["Paralysation",
1474 "<b>Paralysation</b> (this resistance affects the chance you get paralysed)"], 1524 "<b>Paralysation</b> (this resistance affects the chance you get paralysed)"],
1475 deat => ["Death", 1525 deat => ["Death",
1476 "<b>Death</b> (resistance against death spells)"], 1526 "<b>Death</b> (resistance against death spells)"],
1477 phys => ["Physical", 1527 phys => ["Physical",
1478 "<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.)"],
1479 blind => ["Blind", 1529 blind => ["Blind",
1480 "<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)"],
1481 fear => ["Fear", 1531 fear => ["Fear",
1482 "<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)"],
1483 tund => ["Turn undead", 1533 tund => ["Turn undead",
1942 $r 1992 $r
1943} 1993}
1944 1994
1945my %SORT_ORDER = ( 1995my %SORT_ORDER = (
1946 type => sub { 1996 type => sub {
1997 use sort 'stable';
1947 sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_ 1998 sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_
1948 }, 1999 },
1949 mtime => sub { 2000 mtime => sub {
2001 use sort 'stable';
1950 my $NOW = time; 2002 my $NOW = time;
1951 sort { 2003 sort {
1952 my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6; 2004 my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6;
1953 my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6; 2005 my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6;
1954 2006
1955 ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED) 2007 ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED)
1956 or $btime <=> $atime 2008 or $btime <=> $atime
1957 or $a->{type} <=> $b->{type} 2009 or $a->{type} <=> $b->{type}
1958 } @_ 2010 } @_
1959 }, 2011 },
1960 weight => sub { sort { 2012 weight => sub {
2013 use sort 'stable';
2014 sort {
1961 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1) 2015 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1)
1962 or $a->{type} <=> $b->{type} 2016 or $a->{type} <=> $b->{type}
1963 } @_ }, 2017 } @_
2018 },
1964); 2019);
1965 2020
1966sub inventory_widget { 2021sub inventory_widget {
1967 my $hb = new DC::UI::HBox homogeneous => 1; 2022 my $hb = new DC::UI::HBox homogeneous => 1;
1968 2023
2409 2464
2410 $dialog->show; 2465 $dialog->show;
2411 }; 2466 };
2412} 2467}
2413 2468
2414sub sdl_init {
2415 DC::SDL_Init DC::SDL_INIT_AUDIO #| DC::SDL_NOPARACHUTE
2416 and die "SDL::Init failed!\n";
2417}
2418
2419sub video_init { 2469sub video_init {
2420 DC::set_theme $CFG->{uitheme}; 2470 DC::set_theme $CFG->{uitheme};
2421 2471
2422 DC::SDL_InitSubSystem DC::SDL_INIT_VIDEO if $SDL_REINIT; 2472 DC::SDL_InitSubSystem DC::SDL_INIT_VIDEO if $SDL_REINIT;
2423 $SDL_REINIT = 0; 2473 $SDL_REINIT = 0;
2482 2532
2483 $DEBUG_STATUS = new DC::UI::Label 2533 $DEBUG_STATUS = new DC::UI::Label
2484 padding => 0, 2534 padding => 0,
2485 z => 100, 2535 z => 100,
2486 force_x => "max", 2536 force_x => "max",
2487 force_y => 0; 2537 force_y => 20;
2488 $DEBUG_STATUS->show; 2538 $DEBUG_STATUS->show;
2489 2539
2490 $STATUSBOX = new DC::UI::Statusbox; 2540 $STATUSBOX = new DC::UI::Statusbox;
2491 2541
2492 $MODBOX = new DC::UI::Label 2542 $MODBOX = new DC::UI::Label
2620my $animate_timer; 2670my $animate_timer;
2621 2671
2622my $fps = 9; 2672my $fps = 9;
2623 2673
2624sub force_refresh { 2674sub force_refresh {
2625 if ($ENV{CFPLUS_DEBUG} & 4) { 2675 if ($DELIANTRA_DEBUG & 4) {
2626 $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02; 2676 $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02;
2627 debug sprintf "%3.2f", $fps; 2677 debug sprintf "%3.2f", $fps;
2628 } 2678 }
2629 2679
2630 undef $WANT_REFRESH; 2680 undef $WANT_REFRESH;
2783 $CFG->{$k} = $v unless exists $CFG->{$k}; 2833 $CFG->{$k} = $v unless exists $CFG->{$k};
2784 } 2834 }
2785 2835
2786 my @args = @ARGV; 2836 my @args = @ARGV;
2787 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
2788 my $profile = 'default'; 2843 my $profile = 'default';
2789 2844
2790 for (my $i = 0; $i < @args; $i++) { 2845 for (my $i = 0; $i < @args; $i++) {
2791 if ($args[$i] eq '-profile') { 2846 if ($args[$i] =~ /^--?profile$/) {
2792 $profile = $args[$i + 1]; 2847 $profile = $args[$i + 1];
2793 splice @args, $i, 2, (); 2848 splice @args, $i, 2, ();
2794 $i = 0; 2849 $i = 0;
2850 } elsif ($args[$i] =~ /^--?h/) {
2851 print STDERR "Usage: $0 [--profile name] [host [user [password]]]\n";
2852 exit 0;
2795 } 2853 }
2796 } 2854 }
2797 2855
2798 $CFG->{profile}{$profile} ||= {}; 2856 $CFG->{profile}{$profile} ||= {};
2799 $PROFILE = $CFG->{profile}{$profile}; 2857 $PROFILE = $CFG->{profile}{$profile};
2812 action => $cmds, 2870 action => $cmds,
2813 }; 2871 };
2814 } 2872 }
2815 } 2873 }
2816 } 2874 }
2817
2818 sdl_init;
2819 2875
2820 $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf"; 2876 $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf";
2821 $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts"; 2877 $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts";
2822 2878
2823 { 2879 {
2854# } 2910# }
2855# my $t2 = Time::HiRes::time; 2911# my $t2 = Time::HiRes::time;
2856# warn $t2-$t1; 2912# warn $t2-$t1;
2857# } 2913# }
2858 2914
2859 video_init; 2915 DC::IMG_Init; video_init;
2860 audio_init; 2916 DC::Mix_Init; audio_init;
2861 } 2917 }
2862 2918
2863 show_tip_of_the_day if $CFG->{show_tips}; 2919 show_tip_of_the_day if $CFG->{show_tips};
2864 2920
2865 our $STARTUP_CANCEL = EV::idle sub { 2921 our $STARTUP_CANCEL = EV::idle sub {
2866 undef $::STARTUP_CANCEL; 2922 undef $::STARTUP_CANCEL;
2867 $startup_done->(); 2923 $startup_done->();
2868 }; 2924 };
2869 2925
2926 debug_toggle 0;
2927
2870 delete $SIG{__DIE__}; 2928 delete $SIG{__DIE__};
2871 EV::loop; 2929 EV::loop;
2872 2930
2873 DC::write_cfg if $CFG->{config_autosave}; 2931 DC::write_cfg if $CFG->{config_autosave};
2874 2932
2886 2944
2887deliantra - A Deliantra MORPG game client 2945deliantra - A Deliantra MORPG game client
2888 2946
2889=head1 SYNOPSIS 2947=head1 SYNOPSIS
2890 2948
2891Just run it - no commandline arguments are supported. 2949 deliantra [--profile name] [host [user [password]]]
2950 deliantra --help
2892 2951
2893=head1 USAGE 2952=head1 USAGE
2894 2953
2895deliantra utilises OpenGL for all UI elements and the game. It is supposed to 2954The deliantra client utilises OpenGL for all UI elements and the game. It
2896be used in fullscreen mode and interactively. 2955is supposed to be used in fullscreen mode and interactively.
2897 2956
2898=head1 DEBUGGING 2957=head1 DEBUGGING
2899 2958
2900
2901CFPLUS_DEBUG - environment variable 2959DELIANTRA_DEBUG - environment variable
2902 2960
2903 1 draw borders around widgets 2961 1 draw borders around widgets
2904 2 add low-level widget info to tooltips 2962 2 add low-level widget info to tooltips
2905 4 show fps 2963 4 show fps
2906 8 suppress tooltips 2964 8 suppress tooltips
2965 16 show bandwidth downstream
2907 2966
2908=head1 AUTHOR 2967=head1 AUTHOR
2909 2968
2910Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org> 2969Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org>
2911 2970

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines