… | |
… | |
32 | Win32::GUI::SplashScreen::Done (1); |
32 | Win32::GUI::SplashScreen::Done (1); |
33 | }; |
33 | }; |
34 | } |
34 | } |
35 | } |
35 | } |
36 | |
36 | |
37 | use strict; |
37 | use common::sense; |
38 | use utf8; |
|
|
39 | |
38 | |
40 | use Carp 'verbose'; |
39 | use Carp 'verbose'; |
41 | |
40 | |
42 | # do things only needed for single-binary version (par) |
41 | # do things only needed for single-binary version (par) |
43 | BEGIN { |
42 | BEGIN { |
… | |
… | |
541 | sub audio_tab_update; |
540 | sub audio_tab_update; |
542 | audio_tab_update; |
541 | audio_tab_update; |
543 | } |
542 | } |
544 | |
543 | |
545 | sub audio_shutdown { |
544 | sub 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 | ############################################################################# |
… | |
… | |
1036 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Smooth Transitions"); |
1038 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Smooth Transitions"); |
1037 | $table->add_at (1, $row++, new DC::UI::CheckBox |
1039 | $table->add_at (1, $row++, new DC::UI::CheckBox |
1038 | state => $CFG->{smooth_transitions}, |
1040 | state => $CFG->{smooth_transitions}, |
1039 | tooltip => "<b>Smooth Transitions</b> tries to blend the fog of war and lighting smoothly between updates. " |
1041 | tooltip => "<b>Smooth Transitions</b> tries to blend the fog of war and lighting smoothly between updates. " |
1040 | . "If you have a very slow system, non-accelerated drivers or plain dislike smooth scrolling, " |
1042 | . "If you have a very slow system, non-accelerated drivers or plain dislike smooth scrolling, " |
1041 | . "then disable this option. Requires Smooth Movement and OpenGL 1.4 or up. Changes take effect immdiately.", |
1043 | . "then disable this option. Requires Smooth Movement and OpenGL Multitexturing. Changes take effect immdiately.", |
1042 | on_changed => sub { my ($self, $value) = @_; $CFG->{smooth_transitions} = $value; 0 } |
1044 | on_changed => sub { my ($self, $value) = @_; $CFG->{smooth_transitions} = $value; 0 } |
1043 | ); |
1045 | ); |
1044 | |
1046 | |
1045 | |
1047 | |
1046 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Scale"); |
1048 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Scale"); |
… | |
… | |
1075 | tooltip => "<b>Fog of War Pattern.</b> The pattern that is overlaid over areas hidden from view. Click to cycle through various alternatives. Changes are instant.", |
1077 | tooltip => "<b>Fog of War Pattern.</b> The pattern that is overlaid over areas hidden from view. Click to cycle through various alternatives. Changes are instant.", |
1076 | on_activate => sub { |
1078 | on_activate => sub { |
1077 | my ($self) = @_; |
1079 | my ($self) = @_; |
1078 | $CFG->{fow_texture} = ($CFG->{fow_texture} + 1) % @DC::MapWidget::TEX_HIDDEN; |
1080 | $CFG->{fow_texture} = ($CFG->{fow_texture} + 1) % @DC::MapWidget::TEX_HIDDEN; |
1079 | $self->set_texture ($DC::MapWidget::TEX_HIDDEN[$CFG->{fow_texture}]); |
1081 | $self->set_texture ($DC::MapWidget::TEX_HIDDEN[$CFG->{fow_texture}]); |
|
|
1082 | $MAPWIDGET->update; |
1080 | } |
1083 | } |
1081 | ); |
1084 | ); |
1082 | |
1085 | |
1083 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Intensity"); |
1086 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Intensity"); |
1084 | $table->add_at (1, $row++, new DC::UI::Slider |
1087 | $table->add_at (1, $row++, new DC::UI::Slider |
… | |
… | |
1137 | |
1140 | |
1138 | my $text = !$freq |
1141 | my $text = !$freq |
1139 | ? "audio is off" |
1142 | ? "audio is off" |
1140 | : "audio is enabled\n" |
1143 | : "audio is enabled\n" |
1141 | . "frequency (Hz): $freq\n" |
1144 | . "frequency (Hz): $freq\n" |
1142 | . "channels: $chans"; |
1145 | . "channels: $chans\n" |
|
|
1146 | . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n" |
|
|
1147 | . "music decoders available: " . (join ", ", DC::MixMusic::decoders); |
1143 | |
1148 | |
1144 | $AUDIO_INFO->set_text ($text); |
1149 | $AUDIO_INFO->set_text ($text); |
1145 | } |
1150 | } |
1146 | |
1151 | |
1147 | sub audio_setup { |
1152 | sub audio_setup { |
… | |
… | |
1667 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1672 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1668 | ); |
1673 | ); |
1669 | |
1674 | |
1670 | $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); |
1675 | $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); |
1671 | $table->add_at (1, 4, new DC::UI::Entry |
1676 | $table->add_at (1, 4, new DC::UI::Entry |
1672 | text => $CFG->{profile}{default}{user}, |
1677 | text => $PROFILE->{user}, |
1673 | tooltip => "The name of your character on the server. The name is case-sensitive!", |
1678 | tooltip => "The name of your character on the server. The name is case-sensitive!", |
1674 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } |
1679 | on_changed => sub { my ($self, $value) = @_; $PROFILE->{user} = $value; 1 } |
1675 | ); |
1680 | ); |
1676 | |
1681 | |
1677 | $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); |
1682 | $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); |
1678 | $table->add_at (1, 5, new DC::UI::Entry |
1683 | $table->add_at (1, 5, new DC::UI::Entry |
1679 | text => $CFG->{profile}{default}{password}, |
1684 | text => $PROFILE->{password}, |
1680 | hidden => 1, |
1685 | hidden => 1, |
1681 | tooltip => "The password for your character.", |
1686 | tooltip => "The password for your character.", |
1682 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } |
1687 | on_changed => sub { my ($self, $value) = @_; $PROFILE->{password} = $value; 1 } |
1683 | ); |
1688 | ); |
1684 | |
1689 | |
1685 | $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button |
1690 | $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button |
1686 | expand => 1, |
1691 | expand => 1, |
1687 | text => "Login / Register", |
1692 | text => "Login / Register", |
… | |
… | |
1723 | $table->add_at (1, $row, my $vbox = new DC::UI::VBox); |
1728 | $table->add_at (1, $row, my $vbox = new DC::UI::VBox); |
1724 | |
1729 | |
1725 | $vbox->add ( |
1730 | $vbox->add ( |
1726 | $HOST_ENTRY = new DC::UI::Entry |
1731 | $HOST_ENTRY = new DC::UI::Entry |
1727 | expand => 1, |
1732 | expand => 1, |
1728 | text => $CFG->{profile}{default}{host}, |
1733 | text => $PROFILE->{host}, |
1729 | tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)", |
1734 | tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)", |
1730 | on_changed => sub { |
1735 | on_changed => sub { |
1731 | my ($self, $value) = @_; |
1736 | my ($self, $value) = @_; |
1732 | $CFG->{profile}{default}{host} = $value; |
1737 | $PROFILE->{host} = $value; |
1733 | 1 |
1738 | 1 |
1734 | } |
1739 | } |
1735 | ); |
1740 | ); |
1736 | |
1741 | |
1737 | if (0) { #d# disabled |
1742 | if (0) { #d# disabled |
… | |
… | |
1936 | $r |
1941 | $r |
1937 | } |
1942 | } |
1938 | |
1943 | |
1939 | my %SORT_ORDER = ( |
1944 | my %SORT_ORDER = ( |
1940 | type => sub { |
1945 | type => sub { |
|
|
1946 | use sort 'stable'; |
1941 | sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_ |
1947 | sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_ |
1942 | }, |
1948 | }, |
1943 | mtime => sub { |
1949 | mtime => sub { |
|
|
1950 | use sort 'stable'; |
1944 | my $NOW = time; |
1951 | my $NOW = time; |
1945 | sort { |
1952 | sort { |
1946 | my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6; |
1953 | my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6; |
1947 | my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6; |
1954 | my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6; |
1948 | |
1955 | |
1949 | ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED) |
1956 | ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED) |
1950 | or $btime <=> $atime |
1957 | or $btime <=> $atime |
1951 | or $a->{type} <=> $b->{type} |
1958 | or $a->{type} <=> $b->{type} |
1952 | } @_ |
1959 | } @_ |
1953 | }, |
1960 | }, |
1954 | weight => sub { sort { |
1961 | weight => sub { |
|
|
1962 | use sort 'stable'; |
|
|
1963 | sort { |
1955 | $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1) |
1964 | $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1) |
1956 | or $a->{type} <=> $b->{type} |
1965 | or $a->{type} <=> $b->{type} |
1957 | } @_ }, |
1966 | } @_ |
|
|
1967 | }, |
1958 | ); |
1968 | ); |
1959 | |
1969 | |
1960 | sub inventory_widget { |
1970 | sub inventory_widget { |
1961 | my $hb = new DC::UI::HBox homogeneous => 1; |
1971 | my $hb = new DC::UI::HBox homogeneous => 1; |
1962 | |
1972 | |
… | |
… | |
2770 | shift_fire_stop => 0, |
2780 | shift_fire_stop => 0, |
2771 | uitheme => "wood", |
2781 | uitheme => "wood", |
2772 | map_shift_x => -24, # arbitrary |
2782 | map_shift_x => -24, # arbitrary |
2773 | map_shift_y => +24, # arbitrary |
2783 | map_shift_y => +24, # arbitrary |
2774 | ); |
2784 | ); |
2775 | |
2785 | |
2776 | while (my ($k, $v) = each %DEF_CFG) { |
2786 | while (my ($k, $v) = each %DEF_CFG) { |
2777 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2787 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2778 | } |
2788 | } |
2779 | |
2789 | |
2780 | $CFG->{profile}{default}{host} ||= "gameserver.deliantra.net"; |
2790 | my @args = @ARGV; |
|
|
2791 | |
|
|
2792 | my $profile = 'default'; |
|
|
2793 | |
|
|
2794 | for (my $i = 0; $i < @args; $i++) { |
|
|
2795 | if ($args[$i] =~ /^--?profile$/) { |
|
|
2796 | $profile = $args[$i + 1]; |
|
|
2797 | splice @args, $i, 2, (); |
|
|
2798 | $i = 0; |
|
|
2799 | } elsif ($args[$i] =~ /^--?h/) { |
|
|
2800 | print STDERR "Usage: $0 [--profile name] [host [user [password]]]\n"; |
|
|
2801 | exit 0; |
|
|
2802 | } |
|
|
2803 | } |
|
|
2804 | |
|
|
2805 | $CFG->{profile}{$profile} ||= {}; |
2781 | $PROFILE = $CFG->{profile}{default}; |
2806 | $PROFILE = $CFG->{profile}{$profile}; |
|
|
2807 | $PROFILE->{host} ||= "gameserver.deliantra.net"; |
|
|
2808 | |
|
|
2809 | $PROFILE->{host} = $args[0] if @args > 0; |
|
|
2810 | $PROFILE->{user} = $args[1] if @args > 1; |
|
|
2811 | $PROFILE->{password} = $args[2] if @args > 2; |
2782 | |
2812 | |
2783 | # convert old bindings (only default profile matters) |
2813 | # convert old bindings (only default profile matters) |
2784 | if (my $bindings = delete $PROFILE->{bindings}) { |
2814 | if (my $bindings = delete $PROFILE->{bindings}) { |
2785 | while (my ($mod, $syms) = each %$bindings) { |
2815 | while (my ($mod, $syms) = each %$bindings) { |
2786 | while (my ($sym, $cmds) = each %$syms) { |
2816 | while (my ($sym, $cmds) = each %$syms) { |
… | |
… | |
2809 | DejaVuSansMono-BoldOblique.ttf |
2839 | DejaVuSansMono-BoldOblique.ttf |
2810 | mona.ttf |
2840 | mona.ttf |
2811 | ); |
2841 | ); |
2812 | |
2842 | |
2813 | DC::add_font $_ for @fonts; |
2843 | DC::add_font $_ for @fonts; |
2814 | |
2844 | |
2815 | $FONT_PROP = new_from_file DC::Font $fonts[0]; |
2845 | $FONT_PROP = new_from_file DC::Font $fonts[0]; |
2816 | $FONT_FIXED = new_from_file DC::Font $fonts[1]; |
2846 | $FONT_FIXED = new_from_file DC::Font $fonts[1]; |
2817 | |
2847 | |
2818 | $FONT_PROP->make_default; |
2848 | $FONT_PROP->make_default; |
2819 | |
2849 | |
… | |
… | |
2863 | |
2893 | |
2864 | deliantra - A Deliantra MORPG game client |
2894 | deliantra - A Deliantra MORPG game client |
2865 | |
2895 | |
2866 | =head1 SYNOPSIS |
2896 | =head1 SYNOPSIS |
2867 | |
2897 | |
2868 | Just run it - no commandline arguments are supported. |
2898 | deliantra [--profile name] [host [user [password]]] |
|
|
2899 | deliantra --help |
2869 | |
2900 | |
2870 | =head1 USAGE |
2901 | =head1 USAGE |
2871 | |
2902 | |
2872 | deliantra utilises OpenGL for all UI elements and the game. It is supposed to |
2903 | The deliantra client utilises OpenGL for all UI elements and the game. It |
2873 | be used in fullscreen mode and interactively. |
2904 | is supposed to be used in fullscreen mode and interactively. |
2874 | |
2905 | |
2875 | =head1 DEBUGGING |
2906 | =head1 DEBUGGING |
2876 | |
|
|
2877 | |
2907 | |
2878 | CFPLUS_DEBUG - environment variable |
2908 | CFPLUS_DEBUG - environment variable |
2879 | |
2909 | |
2880 | 1 draw borders around widgets |
2910 | 1 draw borders around widgets |
2881 | 2 add low-level widget info to tooltips |
2911 | 2 add low-level widget info to tooltips |