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.107 by root, Thu Apr 8 03:51:26 2010 UTC vs.
Revision 1.111 by root, Mon Apr 12 02:46:55 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
812 c_version => {
811 client => "deliantra", 813 client => "deliantra",
812 clientversion => $DC::VERSION, 814 clientver => $DC::VERSION,
815 gl_vendor => DC::OpenGL::gl_vendor,
816 gl_version => DC::OpenGL::gl_version,
817 },
813 818
814 map_widget => $MAPWIDGET, 819 map_widget => $MAPWIDGET,
815 statusbox => $STATUSBOX, 820 statusbox => $STATUSBOX,
816 map => $MAP, 821 map => $MAP,
817 mapmap => $MAPMAP, 822 mapmap => $MAPMAP,
849 854
850 # hack to make SURE we find the IP address all right 855 # hack to make SURE we find the IP address all right
851 # can be removed once AnyEvent::DNS is proven stable. 856 # can be removed once AnyEvent::DNS is proven stable.
852 if ($host eq "gameserver.deliantra.net") { 857 if ($host eq "gameserver.deliantra.net") {
853 AnyEvent::DNS::a "dnstest.deliantra.net", sub { 858 AnyEvent::DNS::a "dnstest.deliantra.net", sub {
854 if ($_[0] ne "80.101.114.108") { # Perl 859 if ($_[0] ne "80.101.114.108") { # P-e-r-l
855 status "dns failure, trying differently"; 860 status "dns failure, trying differently";
856 $host = eval { Socket::inet_ntoa Socket::inet_aton "gameserver.deliantra.net" }; 861 $host = eval { Socket::inet_ntoa Socket::inet_aton "gameserver.deliantra.net" };
857 unless (defined $host) { 862 unless (defined $host) {
858 status "dns failure, using hardcoded address"; 863 status "dns failure, using hardcoded address";
859 $host = "129.13.162.95"; 864 $host = "194.126.175.154";
860 } 865 }
861 } 866 }
862 867
863 dc_connect $host, $port; 868 dc_connect $host, $port;
864 }; 869 };
1182 ); 1187 );
1183 1188
1184 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music"); 1189 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music");
1185 $table->add_at (1, $row, new DC::UI::CheckBox 1190 $table->add_at (1, $row, new DC::UI::CheckBox
1186 expand => 1, state => $CFG->{bgm_enable}, 1191 expand => 1, state => $CFG->{bgm_enable},
1187 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", 1192 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 { 1193 on_changed => sub {
1189 $CFG->{bgm_enable} = $_[1]; 1194 $CFG->{bgm_enable} = $_[1];
1190 $CONN->update_fx_want if $CONN; 1195 $CONN->update_fx_want if $CONN;
1191 audio_music_push; 1196 audio_music_push;
1192 1 1197 1
1329 &set_gauge_window_fontsize; 1334 &set_gauge_window_fontsize;
1330 1335
1331 $win 1336 $win
1332} 1337}
1333 1338
1339our $BW_WATCHER;
1340
1341sub debug_toggle($) {
1342 $DELIANTRA_DEBUG ^= $_[0];
1343
1344 if ($DELIANTRA_DEBUG & 16) {
1345 $BW_WATCHER = EV::periodic 0, 1, 0, sub {
1346 return unless $CONN;
1347 debug sprintf "%8.2gKB/s", $CONN->{octets_in} / 1e3;
1348 $CONN->{octets_in} = 0;
1349 };
1350 } else {
1351 undef $BW_WATCHER;
1352 }
1353
1354}
1355
1334sub debug_setup { 1356sub debug_setup {
1335 my $table = new DC::UI::Table; 1357 my $table = new DC::UI::Table;
1336 1358
1337 $table->add_at (0, 0, new DC::UI::Label text => "Widget Borders"); 1359 $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 }); 1360 $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"); 1361 $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 }); 1362 $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"); 1363 $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 }); 1364 $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"); 1365 $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 }); 1366 $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { debug_toggle 8; 0 });
1367 $table->add_at (0, 4, new DC::UI::Label text => "Show Bandwidth");
1368 $table->add_at (1, 4, new DC::UI::CheckBox on_changed => sub { debug_toggle 16; 0 });
1369
1345 $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); 1370 $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# 1371 $table->add_at (0, 7, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d#
1348 1372
1349 $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); 1373 $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); 1374 $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 ); 1375 $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); 1376 $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2);
2487 2511
2488 $DEBUG_STATUS = new DC::UI::Label 2512 $DEBUG_STATUS = new DC::UI::Label
2489 padding => 0, 2513 padding => 0,
2490 z => 100, 2514 z => 100,
2491 force_x => "max", 2515 force_x => "max",
2492 force_y => 0; 2516 force_y => 20;
2493 $DEBUG_STATUS->show; 2517 $DEBUG_STATUS->show;
2494 2518
2495 $STATUSBOX = new DC::UI::Statusbox; 2519 $STATUSBOX = new DC::UI::Statusbox;
2496 2520
2497 $MODBOX = new DC::UI::Label 2521 $MODBOX = new DC::UI::Label
2625my $animate_timer; 2649my $animate_timer;
2626 2650
2627my $fps = 9; 2651my $fps = 9;
2628 2652
2629sub force_refresh { 2653sub force_refresh {
2630 if ($ENV{CFPLUS_DEBUG} & 4) { 2654 if ($DELIANTRA_DEBUG & 4) {
2631 $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02; 2655 $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02;
2632 debug sprintf "%3.2f", $fps; 2656 debug sprintf "%3.2f", $fps;
2633 } 2657 }
2634 2658
2635 undef $WANT_REFRESH; 2659 undef $WANT_REFRESH;
2873 our $STARTUP_CANCEL = EV::idle sub { 2897 our $STARTUP_CANCEL = EV::idle sub {
2874 undef $::STARTUP_CANCEL; 2898 undef $::STARTUP_CANCEL;
2875 $startup_done->(); 2899 $startup_done->();
2876 }; 2900 };
2877 2901
2902 debug_toggle 0;
2903
2878 delete $SIG{__DIE__}; 2904 delete $SIG{__DIE__};
2879 EV::loop; 2905 EV::loop;
2880 2906
2881 DC::write_cfg if $CFG->{config_autosave}; 2907 DC::write_cfg if $CFG->{config_autosave};
2882 2908
2904The deliantra client utilises OpenGL for all UI elements and the game. It 2930The deliantra client utilises OpenGL for all UI elements and the game. It
2905is supposed to be used in fullscreen mode and interactively. 2931is supposed to be used in fullscreen mode and interactively.
2906 2932
2907=head1 DEBUGGING 2933=head1 DEBUGGING
2908 2934
2909CFPLUS_DEBUG - environment variable 2935DELIANTRA_DEBUG - environment variable
2910 2936
2911 1 draw borders around widgets 2937 1 draw borders around widgets
2912 2 add low-level widget info to tooltips 2938 2 add low-level widget info to tooltips
2913 4 show fps 2939 4 show fps
2914 8 suppress tooltips 2940 8 suppress tooltips
2941 16 show bandwidth downstream
2915 2942
2916=head1 AUTHOR 2943=head1 AUTHOR
2917 2944
2918Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org> 2945Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org>
2919 2946

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines