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.108 by root, Thu Apr 8 04:49:32 2010 UTC vs.
Revision 1.112 by root, Thu Apr 22 11:18:04 2010 UTC

143our $NOW; 143our $NOW;
144 144
145our $CFG; 145our $CFG;
146our $PROFILE; # current profile 146our $PROFILE; # current profile
147our $FAST; # fast, low-quality mode, possibly useful for software-rendering 147our $FAST; # fast, low-quality mode, possibly useful for software-rendering
148our $DELIANTRA_DEBUG = $ENV{DELIANTRA_DEBUG} * 1;
148 149
149our $WANT_REFRESH; 150our $WANT_REFRESH;
150 151
151our $MODE_SLIDER; 152our $MODE_SLIDER;
152our $CAVEAT_LABEL; 153our $CAVEAT_LABEL;
806 user => $PROFILE->{user}, 807 user => $PROFILE->{user},
807 pass => $PROFILE->{password}, 808 pass => $PROFILE->{password},
808 mapw => $mapw, 809 mapw => $mapw,
809 maph => $maph, 810 maph => $maph,
810 811
811 version => { 812 c_version => {
812 client => "deliantra", 813 client => "deliantra",
813 clientver => $DC::VERSION, 814 clientver => $DC::VERSION,
814 gl_vendor => DC::OpenGL::gl_vendor, 815 gl_vendor => DC::OpenGL::gl_vendor,
815 gl_version => DC::OpenGL::gl_version, 816 gl_version => DC::OpenGL::gl_version,
816 }, 817 },
853 854
854 # hack to make SURE we find the IP address all right 855 # hack to make SURE we find the IP address all right
855 # can be removed once AnyEvent::DNS is proven stable. 856 # can be removed once AnyEvent::DNS is proven stable.
856 if ($host eq "gameserver.deliantra.net") { 857 if ($host eq "gameserver.deliantra.net") {
857 AnyEvent::DNS::a "dnstest.deliantra.net", sub { 858 AnyEvent::DNS::a "dnstest.deliantra.net", sub {
858 if ($_[0] ne "80.101.114.108") { # Perl 859 if ($_[0] ne "80.101.114.108") { # P-e-r-l
859 status "dns failure, trying differently"; 860 status "dns failure, trying differently";
860 $host = eval { Socket::inet_ntoa Socket::inet_aton "gameserver.deliantra.net" }; 861 $host = eval { Socket::inet_ntoa Socket::inet_aton "gameserver.deliantra.net" };
861 unless (defined $host) { 862 unless (defined $host) {
862 status "dns failure, using hardcoded address"; 863 status "dns failure, using hardcoded address";
863 $host = "129.13.162.95"; 864 $host = "194.126.175.154";
864 } 865 }
865 } 866 }
866 867
867 dc_connect $host, $port; 868 dc_connect $host, $port;
868 }; 869 };
1144 ]); 1145 ]);
1145 1146
1146 my $text = !$freq 1147 my $text = !$freq
1147 ? "audio is off" 1148 ? "audio is off"
1148 : "audio is enabled\n" 1149 : "audio is enabled\n"
1150 . "driver: " . DC::SDL_AudioDriverName . "\n"
1149 . "frequency (Hz): $freq\n" 1151 . "frequency (Hz): $freq\n"
1150 . "channels: $chans\n" 1152 . "channels: $chans\n"
1151 . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n" 1153 . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n"
1152 . "music decoders available: " . (join ", ", DC::MixMusic::decoders); 1154 . "music decoders available: " . (join ", ", DC::MixMusic::decoders);
1153 1155
1154 $AUDIO_INFO->set_text ($text); 1156 $AUDIO_INFO->set_text ($text);
1155} 1157}
1156 1158
1157sub audio_setup { 1159sub audio_setup {
1186 ); 1188 );
1187 1189
1188 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music"); 1190 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music");
1189 $table->add_at (1, $row, new DC::UI::CheckBox 1191 $table->add_at (1, $row, new DC::UI::CheckBox
1190 expand => 1, state => $CFG->{bgm_enable}, 1192 expand => 1, state => $CFG->{bgm_enable},
1191 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", 1193 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played. Needs server reconnect to take effect.",
1192 on_changed => sub { 1194 on_changed => sub {
1193 $CFG->{bgm_enable} = $_[1]; 1195 $CFG->{bgm_enable} = $_[1];
1194 $CONN->update_fx_want if $CONN; 1196 $CONN->update_fx_want if $CONN;
1195 audio_music_push; 1197 audio_music_push;
1196 1 1198 1
1333 &set_gauge_window_fontsize; 1335 &set_gauge_window_fontsize;
1334 1336
1335 $win 1337 $win
1336} 1338}
1337 1339
1340our $BW_WATCHER;
1341
1342sub debug_toggle($) {
1343 $DELIANTRA_DEBUG ^= $_[0];
1344
1345 if ($DELIANTRA_DEBUG & 16) {
1346 $BW_WATCHER = EV::periodic 0, 1, 0, sub {
1347 return unless $CONN;
1348 debug sprintf "%8.2gKB/s", $CONN->{octets_in} / 1e3;
1349 $CONN->{octets_in} = 0;
1350 };
1351 } else {
1352 undef $BW_WATCHER;
1353 }
1354
1355}
1356
1338sub debug_setup { 1357sub debug_setup {
1339 my $table = new DC::UI::Table; 1358 my $table = new DC::UI::Table;
1340 1359
1341 $table->add_at (0, 0, new DC::UI::Label text => "Widget Borders"); 1360 $table->add_at (0, 0, new DC::UI::Label text => "Widget Borders");
1342 $table->add_at (1, 0, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1; 0 }); 1361 $table->add_at (1, 0, new DC::UI::CheckBox on_changed => sub { debug_toggle 1; 0 });
1343 $table->add_at (0, 1, new DC::UI::Label text => "Tooltip Widget Info"); 1362 $table->add_at (0, 1, new DC::UI::Label text => "Tooltip Widget Info");
1344 $table->add_at (1, 1, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 }); 1363 $table->add_at (1, 1, new DC::UI::CheckBox on_changed => sub { debug_toggle 2; 0 });
1345 $table->add_at (0, 2, new DC::UI::Label text => "Show FPS"); 1364 $table->add_at (0, 2, new DC::UI::Label text => "Show FPS");
1346 $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); 1365 $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { debug_toggle 4; 0 });
1347 $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips"); 1366 $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips");
1348 $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); 1367 $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { debug_toggle 8; 0 });
1368 $table->add_at (0, 4, new DC::UI::Label text => "Show Bandwidth");
1369 $table->add_at (1, 4, new DC::UI::CheckBox on_changed => sub { debug_toggle 16; 0 });
1370
1349 $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); 1371 $table->add_at (0, 6, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } );
1350
1351 $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d# 1372 $table->add_at (0, 7, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d#
1352 1373
1353 $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); 1374 $table->add_at (7,7, my $t = new DC::UI::Table expand => 0);
1354 $t->add_at (0,0, new DC::UI::Label text => "a a", c_rowspan => 1, c_colspan => 2); 1375 $t->add_at (0,0, new DC::UI::Label text => "a a", c_rowspan => 1, c_colspan => 2);
1355 $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1, ellipsise => 0 ); 1376 $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1, ellipsise => 0 );
1356 $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2); 1377 $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2);
2491 2512
2492 $DEBUG_STATUS = new DC::UI::Label 2513 $DEBUG_STATUS = new DC::UI::Label
2493 padding => 0, 2514 padding => 0,
2494 z => 100, 2515 z => 100,
2495 force_x => "max", 2516 force_x => "max",
2496 force_y => 0; 2517 force_y => 20;
2497 $DEBUG_STATUS->show; 2518 $DEBUG_STATUS->show;
2498 2519
2499 $STATUSBOX = new DC::UI::Statusbox; 2520 $STATUSBOX = new DC::UI::Statusbox;
2500 2521
2501 $MODBOX = new DC::UI::Label 2522 $MODBOX = new DC::UI::Label
2629my $animate_timer; 2650my $animate_timer;
2630 2651
2631my $fps = 9; 2652my $fps = 9;
2632 2653
2633sub force_refresh { 2654sub force_refresh {
2634 if ($ENV{CFPLUS_DEBUG} & 4) { 2655 if ($DELIANTRA_DEBUG & 4) {
2635 $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02; 2656 $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02;
2636 debug sprintf "%3.2f", $fps; 2657 debug sprintf "%3.2f", $fps;
2637 } 2658 }
2638 2659
2639 undef $WANT_REFRESH; 2660 undef $WANT_REFRESH;
2877 our $STARTUP_CANCEL = EV::idle sub { 2898 our $STARTUP_CANCEL = EV::idle sub {
2878 undef $::STARTUP_CANCEL; 2899 undef $::STARTUP_CANCEL;
2879 $startup_done->(); 2900 $startup_done->();
2880 }; 2901 };
2881 2902
2903 debug_toggle 0;
2904
2882 delete $SIG{__DIE__}; 2905 delete $SIG{__DIE__};
2883 EV::loop; 2906 EV::loop;
2884 2907
2885 DC::write_cfg if $CFG->{config_autosave}; 2908 DC::write_cfg if $CFG->{config_autosave};
2886 2909
2908The deliantra client utilises OpenGL for all UI elements and the game. It 2931The deliantra client utilises OpenGL for all UI elements and the game. It
2909is supposed to be used in fullscreen mode and interactively. 2932is supposed to be used in fullscreen mode and interactively.
2910 2933
2911=head1 DEBUGGING 2934=head1 DEBUGGING
2912 2935
2913CFPLUS_DEBUG - environment variable 2936DELIANTRA_DEBUG - environment variable
2914 2937
2915 1 draw borders around widgets 2938 1 draw borders around widgets
2916 2 add low-level widget info to tooltips 2939 2 add low-level widget info to tooltips
2917 4 show fps 2940 4 show fps
2918 8 suppress tooltips 2941 8 suppress tooltips
2942 16 show bandwidth downstream
2919 2943
2920=head1 AUTHOR 2944=head1 AUTHOR
2921 2945
2922Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org> 2946Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org>
2923 2947

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines