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.50 by root, Sat Jun 3 02:32:35 2006 UTC vs.
Revision 1.56 by root, Mon Jun 5 05:23:21 2006 UTC

25# need to do it again because that pile of garbage called PAR nukes it before main 25# need to do it again because that pile of garbage called PAR nukes it before main
26unshift @INC, $ENV{PAR_TEMP} 26unshift @INC, $ENV{PAR_TEMP}
27 if %PAR::LibCache; 27 if %PAR::LibCache;
28 28
29use Time::HiRes 'time'; 29use Time::HiRes 'time';
30use Pod::POM;
31use Event; 30use Event;
32 31
33use Crossfire; 32use Crossfire;
34use Crossfire::Protocol::Constants; 33use Crossfire::Protocol::Constants;
35 34
174 } 173 }
175} 174}
176 175
177sub stop_game { 176sub stop_game {
178 $LOGIN_BUTTON->set_text ("Login"); 177 $LOGIN_BUTTON->set_text ("Login");
178 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER);
179 $SETUP_DIALOG->show; 179 $SETUP_DIALOG->show;
180 $INV_WINDOW->hide; 180 $INV_WINDOW->hide;
181 $LOGVIEW->hide;
182 181
183 return unless $CONN; 182 return unless $CONN;
184 183
185 status "connection closed"; 184 status "connection closed";
186 185
903sub open_quit_dialog { 902sub open_quit_dialog {
904 unless ($QUIT_DIALOG) { 903 unless ($QUIT_DIALOG) {
905 $QUIT_DIALOG = new CFClient::UI::FancyFrame 904 $QUIT_DIALOG = new CFClient::UI::FancyFrame
906 x => "center", 905 x => "center",
907 y => "center", 906 y => "center",
907 z => 50,
908 title => "Really Quit?", 908 title => "Really Quit?",
909 ; 909 ;
910 910
911 $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); 911 $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1);
912 912
930 930
931 $QUIT_DIALOG->show; 931 $QUIT_DIALOG->show;
932} 932}
933 933
934sub autopickup_setup { 934sub autopickup_setup {
935 my $vb = new CFClient::UI::VBox; 935 my $table = new CFClient::UI::Table;
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;
943 my $tblrow = 0;
944 936
945 for ( 937 for (
946 ["General", $gen_tbl], 938 ["General", 0, 0,
947 ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE], 939 ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE],
948 ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT], 940 ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT],
949 ["Stop before pickup" => CFClient::Pickup::PU_STOP], 941 ["Stop before pickup" => CFClient::Pickup::PU_STOP],
950 ["Debug autopickup" => CFClient::Pickup::PU_DEBUG], 942 ["Debug autopickup" => CFClient::Pickup::PU_DEBUG],
943 ],
951 ["Weapons", $ltbl], 944 ["Weapons", 0, 6,
952 ["All weapons" => CFClient::Pickup::PU_ALLWEAPON], 945 ["All weapons" => CFClient::Pickup::PU_ALLWEAPON],
953 ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON], 946 ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON],
954 ["Bows" => CFClient::Pickup::PU_BOW], 947 ["Bows" => CFClient::Pickup::PU_BOW],
955 ["Arrows" => CFClient::Pickup::PU_ARROW], 948 ["Arrows" => CFClient::Pickup::PU_ARROW],
949 ],
956 ["Armour"], 950 ["Armour", 0, 12,
957 ["Helmets" => CFClient::Pickup::PU_HELMET], 951 ["Helmets" => CFClient::Pickup::PU_HELMET],
958 ["Shields" => CFClient::Pickup::PU_SHIELD], 952 ["Shields" => CFClient::Pickup::PU_SHIELD],
959 ["Body Armour" => CFClient::Pickup::PU_ARMOUR], 953 ["Body Armour" => CFClient::Pickup::PU_ARMOUR],
960 ["Boots" => CFClient::Pickup::PU_BOOTS], 954 ["Boots" => CFClient::Pickup::PU_BOOTS],
961 ["Gloves" => CFClient::Pickup::PU_GLOVES], 955 ["Gloves" => CFClient::Pickup::PU_GLOVES],
962 ["Cloaks" => CFClient::Pickup::PU_CLOAK], 956 ["Cloaks" => CFClient::Pickup::PU_CLOAK],
957 ],
958
963 ["Readables", $rtbl], 959 ["Readables", 2, 2,
964 ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK], 960 ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK],
965 ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL], 961 ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL],
966 ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES], 962 ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES],
963 ],
967 ["Misc"], 964 ["Misc", 2, 7,
968 ["Food" => CFClient::Pickup::PU_FOOD], 965 ["Food" => CFClient::Pickup::PU_FOOD],
969 ["Drinks" => CFClient::Pickup::PU_DRINK], 966 ["Drinks" => CFClient::Pickup::PU_DRINK],
970 ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES], 967 ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES],
971 ["Keys" => CFClient::Pickup::PU_KEY], 968 ["Keys" => CFClient::Pickup::PU_KEY],
972 ["Magical Items" => CFClient::Pickup::PU_MAGICAL], 969 ["Magical Items" => CFClient::Pickup::PU_MAGICAL],
973 ["Potions" => CFClient::Pickup::PU_POTION], 970 ["Potions" => CFClient::Pickup::PU_POTION],
974 ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE], 971 ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE],
975 ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED], 972 ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED],
976 ["Jewelery" => CFClient::Pickup::PU_JEWELS], 973 ["Jewelery" => CFClient::Pickup::PU_JEWELS],
974 ],
977 ) 975 )
978 { 976 {
979 if (ref $_->[1]) { 977 my ($title, $x, $y, @bits) = @$_;
980 $tbl = $_->[1];
981 $tblrow = 0;
982 $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1); 978 $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]);
983 } elsif (not defined $_->[1]) { 979
984 $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1); 980 for (@bits) {
985 } else { 981 ++$y;
982
986 my $mask = $_->[1]; 983 my $mask = $_->[1];
987 $tbl->add (0, $tblrow, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); 984 $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1);
988 $tbl->add (1, $tblrow++, new CFClient::UI::CheckBox 985 $table->add ($x+1, $y, new CFClient::UI::CheckBox
989 state => $CFG->{pickup} & $mask, 986 state => $CFG->{pickup} & $mask,
990 on_changed => sub { 987 on_changed => sub {
991 my ($box, $value) = @_; 988 my ($box, $value) = @_;
992 if ($value) { 989 if ($value) {
993 $::CFG->{pickup} |= $mask; 990 $::CFG->{pickup} |= $mask;
998 if defined $::CONN; 995 if defined $::CONN;
999 }); 996 });
1000 } 997 }
1001 } 998 }
1002 999
1003 $vb 1000 $table
1004} 1001}
1005 1002
1006sub make_inventory_window { 1003sub make_inventory_window {
1007 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame 1004 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame
1008 x => "center", 1005 x => "center",
1103 $SETUP_DIALOG->show; 1100 $SETUP_DIALOG->show;
1104 }, 1101 },
1105 sub { 1102 sub {
1106 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); 1103 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD);
1107 $SETUP_DIALOG->show; 1104 $SETUP_DIALOG->show;
1108 }); 1105 },
1106 );
1109 $SETUP_DIALOG->hide; 1107 $SETUP_DIALOG->hide;
1110 $::BIND_EDITOR->show; 1108 $::BIND_EDITOR->show;
1111 }, 1109 },
1112 ); 1110 );
1113 1111
1127 1125
1128sub make_help_window { 1126sub make_help_window {
1129 my $win = new CFClient::UI::FancyFrame 1127 my $win = new CFClient::UI::FancyFrame
1130 x => 'center', 1128 x => 'center',
1131 y => 'center', 1129 y => 'center',
1130 z => 2,
1132 name => 'doc_browser', 1131 name => 'doc_browser',
1133 force_w => int $WIDTH * 7/8, 1132 force_w => int $WIDTH * 7/8,
1134 force_h => int $HEIGHT * 7/8, 1133 force_h => int $HEIGHT * 7/8,
1135 title => "Documentation"; 1134 title => "Documentation";
1136 1135
1148 my ($pod, $label) = @$_; 1147 my ($pod, $label) = @$_;
1149 1148
1150 $buttons->add (new CFClient::UI::Button 1149 $buttons->add (new CFClient::UI::Button
1151 text => $label, 1150 text => $label,
1152 on_activate => sub { 1151 on_activate => sub {
1153 my $parser = new Pod::POM;
1154 my $pom = $parser->parse_file (CFClient::find_rcfile "pod/$pod.pod"); 1152 my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod";
1155 1153
1156 $viewer->clear; 1154 $viewer->clear;
1157 1155
1158 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) 1156 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0])
1159 for @{ CFClient::pod_to_pango_list $pom }; 1157 for @{ CFClient::pod_to_pango_list $pom };
1211 $DEBUG_STATUS->show; 1209 $DEBUG_STATUS->show;
1212 1210
1213 $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); 1211 $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0);
1214 1212
1215 $STATUSBOX = new CFClient::UI::Statusbox; 1213 $STATUSBOX = new CFClient::UI::Statusbox;
1216 $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", pri => -100, color => [1, 1, 1, 0.8]); 1214 $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]);
1217 1215
1218 (new CFClient::UI::Frame 1216 (new CFClient::UI::Frame
1219 bg => [0, 0, 0, 0.4], 1217 bg => [0, 0, 0, 0.4],
1220 force_x => 0, 1218 force_x => 0,
1221 force_y => "max", 1219 force_y => "max",
1262 $SETUP_DIALOG = new CFClient::UI::FancyFrame 1260 $SETUP_DIALOG = new CFClient::UI::FancyFrame
1263 title => "Setup", 1261 title => "Setup",
1264 name => "setup_dialog", 1262 name => "setup_dialog",
1265 x => 'center', 1263 x => 'center',
1266 y => 'center', 1264 y => 'center',
1265 z => 2,
1267 force_w => $::WIDTH * 0.6, 1266 force_w => $::WIDTH * 0.6,
1268 force_h => $::HEIGHT * 0.6, 1267 force_h => $::HEIGHT * 0.6,
1269 ; 1268 ;
1270 1269
1271 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, 1270 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1,
1279 "Configure the video mode, performance, fonts and other graphical aspects of the game."); 1278 "Configure the video mode, performance, fonts and other graphical aspects of the game.");
1280 $SETUP_NOTEBOOK->add (Audio => audio_setup, 1279 $SETUP_NOTEBOOK->add (Audio => audio_setup,
1281 "Configure the use of audio, sound effects and background music."); 1280 "Configure the use of audio, sound effects and background music.");
1282 $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, 1281 $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup,
1283 "Lets you define, edit and delete bindings." 1282 "Lets you define, edit and delete bindings."
1284 . "There is a shortcut for making bindings: Left Control + Insert opens the binding editor " 1283 . "There is a shortcut for making bindings: <b>Left Control + Insert</b> opens the binding editor "
1285 . "with nothing set and the recording started. After doing the actions you " 1284 . "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." 1285 . "want to record press <b>Insert</b> and you will be asked to press a key-combo. "
1287 . "After pressing the combo the binding will be saved automatically and the " 1286 . "After pressing the combo the binding will be saved automatically and the "
1288 . "binding editor closes"); 1287 . "binding editor closes");
1289 $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, 1288 $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup,
1290 "Displays all spells you have and lets you edit keyboard shortcuts for them."); 1289 "Displays all spells you have and lets you edit keyboard shortcuts for them.");
1291 1290
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 1299 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
1301 1300
1302 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, 1301 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window,
1303 tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); 1302 tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times.");
1304 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, 1303 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window,
1305 tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)." 1304 tooltip => "Toggles the inventory window, where you can manage your loot (or treasures :). "
1306 ."You can also hit the <b>Tab</b>-key to show/hide the Inventory."); 1305 . "You can also hit the <b>Tab</b>-key to show/hide the Inventory.");
1307 1306
1308 $BUTTONBAR->add (new CFClient::UI::Button 1307 $BUTTONBAR->add (new CFClient::UI::Button
1309 text => "Save Config", 1308 text => "Save Config",
1310 tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", 1309 tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.",
1311 on_activate => sub { 1310 on_activate => sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines