ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.43 by elmex, Fri Jun 2 16:27:28 2006 UTC vs.
Revision 1.50 by root, Sat Jun 3 02:32:35 2006 UTC

41use CFClient::UI; 41use CFClient::UI;
42use CFClient::MapWidget; 42use CFClient::MapWidget;
43 43
44$Event::DIED = sub { 44$Event::DIED = sub {
45 # TODO: display dialog box or so 45 # TODO: display dialog box or so
46 Carp::confess $_[1];#d#TODO: remove when stable
46 CFClient::error $_[1]; 47 CFClient::error $_[1];
47}; 48};
48 49
49#$SIG{__WARN__} = sub { Carp::cluck $_[0] };#d# 50#$SIG{__WARN__} = sub { Carp::cluck $_[0] };#d#
50 51
82our $CONSOLE; 83our $CONSOLE;
83our $METASERVER; 84our $METASERVER;
84our $LOGIN_BUTTON; 85our $LOGIN_BUTTON;
85our $QUIT_DIALOG; 86our $QUIT_DIALOG;
86our $HOST_ENTRY; 87our $HOST_ENTRY;
87our $SERVER_SETUP; 88
89our $SETUP_DIALOG;
90our $SETUP_NOTEBOOK;
91our $SETUP_SERVER;
92our $SETUP_KEYBOARD;
93our $SETUP_SPELLS;
88 94
89our $FLOORBOX; 95our $FLOORBOX;
90our $GAUGES; 96our $GAUGES;
91our $STATWIDS; 97our $STATWIDS;
92 98
104our $INV_WINDOW; 110our $INV_WINDOW;
105our $INV; 111our $INV;
106our $INVR; 112our $INVR;
107our $INV_RIGHT_HB; 113our $INV_RIGHT_HB;
108 114
109our $BIND_WINDOW;
110our $BIND_EDITOR; 115our $BIND_EDITOR;
111 116
112our $SPELL_LIST;
113our $PICKUP_CFG; 117our $PICKUP_CFG;
114 118
115sub status { 119sub status {
116 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); 120 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
117} 121}
122 126
123sub start_game { 127sub start_game {
124 status "logging in..."; 128 status "logging in...";
125 129
126 $LOGIN_BUTTON->set_text ("Logout"); 130 $LOGIN_BUTTON->set_text ("Logout");
127 $SERVER_SETUP->hide; 131 $SETUP_DIALOG->hide;
128 132
129 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; 133 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32;
130 134
131 my ($host, $port) = split /:/, $CFG->{host}; 135 my ($host, $port) = split /:/, $CFG->{host};
132 136
170 } 174 }
171} 175}
172 176
173sub stop_game { 177sub stop_game {
174 $LOGIN_BUTTON->set_text ("Login"); 178 $LOGIN_BUTTON->set_text ("Login");
175 $SERVER_SETUP->show; 179 $SETUP_DIALOG->show;
176 $INV_WINDOW->hide; 180 $INV_WINDOW->hide;
177 $LOGVIEW->hide; 181 $LOGVIEW->hide;
178 182
179 return unless $CONN; 183 return unless $CONN;
180 184
182 186
183 $CONN->destroy; 187 $CONN->destroy;
184 $CONN = 0; # false, does not autovivify 188 $CONN = 0; # false, does not autovivify
185} 189}
186 190
187sub client_setup { 191sub graphics_setup {
188 my $dialog = new CFClient::UI::FancyFrame
189 x => 1,
190 y => $HEIGHT * (1/8),
191 name => "client_setup",
192 title => "Client Setup",
193 child => (my $vbox = new CFClient::UI::VBox); 192 my $vbox = new CFClient::UI::VBox;
194 193
195 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); 194 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]);
196 195
197 $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode"); 196 $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode");
198 $table->add (1, 0, my $hbox = new CFClient::UI::HBox); 197 $table->add (1, 0, my $hbox = new CFClient::UI::HBox);
322 on_activate => sub { 321 on_activate => sub {
323 video_shutdown (); 322 video_shutdown ();
324 video_init (); 323 video_init ();
325 } 324 }
326 ); 325 );
326
327 $vbox
328}
329
330sub audio_setup {
331 my $vbox = new CFClient::UI::VBox;
332
333 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]);
334
335 my $row = 0;
327 336
328 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); 337 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable");
329 $table->add (1, $row++, new CFClient::UI::CheckBox 338 $table->add (1, $row++, new CFClient::UI::CheckBox
330 state => $CFG->{audio_enable}, 339 state => $CFG->{audio_enable},
331 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.", 340 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.",
362 audio_shutdown (); 371 audio_shutdown ();
363 audio_init (); 372 audio_init ();
364 } 373 }
365 ); 374 );
366 375
367 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Chat Command"); 376 $vbox
368 $table->add (1, $row++, my $saycmd = new CFClient::UI::Entry
369 text => $CFG->{say_command},
370 tooltip => "This is the command that will be used if you write a line in the message window entry or press <b>\"</b> in the map window. "
371 . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
372 . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.",
373 on_changed => sub {
374 my ($self, $value) = @_;
375 $CFG->{say_command} = $value;
376 }
377 );
378
379 $dialog
380} 377}
381 378
382sub set_stats_window_fontsize { 379sub set_stats_window_fontsize {
383 for (values %{$STATWIDS}) { 380 for (values %{$STATWIDS}) {
384 $_->set_fontsize ($::CFG->{stat_fontsize}); 381 $_->set_fontsize ($::CFG->{stat_fontsize});
557 update_stats_window ({}); 554 update_stats_window ({});
558 555
559 $tgw 556 $tgw
560} 557}
561 558
562sub formsep { 559sub formsep($) {
563 reverse join ",", grep length, split /(...)/, reverse $_[0] * 1 560 scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1
564} 561}
565 562
566sub update_stats_window { 563sub update_stats_window {
567 my ($stats) = @_; 564 my ($stats) = @_;
568 565
726 723
727 $dialog 724 $dialog
728} 725}
729 726
730sub server_setup { 727sub server_setup {
731 my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame
732 x => "center",
733 y => "center",
734 name => "server_setup",
735 title => "Server Setup",
736 child => (my $vbox = new CFClient::UI::VBox), 728 my $vbox = new CFClient::UI::VBox;
737 ;
738 729
739 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); 730 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]);
740 $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); 731 $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port");
741 732
742 { 733 {
835 $CONN ? stop_game 826 $CONN ? stop_game
836 : start_game; 827 : start_game;
837 }, 828 },
838 ); 829 );
839 830
840 $dialog 831 $table->add (0, 12, new CFClient::UI::Label valign => 0, align => 1, text => "Chat Command");
832 $table->add (1, 12, my $saycmd = new CFClient::UI::Entry
833 text => $CFG->{say_command},
834 tooltip => "This is the command that will be used if you write a line in the message window entry or press <b>\"</b> in the map window. "
835 . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
836 . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.",
837 on_changed => sub {
838 my ($self, $value) = @_;
839 $CFG->{say_command} = $value;
840 }
841 );
842
843 $vbox
841} 844}
842 845
843sub message_window { 846sub message_window {
844 my $window = new CFClient::UI::FancyFrame 847 my $window = new CFClient::UI::FancyFrame
845 name => "message_window", 848 name => "message_window",
871 }, 874 },
872 on_activate => sub { 875 on_activate => sub {
873 my ($input, $text) = @_; 876 my ($input, $text) = @_;
874 $input->set_text (''); 877 $input->set_text ('');
875 878
876 if ($text =~ /^\/bind\s+(.*)$/) {
877 CFClient::Binder::open_binding_dialog (sub {
878 my ($mod, $sym) = @_;
879 $::CFG->{bindings}->{$mod}->{$sym} = [$1];
880 });
881 } elsif ($text =~ /^\/(.*)/) { 879 if ($text =~ /^\/(.*)/) {
882 $::CONN->user_send ($1); 880 $::CONN->user_send ($1);
883 } else { 881 } else {
884 my $say_cmd = $::CFG->{say_command} || 'say'; 882 my $say_cmd = $::CFG->{say_command} || 'say';
885 $::CONN->user_send ("$say_cmd $text"); 883 $::CONN->user_send ("$say_cmd $text");
886 } 884 }
931 } 929 }
932 930
933 $QUIT_DIALOG->show; 931 $QUIT_DIALOG->show;
934} 932}
935 933
936sub make_pickup_cfg_window { 934sub autopickup_setup {
937 $PICKUP_CFG = new CFClient::UI::FancyFrame
938 x => "center",
939 y => "center",
940 force_w => $WIDTH * 3/10,
941 force_h => $HEIGHT * 9/10;
942
943 my $tbl = new CFClient::UI::Table; 935 my $vb = new CFClient::UI::VBox;
936
937 $vb->add (my $gen_tbl = new CFClient::UI::Table expand => 1);
938 $vb->add (my $hb = new CFClient::UI::HBox expand => 1);
939 $hb->add (my $ltbl = new CFClient::UI::Table expand => 1);
940 $hb->add (my $rtbl = new CFClient::UI::Table expand => 1);
941
942 my $tbl = 0;
944 my $tblrow = 0; 943 my $tblrow = 0;
945 $PICKUP_CFG->add (my $sw = new CFClient::UI::ScrolledWindow scrolled => $tbl);
946 944
947 for ( 945 for (
948 ["General"], 946 ["General", $gen_tbl],
949 ["Enable (new) autopickup" => CFClient::Pickup::PU_NEWMODE], 947 ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE],
950 ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT], 948 ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT],
951 ["Stop before pickup" => CFClient::Pickup::PU_STOP], 949 ["Stop before pickup" => CFClient::Pickup::PU_STOP],
952 ["Debug autopickup" => CFClient::Pickup::PU_DEBUG], 950 ["Debug autopickup" => CFClient::Pickup::PU_DEBUG],
953 ["Weapons"], 951 ["Weapons", $ltbl],
954 ["All weapons" => CFClient::Pickup::PU_ALLWEAPON], 952 ["All weapons" => CFClient::Pickup::PU_ALLWEAPON],
955 ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON], 953 ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON],
956 ["Bows" => CFClient::Pickup::PU_BOW], 954 ["Bows" => CFClient::Pickup::PU_BOW],
957 ["Arrows" => CFClient::Pickup::PU_ARROW], 955 ["Arrows" => CFClient::Pickup::PU_ARROW],
958 ["Armour"], 956 ["Armour"],
960 ["Shields" => CFClient::Pickup::PU_SHIELD], 958 ["Shields" => CFClient::Pickup::PU_SHIELD],
961 ["Body Armour" => CFClient::Pickup::PU_ARMOUR], 959 ["Body Armour" => CFClient::Pickup::PU_ARMOUR],
962 ["Boots" => CFClient::Pickup::PU_BOOTS], 960 ["Boots" => CFClient::Pickup::PU_BOOTS],
963 ["Gloves" => CFClient::Pickup::PU_GLOVES], 961 ["Gloves" => CFClient::Pickup::PU_GLOVES],
964 ["Cloaks" => CFClient::Pickup::PU_CLOAK], 962 ["Cloaks" => CFClient::Pickup::PU_CLOAK],
965 ["Readables"], 963 ["Readables", $rtbl],
966 ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK], 964 ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK],
967 ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL], 965 ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL],
968 ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES], 966 ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES],
969 ["Misc"], 967 ["Misc"],
970 ["Food" => CFClient::Pickup::PU_FOOD], 968 ["Food" => CFClient::Pickup::PU_FOOD],
976 ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE], 974 ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE],
977 ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED], 975 ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED],
978 ["Jewelery" => CFClient::Pickup::PU_JEWELS], 976 ["Jewelery" => CFClient::Pickup::PU_JEWELS],
979 ) 977 )
980 { 978 {
981 unless (defined $_->[1]) { 979 if (ref $_->[1]) {
980 $tbl = $_->[1];
981 $tblrow = 0;
982 $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => 0); 982 $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1);
983 } elsif (not defined $_->[1]) {
984 $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1);
983 } else { 985 } else {
984 my $mask = $_->[1]; 986 my $mask = $_->[1];
985 $tbl->add (0, $tblrow, new CFClient::UI::Label text => $_->[0], align => -1); 987 $tbl->add (0, $tblrow, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1);
986 $tbl->add (1, $tblrow++, new CFClient::UI::CheckBox 988 $tbl->add (1, $tblrow++, new CFClient::UI::CheckBox
987 state => $CFG->{pickup} & $mask, 989 state => $CFG->{pickup} & $mask,
988 on_changed => sub { 990 on_changed => sub {
989 my ($box, $value) = @_; 991 my ($box, $value) = @_;
990 if ($value) { 992 if ($value) {
991 $CFG->{pickup} |= $mask; 993 $::CFG->{pickup} |= $mask;
992 } else { 994 } else {
993 $CFG->{pickup} = $CFG->{pickup} & ~$mask; 995 $::CFG->{pickup} = $::CFG->{pickup} & ~$mask;
994 } 996 }
995 $::CONN->send (sprintf "command pickup %u", $CFG->{pickup}); 997 $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup})
998 if defined $::CONN;
996 }); 999 });
997 } 1000 }
998 } 1001 }
999 1002
1000 $PICKUP_CFG 1003 $vb
1001} 1004}
1002 1005
1003sub make_inventory_window { 1006sub make_inventory_window {
1004 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame 1007 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame
1005 x => "center", 1008 x => "center",
1025 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); 1028 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor");
1026 1029
1027 $invwin 1030 $invwin
1028} 1031}
1029 1032
1030sub make_spell_list { 1033sub spell_setup {
1031 $SPELL_LIST = new CFClient::UI::SpellList 1034 new CFClient::UI::SpellList
1032 force_w => $WIDTH * (9/10),
1033 force_h => $HEIGHT * (9/10);
1034 $SPELL_LIST
1035} 1035}
1036 1036
1037sub make_binding_window { 1037sub keyboard_setup {
1038 my $binding_list = new CFClient::UI::VBox; 1038 my $binding_list = new CFClient::UI::VBox;
1039 1039
1040 my $refresh; 1040 my $refresh;
1041 $refresh = sub { 1041 $refresh = sub {
1042 $binding_list->clear (); 1042 $binding_list->clear ();
1066 sub { 1066 sub {
1067 my ($nmod, $nsym, $ncmds) = @_; 1067 my ($nmod, $nsym, $ncmds) = @_;
1068 delete $::CFG->{bindings}->{$mod}->{$sym}; 1068 delete $::CFG->{bindings}->{$mod}->{$sym};
1069 $::CFG->{bindings}->{$nmod}->{$nsym} = $ncmds; 1069 $::CFG->{bindings}->{$nmod}->{$nsym} = $ncmds;
1070 $refresh->(); 1070 $refresh->();
1071 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD);
1071 $::BIND_WINDOW->show; 1072 $SETUP_DIALOG->show;
1072 }, 1073 },
1073 sub { 1074 sub {
1075 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD);
1074 $::BIND_WINDOW->show; 1076 $SETUP_DIALOG->show;
1075 }); 1077 });
1076 $::BIND_EDITOR->show; 1078 $::BIND_EDITOR->show;
1077 $::BIND_WINDOW->hide; 1079 $SETUP_DIALOG->hide;
1078 }); 1080 });
1079 1081
1080 $hb->add (new CFClient::UI::Label text => "(Key: $nam)"); 1082 $hb->add (new CFClient::UI::Label text => "(Key: $nam)");
1081 $hb->add (new CFClient::UI::Label text => $lbl, expand => 1); 1083 $hb->add (new CFClient::UI::Label text => $lbl, expand => 1);
1082 } 1084 }
1083 } 1085 }
1084 }; 1086 };
1085 1087
1086 $BIND_WINDOW = new CFClient::UI::FancyFrame
1087 title => "Bindings",
1088 x => "center",
1089 y => "center",
1090 def_w => int $WIDTH * 9/10,
1091 def_h => int $HEIGHT * 9/10,
1092 on_visibility_change => sub {
1093 my ($self, $visible) = @_;
1094 $refresh->() if $visible;
1095 };
1096
1097 $BIND_WINDOW->add (my $vb = new CFClient::UI::VBox); 1088 my $vb = new CFClient::UI::VBox;
1098 $vb->add ($binding_list); 1089 $vb->add ($binding_list);
1099 $vb->add (my $hb = new CFClient::UI::HBox); 1090 $vb->add (my $hb = new CFClient::UI::HBox);
1091
1100 $hb->add (new CFClient::UI::Button 1092 $hb->add (new CFClient::UI::Button
1101 text => "record new", 1093 text => "record new",
1102 expand => 1, 1094 expand => 1,
1103 tooltip => "This button opens the binding editor with an empty binding.", 1095 tooltip => "This button opens the binding editor with an empty binding.",
1104 on_activate => sub { 1096 on_activate => sub {
1105 $::BIND_EDITOR->set_binding (undef, undef, [], 1097 $::BIND_EDITOR->set_binding (undef, undef, [],
1106 sub { 1098 sub {
1107 my ($mod, $sym, $cmds) = @_; 1099 my ($mod, $sym, $cmds) = @_;
1108 $::CFG->{bindings}->{$mod}->{$sym} = $cmds; 1100 $::CFG->{bindings}->{$mod}->{$sym} = $cmds;
1109 $refresh->(); 1101 $refresh->();
1110 $::BIND_WINDOW->show; 1102 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD);
1103 $SETUP_DIALOG->show;
1111 }, 1104 },
1112 sub { 1105 sub {
1113 $::BIND_WINDOW->show; 1106 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD);
1107 $SETUP_DIALOG->show;
1114 }); 1108 });
1115 $::BIND_WINDOW->hide; 1109 $SETUP_DIALOG->hide;
1116 $::BIND_EDITOR->show; 1110 $::BIND_EDITOR->show;
1117 }, 1111 },
1118 ); 1112 );
1113
1119 $hb->add (new CFClient::UI::Button 1114 $hb->add (new CFClient::UI::Button
1120 text => "close", 1115 text => "close",
1121 tooltip => "Closes the binding window", 1116 tooltip => "Closes the binding window",
1122 expand => 1, 1117 expand => 1,
1123 on_activate => sub { 1118 on_activate => sub {
1124 $::BIND_WINDOW->hide; 1119 $SETUP_DIALOG->hide;
1125 } 1120 }
1126 ); 1121 );
1127 1122
1128 $refresh->(); 1123 $refresh->();
1129 $BIND_WINDOW 1124
1125 $vb
1130} 1126}
1131 1127
1132sub make_help_window { 1128sub make_help_window {
1133 my $win = new CFClient::UI::FancyFrame 1129 my $win = new CFClient::UI::FancyFrame
1134 x => 'center', 1130 x => 'center',
1225 force_y => "max", 1221 force_y => "max",
1226 child => $STATUSBOX, 1222 child => $STATUSBOX,
1227 )->show; 1223 )->show;
1228 1224
1229 CFClient::UI::FancyFrame->new ( 1225 CFClient::UI::FancyFrame->new (
1230 title => "Mini Map", 1226 title => "Map",
1231 name => "mapmap", 1227 name => "mapmap",
1232 x => 0, 1228 x => 0,
1233 y => $FONTSIZE + 8, 1229 y => $FONTSIZE + 8,
1234 border_bg => [1, 1, 1, 192/255], 1230 border_bg => [1, 1, 1, 192/255],
1235 bg => [1, 1, 1, 0], 1231 bg => [1, 1, 1, 0],
1261 can_hover => 1, 1257 can_hover => 1,
1262 can_events => 1, 1258 can_events => 1,
1263 tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.", 1259 tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.",
1264 ; 1260 ;
1265 1261
1262 $SETUP_DIALOG = new CFClient::UI::FancyFrame
1263 title => "Setup",
1264 name => "setup_dialog",
1265 x => 'center',
1266 y => 'center',
1267 force_w => $::WIDTH * 0.6,
1268 force_h => $::HEIGHT * 0.6,
1269 ;
1270
1271 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1,
1272 filter => new CFClient::UI::ScrolledWindow xxx => 1, expand => 1, scroll_y => 1);
1273
1274 $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup,
1275 "Configure the server to play on, your username, password and other server-related options.");
1276 $SETUP_NOTEBOOK->add (Pickup => autopickup_setup,
1277 "Configure autopicking stetings, i.e. which items you will pick up automatically when walking over them.");
1278 $SETUP_NOTEBOOK->add (Graphics => graphics_setup,
1279 "Configure the video mode, performance, fonts and other graphical aspects of the game.");
1280 $SETUP_NOTEBOOK->add (Audio => audio_setup,
1281 "Configure the use of audio, sound effects and background music.");
1282 $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup,
1283 "Lets you define, edit and delete bindings."
1284 . "There is a shortcut for making bindings: Left Control + Insert opens the binding editor "
1285 . "with nothing set and the recording started. After doing the actions you "
1286 . "want to record press Insert and you will be asked to press a key-combo."
1287 . "After pressing the combo the binding will be saved automatically and the "
1288 . "binding editor closes");
1289 $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup,
1290 "Displays all spells you have and lets you edit keyboard shortcuts for them.");
1291
1266 $BUTTONBAR = new CFClient::UI::HBox x => 0, y => 0; 1292 $BUTTONBAR = new CFClient::UI::HBox x => 0, y => 0;
1267 1293
1268 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup, 1294 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG,
1269 tooltip => "Toggles a dialog where you can configure various aspects of the client, such as graphics mode, performance, and audio options."); 1295 tooltip => "Toggles a dialog where you can configure all aspects of this client.");
1270 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup, 1296
1271 tooltip => "Toggles a dialog where you can configure the server to play on, your username, password and other server-related options.");
1272 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window, 1297 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window,
1273 tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); 1298 tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server.");
1274 1299
1275 make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D 1300 make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D
1276 1301
1277 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, 1302 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window,
1278 tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); 1303 tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times.");
1279 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, 1304 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window,
1280 tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)." 1305 tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)."
1281 ."You can also hit the Tab-key to show/hide the Inventory."); 1306 ."You can also hit the <b>Tab</b>-key to show/hide the Inventory.");
1282 1307
1283 $BUTTONBAR->add (new CFClient::UI::Button 1308 $BUTTONBAR->add (new CFClient::UI::Button
1284 text => "Save Config", 1309 text => "Save Config",
1285 tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", 1310 tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.",
1286 on_activate => sub { 1311 on_activate => sub {
1290 }, 1315 },
1291 ); 1316 );
1292 1317
1293 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, 1318 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window,
1294 tooltip => "View Documentation"); 1319 tooltip => "View Documentation");
1295
1296 $BUTTONBAR->add (new CFClient::UI::Flopper
1297 text => "Bindings",
1298 other => make_binding_window,
1299 tooltip =>
1300 "Lets you define, edit and delete bindings."
1301 ."There is a shortcut for making bindings: LCTRL+Insert opens the binding editor "
1302 ."with nothing set and the recording started. After doing the actions you "
1303 ."want to record press Insert and you will be asked to press a key-combo."
1304 ."After pressing the combo the binding will be saved automatically and the "
1305 ."binding editor closes");
1306
1307 $BUTTONBAR->add (new CFClient::UI::Flopper
1308 text => "Spells",
1309 other => make_spell_list,
1310 tooltip => "The spell list");
1311
1312 $BUTTONBAR->add (new CFClient::UI::Flopper
1313 text => "Pickup",
1314 other => make_pickup_cfg_window,
1315 tooltip => "The pickup dialog");
1316
1317 1320
1318 $BUTTONBAR->add (new CFClient::UI::Button 1321 $BUTTONBAR->add (new CFClient::UI::Button
1319 text => "Quit", 1322 text => "Quit",
1320 tooltip => "Terminates the program", 1323 tooltip => "Terminates the program",
1321 on_activate => sub { 1324 on_activate => sub {
1326 } 1329 }
1327 }, 1330 },
1328 ); 1331 );
1329 1332
1330 $BUTTONBAR->show; 1333 $BUTTONBAR->show;
1331 $SERVER_SETUP->show; 1334 $SETUP_DIALOG->show;
1335 }
1332 1336
1333 $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); 1337 $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]);
1334 }
1335} 1338}
1336 1339
1337sub video_shutdown { 1340sub video_shutdown {
1338 undef $SDL_ACTIVE; 1341 undef $SDL_ACTIVE;
1339} 1342}
1471}; 1474};
1472 1475
1473 CFClient::SDL_GL_SwapBuffers; 1476 CFClient::SDL_GL_SwapBuffers;
1474} 1477}
1475 1478
1476my $refresh_watcher = Event->timer (after => 0, hard => 1, interval => 1 / $MAX_FPS, cb => sub { 1479my $refresh_watcher = Event->timer (after => 0, hard => 0, interval => 1 / $MAX_FPS, cb => sub {
1477 $NOW = time; 1480 $NOW = time;
1478 1481
1479 ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) 1482 ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_)
1480 for CFClient::SDL_PollEvent; 1483 for CFClient::SDL_PollEvent;
1481 1484
1548############################################################################# 1551#############################################################################
1549 1552
1550$SIG{INT} = $SIG{TERM} = sub { exit }; 1553$SIG{INT} = $SIG{TERM} = sub { exit };
1551 1554
1552{ 1555{
1553 local $SIG{__DIE__} = sub { CFClient::fatal $_[0] if defined $^S && !$^S }; 1556 local $SIG{__DIE__} = sub {
1557 return unless defined $^S && !$^S;
1558 Carp::confess $_[1];#d#TODO: remove when stable
1559 CFClient::fatal $_[0];
1560 };
1554 1561
1555 CFClient::read_cfg "$Crossfire::VARDIR/cfplusrc"; 1562 CFClient::read_cfg "$Crossfire::VARDIR/cfplusrc";
1556 CFClient::UI::set_layout ($::CFG->{layout}); 1563 CFClient::UI::set_layout ($::CFG->{layout});
1557 1564
1558 my %DEF_CFG = ( 1565 my %DEF_CFG = (

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines