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.74 by root, Sun Jun 18 17:13:12 2006 UTC vs.
Revision 1.76 by root, Tue Jun 20 08:49:40 2006 UTC

324 $LOGIN_BUTTON->set_text ("Logout"); 324 $LOGIN_BUTTON->set_text ("Logout");
325 $SETUP_DIALOG->hide; 325 $SETUP_DIALOG->hide;
326 326
327 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; 327 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32;
328 328
329 my ($host, $port) = split /:/, $CFG->{host}; 329 my ($host, $port) = split /:/, $CFG->{profile}{default}{host};
330 330
331 $MAP = new CFClient::Map $mapsize, $mapsize; 331 $MAP = new CFClient::Map $mapsize, $mapsize;
332 332
333 $CONN = eval { 333 $CONN = eval {
334 new CFClient::Protocol 334 new CFClient::Protocol
335 host => $host, 335 host => $host,
336 port => $port || 13327, 336 port => $port || 13327,
337 user => $CFG->{user}, 337 user => $CFG->{profile}{default}{user},
338 pass => $CFG->{password}, 338 pass => $CFG->{profile}{default}{password},
339 mapw => $mapsize, 339 mapw => $mapsize,
340 maph => $mapsize, 340 maph => $mapsize,
341 341
342 map_widget => $MAPWIDGET, 342 map_widget => $MAPWIDGET,
343 logview => $LOGVIEW, 343 logview => $LOGVIEW,
381 status "connection closed"; 381 status "connection closed";
382 382
383 destroy_query_dialog $CONN; 383 destroy_query_dialog $CONN;
384 $CONN->destroy; 384 $CONN->destroy;
385 $CONN = 0; # false, does not autovivify 385 $CONN = 0; # false, does not autovivify
386
387 undef $MAP;
386} 388}
387 389
388sub graphics_setup { 390sub graphics_setup {
389 my $vbox = new CFClient::UI::VBox; 391 my $vbox = new CFClient::UI::VBox;
390 392
912 $table->add (scalar @$m, $y, new CFClient::UI::VBox children => [ 914 $table->add (scalar @$m, $y, new CFClient::UI::VBox children => [
913 (new CFClient::UI::Button 915 (new CFClient::UI::Button
914 text => "Use", 916 text => "Use",
915 tooltip => "Put this server into the <b>Host:Port</b> field", 917 tooltip => "Put this server into the <b>Host:Port</b> field",
916 on_activate => sub { 918 on_activate => sub {
917 $HOST_ENTRY->set_text ($CFG->{host} = $host); 919 $HOST_ENTRY->set_text ($CFG->{profile}{default}{host} = $host);
918 $METASERVER->hide; 920 $METASERVER->hide;
919 0 921 0
920 }, 922 },
921 ), 923 ),
922 (new CFClient::UI::Empty expand => 1), 924 (new CFClient::UI::Empty expand => 1),
968 $table->add (1, 2, my $vbox = new CFClient::UI::VBox); 970 $table->add (1, 2, my $vbox = new CFClient::UI::VBox);
969 971
970 $vbox->add ( 972 $vbox->add (
971 $HOST_ENTRY = new CFClient::UI::Entry 973 $HOST_ENTRY = new CFClient::UI::Entry
972 expand => 1, 974 expand => 1,
973 text => $CFG->{host}, 975 text => $CFG->{profile}{default}{host},
974 tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", 976 tooltip => "The hostname or ip address of the Crossfire(+) server to connect to",
975 on_changed => sub { 977 on_changed => sub {
976 my ($self, $value) = @_; 978 my ($self, $value) = @_;
977 $CFG->{host} = $value; 979 $CFG->{profile}{default}{host} = $value;
978 0 980 0
979 } 981 }
980 ); 982 );
981 983
982 $METASERVER = metaserver_dialog; 984 $METASERVER = metaserver_dialog;
991 ); 993 );
992 } 994 }
993 995
994 $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); 996 $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username");
995 $table->add (1, 4, new CFClient::UI::Entry 997 $table->add (1, 4, new CFClient::UI::Entry
996 text => $CFG->{user}, 998 text => $CFG->{profile}{default}{user},
997 tooltip => "The name of your character on the server", 999 tooltip => "The name of your character on the server",
998 on_changed => sub { my ($self, $value) = @_; $CFG->{user} = $value; 0 } 1000 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value }
999 ); 1001 );
1000 1002
1001 $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password"); 1003 $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password");
1002 $table->add (1, 5, new CFClient::UI::Entry 1004 $table->add (1, 5, new CFClient::UI::Entry
1003 text => $CFG->{password}, 1005 text => $CFG->{profile}{default}{password},
1004 hidden => 1, 1006 hidden => 1,
1005 tooltip => "The password for your character", 1007 tooltip => "The password for your character",
1006 on_changed => sub { my ($self, $value) = @_; $CFG->{password} = $value; 0 } 1008 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value }
1007 ); 1009 );
1008 1010
1009 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); 1011 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size");
1010 $table->add (1, 7, new CFClient::UI::Slider 1012 $table->add (1, 7, new CFClient::UI::Slider
1011 force_w => 100, 1013 force_w => 100,
1306 1308
1307 my $refresh; 1309 my $refresh;
1308 $refresh = sub { 1310 $refresh = sub {
1309 $binding_list->clear (); 1311 $binding_list->clear ();
1310 1312
1311 for my $mod (keys %{$::CFG->{bindings}}) { 1313 for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) {
1312 for my $sym (keys %{$::CFG->{bindings}->{$mod}}) { 1314 for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) {
1313 my $cmds = $::CFG->{bindings}->{$mod}->{$sym}; 1315 my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym};
1314 next unless ref $cmds eq 'ARRAY' and @$cmds > 0; 1316 next unless ref $cmds eq 'ARRAY' and @$cmds > 0;
1315 1317
1316 my $lbl = join "; ", @$cmds; 1318 my $lbl = join "; ", @$cmds;
1317 my $nam = CFClient::Binder::keycombo_to_name ($mod, $sym); 1319 my $nam = CFClient::Binder::keycombo_to_name ($mod, $sym);
1318 $binding_list->add (my $hb = new CFClient::UI::HBox); 1320 $binding_list->add (my $hb = new CFClient::UI::HBox);
1319 $hb->add (new CFClient::UI::Button 1321 $hb->add (new CFClient::UI::Button
1320 text => "delete", 1322 text => "delete",
1321 tooltip => "Deletes the binding", 1323 tooltip => "Deletes the binding",
1322 on_activate => sub { 1324 on_activate => sub {
1323 $binding_list->remove ($hb); 1325 $binding_list->remove ($hb);
1324 delete $::CFG->{bindings}->{$mod}->{$sym}; 1326 delete $::CFG->{profile}{default}{bindings}{$mod}{$sym};
1325 0 1327 0
1326 }); 1328 });
1327 1329
1328 $hb->add (new CFClient::UI::Button 1330 $hb->add (new CFClient::UI::Button
1329 text => "edit", 1331 text => "edit",
1330 tooltip => "Edits the binding", 1332 tooltip => "Edits the binding",
1331 on_activate => sub { 1333 on_activate => sub {
1332 $::BIND_EDITOR->set_binding ( 1334 $::BIND_EDITOR->set_binding (
1333 $mod, $sym, $::CFG->{bindings}->{$mod}->{$sym}, 1335 $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym},
1334 sub { 1336 sub {
1335 my ($nmod, $nsym, $ncmds) = @_; 1337 my ($nmod, $nsym, $ncmds) = @_;
1336 delete $::CFG->{bindings}->{$mod}->{$sym}; 1338 delete $::CFG->{profile}{default}{bindings}{$mod}{$sym};
1337 $::CFG->{bindings}->{$nmod}->{$nsym} = $ncmds; 1339 $::CFG->{profile}{default}{bindings}{$nmod}{$nsym} = $ncmds;
1338 $refresh->(); 1340 $refresh->();
1339 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); 1341 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD);
1340 $SETUP_DIALOG->show; 1342 $SETUP_DIALOG->show;
1341 }, 1343 },
1342 sub { 1344 sub {
1376 tooltip => "This button opens the binding editor with an empty binding.", 1378 tooltip => "This button opens the binding editor with an empty binding.",
1377 on_activate => sub { 1379 on_activate => sub {
1378 $::BIND_EDITOR->set_binding (undef, undef, [], 1380 $::BIND_EDITOR->set_binding (undef, undef, [],
1379 sub { 1381 sub {
1380 my ($mod, $sym, $cmds) = @_; 1382 my ($mod, $sym, $cmds) = @_;
1381 $::CFG->{bindings}->{$mod}->{$sym} = $cmds; 1383 $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds;
1382 $refresh->(); 1384 $refresh->();
1383 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); 1385 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD);
1384 $SETUP_DIALOG->show; 1386 $SETUP_DIALOG->show;
1385 }, 1387 },
1386 sub { 1388 sub {
1575 $SETUP_NOTEBOOK->add (Graphics => graphics_setup, 1577 $SETUP_NOTEBOOK->add (Graphics => graphics_setup,
1576 "Configure the video mode, performance, fonts and other graphical aspects of the game."); 1578 "Configure the video mode, performance, fonts and other graphical aspects of the game.");
1577 $SETUP_NOTEBOOK->add (Audio => audio_setup, 1579 $SETUP_NOTEBOOK->add (Audio => audio_setup,
1578 "Configure the use of audio, sound effects and background music."); 1580 "Configure the use of audio, sound effects and background music.");
1579 $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, 1581 $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup,
1580 "Lets you define, edit and delete bindings." 1582 "Lets you define, edit and delete key bindings."
1581 . "There is a shortcut for making bindings: <b>Left Control + Insert</b> opens the binding editor " 1583 . "There is a shortcut for making bindings: <b>Control-Insert</b> opens the binding editor "
1582 . "with nothing set and the recording started. After doing the actions you " 1584 . "with nothing set and the recording started. After doing the actions you "
1583 . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " 1585 . "want to record press <b>Insert</b> and you will be asked to press a key-combo. "
1584 . "After pressing the combo the binding will be saved automatically and the " 1586 . "After pressing the combo the binding will be saved automatically and the "
1585 . "binding editor closes"); 1587 . "binding editor closes");
1586 $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, 1588 $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup,
1587 "Displays all spells you have and lets you edit keyboard shortcuts for them."); 1589 "Displays all spells you have and lets you edit keyboard shortcuts for them.");
1588 $SETUP_NOTEBOOK->add (Debug => debug_setup, 1590 $SETUP_NOTEBOOK->add (Debug => debug_setup,
1589 "Some debuggign options. Do not ask."); 1591 "Some debuggin' options. Do not ask.");
1590 1592
1591 $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top 1593 $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top
1592 1594
1593 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, 1595 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG,
1594 tooltip => "Toggles a dialog where you can configure all aspects of this client."); 1596 tooltip => "Toggles a dialog where you can configure all aspects of this client.");
1864 1866
1865 CFClient::read_cfg "$Crossfire::VARDIR/cfplusrc"; 1867 CFClient::read_cfg "$Crossfire::VARDIR/cfplusrc";
1866 CFClient::UI::set_layout ($::CFG->{layout}); 1868 CFClient::UI::set_layout ($::CFG->{layout});
1867 1869
1868 my %DEF_CFG = ( 1870 my %DEF_CFG = (
1869 sdl_mode => 0, 1871 sdl_mode => 0,
1870 width => 640, 1872 width => 640,
1871 height => 480, 1873 height => 480,
1872 fullscreen => 0, 1874 fullscreen => 0,
1873 fast => 0, 1875 fast => 0,
1874 map_scale => 1, 1876 map_scale => 1,
1875 fow_enable => 1, 1877 fow_enable => 1,
1876 fow_intensity => 0.45, 1878 fow_intensity => 0.45,
1877 fow_smooth => 0, 1879 fow_smooth => 0,
1878 gui_fontsize => 1, 1880 gui_fontsize => 1,
1879 log_fontsize => 0.7, 1881 log_fontsize => 0.7,
1880 gauge_fontsize=> 1, 1882 gauge_fontsize => 1,
1881 gauge_size => 0.35, 1883 gauge_size => 0.35,
1882 stat_fontsize => 0.7, 1884 stat_fontsize => 0.7,
1883 mapsize => 100, 1885 mapsize => 100,
1884 host => "crossfire.schmorp.de",
1885 say_command => 'say', 1886 say_command => 'say',
1886 audio_enable => 1, 1887 audio_enable => 1,
1887 bgm_enable => 1, 1888 bgm_enable => 1,
1888 bgm_volume => 0.25, 1889 bgm_volume => 0.25,
1889 face_prefetch => 0, 1890 face_prefetch => 0,
1890 output_sync => 1, 1891 output_sync => 1,
1891 output_count => 1, 1892 output_count => 1,
1892 pickup => 0, 1893 pickup => 0,
1894 default => "profile", # default profile
1895 );
1893 ); 1896
1894
1895 while (my ($k, $v) = each %DEF_CFG) { 1897 while (my ($k, $v) = each %DEF_CFG) {
1896 $CFG->{$k} = $v unless exists $CFG->{$k}; 1898 $CFG->{$k} = $v unless exists $CFG->{$k};
1897 } 1899 }
1900
1901 $CFG->{profile}{default}{host} ||= "crossfire.schmorp.de";
1898 1902
1899 sdl_init; 1903 sdl_init;
1900 1904
1901 @SDL_MODES = reverse 1905 @SDL_MODES = reverse
1902 grep $_->[0] >= 640 && $_->[1] >= 480, 1906 grep $_->[0] >= 640 && $_->[1] >= 480,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines