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.19 by root, Thu Dec 27 18:35:56 2007 UTC vs.
Revision 1.31 by root, Tue Mar 25 02:12:35 2008 UTC

78} 78}
79 79
80# prepend private library directory 80# prepend private library directory
81BEGIN { 81BEGIN {
82 for (grep !ref, @INC) { 82 for (grep !ref, @INC) {
83 my $path = "$_/Deliantra/Client/private/dc"; 83 my $path = "$_/Deliantra/Client/private";
84 if (-d $path) { 84 if (-d $path) {
85 unshift @INC, $path; 85 unshift @INC, $path;
86 last; 86 last;
87 } 87 }
88 } 88 }
108use DC::UI; 108use DC::UI;
109use DC::UI::Canvas; 109use DC::UI::Canvas;
110use DC::UI::Inventory; 110use DC::UI::Inventory;
111use DC::UI::SpellList; 111use DC::UI::SpellList;
112use DC::UI::Dockable; 112use DC::UI::Dockable;
113use DC::UI::Dockbar;
113use DC::UI::MessageWindow; 114use DC::UI::MessageWindow;
114use DC::UI::ChatView; 115use DC::UI::ChatView;
116use DC::MessageDistributor;
115use DC::Pod; 117use DC::Pod;
116use DC::MapWidget; 118use DC::MapWidget;
117use DC::Macro; 119use DC::Macro;
118 120
119$SIG{QUIT} = sub { Carp::cluck "QUIT" }; 121$SIG{QUIT} = sub { Carp::cluck "QUIT" };
178our $SPELL_PAGE; 180our $SPELL_PAGE;
179our $SPELL_LIST; 181our $SPELL_LIST;
180 182
181our $HELP_WINDOW; 183our $HELP_WINDOW;
182our $MESSAGE_WINDOW; 184our $MESSAGE_WINDOW;
185our $MESSAGE_DIST;
183our $FLOORBOX; 186our $FLOORBOX;
184our $GAUGES; 187our $GAUGES;
185our $STATWIDS; 188our $STATWIDS;
186 189
187our $SDL_ACTIVE; 190our $SDL_ACTIVE;
188our %SDL_CB; 191our %SDL_CB;
189 192
190our $ALT_ENTER_MESSAGE; 193our $ALT_ENTER_MESSAGE;
191our $STATUSBOX; 194our $STATUSBOX;
195our $MODBOX;
192our $DEBUG_STATUS; 196our $DEBUG_STATUS;
193 197
194our $INV; 198our $INV;
195our $INVR; 199our $INVR;
196our $INVR_HB; 200our $INVR_HB;
204sub debug { 208sub debug {
205 $DEBUG_STATUS->set_text ($_[0]); 209 $DEBUG_STATUS->set_text ($_[0]);
206} 210}
207 211
208sub message { 212sub message {
209 $MESSAGE_WINDOW->message (@_); 213 $MESSAGE_DIST->message (@_);
214}
215
216sub update_modbox {
217 my $mod = DC::SDL_GetModState;
218
219 my $markup;
220
221 $markup .= $mod & DC::KMOD_CTRL
222 ? ($MAPWIDGET->{ctrl} ? "[REPEAT]" : "[<span foreground='#888'>REPEAT</span>]")
223 : "[<span foreground='#888'> once </span>]";
224
225 $markup .= $mod & DC::KMOD_SHIFT
226 ? ($MAPWIDGET->{shft} ? "[FIRE]" : "[<span foreground='#888'>FIRE</span>]")
227 : "[<span foreground='#888'>move</span>]";
228
229 $markup .= $mod & (DC::KMOD_ALT | DC::KMOD_META)
230 ? "[ALT]"
231 : "[<span foreground='#888'>alt</span>]";
232
233 $markup .= $mod & DC::KMOD_NUM
234 ? "[NUM]"
235 : "[<span foreground='#888'>num</span>]";
236
237 # <tt> around next statement works around some bug that keeps the
238 # "font =>" from being used on windows
239 $MODBOX->set_markup ("<tt>$markup</tt>");
210} 240}
211 241
212############################################################################# 242#############################################################################
213#TODO: maybe move into own audio module... 243#TODO: maybe move into own audio module...
214 244
653 [Cha => CS_STAT_CHA], 683 [Cha => CS_STAT_CHA],
654 ) { 684 ) {
655 my ($name, $id) = @$_; 685 my ($name, $id) = @$_;
656 $hbox->add (new DC::UI::Label 686 $hbox->add (new DC::UI::Label
657 markup => "$conn->{stat}{$id} <span foreground='yellow'>$name</span>", 687 markup => "$conn->{stat}{$id} <span foreground='yellow'>$name</span>",
658 align => 0,
659 expand => 1, 688 expand => 1,
660 can_events => 1, 689 can_events => 1,
661 can_hover => 1, 690 can_hover => 1,
662 tooltip => "#stat_$name", 691 tooltip => "#stat_$name",
663 ); 692 );
718 user => $PROFILE->{user}, 747 user => $PROFILE->{user},
719 pass => $PROFILE->{password}, 748 pass => $PROFILE->{password},
720 mapw => $mapsize, 749 mapw => $mapsize,
721 maph => $mapsize, 750 maph => $mapsize,
722 751
723 client => "cfplus $DC::VERSION $] $^O", 752 client => "$DC::VERSION $] $^O",
724 753
725 map_widget => $MAPWIDGET, 754 map_widget => $MAPWIDGET,
726 statusbox => $STATUSBOX, 755 statusbox => $STATUSBOX,
727 map => $MAP, 756 map => $MAP,
728 mapmap => $MAPMAP, 757 mapmap => $MAPMAP,
769 798
770 $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]); 799 $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]);
771 800
772 my $row = 0; 801 my $row = 0;
773 802
774 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "OpenGL Info"); 803 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "OpenGL Info");
775 $table->add_at (1, $row++, new DC::UI::Label valign => 0, fontsize => 0.8, text => DC::OpenGL::gl_vendor . ", " . DC::OpenGL::gl_version, 804 $table->add_at (1, $row++, new DC::UI::Label fontsize => 0.8, text => DC::OpenGL::gl_vendor . ", " . DC::OpenGL::gl_version,
776 can_events => 1, 805 can_events => 1,
777 tooltip => "<tt><span size='8192'>" . (DC::OpenGL::gl_extensions) . "</span></tt>"); 806 tooltip => "<tt><span size='8192'>" . (DC::OpenGL::gl_extensions) . "</span></tt>");
778 807
779 my $vidmode_tooltip = 808 my $vidmode_tooltip =
780 "<b>Video Mode.</b> The video mode to use for fullscreen (and the window size for windowed operation). " 809 "<b>Video Mode.</b> The video mode to use for fullscreen (and the window size for windowed operation). "
781 . "The format is <i>width</i> x <i>height</i> \@ <i>depth-per-channel</i> + <i>alpha-channel</i>."; 810 . "The format is <i>width</i> x <i>height</i> \@ <i>depth-per-channel</i> + <i>alpha-channel</i>.";
782 811
783 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Video Mode"); 812 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Video Mode");
784 $table->add_at (1, $row++, my $hbox = new DC::UI::HBox); 813 $table->add_at (1, $row++, my $hbox = new DC::UI::HBox);
785 814
786 $hbox->add (my $mode_slider = new DC::UI::Slider 815 $hbox->add (my $mode_slider = new DC::UI::Slider
787 force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1], 816 force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1],
788 tooltip => $vidmode_tooltip); 817 tooltip => $vidmode_tooltip);
789 $hbox->add (my $mode_label = new DC::UI::Label 818 $hbox->add (my $mode_label = new DC::UI::Label
790 align => 0, valign => 0, height => 0.8, template => "9999x9999@9+9", 819 height => 0.8, template => "9999x9999@9+9",
791 can_events => 1, tooltip => $vidmode_tooltip); 820 can_events => 1, tooltip => $vidmode_tooltip);
792 821
793 $mode_slider->connect (changed => sub { 822 $mode_slider->connect (changed => sub {
794 my ($self, $value) = @_; 823 my ($self, $value) = @_;
795 824
796 $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; 825 $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value;
797 $mode_label->set_text (sprintf '%dx%d@%d+%d', @{$SDL_MODES[$value]}); 826 $mode_label->set_text (sprintf '%dx%d@%d+%d', @{$SDL_MODES[$value]});
798 }); 827 });
799 $mode_slider->emit (changed => $mode_slider->{range}[0]); 828 $mode_slider->emit (changed => $mode_slider->{range}[0]);
800 829
801 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fullscreen"); 830 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fullscreen");
802 $table->add_at (1, $row++, $FULLSCREEN_ENABLE = new DC::UI::CheckBox 831 $table->add_at (1, $row++, $FULLSCREEN_ENABLE = new DC::UI::CheckBox
803 state => $CFG->{fullscreen}, 832 state => $CFG->{fullscreen},
804 tooltip => "Bring the client into fullscreen mode.", 833 tooltip => "Bring the client into fullscreen mode.",
805 on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } 834 on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 }
806 ); 835 );
807 836
808 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); 837 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Force OpenGL 1.1");
809 $table->add_at (1, $row++, new DC::UI::CheckBox 838 $table->add_at (1, $row++, new DC::UI::CheckBox
810 state => $CFG->{force_opengl11}, 839 state => $CFG->{force_opengl11},
811 tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " 840 tooltip => "Limit Deliantra to use OpenGL 1.1 features only. This will normally result in "
812 . "higher memory usage and slower performance. It will, however, help tremendously on " 841 . "higher memory usage and slower performance. It will, however, help tremendously on "
813 . "cards that claim to support a feature but fall back to software rendering. " 842 . "cards that claim to support a feature but fall back to software rendering. "
814 . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, " 843 . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, "
815 . "but cards and drivers from other vendors (ATI) are often just as bad. <b>If you " 844 . "but cards and drivers from other vendors (ATI) are often just as bad. <b>If you "
816 . "experience extremely low framerates and your card should do better, try this option.</b>", 845 . "experience extremely low framerates and your card should do better, try this option.</b>",
817 on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 } 846 on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 }
818 ); 847 );
819 848
820 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Compress Textures"); 849 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Compress Textures");
821 $table->add_at (1, $row++, new DC::UI::CheckBox 850 $table->add_at (1, $row++, new DC::UI::CheckBox
822 state => $CFG->{texture_compression}, 851 state => $CFG->{texture_compression},
823 tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " 852 tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but "
824 . "will save a lot of memory and increase performance. The compression algorithm " 853 . "will save a lot of memory and increase performance. The compression algorithm "
825 . "can differ form card to card, so your mileage may vary. This setting is ignored in " 854 . "can differ form card to card, so your mileage may vary. This setting is ignored in "
826 . "forced OpenGL 1.1 mode.", 855 . "forced OpenGL 1.1 mode.",
827 on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } 856 on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 }
828 ); 857 );
829 858
830 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); 859 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fast & Ugly");
831 $table->add_at (1, $row++, new DC::UI::CheckBox 860 $table->add_at (1, $row++, new DC::UI::CheckBox
832 state => $CFG->{fast}, 861 state => $CFG->{fast},
833 tooltip => "Lower the visual quality considerably to speed up rendering.", 862 tooltip => "Lower the visual quality considerably to speed up rendering.",
834 on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } 863 on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 }
835 ); 864 );
836 865
837 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); 866 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "GUI Fontsize");
838 $table->add_at (1, $row++, new DC::UI::Slider 867 $table->add_at (1, $row++, new DC::UI::Slider
839 range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], 868 range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1],
840 tooltip => "The base font size used by most GUI elements that do not have their own setting.", 869 tooltip => "The base font size used by most GUI elements that do not have their own setting.",
841 on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 }, 870 on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 },
842 ); 871 );
843 872
844 $table->add_at (1, $row++, new DC::UI::Button 873 $table->add_at (1, $row++, new DC::UI::Button
845 expand => 1, align => 0, text => "Apply", 874 expand => 1, text => "Apply",
846 tooltip => "Apply the video settings above.", 875 tooltip => "Apply the video settings above.",
847 on_activate => sub { 876 on_activate => sub {
848 video_shutdown (); 877 video_shutdown ();
849 video_init (); 878 video_init ();
850 0 879 0
851 } 880 }
852 ); 881 );
853 882
854 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Map Scale"); 883 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Scale");
855 $table->add_at (1, $row++, new DC::UI::Slider 884 $table->add_at (1, $row++, new DC::UI::Slider
856 range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], 885 range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1],
857 tooltip => "Enlarge or shrink the displayed map. Changes are instant.", 886 tooltip => "Enlarge or shrink the displayed map. Changes are instant.",
858 on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } 887 on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 }
859 ); 888 );
860 889
861 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Map Smoothing"); 890 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Smoothing");
862 $table->add_at (1, $row++, new DC::UI::CheckBox 891 $table->add_at (1, $row++, new DC::UI::CheckBox
863 state => $CFG->{map_smoothing}, 892 state => $CFG->{map_smoothing},
864 tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " 893 tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. "
865 . "This increases load on the graphics subsystem and works only with TRT servers. " 894 . "This increases load on the graphics subsystem and works only with TRT servers. "
866 . "Changes take effect at next login only.", 895 . "Changes take effect at next login only.",
867 on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } 896 on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 }
868 ); 897 );
869 898
870 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fog of War"); 899 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fog of War");
871 $table->add_at (1, $row++, new DC::UI::CheckBox 900 $table->add_at (1, $row++, new DC::UI::CheckBox
872 state => $CFG->{fow_enable}, 901 state => $CFG->{fow_enable},
873 tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.", 902 tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.",
874 on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 } 903 on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 }
875 ); 904 );
876 905
877 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "FoW Intensity"); 906 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Intensity");
878 $table->add_at (1, $row++, new DC::UI::Slider 907 $table->add_at (1, $row++, new DC::UI::Slider
879 range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], 908 range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256],
880 tooltip => "<b>Fog of War Lightness.</b> The higher the intensity, the lighter the Fog-of-War color. Changes are instant.", 909 tooltip => "<b>Fog of War Lightness.</b> The higher the intensity, the lighter the Fog-of-War color. Changes are instant.",
881 on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 } 910 on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 }
882 ); 911 );
883 912
884 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Message Fontsize"); 913 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Fontsize");
885 $table->add_at (1, $row++, new DC::UI::Slider 914 $table->add_at (1, $row++, new DC::UI::Slider
886 range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], 915 range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1],
887 tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant, " 916 tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant, "
888 . "but you still need to press apply to correctly re-layout the widget.", 917 . "but you still need to press apply to correctly re-layout the widget.",
889 on_changed => sub { $MESSAGE_WINDOW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, 918 on_changed => sub { $MESSAGE_DIST->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 },
890 ); 919 );
891 920
892 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); 921 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge fontsize");
893 $table->add_at (1, $row++, new DC::UI::Slider 922 $table->add_at (1, $row++, new DC::UI::Slider
894 range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], 923 range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1],
895 tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.", 924 tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.",
896 on_changed => sub { 925 on_changed => sub {
897 $CFG->{gauge_fontsize} = $_[1]; 926 $CFG->{gauge_fontsize} = $_[1];
898 &set_gauge_window_fontsize; 927 &set_gauge_window_fontsize;
899 0 928 0
900 } 929 }
901 ); 930 );
902 931
903 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Gauge size"); 932 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge size");
904 $table->add_at (1, $row++, new DC::UI::Slider 933 $table->add_at (1, $row++, new DC::UI::Slider
905 range => [$CFG->{gauge_size}, 0.2, 0.8], 934 range => [$CFG->{gauge_size}, 0.2, 0.8],
906 tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.", 935 tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.",
907 on_changed => sub { 936 on_changed => sub {
908 $CFG->{gauge_size} = $_[1]; 937 $CFG->{gauge_size} = $_[1];
942 971
943 $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]); 972 $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]);
944 973
945 my $row = 0; 974 my $row = 0;
946 975
947 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Audio Enable"); 976 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable");
948 $table->add_at (1, $row++, new DC::UI::CheckBox 977 $table->add_at (1, $row++, new DC::UI::CheckBox
949 state => $CFG->{audio_enable}, 978 state => $CFG->{audio_enable},
950 tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", 979 tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.",
951 on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } 980 on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 }
952 ); 981 );
953 982
954 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Sound Effects"); 983 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects");
955 $table->add_at (1, $row, new DC::UI::CheckBox 984 $table->add_at (1, $row, new DC::UI::CheckBox
956 expand => 1, state => $CFG->{effects_enable}, 985 expand => 1, state => $CFG->{effects_enable},
957 tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.", 986 tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.",
958 on_changed => sub { 987 on_changed => sub {
959 $CFG->{effects_enable} = $_[1]; 988 $CFG->{effects_enable} = $_[1];
966 tooltip => "The relative volume of sound effects. Best audio quality is achieved if this " 995 tooltip => "The relative volume of sound effects. Best audio quality is achieved if this "
967 . "is set highest (rightmost) and you use your operating system volume setting. Changes are instant.", 996 . "is set highest (rightmost) and you use your operating system volume setting. Changes are instant.",
968 on_changed => sub { $CFG->{effects_volume} = $_[1]; 1 } 997 on_changed => sub { $CFG->{effects_volume} = $_[1]; 1 }
969 ); 998 );
970 999
971 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Background Music"); 1000 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music");
972 $table->add_at (1, $row, new DC::UI::CheckBox 1001 $table->add_at (1, $row, new DC::UI::CheckBox
973 expand => 1, state => $CFG->{bgm_enable}, 1002 expand => 1, state => $CFG->{bgm_enable},
974 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", 1003 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.",
975 on_changed => sub { 1004 on_changed => sub {
976 $CFG->{bgm_enable} = $_[1]; 1005 $CFG->{bgm_enable} = $_[1];
983 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], 1012 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128],
984 tooltip => "The volume of the background music. Changes are instant.", 1013 tooltip => "The volume of the background music. Changes are instant.",
985 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } 1014 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 }
986 ); 1015 );
987 1016
988 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Frequency"); 1017 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Frequency");
989 $table->add_at (1, $row++, new DC::UI::Selector 1018 $table->add_at (1, $row++, new DC::UI::Selector
990 c_colspan => 2, expand => 1, 1019 c_colspan => 2, expand => 1,
991 value => $CFG->{audio_hw_frequency}, 1020 value => $CFG->{audio_hw_frequency},
992 options => [ 1021 options => [
993 [ 0, "default" , "Use System Default"], 1022 [ 0, "default" , "Use System Default"],
1002 audio_tab_update; 1031 audio_tab_update;
1003 1 1032 1
1004 } 1033 }
1005 ); 1034 );
1006 1035
1007 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Channels"); 1036 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Channels");
1008 $table->add_at (1, $row++, new DC::UI::Selector 1037 $table->add_at (1, $row++, new DC::UI::Selector
1009 c_colspan => 2, expand => 1, 1038 c_colspan => 2, expand => 1,
1010 value => $CFG->{audio_hw_channels}, 1039 value => $CFG->{audio_hw_channels},
1011 options => [ 1040 options => [
1012 [0, "default" , "Use System Default"], 1041 [0, "default" , "Use System Default"],
1021 audio_tab_update; 1050 audio_tab_update;
1022 1 1051 1
1023 } 1052 }
1024 ); 1053 );
1025 1054
1026 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Latency"); 1055 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Latency");
1027 $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector 1056 $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector
1028 c_colspan => 2, expand => 1, 1057 c_colspan => 2, expand => 1,
1029 value => $CFG->{audio_hw_chunksize}, 1058 value => $CFG->{audio_hw_chunksize},
1030 tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " 1059 tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback "
1031 . "is stuttering, increase this value. Values of 50-100ms are optimal.", 1060 . "is stuttering, increase this value. Values of 50-100ms are optimal.",
1035 1 1064 1
1036 } 1065 }
1037 ); 1066 );
1038 1067
1039 # should really be a slider 1068 # should really be a slider
1040 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Mixer Voices"); 1069 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Mixer Voices");
1041 $table->add_at (1, $row++, new DC::UI::ValSlider 1070 $table->add_at (1, $row++, new DC::UI::ValSlider
1042 c_colspan => 2, expand => 1, 1071 c_colspan => 2, expand => 1,
1043 tooltip => "The number of simultaneous sound effects possible. Higher is better, but also more cpu-intensive and might cause stuttering.", 1072 tooltip => "The number of simultaneous sound effects possible. Higher is better, but also more cpu-intensive and might cause stuttering.",
1044 range => [$::CFG->{audio_mix_channels}, 4, 32, 0, 1], 1073 range => [$::CFG->{audio_mix_channels}, 4, 32, 0, 1],
1045 template => ">= 99", 1074 template => ">= 99",
1051 1; 1080 1;
1052 } 1081 }
1053 ); 1082 );
1054 1083
1055 $table->add_at (1, $row++, new DC::UI::Button 1084 $table->add_at (1, $row++, new DC::UI::Button
1056 c_colspan => 2, expand => 1, align => 0, text => "Apply", 1085 c_colspan => 2, expand => 1, text => "Apply",
1057 tooltip => "Apply the audio settings", 1086 tooltip => "Apply the audio settings",
1058 on_activate => sub { 1087 on_activate => sub {
1059 audio_shutdown (); 1088 audio_shutdown ();
1060 audio_init (); 1089 audio_init ();
1061 0 1090 0
1111 $hb->add (my $hg = new DC::UI::Gauge type => 'hp', tooltip => "#stat_health"); 1140 $hb->add (my $hg = new DC::UI::Gauge type => 'hp', tooltip => "#stat_health");
1112 $hb->add (my $mg = new DC::UI::Gauge type => 'mana', tooltip => "#stat_mana"); 1141 $hb->add (my $mg = new DC::UI::Gauge type => 'mana', tooltip => "#stat_mana");
1113 $hb->add (my $gg = new DC::UI::Gauge type => 'grace', tooltip => "#stat_grace"); 1142 $hb->add (my $gg = new DC::UI::Gauge type => 'grace', tooltip => "#stat_grace");
1114 $hb->add (my $fg = new DC::UI::Gauge type => 'food', tooltip => "#stat_food"); 1143 $hb->add (my $fg = new DC::UI::Gauge type => 'food', tooltip => "#stat_food");
1115 1144
1116 $vbox->add (my $exp = new DC::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp"); 1145 $vbox->add (my $exp = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp");
1117 $vbox->add (my $prg = new DC::UI::ExperienceProgress); 1146 $vbox->add (my $prg = new DC::UI::ExperienceProgress);
1118 $vbox->add (my $sklprg = new DC::UI::ExperienceProgress); 1147 $vbox->add (my $sklprg = new DC::UI::ExperienceProgress);
1119 $vbox->add (my $rng = new DC::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged"); 1148 $vbox->add (my $rng = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged");
1120 1149
1121 $GAUGES = { 1150 $GAUGES = {
1122 exp => $exp, prg => $prg, sklprg => $sklprg, 1151 exp => $exp, prg => $prg, sklprg => $sklprg,
1123 win => $win, range => $rng, 1152 win => $win, range => $rng,
1124 hp => $hg, mana => $mg, grace => $gg, food => $fg, 1153 hp => $hg, mana => $mg, grace => $gg, food => $fg,
1140 $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); 1169 $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 });
1141 $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips"); 1170 $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips");
1142 $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); 1171 $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 });
1143 $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); 1172 $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } );
1144 1173
1145 $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153");#d# 1174 $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d#
1146 1175
1147 $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); 1176 $table->add_at (7,7, my $t = new DC::UI::Table expand => 0);
1148 $t->add_at (0,0, new DC::UI::Label text => "a a a a", c_rowspan => 1, c_colspan => 2); 1177 $t->add_at (0,0, new DC::UI::Label text => "a a", c_rowspan => 1, c_colspan => 2);
1149 $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1); 1178 $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1, ellipsise => 0 );
1150 $t->add_at (1,2, new DC::UI::Label text => "c c c c", c_rowspan => 1, c_colspan => 2); 1179 $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2);
1151 $t->add_at (0,1, new DC::UI::Label text => "d\nd", c_rowspan => 2, c_colspan => 1); 1180 $t->add_at (0,1, new DC::UI::Label text => "d\nd", c_rowspan => 2, c_colspan => 1, ellipsise => 0 );
1152 $t->add_at (1,1, new DC::UI::Label text => "e"); 1181 $t->add_at (1,1, new DC::UI::Label text => "e");
1153 1182
1154 $table->add_at (7, 6, my $c = new DC::UI::Canvas); 1183 $table->add_at (7, 6, my $c = new DC::UI::Canvas);
1155 1184
1156 $c->add_items ({ 1185 $c->add_items ({
1190 $vb->add (new DC::UI::FancyFrame 1219 $vb->add (new DC::UI::FancyFrame
1191 label => "Player", 1220 label => "Player",
1192 child => (my $pi = new DC::UI::VBox), 1221 child => (my $pi = new DC::UI::VBox),
1193 ); 1222 );
1194 1223
1195 $pi->add ($STATWIDS->{title} = new DC::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, 1224 $pi->add ($STATWIDS->{title} = new DC::UI::Label text => "Title:", expand => 1, align => 0,
1196 can_hover => 1, can_events => 1, 1225 can_hover => 1, can_events => 1,
1197 tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); 1226 tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server.");
1198 $pi->add ($STATWIDS->{map} = new DC::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, 1227 $pi->add ($STATWIDS->{map} = new DC::UI::Label align => 0, text => "Map:", expand => 1,
1199 can_hover => 1, can_events => 1, 1228 can_hover => 1, can_events => 1,
1200 tooltip => "The map you are currently on (if supported by the server)."); 1229 tooltip => "The map you are currently on (if supported by the server).");
1201 1230
1202 $pi->add (my $hb0 = new DC::UI::HBox); 1231 $pi->add (my $hb0 = new DC::UI::HBox);
1203 $hb0->add ($STATWIDS->{weight} = new DC::UI::Label valign => 0, align => -1, text => "Weight:", expand => 1, 1232 $hb0->add ($STATWIDS->{weight} = new DC::UI::Label text => "Weight:", expand => 1, align => 0,
1204 can_hover => 1, can_events => 1, 1233 can_hover => 1, can_events => 1,
1205 tooltip => "The weight of the player including all inventory items."); 1234 tooltip => "The weight of the player including all inventory items.");
1206 $hb0->add ($STATWIDS->{m_weight} = new DC::UI::Label valign => 0, align => -1, text => "Max weight:", expand => 1, 1235 $hb0->add ($STATWIDS->{m_weight} = new DC::UI::Label align => 0, text => "Max weight:", expand => 1,
1207 can_hover => 1, can_events => 1, 1236 can_hover => 1, can_events => 1,
1208 tooltip => "The weight limit: you cannot carry more than this."); 1237 tooltip => "The weight limit: you cannot carry more than this.");
1209 1238
1210 $vb->add (new DC::UI::FancyFrame 1239 $vb->add (new DC::UI::FancyFrame
1211 label => "Primary/Secondary Statistics", 1240 label => "Primary/Secondary Statistics",
1232 [2, 5, st_wspd => "WSp", 10.54], 1261 [2, 5, st_wspd => "WSp", 10.54],
1233 ) { 1262 ) {
1234 my ($col, $row, $id, $label, $template) = @$_; 1263 my ($col, $row, $id, $label, $template) = @$_;
1235 1264
1236 $tbl->add_at ($col , $row, $STATWIDS->{$id} = new DC::UI::Label 1265 $tbl->add_at ($col , $row, $STATWIDS->{$id} = new DC::UI::Label
1237 font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, 1266 font => $FONT_FIXED, can_hover => 1, can_events => 1,
1238 align => +1, template => $template, tooltip => "#stat_$label"); 1267 align => 1, template => $template, tooltip => "#stat_$label");
1239 $tbl->add_at ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new DC::UI::Label 1268 $tbl->add_at ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new DC::UI::Label
1240 font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0, 1269 font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2,
1241 align => -1, text => $label, tooltip => "#stat_$label"); 1270 align => 0, text => $label, tooltip => "#stat_$label");
1242 } 1271 }
1243 1272
1244 $vb->add (new DC::UI::FancyFrame 1273 $vb->add (new DC::UI::FancyFrame
1245 label => "Resistancies", 1274 label => "Resistancies",
1246 child => (my $tbl2 = new DC::UI::Table expand => 1), 1275 child => (my $tbl2 = new DC::UI::Table expand => 1, col_expand => [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0]),
1247 ); 1276 );
1248 1277
1249 my $row = 0; 1278 my $row = 0;
1250 my $col = 0; 1279 my $col = 0;
1251 1280
1290 1319
1291 for (qw/slow holyw conf fire depl magic 1320 for (qw/slow holyw conf fire depl magic
1292 drain acid pois para deat phys 1321 drain acid pois para deat phys
1293 blind fear tund elec cold ghit/) 1322 blind fear tund elec cold ghit/)
1294 { 1323 {
1295 $tbl2->add_at ($col, $row, 1324 $tbl2->add_at ($col + 2, $row,
1296 $STATWIDS->{"res_$_"} = 1325 $STATWIDS->{"res_$_"} =
1297 new DC::UI::Label 1326 new DC::UI::Label
1298 font => $FONT_FIXED, 1327 font => $FONT_FIXED,
1299 template => "-100%", 1328 template => "-100%",
1300 align => +1, 1329 align => 1,
1301 valign => 0,
1302 can_events => 1, 1330 can_events => 1,
1303 can_hover => 1, 1331 can_hover => 1,
1304 tooltip => $resist_names{$_}->[1], 1332 tooltip => $resist_names{$_}->[1],
1305 ); 1333 );
1306 $tbl2->add_at ($col + 1, $row, new DC::UI::Image 1334 $tbl2->add_at ($col + 1, $row, new DC::UI::Image
1308 can_hover => 1, 1336 can_hover => 1,
1309 can_events => 1, 1337 can_events => 1,
1310 path => "ui/resist/resist_$_.png", 1338 path => "ui/resist/resist_$_.png",
1311 tooltip => $resist_names{$_}->[1], 1339 tooltip => $resist_names{$_}->[1],
1312 ); 1340 );
1313 $tbl2->add_at ($col + 2, $row, new DC::UI::Label 1341 $tbl2->add_at ($col + 0, $row, new DC::UI::Label
1314 text => $resist_names{$_}->[0], 1342 text => $resist_names{$_}->[0],
1315 font => $FONT_FIXED, 1343 font => $FONT_FIXED,
1344 align => 1,
1316 can_hover => 1, 1345 can_hover => 1,
1317 can_events => 1, 1346 can_events => 1,
1318 tooltip => $resist_names{$_}->[1], 1347 tooltip => $resist_names{$_}->[1],
1319 ); 1348 );
1320 1349
1321 $row++; 1350 $row++;
1322 if ($row % 6 == 0) { 1351 if ($row % 6 == 0) {
1323 $col += 3; 1352 $col += 4;
1324 $row = 0; 1353 $row = 0;
1325 } 1354 }
1326 } 1355 }
1327 1356
1328 #update_stats_window ({}); 1357 #update_stats_window ({});
1374 "The time this server has been running without being restarted.", 1403 "The time this server has been running without being restarted.",
1375 "Short information about this server provided by its admins.", 1404 "Short information about this server provided by its admins.",
1376 ); 1405 );
1377 my @col = qw(#Users Host Uptime Version Description); 1406 my @col = qw(#Users Host Uptime Version Description);
1378 $table->add_at ($_, 0, new DC::UI::Label 1407 $table->add_at ($_, 0, new DC::UI::Label
1379 can_hover => 1, can_events => 1, 1408 can_hover => 1, can_events => 1, fg => [1, 1, 0],
1380 align => 0, fg => [1, 1, 0],
1381 text => $col[$_], tooltip => $tip[$_]) 1409 text => $col[$_], tooltip => $tip[$_])
1382 for 0 .. $#col; 1410 for 0 .. $#col;
1383 1411
1384 my @align = qw(1 0 1 1 -1); 1412 my @align = qw(1 0.5 1 1 0);
1385 1413
1386 my $y = 0; 1414 my $y = 0;
1387 for my $m (@{ $msg->{servers} }) { 1415 for my $m (@{ $msg->{servers} }) {
1388 my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime, $highlight) = 1416 my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime, $highlight) =
1389 @$m{qw(ip age hostname users version description ibytes obytes uptime highlight)}; 1417 @$m{qw(ip age hostname users version description ibytes obytes uptime highlight)};
1470 $vbox->add (new DC::UI::FancyFrame 1498 $vbox->add (new DC::UI::FancyFrame
1471 label => "Login Settings", 1499 label => "Login Settings",
1472 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), 1500 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]),
1473 ); 1501 );
1474 1502
1475 $table->add_at (0, 4, new DC::UI::Label valign => 0, align => 1, text => "Username"); 1503 $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username");
1476 $table->add_at (1, 4, new DC::UI::Entry 1504 $table->add_at (1, 4, new DC::UI::Entry
1477 text => $CFG->{profile}{default}{user}, 1505 text => $CFG->{profile}{default}{user},
1478 tooltip => "The name of your character on the server.", 1506 tooltip => "The name of your character on the server.",
1479 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } 1507 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 }
1480 ); 1508 );
1481 1509
1482 $table->add_at (0, 5, new DC::UI::Label valign => 0, align => 1, text => "Password"); 1510 $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password");
1483 $table->add_at (1, 5, new DC::UI::Entry 1511 $table->add_at (1, 5, new DC::UI::Entry
1484 text => $CFG->{profile}{default}{password}, 1512 text => $CFG->{profile}{default}{password},
1485 hidden => 1, 1513 hidden => 1,
1486 tooltip => "The password for your character.", 1514 tooltip => "The password for your character.",
1487 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } 1515 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 }
1488 ); 1516 );
1489 1517
1490 $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button 1518 $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button
1491 expand => 1, 1519 expand => 1,
1492 align => 0,
1493 text => "Login / Register", 1520 text => "Login / Register",
1494 tooltip => "This button will either login to the account configured above or register a new account.", 1521 tooltip => "This button will either login to the account configured above or register a new account.",
1495 on_activate => sub { 1522 on_activate => sub {
1496 $CONN ? stop_game 1523 $CONN ? stop_game
1497 : start_game; 1524 : start_game;
1500 ); 1527 );
1501 1528
1502 $vbox->add (new DC::UI::FancyFrame 1529 $vbox->add (new DC::UI::FancyFrame
1503 label => "Registering", 1530 label => "Registering",
1504 min_h => 200, 1531 min_h => 200,
1505 child => (new DC::UI::Label valign => -1, ellipsise => 0, 1532 child => (new DC::UI::Label valign => 0, ellipsise => 0,
1506 markup => 1533 markup =>
1507 "To register a new account, choose a username that hasn't been taken yet and " 1534 "To register a new account, choose a username that hasn't been taken yet and "
1508 . "try to log-in. Follow the instructions in the Log tab in the message window.", 1535 . "try to log-in. Follow the instructions in the Log tab in the message window.",
1509 ), 1536 ),
1510 ); 1537 );
1520 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), 1547 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]),
1521 ); 1548 );
1522 1549
1523 my $row = 0; 1550 my $row = 0;
1524 1551
1525 $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Host:Port"); 1552 $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Host:Port");
1526 { 1553 {
1527 $table->add_at (1, $row, my $vbox = new DC::UI::VBox); 1554 $table->add_at (1, $row, my $vbox = new DC::UI::VBox);
1528 1555
1529 $vbox->add ( 1556 $vbox->add (
1530 $HOST_ENTRY = new DC::UI::Entry 1557 $HOST_ENTRY = new DC::UI::Entry
1531 expand => 1, 1558 expand => 1,
1532 text => $CFG->{profile}{default}{host}, 1559 text => $CFG->{profile}{default}{host},
1533 tooltip => "The hostname or ip address of the Deliantra server to connect to", 1560 tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)",
1534 on_changed => sub { 1561 on_changed => sub {
1535 my ($self, $value) = @_; 1562 my ($self, $value) = @_;
1536 $CFG->{profile}{default}{host} = $value; 1563 $CFG->{profile}{default}{host} = $value;
1537 1 1564 1
1538 } 1565 }
1541 if (0) { #d# disabled 1568 if (0) { #d# disabled
1542 $vbox->add (new DC::UI::Button 1569 $vbox->add (new DC::UI::Button
1543 expand => 1, 1570 expand => 1,
1544 text => "Server List", 1571 text => "Server List",
1545 other => $METASERVER, 1572 other => $METASERVER,
1546 tooltip => "Show a list of available crossfire servers", 1573 tooltip => "Show a list of available Deliantra servers",
1547 on_activate => sub { $METASERVER->toggle_visibility; 0 }, 1574 on_activate => sub { $METASERVER->toggle_visibility; 0 },
1548 on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, 1575 on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 },
1549 ); 1576 );
1550 }#d# 1577 }#d#
1551 } 1578 }
1552 1579
1553 $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Map Size"); 1580 $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Map Size");
1554 $table->add_at (1, $row, new DC::UI::Slider 1581 $table->add_at (1, $row, new DC::UI::Slider
1555 force_w => 100, 1582 force_w => 100,
1556 range => [$CFG->{mapsize}, 10, 100, 0, 1], 1583 range => [$CFG->{mapsize}, 10, 100, 0, 1],
1557 tooltip => "This is the size of the portion of the map update the server sends you. " 1584 tooltip => "This is the size of the portion of the map update the server sends you. "
1558 . "If you set this to a high value you will be able to see further, " 1585 . "If you set this to a high value you will be able to see further, "
1559 . "but you also increase bandwidth requirements and latency. " 1586 . "but you also increase bandwidth requirements and latency. "
1560 . "This option is only used once at log-in.", 1587 . "This option is only used once at log-in.",
1561 on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 }, 1588 on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 },
1562 ); 1589 );
1563 1590
1564 $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Output-Rate"); 1591 $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Output-Rate");
1565 $table->add_at (1, $row, new DC::UI::Entry 1592 $table->add_at (1, $row, new DC::UI::Entry
1566 text => $CFG->{output_rate}, 1593 text => $CFG->{output_rate},
1567 tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " 1594 tooltip => "The maximum bandwidth in bytes per second that the server should not exceed "
1568 . "when sending data. When 0 or unset, the server " 1595 . "when sending data. When 0 or unset, the server "
1569 . "default will be used, which is usually around 100kb/s. Most servers will " 1596 . "default will be used, which is usually around 100kb/s. Most servers will "
1582sub client_setup { 1609sub client_setup {
1583 my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]; 1610 my $table = new DC::UI::Table expand => 1, col_expand => [0, 1];
1584 1611
1585 my $row = 0; 1612 my $row = 0;
1586 1613
1587 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Tip of the day"); 1614 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Tip of the day");
1588 $table->add_at (1, $row++, new DC::UI::CheckBox 1615 $table->add_at (1, $row++, new DC::UI::CheckBox
1589 state => $CFG->{show_tips}, 1616 state => $CFG->{show_tips},
1590 tooltip => "Show the <b>Tip of the day</b> window at startup?", 1617 tooltip => "Show the <b>Tip of the day</b> window at startup?",
1591 on_changed => sub { 1618 on_changed => sub {
1592 my ($self, $value) = @_; 1619 my ($self, $value) = @_;
1593 $CFG->{show_tips} = $value; 1620 $CFG->{show_tips} = $value;
1594 0 1621 0
1595 } 1622 }
1596 ); 1623 );
1597 1624
1598 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Messages Window Size"); 1625 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Messages Window Size");
1599 $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry 1626 $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry
1600 text => $CFG->{logview_max_par}, 1627 text => $CFG->{logview_max_par},
1601 tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " 1628 tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server "
1602 . "sends more messages than this number, older messages get removed to save memory and " 1629 . "sends more messages than this number, older messages get removed to save memory and "
1603 . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", 1630 . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.",
1604 on_changed => sub { 1631 on_changed => sub {
1605 my ($self, $value) = @_; 1632 my ($self, $value) = @_;
1606 $MESSAGE_WINDOW->set_max_para ($CFG->{logview_max_par} = $value*1); 1633 $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1);
1607 0 1634 0
1608 }, 1635 },
1609 ); 1636 );
1610 1637
1611 $table 1638 $table
1737 1764
1738sub inventory_widget { 1765sub inventory_widget {
1739 my $hb = new DC::UI::HBox homogeneous => 1; 1766 my $hb = new DC::UI::HBox homogeneous => 1;
1740 1767
1741 $hb->add (my $vb1 = new DC::UI::VBox); 1768 $hb->add (my $vb1 = new DC::UI::VBox);
1742 $vb1->add (new DC::UI::Label align => 0, text => "Player"); 1769 $vb1->add (new DC::UI::Label text => "Player");
1743 1770
1744 $vb1->add (my $hb1 = new DC::UI::HBox); 1771 $vb1->add (my $hb1 = new DC::UI::HBox);
1745 1772
1746 use sort 'stable'; 1773 use sort 'stable';
1747 1774
1757 $INV->set_sort_order ($SORT_ORDER{$_[1]}); 1784 $INV->set_sort_order ($SORT_ORDER{$_[1]});
1758 }, 1785 },
1759 ); 1786 );
1760 $hb1->add (new DC::UI::Label text => "Weight: ", align => 1, expand => 1); 1787 $hb1->add (new DC::UI::Label text => "Weight: ", align => 1, expand => 1);
1761 #TODO# update to weigh/maxweight 1788 #TODO# update to weigh/maxweight
1762 $hb1->add ($STATWIDS->{i_weight} = new DC::UI::Label align => -1); 1789 $hb1->add ($STATWIDS->{i_weight} = new DC::UI::Label align => 0);
1763 1790
1764 $vb1->add (my $sw1 = new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); 1791 $vb1->add (my $sw1 = new DC::UI::ScrolledWindow expand => 1, scroll_y => 1);
1765 $sw1->add ($INV = new DC::UI::Inventory); 1792 $sw1->add ($INV = new DC::UI::Inventory);
1766 $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); 1793 $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}});
1767 1794
1947 my @path = DC::Pod::full_path_of $node; 1974 my @path = DC::Pod::full_path_of $node;
1948 pop @path; # drop current node 1975 pop @path; # drop current node
1949 1976
1950 for my $node (@path) { 1977 for my $node (@path) {
1951 $buttons->add (new DC::UI::Button 1978 $buttons->add (new DC::UI::Button
1952 text => $node->{kw}[0], 1979 text => $node->[DC::Pod::N_KW][0],
1953 tooltip => "go to <i>" . (DC::asxml DC::Pod::full_path $node) . "</i>", 1980 tooltip => "go to <i>" . (DC::asxml DC::Pod::full_path $node) . "</i>",
1954 on_activate => sub { 1981 on_activate => sub {
1955 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = (); 1982 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = ();
1956 $load_node->($node); 1983 $load_node->($node);
1957 }, 1984 },
1958 ); 1985 );
1959 $buttons->add (new DC::UI::Label text => "/"); 1986 $buttons->add (new DC::UI::Label text => "/");
1960 } 1987 }
1961 1988
1962 $buttons->add (new DC::UI::Label text => $node->{kw}[0], padding_x => 4, padding_y => 4); 1989 $buttons->add (new DC::UI::Label text => $node->[DC::Pod::N_KW][0], padding_x => 4, padding_y => 4);
1963 1990
1964 $curnode = $node; 1991 $curnode = $node;
1965 1992
1966 $viewer->clear; 1993 $viewer->clear;
1967 $viewer->add_paragraph (DC::Pod::as_paragraphs DC::Pod::section_of $curnode); 1994 $viewer->add_paragraph (DC::Pod::as_paragraphs DC::Pod::section_of $curnode);
2146 force_x => "max", 2173 force_x => "max",
2147 force_y => 0; 2174 force_y => 0;
2148 $DEBUG_STATUS->show; 2175 $DEBUG_STATUS->show;
2149 2176
2150 $STATUSBOX = new DC::UI::Statusbox; 2177 $STATUSBOX = new DC::UI::Statusbox;
2151 $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); 2178
2179 $MODBOX = new DC::UI::Label
2180 can_events => 1,
2181 can_hover => 1,
2182 markup => "",
2183 align => 0,
2184 font => $FONT_FIXED,
2185 tooltip => "#modifier_box",
2186 tooltip_width => 0.67,
2187 ;
2188
2189 update_modbox;
2152 2190
2153 (new DC::UI::Frame 2191 (new DC::UI::Frame
2154 bg => [0, 0, 0, 0.4], 2192 bg => [0, 0, 0, 0.4],
2155 force_x => 0, 2193 force_x => 0,
2156 force_y => "max", 2194 force_y => "max",
2157 child => $STATUSBOX, 2195 child => (my $LR = new DC::UI::VBox),
2158 )->show; 2196 )->show;
2197
2198 $LR->add ($STATUSBOX);
2199 $LR->add ($MODBOX);
2200 $LR->add (new DC::UI::Label
2201 align => 0,
2202 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode",
2203 fontsize => 0.5,
2204 fg => [1, 1, 0, 0.7],
2205 );
2159 2206
2160 DC::UI::Toplevel->new ( 2207 DC::UI::Toplevel->new (
2161 title => "Minimap", 2208 title => "Minimap",
2162 name => "mapmap", 2209 name => "mapmap",
2163 x => 0, 2210 x => 0,
2171 2218
2172 $MAPWIDGET = new DC::MapWidget; 2219 $MAPWIDGET = new DC::MapWidget;
2173 $MAPWIDGET->connect (activate_console => sub { 2220 $MAPWIDGET->connect (activate_console => sub {
2174 my ($mapwidget, $preset) = @_; 2221 my ($mapwidget, $preset) = @_;
2175 2222
2176 $MESSAGE_WINDOW->activate_console ($preset) 2223 $MESSAGE_DIST->activate_console ($preset)
2177 if $MESSAGE_WINDOW; 2224 if $MESSAGE_DIST;
2178 }); 2225 });
2179 $MAPWIDGET->show; 2226 $MAPWIDGET->show;
2180 $MAPWIDGET->grab_focus; 2227 $MAPWIDGET->grab_focus;
2181 2228
2182 $COMPLETER = new DC::MapWidget::Command:: 2229 $COMPLETER = new DC::MapWidget::Command::
2194 force_h => $::HEIGHT * 0.6, 2241 force_h => $::HEIGHT * 0.6,
2195 has_close_button => 1, 2242 has_close_button => 1,
2196 ; 2243 ;
2197 2244
2198 $METASERVER = metaserver_dialog; 2245 $METASERVER = metaserver_dialog;
2199 $MESSAGE_WINDOW = new DC::UI::MessageWindow; 2246 $MESSAGE_WINDOW = new DC::UI::Dockbar (name => 'message_window', title => 'Messages');
2247 $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW;
2200 2248
2201 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1, 2249 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1,
2202 filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); 2250 filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1);
2203 2251
2204 $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, 2252 $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup,
2344 # alt-enter 2392 # alt-enter
2345 $FULLSCREEN_ENABLE->toggle; 2393 $FULLSCREEN_ENABLE->toggle;
2346 video_shutdown; 2394 video_shutdown;
2347 video_init; 2395 video_init;
2348 } else { 2396 } else {
2349 DC::UI::feed_sdl_key_down_event ($_[0]); 2397 &DC::UI::feed_sdl_key_down_event;
2350 } 2398 }
2399 update_modbox;
2351 }, 2400 },
2352 DC::SDL_KEYUP => \&DC::UI::feed_sdl_key_up_event, 2401 DC::SDL_KEYUP => sub {
2402 &DC::UI::feed_sdl_key_up_event;
2403 update_modbox;
2404 },
2353 DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event, 2405 DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event,
2354 DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event, 2406 DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event,
2355 DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event, 2407 DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event,
2356 DC::SDL_USEREVENT => sub { 2408 DC::SDL_USEREVENT => sub {
2357 if ($_[0]{code} == 1) { 2409 if ($_[0]{code} == 1) {
2373 if (-e "$Deliantra::VARDIR/client.cf") { 2425 if (-e "$Deliantra::VARDIR/client.cf") {
2374 DC::read_cfg "$Deliantra::VARDIR/client.cf"; 2426 DC::read_cfg "$Deliantra::VARDIR/client.cf";
2375 } else { 2427 } else {
2376 #TODO: compatibility cruft 2428 #TODO: compatibility cruft
2377 DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; 2429 DC::read_cfg "$Deliantra::OLDDIR/cfplusrc";
2378 print STDERR "INFO: used old configuratrion file\n"; 2430 print STDERR "INFO: used old configuration file\n";
2379 } 2431 }
2380 2432
2381 DC::DB::Server::run; 2433 DC::DB::Server::run;
2382 2434
2383 DC::UI::set_layout ($::CFG->{layout}); 2435 DC::UI::set_layout ($::CFG->{layout});
2456 DejaVuSansMono-BoldOblique.ttf 2508 DejaVuSansMono-BoldOblique.ttf
2457 ); 2509 );
2458 2510
2459 DC::add_font $_ for @fonts; 2511 DC::add_font $_ for @fonts;
2460 2512
2461 DC::pango_init;
2462
2463 $FONT_PROP = new_from_file DC::Font $fonts[0]; 2513 $FONT_PROP = new_from_file DC::Font $fonts[0];
2464 $FONT_FIXED = new_from_file DC::Font $fonts[1]; 2514 $FONT_FIXED = new_from_file DC::Font $fonts[1];
2465 2515
2466 $FONT_PROP->make_default; 2516 $FONT_PROP->make_default;
2517
2518 DC::pango_init;
2467 } 2519 }
2468 2520
2469# compare mono (ft) vs. rgba (cairo) 2521# compare mono (ft) vs. rgba (cairo)
2470# ft - 1.8s, cairo 3s, even in alpha-only mode 2522# ft - 1.8s, cairo 3s, even in alpha-only mode
2471# for my $rgba (0..1) { 2523# for my $rgba (0..1) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines