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.105 by root, Sat Apr 3 02:58:25 2010 UTC vs.
Revision 1.110 by root, Mon Apr 12 02:03:33 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 => {
813 client => "deliantra",
811 client => "$DC::VERSION $] $^O", 814 clientver => $DC::VERSION,
815 gl_vendor => DC::OpenGL::gl_vendor,
816 gl_version => DC::OpenGL::gl_version,
817 },
812 818
813 map_widget => $MAPWIDGET, 819 map_widget => $MAPWIDGET,
814 statusbox => $STATUSBOX, 820 statusbox => $STATUSBOX,
815 map => $MAP, 821 map => $MAP,
816 mapmap => $MAPMAP, 822 mapmap => $MAPMAP,
1181 ); 1187 );
1182 1188
1183 $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");
1184 $table->add_at (1, $row, new DC::UI::CheckBox 1190 $table->add_at (1, $row, new DC::UI::CheckBox
1185 expand => 1, state => $CFG->{bgm_enable}, 1191 expand => 1, state => $CFG->{bgm_enable},
1186 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.",
1187 on_changed => sub { 1193 on_changed => sub {
1188 $CFG->{bgm_enable} = $_[1]; 1194 $CFG->{bgm_enable} = $_[1];
1189 $CONN->update_fx_want if $CONN; 1195 $CONN->update_fx_want if $CONN;
1190 audio_music_push; 1196 audio_music_push;
1191 1 1197 1
1328 &set_gauge_window_fontsize; 1334 &set_gauge_window_fontsize;
1329 1335
1330 $win 1336 $win
1331} 1337}
1332 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
1333sub debug_setup { 1356sub debug_setup {
1334 my $table = new DC::UI::Table; 1357 my $table = new DC::UI::Table;
1335 1358
1336 $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");
1337 $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 });
1338 $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");
1339 $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 });
1340 $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");
1341 $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 });
1342 $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");
1343 $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
1344 $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() } );
1345
1346 $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#
1347 1372
1348 $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);
1349 $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);
1350 $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 );
1351 $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);
1941 $r 1966 $r
1942} 1967}
1943 1968
1944my %SORT_ORDER = ( 1969my %SORT_ORDER = (
1945 type => sub { 1970 type => sub {
1971 use sort 'stable';
1946 sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_ 1972 sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_
1947 }, 1973 },
1948 mtime => sub { 1974 mtime => sub {
1975 use sort 'stable';
1949 my $NOW = time; 1976 my $NOW = time;
1950 sort { 1977 sort {
1951 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;
1952 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;
1953 1980
1954 ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED) 1981 ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED)
1955 or $btime <=> $atime 1982 or $btime <=> $atime
1956 or $a->{type} <=> $b->{type} 1983 or $a->{type} <=> $b->{type}
1957 } @_ 1984 } @_
1958 }, 1985 },
1959 weight => sub { sort { 1986 weight => sub {
1987 use sort 'stable';
1988 sort {
1960 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1) 1989 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1)
1961 or $a->{type} <=> $b->{type} 1990 or $a->{type} <=> $b->{type}
1962 } @_ }, 1991 } @_
1992 },
1963); 1993);
1964 1994
1965sub inventory_widget { 1995sub inventory_widget {
1966 my $hb = new DC::UI::HBox homogeneous => 1; 1996 my $hb = new DC::UI::HBox homogeneous => 1;
1967 1997
2481 2511
2482 $DEBUG_STATUS = new DC::UI::Label 2512 $DEBUG_STATUS = new DC::UI::Label
2483 padding => 0, 2513 padding => 0,
2484 z => 100, 2514 z => 100,
2485 force_x => "max", 2515 force_x => "max",
2486 force_y => 0; 2516 force_y => 20;
2487 $DEBUG_STATUS->show; 2517 $DEBUG_STATUS->show;
2488 2518
2489 $STATUSBOX = new DC::UI::Statusbox; 2519 $STATUSBOX = new DC::UI::Statusbox;
2490 2520
2491 $MODBOX = new DC::UI::Label 2521 $MODBOX = new DC::UI::Label
2619my $animate_timer; 2649my $animate_timer;
2620 2650
2621my $fps = 9; 2651my $fps = 9;
2622 2652
2623sub force_refresh { 2653sub force_refresh {
2624 if ($ENV{CFPLUS_DEBUG} & 4) { 2654 if ($DELIANTRA_DEBUG & 4) {
2625 $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;
2626 debug sprintf "%3.2f", $fps; 2656 debug sprintf "%3.2f", $fps;
2627 } 2657 }
2628 2658
2629 undef $WANT_REFRESH; 2659 undef $WANT_REFRESH;
2867 our $STARTUP_CANCEL = EV::idle sub { 2897 our $STARTUP_CANCEL = EV::idle sub {
2868 undef $::STARTUP_CANCEL; 2898 undef $::STARTUP_CANCEL;
2869 $startup_done->(); 2899 $startup_done->();
2870 }; 2900 };
2871 2901
2902 debug_toggle 0;
2903
2872 delete $SIG{__DIE__}; 2904 delete $SIG{__DIE__};
2873 EV::loop; 2905 EV::loop;
2874 2906
2875 DC::write_cfg if $CFG->{config_autosave}; 2907 DC::write_cfg if $CFG->{config_autosave};
2876 2908
2898The 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
2899is supposed to be used in fullscreen mode and interactively. 2931is supposed to be used in fullscreen mode and interactively.
2900 2932
2901=head1 DEBUGGING 2933=head1 DEBUGGING
2902 2934
2903CFPLUS_DEBUG - environment variable 2935DELIANTRA_DEBUG - environment variable
2904 2936
2905 1 draw borders around widgets 2937 1 draw borders around widgets
2906 2 add low-level widget info to tooltips 2938 2 add low-level widget info to tooltips
2907 4 show fps 2939 4 show fps
2908 8 suppress tooltips 2940 8 suppress tooltips
2941 16 show bandwidth downstream
2909 2942
2910=head1 AUTHOR 2943=head1 AUTHOR
2911 2944
2912Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org> 2945Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org>
2913 2946

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines