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.198 by root, Tue Jul 31 02:45:39 2007 UTC vs.
Revision 1.199 by root, Wed Aug 1 14:27:21 2007 UTC

211} 211}
212 212
213sub audio_sound_push($) { 213sub audio_sound_push($) {
214 my ($face) = @_; 214 my ($face) = @_;
215 215
216 $CFG->{effects_enable}
217 or return;
218
216 if (my $chunk = $AUDIO_CHUNK{$face}) { 219 if (my $chunk = $AUDIO_CHUNK{$face}) {
217 for (grep $_->[0] >= Event::time, @{(delete $AUDIO_PLAY{$face}) || []}) { 220 for (grep $_->[0] >= Event::time, @{(delete $AUDIO_PLAY{$face}) || []}) {
218 my (undef, $dx, $dy, $vol) = @$_; 221 my (undef, $dx, $dy, $vol) = @$_;
219 222
220 my $channel = CFPlus::Channel::find; 223 my $channel = CFPlus::Channel::find;
221 $channel->volume ($vol * 128 / 255); 224 $channel->volume ($vol * $CFG->{effects_volume} * 128 / 255);
222 $dx = $dx / 10 * 255; 225 $dx = $dx / 10 * 255;
223 $channel->set_panning (255 - $dx, 255 + $dx); 226 $channel->set_panning (255 - $dx, 255 + $dx);
224 227
225# my $angle = $dx ? : $dx < 0 ? 228# my $angle = $dx ? : $dx < 0 ?
226# my $distance = -$vol; 229# my $distance = -$vol;
254 257
255sub audio_sound_play { 258sub audio_sound_play {
256 my ($face, $dx, $dy, $vol) = @_; 259 my ($face, $dx, $dy, $vol) = @_;
257 260
258 $SDL_MIXER 261 $SDL_MIXER
262 or return;
263 $CFG->{effects_enable}
259 or return; 264 or return;
260 265
261 my $queue = $AUDIO_PLAY{$face} ||= []; 266 my $queue = $AUDIO_PLAY{$face} ||= [];
262 push @$queue, [Event::time + 0.2, $dx, $dy, $vol]; # delay sound by max. 0.2s 267 push @$queue, [Event::time + 0.2, $dx, $dy, $vol]; # delay sound by max. 0.2s
263 audio_sound_push $face 268 audio_sound_push $face
839} 844}
840 845
841sub audio_setup { 846sub audio_setup {
842 my $vbox = new CFPlus::UI::VBox; 847 my $vbox = new CFPlus::UI::VBox;
843 848
844 $vbox->add (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]); 849 $vbox->add (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 0, 1]);
845 850
846 my $row = 0; 851 my $row = 0;
847 852
848 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Audio Enable"); 853 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Audio Enable");
849 $table->add_at (1, $row++, new CFPlus::UI::CheckBox 854 $table->add_at (1, $row++, new CFPlus::UI::CheckBox
853 ); 858 );
854# $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume"); 859# $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume");
855# $table->add_at (1, 8, new CFPlus::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub { 860# $table->add_at (1, 8, new CFPlus::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub {
856# $CFG->{effects_volume} = $_[1]; 861# $CFG->{effects_volume} = $_[1];
857# }); 862# });
863
864 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume");
865 $table->add_at (1, $row, new CFPlus::UI::CheckBox
866 expand => 1, state => $CFG->{effects_enable},
867 tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.",
868 on_changed => sub { $CFG->{effects_enable} = $_[1]; 0 }
869 );
870 $table->add_at (2, $row++, new CFPlus::UI::Slider
871 expand => 1, range => [$CFG->{effects_volume}, 0, 1, 0, 1/128],
872 tooltip => "The relative volume of sound effects. Best audio quality is achieved if this "
873 . "is set highest and you use your operating system volume setting. Changes are instant.",
874 on_changed => sub { $CFG->{effects_volume} = $_[1]; 0 }
875 );
876
858 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Background Music"); 877 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Background Music");
859 $table->add_at (1, $row++, my $hbox = new CFPlus::UI::HBox); 878 $table->add_at (1, $row, new CFPlus::UI::CheckBox
860 $hbox->add (new CFPlus::UI::CheckBox
861 expand => 1, state => $CFG->{bgm_enable}, 879 expand => 1, state => $CFG->{bgm_enable},
862 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", 880 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.",
863 on_changed => sub { $CFG->{bgm_enable} = $_[1]; 0 } 881 on_changed => sub { $CFG->{bgm_enable} = $_[1]; 0 }
864 ); 882 );
865 $hbox->add (new CFPlus::UI::Slider 883 $table->add_at (2, $row++, new CFPlus::UI::Slider
866 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], 884 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128],
867 tooltip => "The volume of the background music. Changes are instant.", 885 tooltip => "The volume of the background music. Changes are instant.",
868 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } 886 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 }
869 ); 887 );
870 888
871 $table->add_at (1, $row++, new CFPlus::UI::Button 889 $table->add_at (1, $row++, new CFPlus::UI::Button
872 expand => 1, align => 0, text => "Apply", 890 c_colspan => 2, expand => 1, align => 0, text => "Apply",
873 tooltip => "Apply the audio settings", 891 tooltip => "Apply the audio settings",
874 on_activate => sub { 892 on_activate => sub {
875 audio_shutdown (); 893 audio_shutdown ();
876 audio_init (); 894 audio_init ();
877 0 895 0
948 $table->add_at (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { &CFPlus::debug() } ); 966 $table->add_at (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { &CFPlus::debug() } );
949 967
950 $table->add_at (0, 5, new CFPlus::UI::TextEdit text => "line1\0152\0153");#d# 968 $table->add_at (0, 5, new CFPlus::UI::TextEdit text => "line1\0152\0153");#d#
951 969
952 $table->add_at (7,7, my $t = new CFPlus::UI::Table expand => 0); 970 $table->add_at (7,7, my $t = new CFPlus::UI::Table expand => 0);
953 $t->add_at (0,0, new CFPlus::UI::Label text => "a a a a", rowspan => 1, colspan => 2); 971 $t->add_at (0,0, new CFPlus::UI::Label text => "a a a a", c_rowspan => 1, c_colspan => 2);
954 $t->add_at (2,0, new CFPlus::UI::Label text => "b\nb", rowspan => 2, colspan => 1); 972 $t->add_at (2,0, new CFPlus::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1);
955 $t->add_at (1,2, new CFPlus::UI::Label text => "c c c c", rowspan => 1, colspan => 2); 973 $t->add_at (1,2, new CFPlus::UI::Label text => "c c c c", c_rowspan => 1, c_colspan => 2);
956 $t->add_at (0,1, new CFPlus::UI::Label text => "d\nd", rowspan => 2, colspan => 1); 974 $t->add_at (0,1, new CFPlus::UI::Label text => "d\nd", c_rowspan => 2, c_colspan => 1);
957 $t->add_at (1,1, new CFPlus::UI::Label text => "e"); 975 $t->add_at (1,1, new CFPlus::UI::Label text => "e");
958 976
959 $table->add_at (7, 6, my $c = new CFPlus::UI::Canvas); 977 $table->add_at (7, 6, my $c = new CFPlus::UI::Canvas);
960 978
961 $c->add_items ({ 979 $c->add_items ({
2113 gauge_fontsize => 1, 2131 gauge_fontsize => 1,
2114 gauge_size => 0.35, 2132 gauge_size => 0.35,
2115 stat_fontsize => 0.7, 2133 stat_fontsize => 0.7,
2116 mapsize => 100, 2134 mapsize => 100,
2117 audio_enable => 1, 2135 audio_enable => 1,
2136 effects_enable => 1,
2137 effects_volume => 1,
2118 bgm_enable => 1, 2138 bgm_enable => 1,
2119 bgm_volume => 0.25, 2139 bgm_volume => 0.5,
2120 output_sync => 1, 2140 output_sync => 1,
2121 output_count => 1, 2141 output_count => 1,
2122 output_rate => "", 2142 output_rate => "",
2123 pickup => 0, 2143 pickup => 0,
2124 inv_sort => "mtime", 2144 inv_sort => "mtime",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines