… | |
… | |
420 | statusbox => $STATUSBOX, |
420 | statusbox => $STATUSBOX, |
421 | map => $MAP, |
421 | map => $MAP, |
422 | mapmap => $MAPMAP, |
422 | mapmap => $MAPMAP, |
423 | query => \&server_query, |
423 | query => \&server_query, |
424 | |
424 | |
|
|
425 | setup_req => { |
|
|
426 | smoothing => $CFG->{map_smoothing}*1, |
|
|
427 | }, |
|
|
428 | |
425 | sound_play => sub { |
429 | sound_play => sub { |
426 | my ($x, $y, $soundnum, $type) = @_; |
430 | my ($x, $y, $soundnum, $type) = @_; |
427 | |
431 | |
428 | $SDL_MIXER |
432 | $SDL_MIXER |
429 | or return; |
433 | or return; |
… | |
… | |
501 | state => $CFG->{fast}, |
505 | state => $CFG->{fast}, |
502 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
506 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
503 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
507 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
504 | ); |
508 | ); |
505 | |
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 | |
506 | $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"); |
507 | $table->add (1, $row++, new CFPlus::UI::Slider |
528 | $table->add (1, $row++, new CFPlus::UI::Slider |
508 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
529 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
509 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
530 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
510 | 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 } |
511 | ); |
541 | ); |
512 | |
542 | |
513 | $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"); |
514 | $table->add (1, $row++, new CFPlus::UI::CheckBox |
544 | $table->add (1, $row++, new CFPlus::UI::CheckBox |
515 | state => $CFG->{fow_enable}, |
545 | state => $CFG->{fow_enable}, |
… | |
… | |
534 | 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; |
535 | 0 |
565 | 0 |
536 | } |
566 | } |
537 | ); |
567 | ); |
538 | |
568 | |
539 | $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
|
|
540 | $table->add (1, $row++, new CFPlus::UI::Slider |
|
|
541 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], |
|
|
542 | tooltip => "The base font size used by most GUI elements that do not have their own setting.", |
|
|
543 | on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 }, |
|
|
544 | ); |
|
|
545 | |
|
|
546 | $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"); |
547 | $table->add (1, $row++, new CFPlus::UI::Slider |
570 | $table->add (1, $row++, new CFPlus::UI::Slider |
548 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
571 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
549 | 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.", |
550 | on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
573 | on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
… | |
… | |
566 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
589 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
567 | 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.", |
568 | on_changed => sub { |
591 | on_changed => sub { |
569 | $CFG->{gauge_size} = $_[1]; |
592 | $CFG->{gauge_size} = $_[1]; |
570 | $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); |
593 | $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); |
571 | 0 |
|
|
572 | } |
|
|
573 | ); |
|
|
574 | |
|
|
575 | $table->add (1, $row++, new CFPlus::UI::Button |
|
|
576 | expand => 1, align => 0, text => "Apply", |
|
|
577 | tooltip => "Apply the video settings", |
|
|
578 | on_activate => sub { |
|
|
579 | video_shutdown (); |
|
|
580 | video_init (); |
|
|
581 | 0 |
594 | 0 |
582 | } |
595 | } |
583 | ); |
596 | ); |
584 | |
597 | |
585 | $vbox |
598 | $vbox |
… | |
… | |
1098 | : start_game; |
1111 | : start_game; |
1099 | 0 |
1112 | 0 |
1100 | }, |
1113 | }, |
1101 | ); |
1114 | ); |
1102 | |
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 | |
|
|
1124 | sub client_setup { |
|
|
1125 | my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]; |
|
|
1126 | |
|
|
1127 | my $row = 0; |
|
|
1128 | |
1103 | $table->add (0, 13, 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"); |
1104 | $table->add (1, 13, my $saycmd = new CFPlus::UI::Entry |
1130 | $table->add (1, $row++, my $saycmd = new CFPlus::UI::Entry |
1105 | text => $CFG->{say_command}, |
1131 | text => $CFG->{say_command}, |
1106 | 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. " |
1107 | . "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. " |
1108 | . "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.", |
1109 | on_changed => sub { |
1135 | on_changed => sub { |
1110 | my ($self, $value) = @_; |
1136 | my ($self, $value) = @_; |
1111 | $CFG->{say_command} = $value; |
1137 | $CFG->{say_command} = $value; |
1112 | 0 |
1138 | 0 |
1113 | } |
1139 | } |
1114 | ); |
1140 | ); |
1115 | |
1141 | |
1116 | $table->add (0, 14, 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"); |
1117 | $table->add (1, 14, my $saycmd = new CFPlus::UI::CheckBox |
1143 | $table->add (1, $row++, new CFPlus::UI::CheckBox |
1118 | state => $CFG->{show_tips}, |
1144 | state => $CFG->{show_tips}, |
1119 | 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?", |
1120 | on_changed => sub { |
1146 | on_changed => sub { |
1121 | my ($self, $value) = @_; |
1147 | my ($self, $value) = @_; |
1122 | $CFG->{show_tips} = $value; |
1148 | $CFG->{show_tips} = $value; |
1123 | 0 |
1149 | 0 |
1124 | } |
1150 | } |
1125 | ); |
1151 | ); |
1126 | |
1152 | |
1127 | $vbox->add (new CFPlus::UI::FancyFrame |
1153 | $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Messages Window Size"); |
1128 | label => "Server Info", |
1154 | $table->add (1, $row++, my $saycmd = new CFPlus::UI::Entry |
1129 | 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 | }, |
1130 | ); |
1164 | ); |
1131 | |
1165 | |
1132 | $vbox |
1166 | $table |
1133 | } |
1167 | } |
1134 | |
1168 | |
1135 | sub message_window { |
1169 | sub message_window { |
1136 | my $window = new CFPlus::UI::Toplevel |
1170 | my $window = new CFPlus::UI::Toplevel |
1137 | name => "message_window", |
1171 | name => "message_window", |
… | |
… | |
1711 | font => $FONT_FIXED, |
1745 | font => $FONT_FIXED, |
1712 | fontsize => $::CFG->{log_fontsize}, |
1746 | fontsize => $::CFG->{log_fontsize}, |
1713 | indent => -4, |
1747 | indent => -4, |
1714 | can_hover => 1, |
1748 | can_hover => 1, |
1715 | can_events => 1, |
1749 | can_events => 1, |
|
|
1750 | max_par => $CFG->{logview_max_par}, |
1716 | 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.", |
1717 | ; |
1752 | ; |
1718 | |
1753 | |
1719 | $SETUP_DIALOG = new CFPlus::UI::Toplevel |
1754 | $SETUP_DIALOG = new CFPlus::UI::Toplevel |
1720 | title => "Setup", |
1755 | title => "Setup", |
1721 | name => "setup_dialog", |
1756 | name => "setup_dialog", |
… | |
… | |
1732 | $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, |
1733 | filter => new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1768 | filter => new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1734 | |
1769 | |
1735 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1770 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1736 | "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."); |
1737 | $SETUP_NOTEBOOK->add (Pickup => autopickup_setup, |
1774 | $SETUP_NOTEBOOK->add (Pickup => autopickup_setup, |
1738 | "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."); |
1739 | $SETUP_NOTEBOOK->add (Graphics => graphics_setup, |
1776 | $SETUP_NOTEBOOK->add (Graphics => graphics_setup, |
1740 | "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."); |
1741 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1778 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
… | |
… | |
2090 | CFPlus::DB::Server::run; |
2127 | CFPlus::DB::Server::run; |
2091 | |
2128 | |
2092 | CFPlus::UI::set_layout ($::CFG->{layout}); |
2129 | CFPlus::UI::set_layout ($::CFG->{layout}); |
2093 | |
2130 | |
2094 | my %DEF_CFG = ( |
2131 | my %DEF_CFG = ( |
2095 | sdl_mode => 0, |
2132 | sdl_mode => 0, |
2096 | width => 640, |
2133 | width => 640, |
2097 | height => 480, |
2134 | height => 480, |
2098 | fullscreen => 0, |
2135 | fullscreen => 0, |
2099 | fast => 0, |
2136 | fast => 0, |
2100 | map_scale => 1, |
2137 | map_scale => 1, |
2101 | fow_enable => 1, |
2138 | fow_enable => 1, |
2102 | fow_intensity => 0.45, |
2139 | fow_intensity => 0.45, |
2103 | fow_smooth => 0, |
2140 | fow_smooth => 0, |
|
|
2141 | map_smoothing => 1, |
2104 | gui_fontsize => 1, |
2142 | gui_fontsize => 1, |
2105 | log_fontsize => 0.7, |
2143 | log_fontsize => 0.7, |
2106 | gauge_fontsize => 1, |
2144 | gauge_fontsize => 1, |
2107 | gauge_size => 0.35, |
2145 | gauge_size => 0.35, |
2108 | stat_fontsize => 0.7, |
2146 | stat_fontsize => 0.7, |
2109 | mapsize => 100, |
2147 | mapsize => 100, |
2110 | say_command => 'chat', |
2148 | say_command => 'chat', |
2111 | audio_enable => 1, |
2149 | audio_enable => 1, |
2112 | bgm_enable => 1, |
2150 | bgm_enable => 1, |
2113 | bgm_volume => 0.25, |
2151 | bgm_volume => 0.25, |
2114 | face_prefetch => 0, |
2152 | face_prefetch => 0, |
2115 | output_sync => 1, |
2153 | output_sync => 1, |
2116 | output_count => 1, |
2154 | output_count => 1, |
2117 | output_rate => "", |
2155 | output_rate => "", |
2118 | pickup => 0, |
2156 | pickup => 0, |
2119 | inv_sort => "mtime", |
2157 | inv_sort => "mtime", |
2120 | default => "profile", # default profile |
2158 | default => "profile", # default profile |
2121 | show_tips => 1, |
2159 | show_tips => 1, |
|
|
2160 | logview_max_par => 1000, |
2122 | ); |
2161 | ); |
2123 | |
2162 | |
2124 | while (my ($k, $v) = each %DEF_CFG) { |
2163 | while (my ($k, $v) = each %DEF_CFG) { |
2125 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2164 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2126 | } |
2165 | } |