--- deliantra/Deliantra-Client/bin/cfplus 2007/08/12 13:09:44 1.212 +++ deliantra/Deliantra-Client/bin/cfplus 2007/08/21 00:59:34 1.219 @@ -169,9 +169,7 @@ our $INV; our $INVR; -our $INV_RIGHT_HB; - -our $PICKUP_CFG; +our $INVR_HB; ############################################################################# @@ -232,11 +230,14 @@ } } else { # sound_meta not set means data is in flight either way - my $meta = $CONN->{sound_meta}{$face} + my $meta = $CONN->{face}[$face] + or return; + + $meta->{data} or return; # if its a jingle, play it as ambient music - if ($meta->{meta}{jingle}) { + if ($meta->{data}{jingle}) { if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue &audio_music_push ($face); @@ -247,7 +248,7 @@ my $rwops = new CFPlus::RW $_[0]; my $chunk = new CFPlus::MixChunk $rwops or Carp::confess "sound face " . (JSON::XS::to_json $meta) . " unloadable: " . CFPlus::Mix_GetError; - $chunk->volume (($meta->{meta}{volume} || 1) * 128); + $chunk->volume (($meta->{data}{volume} || 1) * 128); $AUDIO_CHUNK{$face} = $chunk; audio_sound_push ($face); @@ -275,17 +276,17 @@ $MUSIC_PLAYING_META = $meta; $MUSIC_PLAYING_WIDGET->set_markup ( - "Name: " . (CFPlus::asxml $meta->{meta}{name}) . "\n" - . "Author: " . (CFPlus::asxml $meta->{meta}{author}) . "\n" - . "Source: " . (CFPlus::asxml $meta->{meta}{source}) . "\n" - . "License: " . (CFPlus::asxml $meta->{meta}{license}) + "Name: " . (CFPlus::asxml $meta->{data}{name}) . "\n" + . "Author: " . (CFPlus::asxml $meta->{data}{author}) . "\n" + . "Source: " . (CFPlus::asxml $meta->{data}{source}) . "\n" + . "License: " . (CFPlus::asxml $meta->{data}{license}) ); } sub audio_music_update_volume { return unless $MUSIC_PLAYING_META; - my $volume = $MUSIC_PLAYING_META->{meta}{volume} || 1; - my $base = $MUSIC_PLAYING_META->{meta}{jingle} ? 1 : $CFG->{bgm_volume}; + my $volume = $MUSIC_PLAYING_META->{data}{volume} || 1; + my $base = $MUSIC_PLAYING_META->{data}{jingle} ? 1 : $CFG->{bgm_volume}; CFPlus::MixMusic::volume $base * $volume * 128; } @@ -338,8 +339,8 @@ return unless $CFG->{bgm_enable}; my @have = - grep $_, - map $CONN->{music_meta}{$_}, + grep $_ && $_->{data}, + map $CONN->{face}[$_], @$MUSIC_WANT; @MUSIC_HAVE = @have @@ -773,14 +774,24 @@ $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); $table->add_at (1, $row++, new CFPlus::UI::CheckBox - state => $CFG->{opengl11}, + state => $CFG->{force_opengl11}, tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " . "higher memory usage and slower performance. It will, however, help tremendously on " . "cards that claim to support a feature but fall back to software rendering. " . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, " . "but cards and drivers from other vendors (ATI) are often just as bad. If you " . "experience extremely low framerates and your card should do better, try this option.", - on_changed => sub { my ($self, $value) = @_; $CFG->{opengl11} = $value; 0 } + on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 } + ); + + $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Compress Textures"); + $table->add_at (1, $row++, new CFPlus::UI::CheckBox + state => $CFG->{texture_compression}, + tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " + . "will save a lot of memory and increase performance. The compression algorithm " + . "can differ form card to card, so your mileage may vary. This setting is ignored in " + . "forced OpenGL 1.1 mode.", + on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } ); $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); @@ -912,6 +923,7 @@ on_changed => sub { $CFG->{bgm_enable} = $_[1]; $CONN->update_fx_want if $CONN; + audio_music_push; 0 } ); @@ -1612,7 +1624,7 @@ $hb->add (my $vb2 = new CFPlus::UI::VBox); - $vb2->add ($INV_RIGHT_HB = new CFPlus::UI::HBox); + $vb2->add ($INVR_HB = new CFPlus::UI::HBox); $vb2->add (my $sw2 = new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); $sw2->add ($INVR = new CFPlus::UI::Inventory); @@ -1645,7 +1657,7 @@ sub add_license { my ($meta) = @_; - $meta = $meta->{meta} + $meta = $meta->{data} or return; $meta->{license} || $meta->{author} || $meta->{source} @@ -1877,7 +1889,7 @@ $hb->add (new CFPlus::UI::Button text => "Quit anyway", expand => 1, - on_activate => sub { exit }, + on_activate => sub { Event::unloop_all }, ); } @@ -2081,7 +2093,7 @@ if ($CONN) { open_quit_dialog; } else { - exit; + Event::unloop_all; } 0 }, @@ -2089,6 +2101,7 @@ $BUTTONBAR->show; $SETUP_DIALOG->show; + $MESSAGE_WINDOW->show; } $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); @@ -2192,33 +2205,34 @@ CFPlus::UI::set_layout ($::CFG->{layout}); my %DEF_CFG = ( - sdl_mode => 0, - fullscreen => 0, - fast => 0, - opengl11 => 0, - map_scale => 1, - fow_enable => 1, - fow_intensity => 0, - map_smoothing => 1, - gui_fontsize => 1, - log_fontsize => 0.7, - gauge_fontsize => 1, - gauge_size => 0.35, - stat_fontsize => 0.7, - mapsize => 100, - audio_enable => 1, - effects_enable => 1, - effects_volume => 1, - bgm_enable => 1, - bgm_volume => 0.5, - output_sync => 1, - output_count => 1, - output_rate => "", - pickup => 0, - inv_sort => "mtime", - default => "profile", # default profile - show_tips => 1, - logview_max_par => 1000, + sdl_mode => 0, + fullscreen => 0, + fast => 0, + force_opengl11 => undef, + texture_compression => 1, + map_scale => 1, + fow_enable => 1, + fow_intensity => 0, + map_smoothing => 1, + gui_fontsize => 1, + log_fontsize => 0.7, + gauge_fontsize => 1, + gauge_size => 0.35, + stat_fontsize => 0.7, + mapsize => 100, + audio_enable => 1, + effects_enable => 1, + effects_volume => 1, + bgm_enable => 1, + bgm_volume => 0.5, + output_sync => 1, + output_count => 1, + output_rate => "", + pickup => 0, + inv_sort => "mtime", + default => "profile", # default profile + show_tips => 1, + logview_max_par => 1000, ); while (my ($k, $v) = each %DEF_CFG) { @@ -2294,15 +2308,11 @@ show_tip_of_the_day if $CFG->{show_tips}; Event::loop; -#CFPlus::SDL_Quit; -#CFPlus::_exit 0; -END { - video_shutdown; - audio_shutdown; - CFPlus::SDL_Quit; - CFPlus::DB::Server::stop; -} +#video_shutdown; +#audio_shutdown; +CFPlus::SDL_Quit; +CFPlus::DB::Server::stop; =head1 NAME