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.20 by root, Fri Dec 28 11:44:02 2007 UTC vs.
Revision 1.29 by root, Mon Mar 24 00:24:47 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 $MODBOX->set_markup ($markup);
210} 238}
211 239
212############################################################################# 240#############################################################################
213#TODO: maybe move into own audio module... 241#TODO: maybe move into own audio module...
214 242
653 [Cha => CS_STAT_CHA], 681 [Cha => CS_STAT_CHA],
654 ) { 682 ) {
655 my ($name, $id) = @$_; 683 my ($name, $id) = @$_;
656 $hbox->add (new DC::UI::Label 684 $hbox->add (new DC::UI::Label
657 markup => "$conn->{stat}{$id} <span foreground='yellow'>$name</span>", 685 markup => "$conn->{stat}{$id} <span foreground='yellow'>$name</span>",
658 align => 0,
659 expand => 1, 686 expand => 1,
660 can_events => 1, 687 can_events => 1,
661 can_hover => 1, 688 can_hover => 1,
662 tooltip => "#stat_$name", 689 tooltip => "#stat_$name",
663 ); 690 );
718 user => $PROFILE->{user}, 745 user => $PROFILE->{user},
719 pass => $PROFILE->{password}, 746 pass => $PROFILE->{password},
720 mapw => $mapsize, 747 mapw => $mapsize,
721 maph => $mapsize, 748 maph => $mapsize,
722 749
723 client => "cfplus $DC::VERSION $] $^O", 750 client => "$DC::VERSION $] $^O",
724 751
725 map_widget => $MAPWIDGET, 752 map_widget => $MAPWIDGET,
726 statusbox => $STATUSBOX, 753 statusbox => $STATUSBOX,
727 map => $MAP, 754 map => $MAP,
728 mapmap => $MAPMAP, 755 mapmap => $MAPMAP,
769 796
770 $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]); 797 $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]);
771 798
772 my $row = 0; 799 my $row = 0;
773 800
774 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "OpenGL Info"); 801 $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, 802 $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, 803 can_events => 1,
777 tooltip => "<tt><span size='8192'>" . (DC::OpenGL::gl_extensions) . "</span></tt>"); 804 tooltip => "<tt><span size='8192'>" . (DC::OpenGL::gl_extensions) . "</span></tt>");
778 805
779 my $vidmode_tooltip = 806 my $vidmode_tooltip =
780 "<b>Video Mode.</b> The video mode to use for fullscreen (and the window size for windowed operation). " 807 "<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>."; 808 . "The format is <i>width</i> x <i>height</i> \@ <i>depth-per-channel</i> + <i>alpha-channel</i>.";
782 809
783 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Video Mode"); 810 $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); 811 $table->add_at (1, $row++, my $hbox = new DC::UI::HBox);
785 812
786 $hbox->add (my $mode_slider = new DC::UI::Slider 813 $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], 814 force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1],
788 tooltip => $vidmode_tooltip); 815 tooltip => $vidmode_tooltip);
789 $hbox->add (my $mode_label = new DC::UI::Label 816 $hbox->add (my $mode_label = new DC::UI::Label
790 align => 0, valign => 0, height => 0.8, template => "9999x9999@9+9", 817 height => 0.8, template => "9999x9999@9+9",
791 can_events => 1, tooltip => $vidmode_tooltip); 818 can_events => 1, tooltip => $vidmode_tooltip);
792 819
793 $mode_slider->connect (changed => sub { 820 $mode_slider->connect (changed => sub {
794 my ($self, $value) = @_; 821 my ($self, $value) = @_;
795 822
796 $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; 823 $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value;
797 $mode_label->set_text (sprintf '%dx%d@%d+%d', @{$SDL_MODES[$value]}); 824 $mode_label->set_text (sprintf '%dx%d@%d+%d', @{$SDL_MODES[$value]});
798 }); 825 });
799 $mode_slider->emit (changed => $mode_slider->{range}[0]); 826 $mode_slider->emit (changed => $mode_slider->{range}[0]);
800 827
801 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fullscreen"); 828 $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 829 $table->add_at (1, $row++, $FULLSCREEN_ENABLE = new DC::UI::CheckBox
803 state => $CFG->{fullscreen}, 830 state => $CFG->{fullscreen},
804 tooltip => "Bring the client into fullscreen mode.", 831 tooltip => "Bring the client into fullscreen mode.",
805 on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } 832 on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 }
806 ); 833 );
807 834
808 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); 835 $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 836 $table->add_at (1, $row++, new DC::UI::CheckBox
810 state => $CFG->{force_opengl11}, 837 state => $CFG->{force_opengl11},
811 tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " 838 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 " 839 . "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. " 840 . "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, " 841 . "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 " 842 . "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>", 843 . "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 } 844 on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 }
818 ); 845 );
819 846
820 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Compress Textures"); 847 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Compress Textures");
821 $table->add_at (1, $row++, new DC::UI::CheckBox 848 $table->add_at (1, $row++, new DC::UI::CheckBox
822 state => $CFG->{texture_compression}, 849 state => $CFG->{texture_compression},
823 tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " 850 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 " 851 . "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 " 852 . "can differ form card to card, so your mileage may vary. This setting is ignored in "
826 . "forced OpenGL 1.1 mode.", 853 . "forced OpenGL 1.1 mode.",
827 on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } 854 on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 }
828 ); 855 );
829 856
830 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); 857 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fast & Ugly");
831 $table->add_at (1, $row++, new DC::UI::CheckBox 858 $table->add_at (1, $row++, new DC::UI::CheckBox
832 state => $CFG->{fast}, 859 state => $CFG->{fast},
833 tooltip => "Lower the visual quality considerably to speed up rendering.", 860 tooltip => "Lower the visual quality considerably to speed up rendering.",
834 on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } 861 on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 }
835 ); 862 );
836 863
837 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); 864 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "GUI Fontsize");
838 $table->add_at (1, $row++, new DC::UI::Slider 865 $table->add_at (1, $row++, new DC::UI::Slider
839 range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], 866 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.", 867 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 }, 868 on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 },
842 ); 869 );
843 870
844 $table->add_at (1, $row++, new DC::UI::Button 871 $table->add_at (1, $row++, new DC::UI::Button
845 expand => 1, align => 0, text => "Apply", 872 expand => 1, text => "Apply",
846 tooltip => "Apply the video settings above.", 873 tooltip => "Apply the video settings above.",
847 on_activate => sub { 874 on_activate => sub {
848 video_shutdown (); 875 video_shutdown ();
849 video_init (); 876 video_init ();
850 0 877 0
851 } 878 }
852 ); 879 );
853 880
854 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Map Scale"); 881 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Scale");
855 $table->add_at (1, $row++, new DC::UI::Slider 882 $table->add_at (1, $row++, new DC::UI::Slider
856 range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], 883 range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1],
857 tooltip => "Enlarge or shrink the displayed map. Changes are instant.", 884 tooltip => "Enlarge or shrink the displayed map. Changes are instant.",
858 on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } 885 on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 }
859 ); 886 );
860 887
861 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Map Smoothing"); 888 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Smoothing");
862 $table->add_at (1, $row++, new DC::UI::CheckBox 889 $table->add_at (1, $row++, new DC::UI::CheckBox
863 state => $CFG->{map_smoothing}, 890 state => $CFG->{map_smoothing},
864 tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " 891 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. " 892 . "This increases load on the graphics subsystem and works only with TRT servers. "
866 . "Changes take effect at next login only.", 893 . "Changes take effect at next login only.",
867 on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } 894 on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 }
868 ); 895 );
869 896
870 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fog of War"); 897 $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 898 $table->add_at (1, $row++, new DC::UI::CheckBox
872 state => $CFG->{fow_enable}, 899 state => $CFG->{fow_enable},
873 tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.", 900 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 } 901 on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 }
875 ); 902 );
876 903
877 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "FoW Intensity"); 904 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Intensity");
878 $table->add_at (1, $row++, new DC::UI::Slider 905 $table->add_at (1, $row++, new DC::UI::Slider
879 range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], 906 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.", 907 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 } 908 on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 }
882 ); 909 );
883 910
884 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Message Fontsize"); 911 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Fontsize");
885 $table->add_at (1, $row++, new DC::UI::Slider 912 $table->add_at (1, $row++, new DC::UI::Slider
886 range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], 913 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, " 914 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.", 915 . "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 }, 916 on_changed => sub { $MESSAGE_DIST->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 },
890 ); 917 );
891 918
892 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); 919 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge fontsize");
893 $table->add_at (1, $row++, new DC::UI::Slider 920 $table->add_at (1, $row++, new DC::UI::Slider
894 range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], 921 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.", 922 tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.",
896 on_changed => sub { 923 on_changed => sub {
897 $CFG->{gauge_fontsize} = $_[1]; 924 $CFG->{gauge_fontsize} = $_[1];
898 &set_gauge_window_fontsize; 925 &set_gauge_window_fontsize;
899 0 926 0
900 } 927 }
901 ); 928 );
902 929
903 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Gauge size"); 930 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge size");
904 $table->add_at (1, $row++, new DC::UI::Slider 931 $table->add_at (1, $row++, new DC::UI::Slider
905 range => [$CFG->{gauge_size}, 0.2, 0.8], 932 range => [$CFG->{gauge_size}, 0.2, 0.8],
906 tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.", 933 tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.",
907 on_changed => sub { 934 on_changed => sub {
908 $CFG->{gauge_size} = $_[1]; 935 $CFG->{gauge_size} = $_[1];
942 969
943 $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]); 970 $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]);
944 971
945 my $row = 0; 972 my $row = 0;
946 973
947 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Audio Enable"); 974 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable");
948 $table->add_at (1, $row++, new DC::UI::CheckBox 975 $table->add_at (1, $row++, new DC::UI::CheckBox
949 state => $CFG->{audio_enable}, 976 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.", 977 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 } 978 on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 }
952 ); 979 );
953 980
954 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Sound Effects"); 981 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects");
955 $table->add_at (1, $row, new DC::UI::CheckBox 982 $table->add_at (1, $row, new DC::UI::CheckBox
956 expand => 1, state => $CFG->{effects_enable}, 983 expand => 1, state => $CFG->{effects_enable},
957 tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.", 984 tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.",
958 on_changed => sub { 985 on_changed => sub {
959 $CFG->{effects_enable} = $_[1]; 986 $CFG->{effects_enable} = $_[1];
966 tooltip => "The relative volume of sound effects. Best audio quality is achieved if this " 993 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.", 994 . "is set highest (rightmost) and you use your operating system volume setting. Changes are instant.",
968 on_changed => sub { $CFG->{effects_volume} = $_[1]; 1 } 995 on_changed => sub { $CFG->{effects_volume} = $_[1]; 1 }
969 ); 996 );
970 997
971 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Background Music"); 998 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music");
972 $table->add_at (1, $row, new DC::UI::CheckBox 999 $table->add_at (1, $row, new DC::UI::CheckBox
973 expand => 1, state => $CFG->{bgm_enable}, 1000 expand => 1, state => $CFG->{bgm_enable},
974 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", 1001 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.",
975 on_changed => sub { 1002 on_changed => sub {
976 $CFG->{bgm_enable} = $_[1]; 1003 $CFG->{bgm_enable} = $_[1];
983 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], 1010 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128],
984 tooltip => "The volume of the background music. Changes are instant.", 1011 tooltip => "The volume of the background music. Changes are instant.",
985 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } 1012 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 }
986 ); 1013 );
987 1014
988 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Frequency"); 1015 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Frequency");
989 $table->add_at (1, $row++, new DC::UI::Selector 1016 $table->add_at (1, $row++, new DC::UI::Selector
990 c_colspan => 2, expand => 1, 1017 c_colspan => 2, expand => 1,
991 value => $CFG->{audio_hw_frequency}, 1018 value => $CFG->{audio_hw_frequency},
992 options => [ 1019 options => [
993 [ 0, "default" , "Use System Default"], 1020 [ 0, "default" , "Use System Default"],
1002 audio_tab_update; 1029 audio_tab_update;
1003 1 1030 1
1004 } 1031 }
1005 ); 1032 );
1006 1033
1007 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Channels"); 1034 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Channels");
1008 $table->add_at (1, $row++, new DC::UI::Selector 1035 $table->add_at (1, $row++, new DC::UI::Selector
1009 c_colspan => 2, expand => 1, 1036 c_colspan => 2, expand => 1,
1010 value => $CFG->{audio_hw_channels}, 1037 value => $CFG->{audio_hw_channels},
1011 options => [ 1038 options => [
1012 [0, "default" , "Use System Default"], 1039 [0, "default" , "Use System Default"],
1021 audio_tab_update; 1048 audio_tab_update;
1022 1 1049 1
1023 } 1050 }
1024 ); 1051 );
1025 1052
1026 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Latency"); 1053 $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 1054 $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector
1028 c_colspan => 2, expand => 1, 1055 c_colspan => 2, expand => 1,
1029 value => $CFG->{audio_hw_chunksize}, 1056 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 " 1057 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.", 1058 . "is stuttering, increase this value. Values of 50-100ms are optimal.",
1035 1 1062 1
1036 } 1063 }
1037 ); 1064 );
1038 1065
1039 # should really be a slider 1066 # should really be a slider
1040 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Mixer Voices"); 1067 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Mixer Voices");
1041 $table->add_at (1, $row++, new DC::UI::ValSlider 1068 $table->add_at (1, $row++, new DC::UI::ValSlider
1042 c_colspan => 2, expand => 1, 1069 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.", 1070 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], 1071 range => [$::CFG->{audio_mix_channels}, 4, 32, 0, 1],
1045 template => ">= 99", 1072 template => ">= 99",
1051 1; 1078 1;
1052 } 1079 }
1053 ); 1080 );
1054 1081
1055 $table->add_at (1, $row++, new DC::UI::Button 1082 $table->add_at (1, $row++, new DC::UI::Button
1056 c_colspan => 2, expand => 1, align => 0, text => "Apply", 1083 c_colspan => 2, expand => 1, text => "Apply",
1057 tooltip => "Apply the audio settings", 1084 tooltip => "Apply the audio settings",
1058 on_activate => sub { 1085 on_activate => sub {
1059 audio_shutdown (); 1086 audio_shutdown ();
1060 audio_init (); 1087 audio_init ();
1061 0 1088 0
1111 $hb->add (my $hg = new DC::UI::Gauge type => 'hp', tooltip => "#stat_health"); 1138 $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"); 1139 $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"); 1140 $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"); 1141 $hb->add (my $fg = new DC::UI::Gauge type => 'food', tooltip => "#stat_food");
1115 1142
1116 $vbox->add (my $exp = new DC::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp"); 1143 $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); 1144 $vbox->add (my $prg = new DC::UI::ExperienceProgress);
1118 $vbox->add (my $sklprg = new DC::UI::ExperienceProgress); 1145 $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"); 1146 $vbox->add (my $rng = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged");
1120 1147
1121 $GAUGES = { 1148 $GAUGES = {
1122 exp => $exp, prg => $prg, sklprg => $sklprg, 1149 exp => $exp, prg => $prg, sklprg => $sklprg,
1123 win => $win, range => $rng, 1150 win => $win, range => $rng,
1124 hp => $hg, mana => $mg, grace => $gg, food => $fg, 1151 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 }); 1167 $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"); 1168 $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 }); 1169 $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() } ); 1170 $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } );
1144 1171
1145 $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153");#d# 1172 $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d#
1146 1173
1147 $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); 1174 $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", c_rowspan => 1, c_colspan => 2); 1175 $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, ellipsise => 0 ); 1176 $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_rowspan => 1, c_colspan => 2); 1177 $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2);
1190 $vb->add (new DC::UI::FancyFrame 1217 $vb->add (new DC::UI::FancyFrame
1191 label => "Player", 1218 label => "Player",
1192 child => (my $pi = new DC::UI::VBox), 1219 child => (my $pi = new DC::UI::VBox),
1193 ); 1220 );
1194 1221
1195 $pi->add ($STATWIDS->{title} = new DC::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, 1222 $pi->add ($STATWIDS->{title} = new DC::UI::Label text => "Title:", expand => 1, align => 0,
1196 can_hover => 1, can_events => 1, 1223 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."); 1224 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, 1225 $pi->add ($STATWIDS->{map} = new DC::UI::Label align => 0, text => "Map:", expand => 1,
1199 can_hover => 1, can_events => 1, 1226 can_hover => 1, can_events => 1,
1200 tooltip => "The map you are currently on (if supported by the server)."); 1227 tooltip => "The map you are currently on (if supported by the server).");
1201 1228
1202 $pi->add (my $hb0 = new DC::UI::HBox); 1229 $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, 1230 $hb0->add ($STATWIDS->{weight} = new DC::UI::Label text => "Weight:", expand => 1, align => 0,
1204 can_hover => 1, can_events => 1, 1231 can_hover => 1, can_events => 1,
1205 tooltip => "The weight of the player including all inventory items."); 1232 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, 1233 $hb0->add ($STATWIDS->{m_weight} = new DC::UI::Label align => 0, text => "Max weight:", expand => 1,
1207 can_hover => 1, can_events => 1, 1234 can_hover => 1, can_events => 1,
1208 tooltip => "The weight limit: you cannot carry more than this."); 1235 tooltip => "The weight limit: you cannot carry more than this.");
1209 1236
1210 $vb->add (new DC::UI::FancyFrame 1237 $vb->add (new DC::UI::FancyFrame
1211 label => "Primary/Secondary Statistics", 1238 label => "Primary/Secondary Statistics",
1232 [2, 5, st_wspd => "WSp", 10.54], 1259 [2, 5, st_wspd => "WSp", 10.54],
1233 ) { 1260 ) {
1234 my ($col, $row, $id, $label, $template) = @$_; 1261 my ($col, $row, $id, $label, $template) = @$_;
1235 1262
1236 $tbl->add_at ($col , $row, $STATWIDS->{$id} = new DC::UI::Label 1263 $tbl->add_at ($col , $row, $STATWIDS->{$id} = new DC::UI::Label
1237 font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, 1264 font => $FONT_FIXED, can_hover => 1, can_events => 1,
1238 align => +1, template => $template, tooltip => "#stat_$label"); 1265 align => 1, template => $template, tooltip => "#stat_$label");
1239 $tbl->add_at ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new DC::UI::Label 1266 $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, 1267 font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2,
1241 align => -1, text => $label, tooltip => "#stat_$label"); 1268 align => 0, text => $label, tooltip => "#stat_$label");
1242 } 1269 }
1243 1270
1244 $vb->add (new DC::UI::FancyFrame 1271 $vb->add (new DC::UI::FancyFrame
1245 label => "Resistancies", 1272 label => "Resistancies",
1246 child => (my $tbl2 = new DC::UI::Table expand => 1), 1273 child => (my $tbl2 = new DC::UI::Table expand => 1, col_expand => [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0]),
1247 ); 1274 );
1248 1275
1249 my $row = 0; 1276 my $row = 0;
1250 my $col = 0; 1277 my $col = 0;
1251 1278
1290 1317
1291 for (qw/slow holyw conf fire depl magic 1318 for (qw/slow holyw conf fire depl magic
1292 drain acid pois para deat phys 1319 drain acid pois para deat phys
1293 blind fear tund elec cold ghit/) 1320 blind fear tund elec cold ghit/)
1294 { 1321 {
1295 $tbl2->add_at ($col, $row, 1322 $tbl2->add_at ($col + 2, $row,
1296 $STATWIDS->{"res_$_"} = 1323 $STATWIDS->{"res_$_"} =
1297 new DC::UI::Label 1324 new DC::UI::Label
1298 font => $FONT_FIXED, 1325 font => $FONT_FIXED,
1299 template => "-100%", 1326 template => "-100%",
1300 align => +1, 1327 align => 1,
1301 valign => 0,
1302 can_events => 1, 1328 can_events => 1,
1303 can_hover => 1, 1329 can_hover => 1,
1304 tooltip => $resist_names{$_}->[1], 1330 tooltip => $resist_names{$_}->[1],
1305 ); 1331 );
1306 $tbl2->add_at ($col + 1, $row, new DC::UI::Image 1332 $tbl2->add_at ($col + 1, $row, new DC::UI::Image
1308 can_hover => 1, 1334 can_hover => 1,
1309 can_events => 1, 1335 can_events => 1,
1310 path => "ui/resist/resist_$_.png", 1336 path => "ui/resist/resist_$_.png",
1311 tooltip => $resist_names{$_}->[1], 1337 tooltip => $resist_names{$_}->[1],
1312 ); 1338 );
1313 $tbl2->add_at ($col + 2, $row, new DC::UI::Label 1339 $tbl2->add_at ($col + 0, $row, new DC::UI::Label
1314 text => $resist_names{$_}->[0], 1340 text => $resist_names{$_}->[0],
1315 font => $FONT_FIXED, 1341 font => $FONT_FIXED,
1342 align => 1,
1316 can_hover => 1, 1343 can_hover => 1,
1317 can_events => 1, 1344 can_events => 1,
1318 tooltip => $resist_names{$_}->[1], 1345 tooltip => $resist_names{$_}->[1],
1319 ); 1346 );
1320 1347
1321 $row++; 1348 $row++;
1322 if ($row % 6 == 0) { 1349 if ($row % 6 == 0) {
1323 $col += 3; 1350 $col += 4;
1324 $row = 0; 1351 $row = 0;
1325 } 1352 }
1326 } 1353 }
1327 1354
1328 #update_stats_window ({}); 1355 #update_stats_window ({});
1374 "The time this server has been running without being restarted.", 1401 "The time this server has been running without being restarted.",
1375 "Short information about this server provided by its admins.", 1402 "Short information about this server provided by its admins.",
1376 ); 1403 );
1377 my @col = qw(#Users Host Uptime Version Description); 1404 my @col = qw(#Users Host Uptime Version Description);
1378 $table->add_at ($_, 0, new DC::UI::Label 1405 $table->add_at ($_, 0, new DC::UI::Label
1379 can_hover => 1, can_events => 1, 1406 can_hover => 1, can_events => 1, fg => [1, 1, 0],
1380 align => 0, fg => [1, 1, 0],
1381 text => $col[$_], tooltip => $tip[$_]) 1407 text => $col[$_], tooltip => $tip[$_])
1382 for 0 .. $#col; 1408 for 0 .. $#col;
1383 1409
1384 my @align = qw(1 0 1 1 -1); 1410 my @align = qw(1 0.5 1 1 0);
1385 1411
1386 my $y = 0; 1412 my $y = 0;
1387 for my $m (@{ $msg->{servers} }) { 1413 for my $m (@{ $msg->{servers} }) {
1388 my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime, $highlight) = 1414 my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime, $highlight) =
1389 @$m{qw(ip age hostname users version description ibytes obytes uptime highlight)}; 1415 @$m{qw(ip age hostname users version description ibytes obytes uptime highlight)};
1470 $vbox->add (new DC::UI::FancyFrame 1496 $vbox->add (new DC::UI::FancyFrame
1471 label => "Login Settings", 1497 label => "Login Settings",
1472 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), 1498 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]),
1473 ); 1499 );
1474 1500
1475 $table->add_at (0, 4, new DC::UI::Label valign => 0, align => 1, text => "Username"); 1501 $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username");
1476 $table->add_at (1, 4, new DC::UI::Entry 1502 $table->add_at (1, 4, new DC::UI::Entry
1477 text => $CFG->{profile}{default}{user}, 1503 text => $CFG->{profile}{default}{user},
1478 tooltip => "The name of your character on the server.", 1504 tooltip => "The name of your character on the server.",
1479 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } 1505 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 }
1480 ); 1506 );
1481 1507
1482 $table->add_at (0, 5, new DC::UI::Label valign => 0, align => 1, text => "Password"); 1508 $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password");
1483 $table->add_at (1, 5, new DC::UI::Entry 1509 $table->add_at (1, 5, new DC::UI::Entry
1484 text => $CFG->{profile}{default}{password}, 1510 text => $CFG->{profile}{default}{password},
1485 hidden => 1, 1511 hidden => 1,
1486 tooltip => "The password for your character.", 1512 tooltip => "The password for your character.",
1487 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } 1513 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 }
1488 ); 1514 );
1489 1515
1490 $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button 1516 $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button
1491 expand => 1, 1517 expand => 1,
1492 align => 0,
1493 text => "Login / Register", 1518 text => "Login / Register",
1494 tooltip => "This button will either login to the account configured above or register a new account.", 1519 tooltip => "This button will either login to the account configured above or register a new account.",
1495 on_activate => sub { 1520 on_activate => sub {
1496 $CONN ? stop_game 1521 $CONN ? stop_game
1497 : start_game; 1522 : start_game;
1500 ); 1525 );
1501 1526
1502 $vbox->add (new DC::UI::FancyFrame 1527 $vbox->add (new DC::UI::FancyFrame
1503 label => "Registering", 1528 label => "Registering",
1504 min_h => 200, 1529 min_h => 200,
1505 child => (new DC::UI::Label valign => -1, ellipsise => 0, 1530 child => (new DC::UI::Label valign => 0, ellipsise => 0,
1506 markup => 1531 markup =>
1507 "To register a new account, choose a username that hasn't been taken yet and " 1532 "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.", 1533 . "try to log-in. Follow the instructions in the Log tab in the message window.",
1509 ), 1534 ),
1510 ); 1535 );
1520 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), 1545 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]),
1521 ); 1546 );
1522 1547
1523 my $row = 0; 1548 my $row = 0;
1524 1549
1525 $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Host:Port"); 1550 $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Host:Port");
1526 { 1551 {
1527 $table->add_at (1, $row, my $vbox = new DC::UI::VBox); 1552 $table->add_at (1, $row, my $vbox = new DC::UI::VBox);
1528 1553
1529 $vbox->add ( 1554 $vbox->add (
1530 $HOST_ENTRY = new DC::UI::Entry 1555 $HOST_ENTRY = new DC::UI::Entry
1531 expand => 1, 1556 expand => 1,
1532 text => $CFG->{profile}{default}{host}, 1557 text => $CFG->{profile}{default}{host},
1533 tooltip => "The hostname or ip address of the Deliantra server to connect to", 1558 tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)",
1534 on_changed => sub { 1559 on_changed => sub {
1535 my ($self, $value) = @_; 1560 my ($self, $value) = @_;
1536 $CFG->{profile}{default}{host} = $value; 1561 $CFG->{profile}{default}{host} = $value;
1537 1 1562 1
1538 } 1563 }
1541 if (0) { #d# disabled 1566 if (0) { #d# disabled
1542 $vbox->add (new DC::UI::Button 1567 $vbox->add (new DC::UI::Button
1543 expand => 1, 1568 expand => 1,
1544 text => "Server List", 1569 text => "Server List",
1545 other => $METASERVER, 1570 other => $METASERVER,
1546 tooltip => "Show a list of available crossfire servers", 1571 tooltip => "Show a list of available Deliantra servers",
1547 on_activate => sub { $METASERVER->toggle_visibility; 0 }, 1572 on_activate => sub { $METASERVER->toggle_visibility; 0 },
1548 on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, 1573 on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 },
1549 ); 1574 );
1550 }#d# 1575 }#d#
1551 } 1576 }
1552 1577
1553 $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Map Size"); 1578 $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Map Size");
1554 $table->add_at (1, $row, new DC::UI::Slider 1579 $table->add_at (1, $row, new DC::UI::Slider
1555 force_w => 100, 1580 force_w => 100,
1556 range => [$CFG->{mapsize}, 10, 100, 0, 1], 1581 range => [$CFG->{mapsize}, 10, 100, 0, 1],
1557 tooltip => "This is the size of the portion of the map update the server sends you. " 1582 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, " 1583 . "If you set this to a high value you will be able to see further, "
1559 . "but you also increase bandwidth requirements and latency. " 1584 . "but you also increase bandwidth requirements and latency. "
1560 . "This option is only used once at log-in.", 1585 . "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 }, 1586 on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 },
1562 ); 1587 );
1563 1588
1564 $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Output-Rate"); 1589 $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Output-Rate");
1565 $table->add_at (1, $row, new DC::UI::Entry 1590 $table->add_at (1, $row, new DC::UI::Entry
1566 text => $CFG->{output_rate}, 1591 text => $CFG->{output_rate},
1567 tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " 1592 tooltip => "The maximum bandwidth in bytes per second that the server should not exceed "
1568 . "when sending data. When 0 or unset, the server " 1593 . "when sending data. When 0 or unset, the server "
1569 . "default will be used, which is usually around 100kb/s. Most servers will " 1594 . "default will be used, which is usually around 100kb/s. Most servers will "
1582sub client_setup { 1607sub client_setup {
1583 my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]; 1608 my $table = new DC::UI::Table expand => 1, col_expand => [0, 1];
1584 1609
1585 my $row = 0; 1610 my $row = 0;
1586 1611
1587 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Tip of the day"); 1612 $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 1613 $table->add_at (1, $row++, new DC::UI::CheckBox
1589 state => $CFG->{show_tips}, 1614 state => $CFG->{show_tips},
1590 tooltip => "Show the <b>Tip of the day</b> window at startup?", 1615 tooltip => "Show the <b>Tip of the day</b> window at startup?",
1591 on_changed => sub { 1616 on_changed => sub {
1592 my ($self, $value) = @_; 1617 my ($self, $value) = @_;
1593 $CFG->{show_tips} = $value; 1618 $CFG->{show_tips} = $value;
1594 0 1619 0
1595 } 1620 }
1596 ); 1621 );
1597 1622
1598 $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Messages Window Size"); 1623 $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 1624 $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry
1600 text => $CFG->{logview_max_par}, 1625 text => $CFG->{logview_max_par},
1601 tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " 1626 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 " 1627 . "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.", 1628 . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.",
1604 on_changed => sub { 1629 on_changed => sub {
1605 my ($self, $value) = @_; 1630 my ($self, $value) = @_;
1606 $MESSAGE_WINDOW->set_max_para ($CFG->{logview_max_par} = $value*1); 1631 $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1);
1607 0 1632 0
1608 }, 1633 },
1609 ); 1634 );
1610 1635
1611 $table 1636 $table
1737 1762
1738sub inventory_widget { 1763sub inventory_widget {
1739 my $hb = new DC::UI::HBox homogeneous => 1; 1764 my $hb = new DC::UI::HBox homogeneous => 1;
1740 1765
1741 $hb->add (my $vb1 = new DC::UI::VBox); 1766 $hb->add (my $vb1 = new DC::UI::VBox);
1742 $vb1->add (new DC::UI::Label align => 0, text => "Player"); 1767 $vb1->add (new DC::UI::Label text => "Player");
1743 1768
1744 $vb1->add (my $hb1 = new DC::UI::HBox); 1769 $vb1->add (my $hb1 = new DC::UI::HBox);
1745 1770
1746 use sort 'stable'; 1771 use sort 'stable';
1747 1772
1757 $INV->set_sort_order ($SORT_ORDER{$_[1]}); 1782 $INV->set_sort_order ($SORT_ORDER{$_[1]});
1758 }, 1783 },
1759 ); 1784 );
1760 $hb1->add (new DC::UI::Label text => "Weight: ", align => 1, expand => 1); 1785 $hb1->add (new DC::UI::Label text => "Weight: ", align => 1, expand => 1);
1761 #TODO# update to weigh/maxweight 1786 #TODO# update to weigh/maxweight
1762 $hb1->add ($STATWIDS->{i_weight} = new DC::UI::Label align => -1); 1787 $hb1->add ($STATWIDS->{i_weight} = new DC::UI::Label align => 0);
1763 1788
1764 $vb1->add (my $sw1 = new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); 1789 $vb1->add (my $sw1 = new DC::UI::ScrolledWindow expand => 1, scroll_y => 1);
1765 $sw1->add ($INV = new DC::UI::Inventory); 1790 $sw1->add ($INV = new DC::UI::Inventory);
1766 $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); 1791 $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}});
1767 1792
2146 force_x => "max", 2171 force_x => "max",
2147 force_y => 0; 2172 force_y => 0;
2148 $DEBUG_STATUS->show; 2173 $DEBUG_STATUS->show;
2149 2174
2150 $STATUSBOX = new DC::UI::Statusbox; 2175 $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]); 2176
2177 $MODBOX = new DC::UI::Label
2178 can_events => 1,
2179 can_hover => 1,
2180 markup => "",
2181 align => 0,
2182 font => $FONT_FIXED,
2183 tooltip => "#modifier_box";
2184
2185 update_modbox;
2152 2186
2153 (new DC::UI::Frame 2187 (new DC::UI::Frame
2154 bg => [0, 0, 0, 0.4], 2188 bg => [0, 0, 0, 0.4],
2155 force_x => 0, 2189 force_x => 0,
2156 force_y => "max", 2190 force_y => "max",
2157 child => $STATUSBOX, 2191 child => (my $LR = new DC::UI::VBox),
2158 )->show; 2192 )->show;
2193
2194 $LR->add ($STATUSBOX);
2195 $LR->add ($MODBOX);
2196 $LR->add (new DC::UI::Label
2197 align => 0,
2198 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode",
2199 fontsize => 0.5,
2200 fg => [1, 1, 0, 0.7],
2201 );
2159 2202
2160 DC::UI::Toplevel->new ( 2203 DC::UI::Toplevel->new (
2161 title => "Minimap", 2204 title => "Minimap",
2162 name => "mapmap", 2205 name => "mapmap",
2163 x => 0, 2206 x => 0,
2171 2214
2172 $MAPWIDGET = new DC::MapWidget; 2215 $MAPWIDGET = new DC::MapWidget;
2173 $MAPWIDGET->connect (activate_console => sub { 2216 $MAPWIDGET->connect (activate_console => sub {
2174 my ($mapwidget, $preset) = @_; 2217 my ($mapwidget, $preset) = @_;
2175 2218
2176 $MESSAGE_WINDOW->activate_console ($preset) 2219 $MESSAGE_DIST->activate_console ($preset)
2177 if $MESSAGE_WINDOW; 2220 if $MESSAGE_DIST;
2178 }); 2221 });
2179 $MAPWIDGET->show; 2222 $MAPWIDGET->show;
2180 $MAPWIDGET->grab_focus; 2223 $MAPWIDGET->grab_focus;
2181 2224
2182 $COMPLETER = new DC::MapWidget::Command:: 2225 $COMPLETER = new DC::MapWidget::Command::
2194 force_h => $::HEIGHT * 0.6, 2237 force_h => $::HEIGHT * 0.6,
2195 has_close_button => 1, 2238 has_close_button => 1,
2196 ; 2239 ;
2197 2240
2198 $METASERVER = metaserver_dialog; 2241 $METASERVER = metaserver_dialog;
2199 $MESSAGE_WINDOW = new DC::UI::MessageWindow; 2242 $MESSAGE_WINDOW = new DC::UI::Dockbar (name => 'message_window', title => 'Messages');
2243 $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW;
2200 2244
2201 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1, 2245 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1,
2202 filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); 2246 filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1);
2203 2247
2204 $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, 2248 $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup,
2344 # alt-enter 2388 # alt-enter
2345 $FULLSCREEN_ENABLE->toggle; 2389 $FULLSCREEN_ENABLE->toggle;
2346 video_shutdown; 2390 video_shutdown;
2347 video_init; 2391 video_init;
2348 } else { 2392 } else {
2349 DC::UI::feed_sdl_key_down_event ($_[0]); 2393 &DC::UI::feed_sdl_key_down_event;
2350 } 2394 }
2395 update_modbox;
2351 }, 2396 },
2352 DC::SDL_KEYUP => \&DC::UI::feed_sdl_key_up_event, 2397 DC::SDL_KEYUP => sub {
2398 &DC::UI::feed_sdl_key_up_event;
2399 update_modbox;
2400 },
2353 DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event, 2401 DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event,
2354 DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event, 2402 DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event,
2355 DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event, 2403 DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event,
2356 DC::SDL_USEREVENT => sub { 2404 DC::SDL_USEREVENT => sub {
2357 if ($_[0]{code} == 1) { 2405 if ($_[0]{code} == 1) {
2373 if (-e "$Deliantra::VARDIR/client.cf") { 2421 if (-e "$Deliantra::VARDIR/client.cf") {
2374 DC::read_cfg "$Deliantra::VARDIR/client.cf"; 2422 DC::read_cfg "$Deliantra::VARDIR/client.cf";
2375 } else { 2423 } else {
2376 #TODO: compatibility cruft 2424 #TODO: compatibility cruft
2377 DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; 2425 DC::read_cfg "$Deliantra::OLDDIR/cfplusrc";
2378 print STDERR "INFO: used old configuratrion file\n"; 2426 print STDERR "INFO: used old configuration file\n";
2379 } 2427 }
2380 2428
2381 DC::DB::Server::run; 2429 DC::DB::Server::run;
2382 2430
2383 DC::UI::set_layout ($::CFG->{layout}); 2431 DC::UI::set_layout ($::CFG->{layout});

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines