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.110 by root, Mon Apr 12 02:03:33 2010 UTC

32 Win32::GUI::SplashScreen::Done (1); 32 Win32::GUI::SplashScreen::Done (1);
33 }; 33 };
34 } 34 }
35} 35}
36 36
37use strict; 37use common::sense;
38use utf8;
39 38
40use Carp 'verbose'; 39use Carp 'verbose';
41 40
42# do things only needed for single-binary version (par) 41# do things only needed for single-binary version (par)
43BEGIN { 42BEGIN {
144our $NOW; 143our $NOW;
145 144
146our $CFG; 145our $CFG;
147our $PROFILE; # current profile 146our $PROFILE; # current profile
148our $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;
149 149
150our $WANT_REFRESH; 150our $WANT_REFRESH;
151 151
152our $MODE_SLIDER; 152our $MODE_SLIDER;
153our $CAVEAT_LABEL; 153our $CAVEAT_LABEL;
807 user => $PROFILE->{user}, 807 user => $PROFILE->{user},
808 pass => $PROFILE->{password}, 808 pass => $PROFILE->{password},
809 mapw => $mapw, 809 mapw => $mapw,
810 maph => $maph, 810 maph => $maph,
811 811
812 c_version => {
813 client => "deliantra",
812 client => "$DC::VERSION $] $^O", 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,
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 "%.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);
1942 $r 1966 $r
1943} 1967}
1944 1968
1945my %SORT_ORDER = ( 1969my %SORT_ORDER = (
1946 type => sub { 1970 type => sub {
1971 use sort 'stable';
1947 sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_ 1972 sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_
1948 }, 1973 },
1949 mtime => sub { 1974 mtime => sub {
1975 use sort 'stable';
1950 my $NOW = time; 1976 my $NOW = time;
1951 sort { 1977 sort {
1952 my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6; 1978 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; 1979 my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6;
1954 1980
1955 ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED) 1981 ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED)
1956 or $btime <=> $atime 1982 or $btime <=> $atime
1957 or $a->{type} <=> $b->{type} 1983 or $a->{type} <=> $b->{type}
1958 } @_ 1984 } @_
1959 }, 1985 },
1960 weight => sub { sort { 1986 weight => sub {
1987 use sort 'stable';
1988 sort {
1961 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1) 1989 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1)
1962 or $a->{type} <=> $b->{type} 1990 or $a->{type} <=> $b->{type}
1963 } @_ }, 1991 } @_
1992 },
1964); 1993);
1965 1994
1966sub inventory_widget { 1995sub inventory_widget {
1967 my $hb = new DC::UI::HBox homogeneous => 1; 1996 my $hb = new DC::UI::HBox homogeneous => 1;
1968 1997
2482 2511
2483 $DEBUG_STATUS = new DC::UI::Label 2512 $DEBUG_STATUS = new DC::UI::Label
2484 padding => 0, 2513 padding => 0,
2485 z => 100, 2514 z => 100,
2486 force_x => "max", 2515 force_x => "max",
2487 force_y => 0; 2516 force_y => 20;
2488 $DEBUG_STATUS->show; 2517 $DEBUG_STATUS->show;
2489 2518
2490 $STATUSBOX = new DC::UI::Statusbox; 2519 $STATUSBOX = new DC::UI::Statusbox;
2491 2520
2492 $MODBOX = new DC::UI::Label 2521 $MODBOX = new DC::UI::Label
2620my $animate_timer; 2649my $animate_timer;
2621 2650
2622my $fps = 9; 2651my $fps = 9;
2623 2652
2624sub force_refresh { 2653sub force_refresh {
2625 if ($ENV{CFPLUS_DEBUG} & 4) { 2654 if ($DELIANTRA_DEBUG & 4) {
2626 $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;
2627 debug sprintf "%3.2f", $fps; 2656 debug sprintf "%3.2f", $fps;
2628 } 2657 }
2629 2658
2630 undef $WANT_REFRESH; 2659 undef $WANT_REFRESH;
2786 my @args = @ARGV; 2815 my @args = @ARGV;
2787 2816
2788 my $profile = 'default'; 2817 my $profile = 'default';
2789 2818
2790 for (my $i = 0; $i < @args; $i++) { 2819 for (my $i = 0; $i < @args; $i++) {
2791 if ($args[$i] eq '-profile') { 2820 if ($args[$i] =~ /^--?profile$/) {
2792 $profile = $args[$i + 1]; 2821 $profile = $args[$i + 1];
2793 splice @args, $i, 2, (); 2822 splice @args, $i, 2, ();
2794 $i = 0; 2823 $i = 0;
2824 } elsif ($args[$i] =~ /^--?h/) {
2825 print STDERR "Usage: $0 [--profile name] [host [user [password]]]\n";
2826 exit 0;
2795 } 2827 }
2796 } 2828 }
2797 2829
2798 $CFG->{profile}{$profile} ||= {}; 2830 $CFG->{profile}{$profile} ||= {};
2799 $PROFILE = $CFG->{profile}{$profile}; 2831 $PROFILE = $CFG->{profile}{$profile};
2865 our $STARTUP_CANCEL = EV::idle sub { 2897 our $STARTUP_CANCEL = EV::idle sub {
2866 undef $::STARTUP_CANCEL; 2898 undef $::STARTUP_CANCEL;
2867 $startup_done->(); 2899 $startup_done->();
2868 }; 2900 };
2869 2901
2902 debug_toggle 0;
2903
2870 delete $SIG{__DIE__}; 2904 delete $SIG{__DIE__};
2871 EV::loop; 2905 EV::loop;
2872 2906
2873 DC::write_cfg if $CFG->{config_autosave}; 2907 DC::write_cfg if $CFG->{config_autosave};
2874 2908
2886 2920
2887deliantra - A Deliantra MORPG game client 2921deliantra - A Deliantra MORPG game client
2888 2922
2889=head1 SYNOPSIS 2923=head1 SYNOPSIS
2890 2924
2891Just run it - no commandline arguments are supported. 2925 deliantra [--profile name] [host [user [password]]]
2926 deliantra --help
2892 2927
2893=head1 USAGE 2928=head1 USAGE
2894 2929
2895deliantra utilises OpenGL for all UI elements and the game. It is supposed to 2930The deliantra client utilises OpenGL for all UI elements and the game. It
2896be used in fullscreen mode and interactively. 2931is supposed to be used in fullscreen mode and interactively.
2897 2932
2898=head1 DEBUGGING 2933=head1 DEBUGGING
2899 2934
2900
2901CFPLUS_DEBUG - environment variable 2935DELIANTRA_DEBUG - environment variable
2902 2936
2903 1 draw borders around widgets 2937 1 draw borders around widgets
2904 2 add low-level widget info to tooltips 2938 2 add low-level widget info to tooltips
2905 4 show fps 2939 4 show fps
2906 8 suppress tooltips 2940 8 suppress tooltips
2941 16 show bandwidth downstream
2907 2942
2908=head1 AUTHOR 2943=head1 AUTHOR
2909 2944
2910Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org> 2945Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org>
2911 2946

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines