1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
2 | |
2 | |
|
|
3 | # do splash-screen thingy on win32 |
3 | my $startup_done = sub { }; |
4 | my $startup_done = sub { }; |
4 | our $PANGO = "1.5.0"; |
|
|
5 | |
|
|
6 | # do splash-screen thingy on win32 |
|
|
7 | BEGIN { |
5 | BEGIN { |
8 | if (%PAR::LibCache && $^O eq "MSWin32") { |
6 | if (%PAR::LibCache && $^O eq "MSWin32") { |
9 | while (my ($filename, $zip) = each %PAR::LibCache) { |
7 | while (my ($filename, $zip) = each %PAR::LibCache) { |
10 | $zip->extractMember ("SPLASH.bmp", "$ENV{PAR_TEMP}/SPLASH.bmp"); |
8 | $zip->extractMember ("SPLASH.bmp", "$ENV{PAR_TEMP}/SPLASH.bmp"); |
11 | } |
9 | } |
… | |
… | |
30 | # do things only needed for single-binary version (par) |
28 | # do things only needed for single-binary version (par) |
31 | BEGIN { |
29 | BEGIN { |
32 | if (%PAR::LibCache) { |
30 | if (%PAR::LibCache) { |
33 | @INC = grep ref, @INC; # weed out all paths except pars loader refs |
31 | @INC = grep ref, @INC; # weed out all paths except pars loader refs |
34 | |
32 | |
35 | my $tmp = $ENV{PAR_TEMP}; |
33 | my $root = $ENV{PAR_TEMP}; |
36 | |
34 | |
37 | while (my ($filename, $zip) = each %PAR::LibCache) { |
35 | while (my ($filename, $zip) = each %PAR::LibCache) { |
38 | for ($zip->memberNames) { |
36 | for ($zip->memberNames) { |
39 | next unless /^root\/(.*)/; |
37 | next unless /^root\/(.*)/; |
40 | $zip->extractMember ($_, "$tmp/$1") |
38 | $zip->extractMember ($_, "$root/$1") |
41 | unless -e "$tmp/$1"; |
39 | unless -e "$root/$1"; |
42 | } |
40 | } |
43 | } |
41 | } |
44 | |
42 | |
45 | if ($^O eq "MSWin32") { |
43 | if ($^O eq "MSWin32") { |
46 | # relocatable |
44 | # pango is relocatable on win32 |
47 | } else { |
45 | } else { |
|
|
46 | open my $fh, "<:perlio", "$root/pangoversion" |
|
|
47 | or die "pangoversion: $!"; |
|
|
48 | my $PANGO = <$fh>; |
48 | # unix, need to patch pango rc file |
49 | # unix, need to patch pango rc file |
49 | open my $fh, "<:perlio", "$tmp/usr/lib/pango/$PANGO/module-files.d/libpango1.0-0.modules" |
50 | open my $fh, "<:perlio", "$root/usr/lib/pango/$PANGO/module-files.d/libpango1.0-0.modules" |
50 | or die "$tmp/usr/lib/$PANGO/module-files.d/libpango1.0-0.modules: $!"; |
51 | or die "$root/usr/lib/$PANGO/module-files.d/libpango1.0-0.modules: $!"; |
51 | local $/; |
52 | local $/; |
52 | my $rc = <$fh>; |
53 | my $rc = <$fh>; |
53 | $rc =~ s/^\//$tmp\//gm; # replace abs paths by relative ones |
54 | $rc =~ s/^\//$root\//gm; # replace abs paths by relative ones |
54 | |
55 | |
55 | mkdir "$tmp/pango-modules"; |
56 | mkdir "$root/pango-modules"; |
56 | open my $fh, ">:perlio", "$tmp/pango-modules/pango.modules" |
57 | open my $fh, ">:perlio", "$root/pango-modules/pango.modules" |
57 | or die "$tmp/pango-modules/pango.modules: $!"; |
58 | or die "$root/pango-modules/pango.modules: $!"; |
58 | print $fh $rc; |
59 | print $fh $rc; |
59 | |
60 | |
60 | $ENV{PANGO_RC_FILE} = "$tmp/pango.rc"; |
61 | $ENV{PANGO_RC_FILE} = "$root/pango.rc"; |
61 | open my $fh, ">:perlio", $ENV{PANGO_RC_FILE} |
62 | open my $fh, ">:perlio", $ENV{PANGO_RC_FILE} |
62 | or die "$ENV{PANGO_RC_FILE}: $!"; |
63 | or die "$ENV{PANGO_RC_FILE}: $!"; |
63 | print $fh "[Pango]\nModuleFiles = $tmp/pango-modules\n"; |
64 | print $fh "[Pango]\nModuleFiles = $root/pango-modules\n"; |
64 | } |
65 | } |
65 | |
66 | |
66 | unshift @INC, $tmp; |
67 | unshift @INC, $root; |
67 | } |
68 | } |
68 | } |
69 | } |
69 | |
70 | |
70 | # need to do it again because that pile of garbage called PAR nukes it before main |
71 | # need to do it again because that pile of garbage called PAR nukes it before main |
71 | unshift @INC, $ENV{PAR_TEMP} |
72 | unshift @INC, $ENV{PAR_TEMP} |
… | |
… | |
86 | use CFPlus::DB; |
87 | use CFPlus::DB; |
87 | use CFPlus::UI; |
88 | use CFPlus::UI; |
88 | use CFPlus::UI::Canvas; |
89 | use CFPlus::UI::Canvas; |
89 | use CFPlus::UI::Inventory; |
90 | use CFPlus::UI::Inventory; |
90 | use CFPlus::UI::SpellList; |
91 | use CFPlus::UI::SpellList; |
|
|
92 | use CFPlus::UI::Dockable; |
91 | use CFPlus::UI::MessageWindow; |
93 | use CFPlus::UI::MessageWindow; |
|
|
94 | use CFPlus::UI::ChatView; |
92 | use CFPlus::Pod; |
95 | use CFPlus::Pod; |
93 | use CFPlus::MapWidget; |
96 | use CFPlus::MapWidget; |
94 | use CFPlus::Macro; |
97 | use CFPlus::Macro; |
95 | |
98 | |
96 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
99 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
… | |
… | |
139 | our $SERVER_INFO; |
142 | our $SERVER_INFO; |
140 | |
143 | |
141 | our $SETUP_DIALOG; |
144 | our $SETUP_DIALOG; |
142 | our $SETUP_NOTEBOOK; |
145 | our $SETUP_NOTEBOOK; |
143 | our $SETUP_SERVER; |
146 | our $SETUP_SERVER; |
|
|
147 | our $SETUP_LOGIN; |
144 | our $SETUP_KEYBOARD; |
148 | our $SETUP_KEYBOARD; |
145 | |
149 | |
146 | our $PL_NOTEBOOK; |
150 | our $PL_NOTEBOOK; |
147 | our $PL_WINDOW; |
151 | our $PL_WINDOW; |
148 | |
152 | |
… | |
… | |
182 | sub debug { |
186 | sub debug { |
183 | $DEBUG_STATUS->set_text ($_[0]); |
187 | $DEBUG_STATUS->set_text ($_[0]); |
184 | } |
188 | } |
185 | |
189 | |
186 | sub message { |
190 | sub message { |
187 | my ($para) = @_; |
|
|
188 | $MESSAGE_WINDOW->message ($para); |
191 | $MESSAGE_WINDOW->message (@_); |
189 | } |
192 | } |
190 | |
193 | |
191 | ############################################################################# |
194 | ############################################################################# |
192 | #TODO: maybe move into own audio module... |
195 | #TODO: maybe move into own audio module... |
193 | |
196 | |
… | |
… | |
406 | } |
409 | } |
407 | |
410 | |
408 | sub audio_init { |
411 | sub audio_init { |
409 | if ($CFG->{audio_enable}) { |
412 | if ($CFG->{audio_enable}) { |
410 | $ENV{MIX_EFFECTSMAXSPEED} = 1; |
413 | $ENV{MIX_EFFECTSMAXSPEED} = 1; |
411 | $SDL_MIXER = !CFPlus::Mix_OpenAudio; |
414 | $SDL_MIXER = !CFPlus::Mix_OpenAudio |
|
|
415 | $CFG->{audio_hw_frequency}, |
|
|
416 | CFPlus::MIX_DEFAULT_FORMAT, |
|
|
417 | $CFG->{audio_hw_channels}, |
|
|
418 | $CFG->{audio_hw_chunksize}; |
412 | |
419 | |
413 | unless ($SDL_MIXER) { |
420 | if ($SDL_MIXER) { |
|
|
421 | CFPlus::Mix_AllocateChannels $CFG->{audio_mix_channels}; |
|
|
422 | |
|
|
423 | audio_music_finished; |
|
|
424 | } else { |
414 | status "Unable to open sound device: there will be no sound"; |
425 | status "Unable to open sound device: there will be no sound"; |
415 | return; |
|
|
416 | } |
426 | } |
417 | |
|
|
418 | CFPlus::Mix_AllocateChannels 16; |
|
|
419 | |
|
|
420 | audio_music_finished; |
|
|
421 | } else { |
427 | } else { |
422 | undef $SDL_MIXER; |
428 | undef $SDL_MIXER; |
423 | } |
429 | } |
|
|
430 | |
|
|
431 | sub audio_tab_update; |
|
|
432 | audio_tab_update; |
424 | } |
433 | } |
425 | |
434 | |
426 | sub audio_shutdown { |
435 | sub audio_shutdown { |
427 | undef $MUSIC_PLAYER; |
436 | undef $MUSIC_PLAYER; |
428 | undef $MUSIC_PLAYING_META; |
437 | undef $MUSIC_PLAYING_META; |
… | |
… | |
718 | stop_game(); |
727 | stop_game(); |
719 | } |
728 | } |
720 | } |
729 | } |
721 | |
730 | |
722 | sub stop_game { |
731 | sub stop_game { |
723 | $LOGIN_BUTTON->set_text ("Login"); |
732 | $LOGIN_BUTTON->set_text ("Login / Register"); |
724 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
733 | $SETUP_NOTEBOOK->set_current_page ($SETUP_LOGIN); |
725 | $SETUP_DIALOG->show; |
734 | $SETUP_DIALOG->show; |
726 | $PL_WINDOW->hide; |
735 | $PL_WINDOW->hide; |
727 | $SPELL_LIST->clear_spells; |
736 | $SPELL_LIST->clear_spells; |
728 | $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN); |
737 | $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN); |
729 | |
738 | |
… | |
… | |
888 | ); |
897 | ); |
889 | |
898 | |
890 | $vbox |
899 | $vbox |
891 | } |
900 | } |
892 | |
901 | |
|
|
902 | our $AUDIO_HW_CHUNKSIZE; |
|
|
903 | our $AUDIO_INFO; |
|
|
904 | |
|
|
905 | sub audio_tab_update { |
|
|
906 | my ($freq, $format, $chans) = CFPlus::Mix_QuerySpec; |
|
|
907 | |
|
|
908 | $AUDIO_HW_CHUNKSIZE->set_options ([ |
|
|
909 | [0, "default", "Use System Default"], |
|
|
910 | map { |
|
|
911 | my $ms = sprintf "%dms", 1000 * $_ / ($CFG->{audio_hw_frequency} || 22050); |
|
|
912 | [$_, $ms, "$ms ($_ samples)"], |
|
|
913 | } 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 |
|
|
914 | ]); |
|
|
915 | |
|
|
916 | my $text = !$freq |
|
|
917 | ? "audio is off" |
|
|
918 | : "audio is enabled\n" |
|
|
919 | . "frequency (Hz): $freq\n" |
|
|
920 | . "channels: $chans"; |
|
|
921 | |
|
|
922 | $AUDIO_INFO->set_text ($text); |
|
|
923 | } |
|
|
924 | |
893 | sub audio_setup { |
925 | sub audio_setup { |
894 | my $vbox = new CFPlus::UI::VBox; |
926 | my $vbox = new CFPlus::UI::VBox; |
895 | |
927 | |
896 | $vbox->add (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 0, 1]); |
928 | $vbox->add (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 0, 1]); |
897 | |
929 | |
… | |
… | |
899 | |
931 | |
900 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
932 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
901 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
933 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
902 | state => $CFG->{audio_enable}, |
934 | state => $CFG->{audio_enable}, |
903 | tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
935 | tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
904 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 0 } |
936 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } |
905 | ); |
937 | ); |
906 | # $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
|
|
907 | # $table->add_at (1, 8, new CFPlus::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub { |
|
|
908 | # $CFG->{effects_volume} = $_[1]; |
|
|
909 | # }); |
|
|
910 | |
938 | |
911 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Sound Effects"); |
939 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Sound Effects"); |
912 | $table->add_at (1, $row, new CFPlus::UI::CheckBox |
940 | $table->add_at (1, $row, new CFPlus::UI::CheckBox |
913 | expand => 1, state => $CFG->{effects_enable}, |
941 | expand => 1, state => $CFG->{effects_enable}, |
914 | tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.", |
942 | tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.", |
915 | on_changed => sub { |
943 | on_changed => sub { |
916 | $CFG->{effects_enable} = $_[1]; |
944 | $CFG->{effects_enable} = $_[1]; |
917 | $CONN->update_fx_want if $CONN; |
945 | $CONN->update_fx_want if $CONN; |
918 | 0 |
946 | 1 |
919 | } |
947 | } |
920 | ); |
948 | ); |
921 | $table->add_at (2, $row++, new CFPlus::UI::Slider |
949 | $table->add_at (2, $row++, new CFPlus::UI::Slider |
922 | expand => 1, range => [$CFG->{effects_volume}, 0, 1, 0, 1/128], |
950 | expand => 1, range => [$CFG->{effects_volume}, 0, 1, 0, 1/128], |
923 | tooltip => "The relative volume of sound effects. Best audio quality is achieved if this " |
951 | tooltip => "The relative volume of sound effects. Best audio quality is achieved if this " |
924 | . "is set highest (rightmost) and you use your operating system volume setting. Changes are instant.", |
952 | . "is set highest (rightmost) and you use your operating system volume setting. Changes are instant.", |
925 | on_changed => sub { $CFG->{effects_volume} = $_[1]; 0 } |
953 | on_changed => sub { $CFG->{effects_volume} = $_[1]; 1 } |
926 | ); |
954 | ); |
927 | |
955 | |
928 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Background Music"); |
956 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Background Music"); |
929 | $table->add_at (1, $row, new CFPlus::UI::CheckBox |
957 | $table->add_at (1, $row, new CFPlus::UI::CheckBox |
930 | expand => 1, state => $CFG->{bgm_enable}, |
958 | expand => 1, state => $CFG->{bgm_enable}, |
931 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
959 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
932 | on_changed => sub { |
960 | on_changed => sub { |
933 | $CFG->{bgm_enable} = $_[1]; |
961 | $CFG->{bgm_enable} = $_[1]; |
934 | $CONN->update_fx_want if $CONN; |
962 | $CONN->update_fx_want if $CONN; |
935 | audio_music_push; |
963 | audio_music_push; |
936 | 0 |
964 | 1 |
937 | } |
965 | } |
938 | ); |
966 | ); |
939 | $table->add_at (2, $row++, new CFPlus::UI::Slider |
967 | $table->add_at (2, $row++, new CFPlus::UI::Slider |
940 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
968 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
941 | tooltip => "The volume of the background music. Changes are instant.", |
969 | tooltip => "The volume of the background music. Changes are instant.", |
942 | on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } |
970 | on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } |
|
|
971 | ); |
|
|
972 | |
|
|
973 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Frequency"); |
|
|
974 | $table->add_at (1, $row++, new CFPlus::UI::Selector |
|
|
975 | c_colspan => 2, expand => 1, |
|
|
976 | value => $CFG->{audio_hw_frequency}, |
|
|
977 | options => [ |
|
|
978 | [ 0, "default" , "Use System Default"], |
|
|
979 | [11025, "11 kHz" , "11kHz (low quality)"], |
|
|
980 | [22050, "22 kHz" , "22kHz (reduced quality)"], |
|
|
981 | [44100, "44.1 kHz", "44.1kHz (cd quality)"], |
|
|
982 | [48000, "48 kHz" , "48kHz (studio quality)"], |
|
|
983 | ], |
|
|
984 | tooltip => "The sampling frequency to use. Higher sounds better, but also more cpu-intensive and might cause stuttering.", |
|
|
985 | on_changed => sub { |
|
|
986 | $CFG->{audio_hw_frequency} = $_[1]; |
|
|
987 | audio_tab_update; |
|
|
988 | 1 |
|
|
989 | } |
|
|
990 | ); |
|
|
991 | |
|
|
992 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Channels"); |
|
|
993 | $table->add_at (1, $row++, new CFPlus::UI::Selector |
|
|
994 | c_colspan => 2, expand => 1, |
|
|
995 | value => $CFG->{audio_hw_channels}, |
|
|
996 | options => [ |
|
|
997 | [0, "default" , "Use System Default"], |
|
|
998 | [1, "Mono" , "Mono (single channel, low quality)"], |
|
|
999 | [2, "Stereo" , "Stereo (dual channe, standard quality)"], |
|
|
1000 | [4, "4 Ch Surround", "4 Channel Surround Sound (3d sound, high quality)"], |
|
|
1001 | [6, "6 Ch Surround", "6 Channel Surround Sound (3d sound + center + lfe)"], |
|
|
1002 | ], |
|
|
1003 | tooltip => "The number of independent sound channels to use. Higher sounds better, but also more cpu-intensive and might cause stuttering.", |
|
|
1004 | on_changed => sub { |
|
|
1005 | $CFG->{audio_hw_channels} = $_[1]; |
|
|
1006 | audio_tab_update; |
|
|
1007 | 1 |
|
|
1008 | } |
|
|
1009 | ); |
|
|
1010 | |
|
|
1011 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Latency"); |
|
|
1012 | $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new CFPlus::UI::Selector |
|
|
1013 | c_colspan => 2, expand => 1, |
|
|
1014 | value => $CFG->{audio_hw_chunksize}, |
|
|
1015 | tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " |
|
|
1016 | . "is stuttering, increase this value. Values of 50-100ms are optimal.", |
|
|
1017 | on_changed => sub { |
|
|
1018 | $CFG->{audio_hw_chunksize} = $_[1]; |
|
|
1019 | audio_tab_update; |
|
|
1020 | 1 |
|
|
1021 | } |
|
|
1022 | ); |
|
|
1023 | |
|
|
1024 | # should really be a slider |
|
|
1025 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Mixer Voices"); |
|
|
1026 | $table->add_at (1, $row++, new CFPlus::UI::ValSlider |
|
|
1027 | c_colspan => 2, expand => 1, |
|
|
1028 | tooltip => "The number of simultaneous sound effects possible. Higher is better, but also more cpu-intensive and might cause stuttering.", |
|
|
1029 | range => [$::CFG->{audio_mix_channels}, 4, 32, 0, 1], |
|
|
1030 | template => ">= 99", |
|
|
1031 | on_changed => sub { |
|
|
1032 | my ($slider, $value) = @_; |
|
|
1033 | |
|
|
1034 | $CFG->{audio_mix_channels} = $value |
|
|
1035 | if $value; |
|
|
1036 | 1; |
|
|
1037 | } |
943 | ); |
1038 | ); |
944 | |
1039 | |
945 | $table->add_at (1, $row++, new CFPlus::UI::Button |
1040 | $table->add_at (1, $row++, new CFPlus::UI::Button |
946 | c_colspan => 2, expand => 1, align => 0, text => "Apply", |
1041 | c_colspan => 2, expand => 1, align => 0, text => "Apply", |
947 | tooltip => "Apply the audio settings", |
1042 | tooltip => "Apply the audio settings", |
… | |
… | |
949 | audio_shutdown (); |
1044 | audio_shutdown (); |
950 | audio_init (); |
1045 | audio_init (); |
951 | 0 |
1046 | 0 |
952 | } |
1047 | } |
953 | ); |
1048 | ); |
|
|
1049 | |
|
|
1050 | $vbox->add (new CFPlus::UI::FancyFrame |
|
|
1051 | expand => 1, |
|
|
1052 | label => "Audio Info", |
|
|
1053 | child => ($AUDIO_INFO = new CFPlus::UI::Label ellipsise => 0), |
|
|
1054 | ); |
|
|
1055 | |
|
|
1056 | audio_tab_update; |
954 | |
1057 | |
955 | $vbox |
1058 | $vbox |
956 | } |
1059 | } |
957 | |
1060 | |
958 | sub set_gauge_window_fontsize { |
1061 | sub set_gauge_window_fontsize { |
… | |
… | |
1345 | ; |
1448 | ; |
1346 | |
1449 | |
1347 | $dialog |
1450 | $dialog |
1348 | } |
1451 | } |
1349 | |
1452 | |
1350 | sub server_setup { |
1453 | sub login_setup { |
1351 | my $vbox = new CFPlus::UI::VBox; |
1454 | my $vbox = new CFPlus::UI::VBox; |
1352 | |
1455 | |
1353 | $vbox->add (new CFPlus::UI::FancyFrame |
1456 | $vbox->add (new CFPlus::UI::FancyFrame |
1354 | label => "Connection Settings", |
1457 | label => "Login Settings", |
1355 | 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]), |
1356 | ); |
1459 | ); |
1357 | $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"); |
1358 | |
1461 | |
1359 | { |
1462 | { |
… | |
… | |
1394 | hidden => 1, |
1497 | hidden => 1, |
1395 | tooltip => "The password for your character", |
1498 | tooltip => "The password for your character", |
1396 | 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 } |
1397 | ); |
1500 | ); |
1398 | |
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 | |
1399 | $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"); |
1400 | $table->add_at (1, 7, new CFPlus::UI::Slider |
1526 | $table->add_at (1, 1, new CFPlus::UI::Slider |
1401 | force_w => 100, |
1527 | force_w => 100, |
1402 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1528 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1403 | 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. " |
1404 | . "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, " |
1405 | . "but you also increase bandwidth requirements and latency. " |
1531 | . "but you also increase bandwidth requirements and latency. " |
1406 | . "This option is only used once at log-in.", |
1532 | . "This option is only used once at log-in.", |
1407 | 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 }, |
1408 | ); |
1534 | ); |
1409 | |
1535 | |
1410 | $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"); |
1411 | $table->add_at (1, 8, new CFPlus::UI::Entry |
1537 | $table->add_at (1, 2, new CFPlus::UI::Entry |
1412 | text => $CFG->{output_rate}, |
1538 | text => $CFG->{output_rate}, |
1413 | 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 " |
1414 | . "when sending data. When 0 or unset, the server " |
1540 | . "when sending data. When 0 or unset, the server " |
1415 | . "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 " |
1416 | . "dynamically find an optimal rate, so adjust this only when necessary.", |
1542 | . "dynamically find an optimal rate, so adjust this only when necessary.", |
1417 | on_changed => sub { $CFG->{output_rate} = $_[1]; 1 }, |
1543 | on_changed => sub { $CFG->{output_rate} = $_[1]; 1 }, |
1418 | ); |
1544 | ); |
1419 | |
1545 | |
1420 | $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"); |
1421 | $table->add_at (1, 9, new CFPlus::UI::Entry |
1547 | $table->add_at (1, 3, new CFPlus::UI::Entry |
1422 | text => $CFG->{output_count}, |
1548 | text => $CFG->{output_count}, |
1423 | 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.", |
1424 | on_changed => sub { $CFG->{output_count} = $_[1]; 1 }, |
1550 | on_changed => sub { $CFG->{output_count} = $_[1]; 1 }, |
1425 | ); |
1551 | ); |
1426 | |
1552 | |
1427 | $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"); |
1428 | $table->add_at (1, 10, new CFPlus::UI::Entry |
1554 | $table->add_at (1, 4, new CFPlus::UI::Entry |
1429 | text => $CFG->{output_sync}, |
1555 | text => $CFG->{output_sync}, |
1430 | 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.", |
1431 | on_changed => sub { $CFG->{output_sync} = $_[1]; 1 }, |
1557 | on_changed => sub { $CFG->{output_sync} = $_[1]; 1 }, |
1432 | ); |
|
|
1433 | |
|
|
1434 | $table->add_at (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button |
|
|
1435 | expand => 1, |
|
|
1436 | align => 0, |
|
|
1437 | text => "Login", |
|
|
1438 | on_activate => sub { |
|
|
1439 | $CONN ? stop_game |
|
|
1440 | : start_game; |
|
|
1441 | 1 |
|
|
1442 | }, |
|
|
1443 | ); |
1558 | ); |
1444 | |
1559 | |
1445 | $vbox->add (new CFPlus::UI::FancyFrame |
1560 | $vbox->add (new CFPlus::UI::FancyFrame |
1446 | label => "Server Info", |
1561 | label => "Server Info", |
1447 | child => ($SERVER_INFO = new CFPlus::UI::Label ellipsise => 0), |
1562 | child => ($SERVER_INFO = new CFPlus::UI::Label ellipsise => 0), |
… | |
… | |
2070 | $MESSAGE_WINDOW = new CFPlus::UI::MessageWindow; |
2185 | $MESSAGE_WINDOW = new CFPlus::UI::MessageWindow; |
2071 | |
2186 | |
2072 | $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, |
2073 | filter => new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2188 | filter => new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2074 | |
2189 | |
|
|
2190 | $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, |
|
|
2191 | "Configure the server to play on, your username and password."); |
2075 | $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, |
2192 | $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, |
2076 | "Configure the server to play on, your username, password and other server-related options."); |
2193 | "Configure other server related options."); |
2077 | $SETUP_NOTEBOOK->add_tab (Client => client_setup, |
2194 | $SETUP_NOTEBOOK->add_tab (Client => client_setup, |
2078 | "Configure various client-specific settings."); |
2195 | "Configure various client-specific settings."); |
2079 | $SETUP_NOTEBOOK->add_tab (Graphics => graphics_setup, |
2196 | $SETUP_NOTEBOOK->add_tab (Graphics => graphics_setup, |
2080 | "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."); |
2081 | $SETUP_NOTEBOOK->add_tab (Audio => audio_setup, |
2198 | $SETUP_NOTEBOOK->add_tab (Audio => audio_setup, |
… | |
… | |
2251 | gauge_fontsize => 1, |
2368 | gauge_fontsize => 1, |
2252 | gauge_size => 0.35, |
2369 | gauge_size => 0.35, |
2253 | stat_fontsize => 0.7, |
2370 | stat_fontsize => 0.7, |
2254 | mapsize => 100, |
2371 | mapsize => 100, |
2255 | audio_enable => 1, |
2372 | audio_enable => 1, |
|
|
2373 | audio_hw_channels => 0, |
|
|
2374 | audio_hw_frequency => 0, |
|
|
2375 | audio_hw_chunksize => 0, |
|
|
2376 | audio_mix_channels => 8, |
2256 | effects_enable => 1, |
2377 | effects_enable => 1, |
2257 | effects_volume => 1, |
2378 | effects_volume => 1, |
2258 | bgm_enable => 1, |
2379 | bgm_enable => 1, |
2259 | bgm_volume => 0.5, |
2380 | bgm_volume => 0.5, |
2260 | output_sync => 1, |
2381 | output_sync => 1, |