… | |
… | |
142 | our $SERVER_INFO; |
142 | our $SERVER_INFO; |
143 | |
143 | |
144 | our $SETUP_DIALOG; |
144 | our $SETUP_DIALOG; |
145 | our $SETUP_NOTEBOOK; |
145 | our $SETUP_NOTEBOOK; |
146 | our $SETUP_SERVER; |
146 | our $SETUP_SERVER; |
|
|
147 | our $SETUP_LOGIN; |
147 | our $SETUP_KEYBOARD; |
148 | our $SETUP_KEYBOARD; |
148 | |
149 | |
149 | our $PL_NOTEBOOK; |
150 | our $PL_NOTEBOOK; |
150 | our $PL_WINDOW; |
151 | our $PL_WINDOW; |
151 | |
152 | |
… | |
… | |
726 | stop_game(); |
727 | stop_game(); |
727 | } |
728 | } |
728 | } |
729 | } |
729 | |
730 | |
730 | sub stop_game { |
731 | sub stop_game { |
731 | $LOGIN_BUTTON->set_text ("Login"); |
732 | $LOGIN_BUTTON->set_text ("Login / Register"); |
732 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
733 | $SETUP_NOTEBOOK->set_current_page ($SETUP_LOGIN); |
733 | $SETUP_DIALOG->show; |
734 | $SETUP_DIALOG->show; |
734 | $PL_WINDOW->hide; |
735 | $PL_WINDOW->hide; |
735 | $SPELL_LIST->clear_spells; |
736 | $SPELL_LIST->clear_spells; |
736 | $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN); |
737 | $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN); |
737 | |
738 | |
… | |
… | |
903 | |
904 | |
904 | sub audio_tab_update { |
905 | sub audio_tab_update { |
905 | my ($freq, $format, $chans) = CFPlus::Mix_QuerySpec; |
906 | my ($freq, $format, $chans) = CFPlus::Mix_QuerySpec; |
906 | |
907 | |
907 | $AUDIO_HW_CHUNKSIZE->set_options ([ |
908 | $AUDIO_HW_CHUNKSIZE->set_options ([ |
908 | [0, "default", "system default"], |
909 | [0, "default", "Use System Default"], |
909 | map { |
910 | map { |
910 | my $ms = sprintf "%dms", 1000 * $_ / $CFG->{audio_hw_frequency}; |
911 | my $ms = sprintf "%dms", 1000 * $_ / ($CFG->{audio_hw_frequency} || 22050); |
911 | [$_, $ms, "$ms ($_ samples)"], |
912 | [$_, $ms, "$ms ($_ samples)"], |
912 | } 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 |
913 | } 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 |
913 | ]); |
914 | ]); |
914 | |
915 | |
915 | my $text = !$freq |
916 | my $text = !$freq |
916 | ? "audio is off" |
917 | ? "audio is off" |
|
|
918 | : "audio is enabled\n" |
917 | : "Frequency (Hz): $freq\n" |
919 | . "frequency (Hz): $freq\n" |
918 | . "Channels: $chans"; |
920 | . "channels: $chans"; |
919 | |
921 | |
920 | $AUDIO_INFO->set_text ($text); |
922 | $AUDIO_INFO->set_text ($text); |
921 | } |
923 | } |
922 | |
924 | |
923 | sub audio_setup { |
925 | sub audio_setup { |
… | |
… | |
971 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Frequency"); |
973 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Frequency"); |
972 | $table->add_at (1, $row++, new CFPlus::UI::Selector |
974 | $table->add_at (1, $row++, new CFPlus::UI::Selector |
973 | c_colspan => 2, expand => 1, |
975 | c_colspan => 2, expand => 1, |
974 | value => $CFG->{audio_hw_frequency}, |
976 | value => $CFG->{audio_hw_frequency}, |
975 | options => [ |
977 | options => [ |
|
|
978 | [ 0, "default" , "Use System Default"], |
976 | [11025, "11 kHz" , "11kHz (low quality)"], |
979 | [11025, "11 kHz" , "11kHz (low quality)"], |
977 | [22050, "22 kHz" , "22kHz (reduced quality)"], |
980 | [22050, "22 kHz" , "22kHz (reduced quality)"], |
978 | [44100, "44.1 kHz", "44.1kHz (cd quality)"], |
981 | [44100, "44.1 kHz", "44.1kHz (cd quality)"], |
979 | [48000, "48 kHz" , "48kHz (studio quality)"], |
982 | [48000, "48 kHz" , "48kHz (studio quality)"], |
980 | ], |
983 | ], |
… | |
… | |
989 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Channels"); |
992 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Channels"); |
990 | $table->add_at (1, $row++, new CFPlus::UI::Selector |
993 | $table->add_at (1, $row++, new CFPlus::UI::Selector |
991 | c_colspan => 2, expand => 1, |
994 | c_colspan => 2, expand => 1, |
992 | value => $CFG->{audio_hw_channels}, |
995 | value => $CFG->{audio_hw_channels}, |
993 | options => [ |
996 | options => [ |
|
|
997 | [0, "default" , "Use System Default"], |
994 | [1, "Mono" , "Mono (single channel, low quality)"], |
998 | [1, "Mono" , "Mono (single channel, low quality)"], |
995 | [2, "Stereo" , "Stereo (dual channe, standard quality)"], |
999 | [2, "Stereo" , "Stereo (dual channe, standard quality)"], |
996 | [4, "4 Ch Surround", "4 Channel Surround Sound (3d sound, high quality)"], |
1000 | [4, "4 Ch Surround", "4 Channel Surround Sound (3d sound, high quality)"], |
997 | [6, "6 Ch Surround", "6 Channel Surround Sound (3d sound + center + lfe)"], |
1001 | [6, "6 Ch Surround", "6 Channel Surround Sound (3d sound + center + lfe)"], |
998 | ], |
1002 | ], |
… | |
… | |
1009 | c_colspan => 2, expand => 1, |
1013 | c_colspan => 2, expand => 1, |
1010 | value => $CFG->{audio_hw_chunksize}, |
1014 | value => $CFG->{audio_hw_chunksize}, |
1011 | tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " |
1015 | tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " |
1012 | . "is stuttering, increase this value. Values of 50-100ms are optimal.", |
1016 | . "is stuttering, increase this value. Values of 50-100ms are optimal.", |
1013 | on_changed => sub { |
1017 | on_changed => sub { |
1014 | $CFG->{audio_hw_chunksize} = $_[1] |
1018 | $CFG->{audio_hw_chunksize} = $_[1]; |
1015 | if $_[1]; |
|
|
1016 | audio_tab_update; |
1019 | audio_tab_update; |
1017 | 1 |
1020 | 1 |
1018 | } |
1021 | } |
1019 | ); |
1022 | ); |
1020 | |
1023 | |
… | |
… | |
1445 | ; |
1448 | ; |
1446 | |
1449 | |
1447 | $dialog |
1450 | $dialog |
1448 | } |
1451 | } |
1449 | |
1452 | |
1450 | sub server_setup { |
1453 | sub login_setup { |
1451 | my $vbox = new CFPlus::UI::VBox; |
1454 | my $vbox = new CFPlus::UI::VBox; |
1452 | |
1455 | |
1453 | $vbox->add (new CFPlus::UI::FancyFrame |
1456 | $vbox->add (new CFPlus::UI::FancyFrame |
1454 | label => "Connection Settings", |
1457 | label => "Login Settings", |
1455 | child => (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]), |
1458 | child => (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]), |
1456 | ); |
1459 | ); |
1457 | $table->add_at (0, 2, new CFPlus::UI::Label valign => 0, align => 1, text => "Host:Port"); |
1460 | $table->add_at (0, 2, new CFPlus::UI::Label valign => 0, align => 1, text => "Host:Port"); |
1458 | |
1461 | |
1459 | { |
1462 | { |
… | |
… | |
1494 | hidden => 1, |
1497 | hidden => 1, |
1495 | tooltip => "The password for your character", |
1498 | tooltip => "The password for your character", |
1496 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } |
1499 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } |
1497 | ); |
1500 | ); |
1498 | |
1501 | |
|
|
1502 | $table->add_at (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button |
|
|
1503 | expand => 1, |
|
|
1504 | align => 0, |
|
|
1505 | text => "Login / Register", |
|
|
1506 | tooltip => "This button will either login to the account configured above or register a new account.", |
|
|
1507 | on_activate => sub { |
|
|
1508 | $CONN ? stop_game |
|
|
1509 | : start_game; |
|
|
1510 | 1 |
|
|
1511 | }, |
|
|
1512 | ); |
|
|
1513 | |
|
|
1514 | $vbox |
|
|
1515 | } |
|
|
1516 | |
|
|
1517 | sub server_setup { |
|
|
1518 | my $vbox = new CFPlus::UI::VBox; |
|
|
1519 | |
|
|
1520 | $vbox->add (new CFPlus::UI::FancyFrame |
|
|
1521 | label => "Connection Settings", |
|
|
1522 | child => (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]), |
|
|
1523 | ); |
|
|
1524 | |
1499 | $table->add_at (0, 7, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Size"); |
1525 | $table->add_at (0, 1, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Size"); |
1500 | $table->add_at (1, 7, new CFPlus::UI::Slider |
1526 | $table->add_at (1, 1, new CFPlus::UI::Slider |
1501 | force_w => 100, |
1527 | force_w => 100, |
1502 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1528 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1503 | tooltip => "This is the size of the portion of the map update the server sends you. " |
1529 | tooltip => "This is the size of the portion of the map update the server sends you. " |
1504 | . "If you set this to a high value you will be able to see further, " |
1530 | . "If you set this to a high value you will be able to see further, " |
1505 | . "but you also increase bandwidth requirements and latency. " |
1531 | . "but you also increase bandwidth requirements and latency. " |
1506 | . "This option is only used once at log-in.", |
1532 | . "This option is only used once at log-in.", |
1507 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 }, |
1533 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 }, |
1508 | ); |
1534 | ); |
1509 | |
1535 | |
1510 | $table->add_at (0, 8, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate"); |
1536 | $table->add_at (0, 2, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate"); |
1511 | $table->add_at (1, 8, new CFPlus::UI::Entry |
1537 | $table->add_at (1, 2, new CFPlus::UI::Entry |
1512 | text => $CFG->{output_rate}, |
1538 | text => $CFG->{output_rate}, |
1513 | tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " |
1539 | tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " |
1514 | . "when sending data. When 0 or unset, the server " |
1540 | . "when sending data. When 0 or unset, the server " |
1515 | . "default will be used, which is usually around 100kb/s. Most servers will " |
1541 | . "default will be used, which is usually around 100kb/s. Most servers will " |
1516 | . "dynamically find an optimal rate, so adjust this only when necessary.", |
1542 | . "dynamically find an optimal rate, so adjust this only when necessary.", |
1517 | on_changed => sub { $CFG->{output_rate} = $_[1]; 1 }, |
1543 | on_changed => sub { $CFG->{output_rate} = $_[1]; 1 }, |
1518 | ); |
1544 | ); |
1519 | |
1545 | |
1520 | $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count"); |
1546 | $table->add_at (0, 3, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count"); |
1521 | $table->add_at (1, 9, new CFPlus::UI::Entry |
1547 | $table->add_at (1, 3, new CFPlus::UI::Entry |
1522 | text => $CFG->{output_count}, |
1548 | text => $CFG->{output_count}, |
1523 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1549 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1524 | on_changed => sub { $CFG->{output_count} = $_[1]; 1 }, |
1550 | on_changed => sub { $CFG->{output_count} = $_[1]; 1 }, |
1525 | ); |
1551 | ); |
1526 | |
1552 | |
1527 | $table->add_at (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
1553 | $table->add_at (0, 4, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
1528 | $table->add_at (1, 10, new CFPlus::UI::Entry |
1554 | $table->add_at (1, 4, new CFPlus::UI::Entry |
1529 | text => $CFG->{output_sync}, |
1555 | text => $CFG->{output_sync}, |
1530 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1556 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1531 | on_changed => sub { $CFG->{output_sync} = $_[1]; 1 }, |
1557 | on_changed => sub { $CFG->{output_sync} = $_[1]; 1 }, |
1532 | ); |
|
|
1533 | |
|
|
1534 | $table->add_at (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button |
|
|
1535 | expand => 1, |
|
|
1536 | align => 0, |
|
|
1537 | text => "Login", |
|
|
1538 | on_activate => sub { |
|
|
1539 | $CONN ? stop_game |
|
|
1540 | : start_game; |
|
|
1541 | 1 |
|
|
1542 | }, |
|
|
1543 | ); |
1558 | ); |
1544 | |
1559 | |
1545 | $vbox->add (new CFPlus::UI::FancyFrame |
1560 | $vbox->add (new CFPlus::UI::FancyFrame |
1546 | label => "Server Info", |
1561 | label => "Server Info", |
1547 | child => ($SERVER_INFO = new CFPlus::UI::Label ellipsise => 0), |
1562 | child => ($SERVER_INFO = new CFPlus::UI::Label ellipsise => 0), |
… | |
… | |
2170 | $MESSAGE_WINDOW = new CFPlus::UI::MessageWindow; |
2185 | $MESSAGE_WINDOW = new CFPlus::UI::MessageWindow; |
2171 | |
2186 | |
2172 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFPlus::UI::Notebook expand => 1, debug => 1, |
2187 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFPlus::UI::Notebook expand => 1, debug => 1, |
2173 | filter => new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2188 | filter => new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2174 | |
2189 | |
|
|
2190 | $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, |
|
|
2191 | "Configure the server to play on, your username and password."); |
2175 | $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, |
2192 | $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, |
2176 | "Configure the server to play on, your username, password and other server-related options."); |
2193 | "Configure other server related options."); |
2177 | $SETUP_NOTEBOOK->add_tab (Client => client_setup, |
2194 | $SETUP_NOTEBOOK->add_tab (Client => client_setup, |
2178 | "Configure various client-specific settings."); |
2195 | "Configure various client-specific settings."); |
2179 | $SETUP_NOTEBOOK->add_tab (Graphics => graphics_setup, |
2196 | $SETUP_NOTEBOOK->add_tab (Graphics => graphics_setup, |
2180 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
2197 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
2181 | $SETUP_NOTEBOOK->add_tab (Audio => audio_setup, |
2198 | $SETUP_NOTEBOOK->add_tab (Audio => audio_setup, |
… | |
… | |
2351 | gauge_fontsize => 1, |
2368 | gauge_fontsize => 1, |
2352 | gauge_size => 0.35, |
2369 | gauge_size => 0.35, |
2353 | stat_fontsize => 0.7, |
2370 | stat_fontsize => 0.7, |
2354 | mapsize => 100, |
2371 | mapsize => 100, |
2355 | audio_enable => 1, |
2372 | audio_enable => 1, |
2356 | audio_hw_channels => 2, |
2373 | audio_hw_channels => 0, |
2357 | audio_hw_frequency => 22050, |
2374 | audio_hw_frequency => 0, |
2358 | audio_hw_chunksize => 0, |
2375 | audio_hw_chunksize => 0, |
2359 | audio_mix_channels => 8, |
2376 | audio_mix_channels => 8, |
2360 | effects_enable => 1, |
2377 | effects_enable => 1, |
2361 | effects_volume => 1, |
2378 | effects_volume => 1, |
2362 | bgm_enable => 1, |
2379 | bgm_enable => 1, |