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.100 by root, Tue Dec 22 01:37:42 2009 UTC vs.
Revision 1.108 by root, Thu Apr 8 04:49:32 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 {
541 sub audio_tab_update; 540 sub audio_tab_update;
542 audio_tab_update; 541 audio_tab_update;
543} 542}
544 543
545sub audio_shutdown { 544sub audio_shutdown {
545 if ($SDL_MIXER) {
546 DC::MixMusic::halt;
547 DC::Mix_AllocateChannels 0;
548 }
549
546 undef $MUSIC_PLAYER; 550 undef $MUSIC_PLAYER;
547 undef $MUSIC_PLAYING_META; 551 undef $MUSIC_PLAYING_META;
548 undef $MUSIC_PLAYING_DATA; 552 undef $MUSIC_PLAYING_DATA;
549 553
550 $MUSIC_WANT = []; 554 $MUSIC_WANT = [];
551 @MUSIC_JINGLE = (); 555 @MUSIC_JINGLE = ();
552 %AUDIO_PLAY = (); 556 %AUDIO_PLAY = ();
553 %AUDIO_CHUNK = (); 557 %AUDIO_CHUNK = ();
554 558
555 DC::MixMusic::halt;
556 DC::Mix_AllocateChannels 0;
557 DC::Mix_CloseAudio if $SDL_MIXER; 559 DC::Mix_CloseAudio if $SDL_MIXER;
558 undef $SDL_MIXER; 560 undef $SDL_MIXER;
559} 561}
560 562
561############################################################################# 563#############################################################################
804 user => $PROFILE->{user}, 806 user => $PROFILE->{user},
805 pass => $PROFILE->{password}, 807 pass => $PROFILE->{password},
806 mapw => $mapw, 808 mapw => $mapw,
807 maph => $maph, 809 maph => $maph,
808 810
811 version => {
812 client => "deliantra",
809 client => "$DC::VERSION $] $^O", 813 clientver => $DC::VERSION,
814 gl_vendor => DC::OpenGL::gl_vendor,
815 gl_version => DC::OpenGL::gl_version,
816 },
810 817
811 map_widget => $MAPWIDGET, 818 map_widget => $MAPWIDGET,
812 statusbox => $STATUSBOX, 819 statusbox => $STATUSBOX,
813 map => $MAP, 820 map => $MAP,
814 mapmap => $MAPMAP, 821 mapmap => $MAPMAP,
1138 1145
1139 my $text = !$freq 1146 my $text = !$freq
1140 ? "audio is off" 1147 ? "audio is off"
1141 : "audio is enabled\n" 1148 : "audio is enabled\n"
1142 . "frequency (Hz): $freq\n" 1149 . "frequency (Hz): $freq\n"
1143 . "channels: $chans"; 1150 . "channels: $chans\n"
1151 . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n"
1152 . "music decoders available: " . (join ", ", DC::MixMusic::decoders);
1144 1153
1145 $AUDIO_INFO->set_text ($text); 1154 $AUDIO_INFO->set_text ($text);
1146} 1155}
1147 1156
1148sub audio_setup { 1157sub audio_setup {
1668 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), 1677 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]),
1669 ); 1678 );
1670 1679
1671 $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); 1680 $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username");
1672 $table->add_at (1, 4, new DC::UI::Entry 1681 $table->add_at (1, 4, new DC::UI::Entry
1673 text => $CFG->{profile}{default}{user}, 1682 text => $PROFILE->{user},
1674 tooltip => "The name of your character on the server. The name is case-sensitive!", 1683 tooltip => "The name of your character on the server. The name is case-sensitive!",
1675 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } 1684 on_changed => sub { my ($self, $value) = @_; $PROFILE->{user} = $value; 1 }
1676 ); 1685 );
1677 1686
1678 $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); 1687 $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password");
1679 $table->add_at (1, 5, new DC::UI::Entry 1688 $table->add_at (1, 5, new DC::UI::Entry
1680 text => $CFG->{profile}{default}{password}, 1689 text => $PROFILE->{password},
1681 hidden => 1, 1690 hidden => 1,
1682 tooltip => "The password for your character.", 1691 tooltip => "The password for your character.",
1683 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } 1692 on_changed => sub { my ($self, $value) = @_; $PROFILE->{password} = $value; 1 }
1684 ); 1693 );
1685 1694
1686 $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button 1695 $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button
1687 expand => 1, 1696 expand => 1,
1688 text => "Login / Register", 1697 text => "Login / Register",
1724 $table->add_at (1, $row, my $vbox = new DC::UI::VBox); 1733 $table->add_at (1, $row, my $vbox = new DC::UI::VBox);
1725 1734
1726 $vbox->add ( 1735 $vbox->add (
1727 $HOST_ENTRY = new DC::UI::Entry 1736 $HOST_ENTRY = new DC::UI::Entry
1728 expand => 1, 1737 expand => 1,
1729 text => $CFG->{profile}{default}{host}, 1738 text => $PROFILE->{host},
1730 tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)", 1739 tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)",
1731 on_changed => sub { 1740 on_changed => sub {
1732 my ($self, $value) = @_; 1741 my ($self, $value) = @_;
1733 $CFG->{profile}{default}{host} = $value; 1742 $PROFILE->{host} = $value;
1734 1 1743 1
1735 } 1744 }
1736 ); 1745 );
1737 1746
1738 if (0) { #d# disabled 1747 if (0) { #d# disabled
1937 $r 1946 $r
1938} 1947}
1939 1948
1940my %SORT_ORDER = ( 1949my %SORT_ORDER = (
1941 type => sub { 1950 type => sub {
1951 use sort 'stable';
1942 sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_ 1952 sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_
1943 }, 1953 },
1944 mtime => sub { 1954 mtime => sub {
1955 use sort 'stable';
1945 my $NOW = time; 1956 my $NOW = time;
1946 sort { 1957 sort {
1947 my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6; 1958 my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6;
1948 my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6; 1959 my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6;
1949 1960
1950 ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED) 1961 ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED)
1951 or $btime <=> $atime 1962 or $btime <=> $atime
1952 or $a->{type} <=> $b->{type} 1963 or $a->{type} <=> $b->{type}
1953 } @_ 1964 } @_
1954 }, 1965 },
1955 weight => sub { sort { 1966 weight => sub {
1967 use sort 'stable';
1968 sort {
1956 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1) 1969 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1)
1957 or $a->{type} <=> $b->{type} 1970 or $a->{type} <=> $b->{type}
1958 } @_ }, 1971 } @_
1972 },
1959); 1973);
1960 1974
1961sub inventory_widget { 1975sub inventory_widget {
1962 my $hb = new DC::UI::HBox homogeneous => 1; 1976 my $hb = new DC::UI::HBox homogeneous => 1;
1963 1977
2771 shift_fire_stop => 0, 2785 shift_fire_stop => 0,
2772 uitheme => "wood", 2786 uitheme => "wood",
2773 map_shift_x => -24, # arbitrary 2787 map_shift_x => -24, # arbitrary
2774 map_shift_y => +24, # arbitrary 2788 map_shift_y => +24, # arbitrary
2775 ); 2789 );
2776 2790
2777 while (my ($k, $v) = each %DEF_CFG) { 2791 while (my ($k, $v) = each %DEF_CFG) {
2778 $CFG->{$k} = $v unless exists $CFG->{$k}; 2792 $CFG->{$k} = $v unless exists $CFG->{$k};
2779 } 2793 }
2780 2794
2781 $CFG->{profile}{default}{host} ||= "gameserver.deliantra.net"; 2795 my @args = @ARGV;
2796
2797 my $profile = 'default';
2798
2799 for (my $i = 0; $i < @args; $i++) {
2800 if ($args[$i] =~ /^--?profile$/) {
2801 $profile = $args[$i + 1];
2802 splice @args, $i, 2, ();
2803 $i = 0;
2804 } elsif ($args[$i] =~ /^--?h/) {
2805 print STDERR "Usage: $0 [--profile name] [host [user [password]]]\n";
2806 exit 0;
2807 }
2808 }
2809
2810 $CFG->{profile}{$profile} ||= {};
2782 $PROFILE = $CFG->{profile}{default}; 2811 $PROFILE = $CFG->{profile}{$profile};
2812 $PROFILE->{host} ||= "gameserver.deliantra.net";
2813
2814 $PROFILE->{host} = $args[0] if @args > 0;
2815 $PROFILE->{user} = $args[1] if @args > 1;
2816 $PROFILE->{password} = $args[2] if @args > 2;
2783 2817
2784 # convert old bindings (only default profile matters) 2818 # convert old bindings (only default profile matters)
2785 if (my $bindings = delete $PROFILE->{bindings}) { 2819 if (my $bindings = delete $PROFILE->{bindings}) {
2786 while (my ($mod, $syms) = each %$bindings) { 2820 while (my ($mod, $syms) = each %$bindings) {
2787 while (my ($sym, $cmds) = each %$syms) { 2821 while (my ($sym, $cmds) = each %$syms) {
2810 DejaVuSansMono-BoldOblique.ttf 2844 DejaVuSansMono-BoldOblique.ttf
2811 mona.ttf 2845 mona.ttf
2812 ); 2846 );
2813 2847
2814 DC::add_font $_ for @fonts; 2848 DC::add_font $_ for @fonts;
2815 2849
2816 $FONT_PROP = new_from_file DC::Font $fonts[0]; 2850 $FONT_PROP = new_from_file DC::Font $fonts[0];
2817 $FONT_FIXED = new_from_file DC::Font $fonts[1]; 2851 $FONT_FIXED = new_from_file DC::Font $fonts[1];
2818 2852
2819 $FONT_PROP->make_default; 2853 $FONT_PROP->make_default;
2820 2854
2864 2898
2865deliantra - A Deliantra MORPG game client 2899deliantra - A Deliantra MORPG game client
2866 2900
2867=head1 SYNOPSIS 2901=head1 SYNOPSIS
2868 2902
2869Just run it - no commandline arguments are supported. 2903 deliantra [--profile name] [host [user [password]]]
2904 deliantra --help
2870 2905
2871=head1 USAGE 2906=head1 USAGE
2872 2907
2873deliantra utilises OpenGL for all UI elements and the game. It is supposed to 2908The deliantra client utilises OpenGL for all UI elements and the game. It
2874be used in fullscreen mode and interactively. 2909is supposed to be used in fullscreen mode and interactively.
2875 2910
2876=head1 DEBUGGING 2911=head1 DEBUGGING
2877
2878 2912
2879CFPLUS_DEBUG - environment variable 2913CFPLUS_DEBUG - environment variable
2880 2914
2881 1 draw borders around widgets 2915 1 draw borders around widgets
2882 2 add low-level widget info to tooltips 2916 2 add low-level widget info to tooltips

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines