--- deliantra/Deliantra-Client/bin/deliantra 2009/07/27 23:08:41 1.96 +++ deliantra/Deliantra-Client/bin/deliantra 2010/03/20 00:50:06 1.102 @@ -136,6 +136,8 @@ my $MAX_FPS = 60; +our $DEFAULT_SERVER = "gameserver.deliantra.net"; + our $META_SERVER = "http://metaserver.schmorp.de/current.json"; our $LAST_REFRESH; @@ -541,6 +543,11 @@ } sub audio_shutdown { + if ($SDL_MIXER) { + DC::MixMusic::halt; + DC::Mix_AllocateChannels 0; + } + undef $MUSIC_PLAYER; undef $MUSIC_PLAYING_META; undef $MUSIC_PLAYING_DATA; @@ -550,8 +557,6 @@ %AUDIO_PLAY = (); %AUDIO_CHUNK = (); - DC::MixMusic::halt; - DC::Mix_AllocateChannels 0; DC::Mix_CloseAudio if $SDL_MIXER; undef $SDL_MIXER; } @@ -832,12 +837,14 @@ sub start_game { status "logging in..."; + + my $server = $PROFILE->{host} || $DEFAULT_SERVER; + my ($host, $port) = AnyEvent::Socket::parse_hostport $server, "deliantra=13327" + or return status "$server: unable to parse server address, try an empty field."; $LOGIN_BUTTON->set_text ("Logout"); $SETUP_DIALOG->hide; - my ($host, $port) = AnyEvent::Socket::parse_hostport $PROFILE->{host}, "deliantra=13327"; - $MAP = new DC::Map; # hack to make SURE we find the IP address all right @@ -1029,6 +1036,16 @@ on_changed => sub { my ($self, $value) = @_; $CFG->{smooth_movement} = $value; 0 } ); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Smooth Transitions"); + $table->add_at (1, $row++, new DC::UI::CheckBox + state => $CFG->{smooth_transitions}, + tooltip => "Smooth Transitions tries to blend the fog of war and lighting smoothly between updates. " + . "If you have a very slow system, non-accelerated drivers or plain dislike smooth scrolling, " + . "then disable this option. Requires Smooth Movement and OpenGL Multitexturing. Changes take effect immdiately.", + on_changed => sub { my ($self, $value) = @_; $CFG->{smooth_transitions} = $value; 0 } + ); + + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Scale"); $table->add_at (1, $row++, new DC::UI::Slider range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], @@ -1052,6 +1069,21 @@ on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 } ); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Pattern"); + $table->add_at (1, $row++, new DC::UI::ImageButton + tex => $DC::MapWidget::TEX_HIDDEN[$CFG->{fow_texture}], + bg => [0.3, 0.3, 0.2], + force_w => 64, + force_h => 64, + tooltip => "Fog of War Pattern. The pattern that is overlaid over areas hidden from view. Click to cycle through various alternatives. Changes are instant.", + on_activate => sub { + my ($self) = @_; + $CFG->{fow_texture} = ($CFG->{fow_texture} + 1) % @DC::MapWidget::TEX_HIDDEN; + $self->set_texture ($DC::MapWidget::TEX_HIDDEN[$CFG->{fow_texture}]); + $MAPWIDGET->update; + } + ); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Intensity"); $table->add_at (1, $row++, new DC::UI::Slider range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], @@ -1111,7 +1143,9 @@ ? "audio is off" : "audio is enabled\n" . "frequency (Hz): $freq\n" - . "channels: $chans"; + . "channels: $chans\n" + . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n" + . "music decoders available: " . (join ", ", DC::MixMusic::decoders); $AUDIO_INFO->set_text ($text); } @@ -2567,6 +2601,8 @@ $MODE_SLIDER->emit (changed => $CFG->{sdl_mode}); $CAVEAT_LABEL->set_text ("None :)"); + $CAVEAT_LABEL->set_text ("Apple/NVIDIA Texture bug (slow)") + if $DC::OpenGL::APPLE_NVIDIA_BUG; $CAVEAT_LABEL->set_text ("Software Rendering (very slow)") unless DC::SDL_GL_GetAttribute DC::SDL_GL_ACCELERATED_VISUAL; @@ -2709,10 +2745,12 @@ force_opengl11 => undef, disable_alpha => 0, smooth_movement => 1, + smooth_transitions => 1, texture_compression => 1, map_scale => 1, fow_enable => 1, fow_intensity => 0, + fow_texture => 0, map_smoothing => 1, gui_fontsize => 1, log_fontsize => 0.7, @@ -2740,7 +2778,7 @@ map_shift_x => -24, # arbitrary map_shift_y => +24, # arbitrary ); - + while (my ($k, $v) = each %DEF_CFG) { $CFG->{$k} = $v unless exists $CFG->{$k}; } @@ -2748,6 +2786,10 @@ $CFG->{profile}{default}{host} ||= "gameserver.deliantra.net"; $PROFILE = $CFG->{profile}{default}; + $PROFILE->{host} = $ARGV[0] if @ARGV > 0; + $PROFILE->{user} = $ARGV[1] if @ARGV > 1; + $PROFILE->{password} = $ARGV[2] if @ARGV > 2; + # convert old bindings (only default profile matters) if (my $bindings = delete $PROFILE->{bindings}) { while (my ($mod, $syms) = each %$bindings) { @@ -2779,7 +2821,7 @@ ); DC::add_font $_ for @fonts; - + $FONT_PROP = new_from_file DC::Font $fonts[0]; $FONT_FIXED = new_from_file DC::Font $fonts[1];