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.140 by elmex, Sat Dec 16 16:01:09 2006 UTC vs.
Revision 1.151 by root, Mon Apr 16 21:12:51 2007 UTC

58use Compress::LZF; 58use Compress::LZF;
59 59
60use CFPlus; 60use CFPlus;
61use CFPlus::OpenGL (); 61use CFPlus::OpenGL ();
62use CFPlus::Protocol; 62use CFPlus::Protocol;
63use CFPlus::DB;
63use CFPlus::UI; 64use CFPlus::UI;
64use CFPlus::UI::Inventory; 65use CFPlus::UI::Inventory;
65use CFPlus::UI::SpellList; 66use CFPlus::UI::SpellList;
66use CFPlus::Pod; 67use CFPlus::Pod;
67use CFPlus::MapWidget; 68use CFPlus::MapWidget;
176sub destroy_query_dialog { 177sub destroy_query_dialog {
177 (delete $_[0]{query_dialog})->destroy 178 (delete $_[0]{query_dialog})->destroy
178 if $_[0]{query_dialog}; 179 if $_[0]{query_dialog};
179} 180}
180 181
182# FIXME: a very ugly hack to wait for stat update look below! #d#
183our $QUERY_TIMER; #d#
184
181# server query dialog 185# server query dialog
182sub server_query { 186sub server_query {
183 my ($conn, $flags, $prompt) = @_; 187 my ($conn, $flags, $prompt) = @_;
188
189 # FIXME: a very ugly hack to wait for stat update #d#
190 if ($prompt =~ /roll new stats/ and not $conn->{stat_change_with}) {
191 unless ($QUERY_TIMER) {
192 $QUERY_TIMER =
193 Event->timer (
194 after => 1,
195 cb => sub {
196 server_query ($conn, $flags, $prompt, 1);
197 $QUERY_TIMER = undef
198 }
199 );
200 return;
201 }
202 }
184 203
185 $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel 204 $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel
186 x => "center", 205 x => "center",
187 y => "center", 206 y => "center",
188 title => "Server Query", 207 title => "Server Query",
401 statusbox => $STATUSBOX, 420 statusbox => $STATUSBOX,
402 map => $MAP, 421 map => $MAP,
403 mapmap => $MAPMAP, 422 mapmap => $MAPMAP,
404 query => \&server_query, 423 query => \&server_query,
405 424
425 setup_req => {
426 smoothing => $CFG->{map_smoothing}*1,
427 },
428
406 sound_play => sub { 429 sound_play => sub {
407 my ($x, $y, $soundnum, $type) = @_; 430 my ($x, $y, $soundnum, $type) = @_;
408 431
409 $SDL_MIXER 432 $SDL_MIXER
410 or return; 433 or return;
447sub graphics_setup { 470sub graphics_setup {
448 my $vbox = new CFPlus::UI::VBox; 471 my $vbox = new CFPlus::UI::VBox;
449 472
450 $vbox->add (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]); 473 $vbox->add (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]);
451 474
475 my $row = 0;
476
477 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "OpenGL Info");
478 $table->add (1, $row++, new CFPlus::UI::Label valign => 0, fontsize => 0.8, text => CFPlus::OpenGL::gl_vendor . ", " . CFPlus::OpenGL::gl_version,
479 can_events => 1,
480 tooltip => "<tt><span size='8192'>" . (CFPlus::OpenGL::gl_extensions) . "</span></tt>");
481
452 $table->add (0, 0, new CFPlus::UI::Label valign => 0, align => 1, text => "Video Mode"); 482 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Video Mode");
453 $table->add (1, 0, my $hbox = new CFPlus::UI::HBox); 483 $table->add (1, $row++, my $hbox = new CFPlus::UI::HBox);
454 484
455 $hbox->add (my $mode_slider = new CFPlus::UI::Slider force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1]); 485 $hbox->add (my $mode_slider = new CFPlus::UI::Slider force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1]);
456 $hbox->add (my $mode_label = new CFPlus::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999"); 486 $hbox->add (my $mode_label = new CFPlus::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999");
457 487
458 $mode_slider->connect (changed => sub { 488 $mode_slider->connect (changed => sub {
460 490
461 $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; 491 $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value;
462 $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]}); 492 $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]});
463 }); 493 });
464 $mode_slider->emit (changed => $mode_slider->{range}[0]); 494 $mode_slider->emit (changed => $mode_slider->{range}[0]);
465
466 my $row = 1;
467 495
468 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fullscreen"); 496 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fullscreen");
469 $table->add (1, $row++, $FULLSCREEN_ENABLE = new CFPlus::UI::CheckBox 497 $table->add (1, $row++, $FULLSCREEN_ENABLE = new CFPlus::UI::CheckBox
470 state => $CFG->{fullscreen}, 498 state => $CFG->{fullscreen},
471 tooltip => "Bring the client into fullscreen mode.", 499 tooltip => "Bring the client into fullscreen mode.",
477 state => $CFG->{fast}, 505 state => $CFG->{fast},
478 tooltip => "Lower the visual quality considerably to speed up rendering.", 506 tooltip => "Lower the visual quality considerably to speed up rendering.",
479 on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } 507 on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 }
480 ); 508 );
481 509
510 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "GUI Fontsize");
511 $table->add (1, $row++, new CFPlus::UI::Slider
512 range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1],
513 tooltip => "The base font size used by most GUI elements that do not have their own setting.",
514 on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 },
515 );
516
517 $table->add (1, $row++, new CFPlus::UI::Button
518 expand => 1, align => 0, text => "Apply",
519 tooltip => "Apply the video settings above.",
520 on_activate => sub {
521 video_shutdown ();
522 video_init ();
523 0
524 }
525 );
526
482 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Scale"); 527 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Scale");
483 $table->add (1, $row++, new CFPlus::UI::Slider 528 $table->add (1, $row++, new CFPlus::UI::Slider
484 range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], 529 range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1],
485 tooltip => "Enlarge or shrink the displayed map. Changes are instant.", 530 tooltip => "Enlarge or shrink the displayed map. Changes are instant.",
486 on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } 531 on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 }
532 );
533
534 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Smoothing");
535 $table->add (1, $row++, new CFPlus::UI::CheckBox
536 state => $CFG->{map_smoothing},
537 tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. "
538 . "This increases load on the graphics subsystem and works only with 2.x servers. "
539 . "Changes take effect at next connection only.",
540 on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 }
487 ); 541 );
488 542
489 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fog of War"); 543 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fog of War");
490 $table->add (1, $row++, new CFPlus::UI::CheckBox 544 $table->add (1, $row++, new CFPlus::UI::CheckBox
491 state => $CFG->{fow_enable}, 545 state => $CFG->{fow_enable},
510 status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFPlus::OpenGL::GL_VERSION < 1.2; 564 status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFPlus::OpenGL::GL_VERSION < 1.2;
511 0 565 0
512 } 566 }
513 ); 567 );
514 568
515 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "GUI Fontsize");
516 $table->add (1, $row++, new CFPlus::UI::Slider
517 range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1],
518 tooltip => "The base font size used by most GUI elements that do not have their own setting.",
519 on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 },
520 );
521
522 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Message Fontsize"); 569 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Message Fontsize");
523 $table->add (1, $row++, new CFPlus::UI::Slider 570 $table->add (1, $row++, new CFPlus::UI::Slider
524 range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], 571 range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1],
525 tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.", 572 tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.",
526 on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, 573 on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 },
542 range => [$CFG->{gauge_size}, 0.2, 0.8], 589 range => [$CFG->{gauge_size}, 0.2, 0.8],
543 tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.", 590 tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.",
544 on_changed => sub { 591 on_changed => sub {
545 $CFG->{gauge_size} = $_[1]; 592 $CFG->{gauge_size} = $_[1];
546 $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); 593 $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size});
547 0
548 }
549 );
550
551 $table->add (1, $row++, new CFPlus::UI::Button
552 expand => 1, align => 0, text => "Apply",
553 tooltip => "Apply the video settings",
554 on_activate => sub {
555 video_shutdown ();
556 video_init ();
557 0 594 0
558 } 595 }
559 ); 596 );
560 597
561 $vbox 598 $vbox
887 for 0 .. $#col; 924 for 0 .. $#col;
888 925
889 my @align = qw(1 0 1 1 -1); 926 my @align = qw(1 0 1 1 -1);
890 927
891 my $y = 0; 928 my $y = 0;
892 for my $m (
893 sort {
894 $b->{version} <=> $a->{version}
895 or $b->{users} <=> $a->{users}
896 }
897 @{ $msg->{servers} } 929 for my $m (@{ $msg->{servers} }) {
898 ) {
899 my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime) = 930 my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime, $highlight) =
900 @$m{qw(ip age hostname users version description ibytes obytes uptime)}; 931 @$m{qw(ip age hostname users version description ibytes obytes uptime highlight)};
901 932
902 for ($desc) { 933 for ($desc) {
903 s/<br>/\n/gi; 934 s/<br>/\n/gi;
904 s/<li>/\n· /gi; 935 s/<li>/\n· /gi;
905 s/<.*?>//sgi; 936 s/<.*?>//sgi;
935 max_w => $::WIDTH * 0.4, 966 max_w => $::WIDTH * 0.4,
936 ellipsise => 0, 967 ellipsise => 0,
937 align => $align[$_], 968 align => $align[$_],
938 text => $m->[$_], 969 text => $m->[$_],
939 tooltip => $tip[$_], 970 tooltip => $tip[$_],
940 fg => ($m->[3] =~ /\+$/ ? [1, 1, 1] : [.7, .7, .7]), 971 fg => ($highlight ? [1, 1, 1] : [.7, .7, .7]),
941 can_hover => 1, 972 can_hover => 1,
942 can_events => 1, 973 can_events => 1,
943 fontsize => 0.8) 974 fontsize => 0.8)
944 for 0 .. $#$m; 975 for 0 .. $#$m;
945 } 976 }
1046 . "so only set it if you really need to prefetch images. " 1077 . "so only set it if you really need to prefetch images. "
1047 . "This option can be set and unset any time.", 1078 . "This option can be set and unset any time.",
1048 on_changed => sub { $CFG->{face_prefetch} = $_[1]; 0 }, 1079 on_changed => sub { $CFG->{face_prefetch} = $_[1]; 0 },
1049 ); 1080 );
1050 1081
1051 $table->add (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count"); 1082 $table->add (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate");
1052 $table->add (1, 9, new CFPlus::UI::Entry 1083 $table->add (1, 9, new CFPlus::UI::Entry
1084 text => $CFG->{output_rate},
1085 tooltip => "The approximate bandwidth in bytes per second that the server should not exceed "
1086 . "when sending images, to ensure interactiveness. When 0 or unset, the server "
1087 . "default will be used, which is usually around 100kb/s.",
1088 on_changed => sub { $CFG->{output_rate} = $_[1]; 0 },
1089 );
1090
1091 $table->add (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count");
1092 $table->add (1, 10, new CFPlus::UI::Entry
1053 text => $CFG->{output_count}, 1093 text => $CFG->{output_count},
1054 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", 1094 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
1055 on_changed => sub { $CFG->{output_count} = $_[1]; 0 }, 1095 on_changed => sub { $CFG->{output_count} = $_[1]; 0 },
1056 ); 1096 );
1057 1097
1058 $table->add (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync"); 1098 $table->add (0, 11, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync");
1059 $table->add (1, 10, new CFPlus::UI::Entry 1099 $table->add (1, 11, new CFPlus::UI::Entry
1060 text => $CFG->{output_sync}, 1100 text => $CFG->{output_sync},
1061 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", 1101 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
1062 on_changed => sub { $CFG->{output_sync} = $_[1]; 0 }, 1102 on_changed => sub { $CFG->{output_sync} = $_[1]; 0 },
1063 ); 1103 );
1064 1104
1065 $table->add (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button 1105 $table->add (1, 12, $LOGIN_BUTTON = new CFPlus::UI::Button
1066 expand => 1, 1106 expand => 1,
1067 align => 0, 1107 align => 0,
1068 text => "Login", 1108 text => "Login",
1069 on_activate => sub { 1109 on_activate => sub {
1070 $CONN ? stop_game 1110 $CONN ? stop_game
1071 : start_game; 1111 : start_game;
1072 0 1112 0
1073 }, 1113 },
1074 ); 1114 );
1075 1115
1116 $vbox->add (new CFPlus::UI::FancyFrame
1117 label => "Server Info",
1118 child => ($SERVER_INFO = new CFPlus::UI::Label ellipsise => 0),
1119 );
1120
1121 $vbox
1122}
1123
1124sub client_setup {
1125 my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1];
1126
1127 my $row = 0;
1128
1076 $table->add (0, 12, new CFPlus::UI::Label valign => 0, align => 1, text => "Chat Command"); 1129 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Chat Command");
1077 $table->add (1, 12, my $saycmd = new CFPlus::UI::Entry 1130 $table->add (1, $row++, my $saycmd = new CFPlus::UI::Entry
1078 text => $CFG->{say_command}, 1131 text => $CFG->{say_command},
1079 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. " 1132 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. "
1080 . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " 1133 . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
1081 . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.", 1134 . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.",
1082 on_changed => sub { 1135 on_changed => sub {
1083 my ($self, $value) = @_; 1136 my ($self, $value) = @_;
1084 $CFG->{say_command} = $value; 1137 $CFG->{say_command} = $value;
1085 0 1138 0
1086 } 1139 }
1087 ); 1140 );
1088 1141
1089 $table->add (0, 13, new CFPlus::UI::Label valign => 0, align => 1, text => "Tip of the day"); 1142 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Tip of the day");
1090 $table->add (1, 13, my $saycmd = new CFPlus::UI::CheckBox 1143 $table->add (1, $row++, new CFPlus::UI::CheckBox
1091 state => $CFG->{show_tips}, 1144 state => $CFG->{show_tips},
1092 tooltip => "Show the <b>Tip of the day</b> window at startup?", 1145 tooltip => "Show the <b>Tip of the day</b> window at startup?",
1093 on_changed => sub { 1146 on_changed => sub {
1094 my ($self, $value) = @_; 1147 my ($self, $value) = @_;
1095 $CFG->{show_tips} = $value; 1148 $CFG->{show_tips} = $value;
1096 0 1149 0
1097 } 1150 }
1098 ); 1151 );
1099 1152
1100 $vbox->add (new CFPlus::UI::FancyFrame 1153 $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Messages Window Size");
1101 label => "Server Info", 1154 $table->add (1, $row++, my $saycmd = new CFPlus::UI::Entry
1102 child => ($SERVER_INFO = new CFPlus::UI::Label ellipsise => 0), 1155 text => $CFG->{logview_max_par},
1156 tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server "
1157 . "sends more messages than this number, older messages get removed to save memory and "
1158 . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.",
1159 on_changed => sub {
1160 my ($self, $value) = @_;
1161 $LOGVIEW->{max_par} = $CFG->{logview_max_par} = $value*1;
1162 0
1163 },
1103 ); 1164 );
1104 1165
1105 $vbox 1166 $table
1106} 1167}
1107 1168
1108sub message_window { 1169sub message_window {
1109 my $window = new CFPlus::UI::Toplevel 1170 my $window = new CFPlus::UI::Toplevel
1110 name => "message_window", 1171 name => "message_window",
1547 1608
1548sub show_tip_of_the_day { 1609sub show_tip_of_the_day {
1549 # find all tips 1610 # find all tips
1550 my @tod = CFPlus::Pod::find tip_of_the_day => "*"; 1611 my @tod = CFPlus::Pod::find tip_of_the_day => "*";
1551 1612
1552 my $todindex = $CFPlus::DB_STATE->get ("tip_of_the_day"); 1613 CFPlus::DB::get state => "tip_of_the_day", sub {
1614 my ($todindex) = @_;
1553 $todindex = 0 if $todindex >= @tod; 1615 $todindex = 0 if $todindex >= @tod;
1554 $CFPlus::DB_STATE->put (tip_of_the_day => $todindex + 1); 1616 CFPlus::DB::put state => tip_of_the_day => $todindex + 1, sub { };
1555 1617
1556 # create dialog 1618 # create dialog
1557 my $dialog; 1619 my $dialog;
1558 1620
1559 my $close = sub { 1621 my $close = sub {
1560 $dialog->destroy; 1622 $dialog->destroy;
1623 };
1624
1625 $dialog = new CFPlus::UI::Toplevel
1626 x => "center",
1627 y => "center",
1628 z => 3,
1629 name => 'tip_of_the_day',
1630 force_w => int $WIDTH * 4/9,
1631 force_h => int $WIDTH * 2/9,
1632 title => "Tip of the day #" . (1 + $todindex),
1633 child => my $vbox = new CFPlus::UI::VBox,
1634 has_close_button => 1,
1635 on_delete => $close,
1636 ;
1637
1638 $vbox->add (my $viewer = new CFPlus::UI::TextScroller
1639 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4);
1640 $viewer->add_paragraph (CFPlus::Pod::as_paragraphs CFPlus::Pod::section_of $tod[$todindex]);
1641
1642 $vbox->add (my $table = new CFPlus::UI::Table col_expand => [0, 1]);
1643
1644 $table->add (0, 0, new CFPlus::UI::Button
1645 text => "Close",
1646 tooltip => "Close the tip of the day window. To never see it again, disable the tip of the day in the <b>Server Setup</b>.",
1647 on_activate => $close,
1648 );
1649
1650 $table->add (2, 0, new CFPlus::UI::Button
1651 text => "Next",
1652 tooltip => "Show the next <b>Tip of the day</b>.",
1653 on_activate => sub {
1654 $close->();
1655 &show_tip_of_the_day;
1656 },
1657 );
1658
1659 $dialog->show;
1561 }; 1660 };
1562
1563 $dialog = new CFPlus::UI::Toplevel
1564 x => "center",
1565 y => "center",
1566 z => 3,
1567 name => 'tip_of_the_day',
1568 force_w => int $WIDTH * 4/9,
1569 force_h => int $WIDTH * 2/9,
1570 title => "Tip of the day #" . (1 + $todindex),
1571 child => my $vbox = new CFPlus::UI::VBox,
1572 has_close_button => 1,
1573 on_delete => $close,
1574 ;
1575
1576 $vbox->add (my $viewer = new CFPlus::UI::TextScroller
1577 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4);
1578 $viewer->add_paragraph (CFPlus::Pod::as_paragraphs CFPlus::Pod::section_of $tod[$todindex]);
1579
1580 $vbox->add (my $table = new CFPlus::UI::Table col_expand => [0, 1]);
1581
1582 $table->add (0, 0, new CFPlus::UI::Button
1583 text => "Close",
1584 tooltip => "Close the tip of the day window. To never see it again, disable the tip of the day in the <b>Server Setup</b>.",
1585 on_activate => $close,
1586 );
1587
1588 $table->add (2, 0, new CFPlus::UI::Button
1589 text => "Next",
1590 tooltip => "Show the next <b>Tip of the day</b>.",
1591 on_activate => sub {
1592 $close->();
1593 &show_tip_of_the_day;
1594 },
1595 );
1596
1597 $dialog->show;
1598} 1661}
1599 1662
1600sub sdl_init { 1663sub sdl_init {
1601 CFPlus::SDL_Init 1664 CFPlus::SDL_Init
1602 and die "SDL::Init failed!\n"; 1665 and die "SDL::Init failed!\n";
1682 font => $FONT_FIXED, 1745 font => $FONT_FIXED,
1683 fontsize => $::CFG->{log_fontsize}, 1746 fontsize => $::CFG->{log_fontsize},
1684 indent => -4, 1747 indent => -4,
1685 can_hover => 1, 1748 can_hover => 1,
1686 can_events => 1, 1749 can_events => 1,
1750 max_par => $CFG->{logview_max_par},
1687 tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.", 1751 tooltip => "<b>Server Log</b>. This text viewer contains all recent messages sent by the server.",
1688 ; 1752 ;
1689 1753
1690 $SETUP_DIALOG = new CFPlus::UI::Toplevel 1754 $SETUP_DIALOG = new CFPlus::UI::Toplevel
1691 title => "Setup", 1755 title => "Setup",
1692 name => "setup_dialog", 1756 name => "setup_dialog",
1703 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFPlus::UI::Notebook expand => 1, debug => 1, 1767 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFPlus::UI::Notebook expand => 1, debug => 1,
1704 filter => new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); 1768 filter => new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1);
1705 1769
1706 $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, 1770 $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup,
1707 "Configure the server to play on, your username, password and other server-related options."); 1771 "Configure the server to play on, your username, password and other server-related options.");
1772 $SETUP_NOTEBOOK->add (Client => client_setup,
1773 "Configure various client-specific settings.");
1708 $SETUP_NOTEBOOK->add (Pickup => autopickup_setup, 1774 $SETUP_NOTEBOOK->add (Pickup => autopickup_setup,
1709 "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them."); 1775 "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them.");
1710 $SETUP_NOTEBOOK->add (Graphics => graphics_setup, 1776 $SETUP_NOTEBOOK->add (Graphics => graphics_setup,
1711 "Configure the video mode, performance, fonts and other graphical aspects of the game."); 1777 "Configure the video mode, performance, fonts and other graphical aspects of the game.");
1712 $SETUP_NOTEBOOK->add (Audio => audio_setup, 1778 $SETUP_NOTEBOOK->add (Audio => audio_setup,
2013 if $CONN; 2079 if $CONN;
2014}); 2080});
2015 2081
2016%SDL_CB = ( 2082%SDL_CB = (
2017 CFPlus::SDL_QUIT => sub { 2083 CFPlus::SDL_QUIT => sub {
2018 Event::unloop -1; 2084 exit;
2019 }, 2085 },
2020 CFPlus::SDL_VIDEORESIZE => sub { 2086 CFPlus::SDL_VIDEORESIZE => sub {
2021 }, 2087 },
2022 CFPlus::SDL_VIDEOEXPOSE => sub { 2088 CFPlus::SDL_VIDEOEXPOSE => sub {
2023 CFPlus::UI::full_refresh; 2089 CFPlus::UI::full_refresh;
2056 2122
2057$SIG{INT} = $SIG{TERM} = sub { exit }; 2123$SIG{INT} = $SIG{TERM} = sub { exit };
2058 2124
2059{ 2125{
2060 CFPlus::read_cfg "$Crossfire::VARDIR/cfplusrc"; 2126 CFPlus::read_cfg "$Crossfire::VARDIR/cfplusrc";
2127 CFPlus::DB::Server::run;
2128
2061 CFPlus::UI::set_layout ($::CFG->{layout}); 2129 CFPlus::UI::set_layout ($::CFG->{layout});
2062 2130
2063 my %DEF_CFG = ( 2131 my %DEF_CFG = (
2064 sdl_mode => 0, 2132 sdl_mode => 0,
2065 width => 640, 2133 width => 640,
2066 height => 480, 2134 height => 480,
2067 fullscreen => 0, 2135 fullscreen => 0,
2068 fast => 0, 2136 fast => 0,
2069 map_scale => 1, 2137 map_scale => 1,
2070 fow_enable => 1, 2138 fow_enable => 1,
2071 fow_intensity => 0.45, 2139 fow_intensity => 0.45,
2072 fow_smooth => 0, 2140 fow_smooth => 0,
2141 map_smoothing => 1,
2073 gui_fontsize => 1, 2142 gui_fontsize => 1,
2074 log_fontsize => 0.7, 2143 log_fontsize => 0.7,
2075 gauge_fontsize => 1, 2144 gauge_fontsize => 1,
2076 gauge_size => 0.35, 2145 gauge_size => 0.35,
2077 stat_fontsize => 0.7, 2146 stat_fontsize => 0.7,
2078 mapsize => 100, 2147 mapsize => 100,
2079 say_command => 'chat', 2148 say_command => 'chat',
2080 audio_enable => 1, 2149 audio_enable => 1,
2081 bgm_enable => 1, 2150 bgm_enable => 1,
2082 bgm_volume => 0.25, 2151 bgm_volume => 0.25,
2083 face_prefetch => 0, 2152 face_prefetch => 0,
2084 output_sync => 1, 2153 output_sync => 1,
2085 output_count => 1, 2154 output_count => 1,
2155 output_rate => "",
2086 pickup => 0, 2156 pickup => 0,
2087 inv_sort => "mtime", 2157 inv_sort => "mtime",
2088 default => "profile", # default profile 2158 default => "profile", # default profile
2089 show_tips => 1, 2159 show_tips => 1,
2160 logview_max_par => 1000,
2090 ); 2161 );
2091 2162
2092 while (my ($k, $v) = each %DEF_CFG) { 2163 while (my ($k, $v) = each %DEF_CFG) {
2093 $CFG->{$k} = $v unless exists $CFG->{$k}; 2164 $CFG->{$k} = $v unless exists $CFG->{$k};
2094 } 2165 }
2163 2234
2164Event::loop; 2235Event::loop;
2165#CFPlus::SDL_Quit; 2236#CFPlus::SDL_Quit;
2166#CFPlus::_exit 0; 2237#CFPlus::_exit 0;
2167 2238
2239END {
2168END { CFPlus::SDL_Quit } 2240 CFPlus::SDL_Quit;
2241 CFPlus::DB::Server::stop;
2242}
2169 2243
2170=head1 NAME 2244=head1 NAME
2171 2245
2172cfplus - A Crossfire+ and Crossfire game client 2246cfplus - A Crossfire+ and Crossfire game client
2173 2247

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines