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.215 by root, Fri Aug 17 21:18:01 2007 UTC vs.
Revision 1.219 by root, Tue Aug 21 00:59:34 2007 UTC

228 $channel->set_position_r ($dx, $dy, 20); 228 $channel->set_position_r ($dx, $dy, 20);
229 $chunk->play ($channel); 229 $chunk->play ($channel);
230 } 230 }
231 } else { 231 } else {
232 # sound_meta not set means data is in flight either way 232 # sound_meta not set means data is in flight either way
233 my $meta = $CONN->{sound_meta}{$face} 233 my $meta = $CONN->{face}[$face]
234 or return; 234 or return;
235 235
236 $meta->{data}
237 or return;
238
236 # if its a jingle, play it as ambient music 239 # if its a jingle, play it as ambient music
237 if ($meta->{meta}{jingle}) { 240 if ($meta->{data}{jingle}) {
238 if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue 241 if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue
239 push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue 242 push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue
240 &audio_music_push ($face); 243 &audio_music_push ($face);
241 } 244 }
242 } else { 245 } else {
243 # fetch from database 246 # fetch from database
244 CFPlus::DB::get res_data => $meta->{name}, sub { 247 CFPlus::DB::get res_data => $meta->{name}, sub {
245 my $rwops = new CFPlus::RW $_[0]; 248 my $rwops = new CFPlus::RW $_[0];
246 my $chunk = new CFPlus::MixChunk $rwops 249 my $chunk = new CFPlus::MixChunk $rwops
247 or Carp::confess "sound face " . (JSON::XS::to_json $meta) . " unloadable: " . CFPlus::Mix_GetError; 250 or Carp::confess "sound face " . (JSON::XS::to_json $meta) . " unloadable: " . CFPlus::Mix_GetError;
248 $chunk->volume (($meta->{meta}{volume} || 1) * 128); 251 $chunk->volume (($meta->{data}{volume} || 1) * 128);
249 $AUDIO_CHUNK{$face} = $chunk; 252 $AUDIO_CHUNK{$face} = $chunk;
250 253
251 audio_sound_push ($face); 254 audio_sound_push ($face);
252 }; 255 };
253 } 256 }
271sub audio_music_set_meta { 274sub audio_music_set_meta {
272 my ($meta) = @_; 275 my ($meta) = @_;
273 276
274 $MUSIC_PLAYING_META = $meta; 277 $MUSIC_PLAYING_META = $meta;
275 $MUSIC_PLAYING_WIDGET->set_markup ( 278 $MUSIC_PLAYING_WIDGET->set_markup (
276 "<b>Name</b>: " . (CFPlus::asxml $meta->{meta}{name}) . "\n" 279 "<b>Name</b>: " . (CFPlus::asxml $meta->{data}{name}) . "\n"
277 . "<b>Author</b>: " . (CFPlus::asxml $meta->{meta}{author}) . "\n" 280 . "<b>Author</b>: " . (CFPlus::asxml $meta->{data}{author}) . "\n"
278 . "<b>Source</b>: " . (CFPlus::asxml $meta->{meta}{source}) . "\n" 281 . "<b>Source</b>: " . (CFPlus::asxml $meta->{data}{source}) . "\n"
279 . "<b>License</b>: " . (CFPlus::asxml $meta->{meta}{license}) 282 . "<b>License</b>: " . (CFPlus::asxml $meta->{data}{license})
280 ); 283 );
281} 284}
282 285
283sub audio_music_update_volume { 286sub audio_music_update_volume {
284 return unless $MUSIC_PLAYING_META; 287 return unless $MUSIC_PLAYING_META;
285 my $volume = $MUSIC_PLAYING_META->{meta}{volume} || 1; 288 my $volume = $MUSIC_PLAYING_META->{data}{volume} || 1;
286 my $base = $MUSIC_PLAYING_META->{meta}{jingle} ? 1 : $CFG->{bgm_volume}; 289 my $base = $MUSIC_PLAYING_META->{data}{jingle} ? 1 : $CFG->{bgm_volume};
287 CFPlus::MixMusic::volume $base * $volume * 128; 290 CFPlus::MixMusic::volume $base * $volume * 128;
288} 291}
289 292
290sub audio_music_start { 293sub audio_music_start {
291 my $meta = $MUSIC_PLAYING_META; 294 my $meta = $MUSIC_PLAYING_META;
334 $fade_out = 333; 337 $fade_out = 333;
335 } else { 338 } else {
336 return unless $CFG->{bgm_enable}; 339 return unless $CFG->{bgm_enable};
337 340
338 my @have = 341 my @have =
339 grep $_, 342 grep $_ && $_->{data},
340 map $CONN->{music_meta}{$_}, 343 map $CONN->{face}[$_],
341 @$MUSIC_WANT; 344 @$MUSIC_WANT;
342 345
343 @MUSIC_HAVE = @have 346 @MUSIC_HAVE = @have
344 if @have; 347 if @have;
345 348
769 on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } 772 on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 }
770 ); 773 );
771 774
772 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); 775 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1");
773 $table->add_at (1, $row++, new CFPlus::UI::CheckBox 776 $table->add_at (1, $row++, new CFPlus::UI::CheckBox
774 state => $CFG->{opengl11}, 777 state => $CFG->{force_opengl11},
775 tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " 778 tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in "
776 . "higher memory usage and slower performance. It will, however, help tremendously on " 779 . "higher memory usage and slower performance. It will, however, help tremendously on "
777 . "cards that claim to support a feature but fall back to software rendering. " 780 . "cards that claim to support a feature but fall back to software rendering. "
778 . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, " 781 . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, "
779 . "but cards and drivers from other vendors (ATI) are often just as bad. <b>If you " 782 . "but cards and drivers from other vendors (ATI) are often just as bad. <b>If you "
780 . "experience extremely low framerates and your card should do better, try this option.</b>", 783 . "experience extremely low framerates and your card should do better, try this option.</b>",
781 on_changed => sub { my ($self, $value) = @_; $CFG->{opengl11} = $value; 0 } 784 on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 }
785 );
786
787 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Compress Textures");
788 $table->add_at (1, $row++, new CFPlus::UI::CheckBox
789 state => $CFG->{texture_compression},
790 tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but "
791 . "will save a lot of memory and increase performance. The compression algorithm "
792 . "can differ form card to card, so your mileage may vary. This setting is ignored in "
793 . "forced OpenGL 1.1 mode.",
794 on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 }
782 ); 795 );
783 796
784 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); 797 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly");
785 $table->add_at (1, $row++, new CFPlus::UI::CheckBox 798 $table->add_at (1, $row++, new CFPlus::UI::CheckBox
786 state => $CFG->{fast}, 799 state => $CFG->{fast},
908 expand => 1, state => $CFG->{bgm_enable}, 921 expand => 1, state => $CFG->{bgm_enable},
909 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", 922 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.",
910 on_changed => sub { 923 on_changed => sub {
911 $CFG->{bgm_enable} = $_[1]; 924 $CFG->{bgm_enable} = $_[1];
912 $CONN->update_fx_want if $CONN; 925 $CONN->update_fx_want if $CONN;
926 audio_music_push;
913 0 927 0
914 } 928 }
915 ); 929 );
916 $table->add_at (2, $row++, new CFPlus::UI::Slider 930 $table->add_at (2, $row++, new CFPlus::UI::Slider
917 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], 931 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128],
1641} 1655}
1642 1656
1643sub add_license { 1657sub add_license {
1644 my ($meta) = @_; 1658 my ($meta) = @_;
1645 1659
1646 $meta = $meta->{meta} 1660 $meta = $meta->{data}
1647 or return; 1661 or return;
1648 1662
1649 $meta->{license} || $meta->{author} || $meta->{source} 1663 $meta->{license} || $meta->{author} || $meta->{source}
1650 or return; 1664 or return;
1651 1665
2189 CFPlus::DB::Server::run; 2203 CFPlus::DB::Server::run;
2190 2204
2191 CFPlus::UI::set_layout ($::CFG->{layout}); 2205 CFPlus::UI::set_layout ($::CFG->{layout});
2192 2206
2193 my %DEF_CFG = ( 2207 my %DEF_CFG = (
2194 sdl_mode => 0, 2208 sdl_mode => 0,
2195 fullscreen => 0, 2209 fullscreen => 0,
2196 fast => 0, 2210 fast => 0,
2197 opengl11 => 0, 2211 force_opengl11 => undef,
2212 texture_compression => 1,
2198 map_scale => 1, 2213 map_scale => 1,
2199 fow_enable => 1, 2214 fow_enable => 1,
2200 fow_intensity => 0, 2215 fow_intensity => 0,
2201 map_smoothing => 1, 2216 map_smoothing => 1,
2202 gui_fontsize => 1, 2217 gui_fontsize => 1,
2203 log_fontsize => 0.7, 2218 log_fontsize => 0.7,
2204 gauge_fontsize => 1, 2219 gauge_fontsize => 1,
2205 gauge_size => 0.35, 2220 gauge_size => 0.35,
2206 stat_fontsize => 0.7, 2221 stat_fontsize => 0.7,
2207 mapsize => 100, 2222 mapsize => 100,
2208 audio_enable => 1, 2223 audio_enable => 1,
2209 effects_enable => 1, 2224 effects_enable => 1,
2210 effects_volume => 1, 2225 effects_volume => 1,
2211 bgm_enable => 1, 2226 bgm_enable => 1,
2212 bgm_volume => 0.5, 2227 bgm_volume => 0.5,
2213 output_sync => 1, 2228 output_sync => 1,
2214 output_count => 1, 2229 output_count => 1,
2215 output_rate => "", 2230 output_rate => "",
2216 pickup => 0, 2231 pickup => 0,
2217 inv_sort => "mtime", 2232 inv_sort => "mtime",
2218 default => "profile", # default profile 2233 default => "profile", # default profile
2219 show_tips => 1, 2234 show_tips => 1,
2220 logview_max_par => 1000, 2235 logview_max_par => 1000,
2221 ); 2236 );
2222 2237
2223 while (my ($k, $v) = each %DEF_CFG) { 2238 while (my ($k, $v) = each %DEF_CFG) {
2224 $CFG->{$k} = $v unless exists $CFG->{$k}; 2239 $CFG->{$k} = $v unless exists $CFG->{$k};
2225 } 2240 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines