--- deliantra/Deliantra-Client/bin/pclient 2006/04/12 23:37:38 1.93 +++ deliantra/Deliantra-Client/bin/pclient 2006/04/13 23:31:43 1.97 @@ -37,6 +37,7 @@ our $HEIGHT; our $FULLSCREEN; +our $MAP; our $MAPWIDGET; our $FONTSIZE; @@ -65,6 +66,8 @@ my $mapsize = List::Util::min 64, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; + $MAP = new CFClient::Map $mapsize, $mapsize; + $CONN = new conn host => $CFG->{host}, port => $CFG->{port}, @@ -116,18 +119,24 @@ }); $table->add (0, 3, new CFClient::UI::Label align => 1, text => "Fog of War"); - $table->add (1, 3, new CFClient::UI::Slider range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], connect_changed => sub { + $table->add (1, 3, new CFClient::UI::CheckBox state => $CFG->{fow_enable}, connect_changed => sub { + my ($self, $value) = @_; + $CFG->{fow_enable} = $value; + }); + + $table->add (0, 4, new CFClient::UI::Label align => 1, text => "FoW Intensity"); + $table->add (1, 4, new CFClient::UI::Slider range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], connect_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; }); - $table->add (0, 4, new CFClient::UI::Label align => 1, text => "Smooth FoW"); - $table->add (1, 4, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub { + $table->add (0, 5, new CFClient::UI::Label align => 1, text => "FoW Smooth"); + $table->add (1, 5, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub { my ($self, $value) = @_; $CFG->{fow_smooth} = $value; }); - $table->add (1, 5, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { + $table->add (1, 6, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { destroy_screen (); init_screen (); }); @@ -171,7 +180,7 @@ } sub sdl_init { - SDL::Init SDL_INIT_AUDIO | SDL_INIT_VIDEO + SDL::Init SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE and die "SDL::Init failed!\n"; } @@ -319,21 +328,27 @@ status $command; } -sub conn::map_update { - my ($self, $dirty) = @_; +sub conn::feed_map1a { + my ($self, $data) = @_; + +# $self->Crossfire::Protocol::feed_map1a ($data); + $MAP->scroll (delete $self->{delayed_scroll_x}, delete $self->{delayed_scroll_y}); + $MAP->map1a_update ($data); $MAPWIDGET->update; } -sub conn::map_scroll { - my ($self, $dx, $dy) = @_; - -# refresh; -} +#sub conn::map_update { +# my ($self, $dirty) = @_; +# +# $MAPWIDGET->update; +#} sub conn::map_clear { my ($self) = @_; + $MAP->clear; + # refresh; } @@ -344,11 +359,14 @@ } sub conn::face_update { - my ($self, $face) = @_; + my ($self, $facenum, $face) = @_; $FACECACHE->{"$face->{chksum},$face->{name}"} = $face->{image}; - $face->{texture} = new_from_image CFClient::Texture delete $face->{image}; + my $tex = $face->{texture} = new_from_image CFClient::Texture delete $face->{image}; + + $MAP->set_texture ($facenum, @$tex{qw(name w h s t)}); + $MAPWIDGET->update; } sub conn::query { @@ -401,6 +419,7 @@ width => 640, height => 480, fast => 0, + fow_enable => 1, fow_intensity => 0.45, fow_smooth => 0, fullscreen => 0,