ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/pclient
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.93 by root, Wed Apr 12 23:37:38 2006 UTC vs.
Revision 1.97 by root, Thu Apr 13 23:31:43 2006 UTC

35our @SDL_MODES; 35our @SDL_MODES;
36our $WIDTH; 36our $WIDTH;
37our $HEIGHT; 37our $HEIGHT;
38our $FULLSCREEN; 38our $FULLSCREEN;
39 39
40our $MAP;
40our $MAPWIDGET; 41our $MAPWIDGET;
41our $FONTSIZE; 42our $FONTSIZE;
42 43
43our $SDL_ACTIVE; 44our $SDL_ACTIVE;
44our $SDL_EV; 45our $SDL_EV;
63sub start_game { 64sub start_game {
64 status "logging in..."; 65 status "logging in...";
65 66
66 my $mapsize = List::Util::min 64, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; 67 my $mapsize = List::Util::min 64, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32;
67 68
69 $MAP = new CFClient::Map $mapsize, $mapsize;
70
68 $CONN = new conn 71 $CONN = new conn
69 host => $CFG->{host}, 72 host => $CFG->{host},
70 port => $CFG->{port}, 73 port => $CFG->{port},
71 user => $CFG->{user}, 74 user => $CFG->{user},
72 pass => $CFG->{password}, 75 pass => $CFG->{password},
114 my ($self, $value) = @_; 117 my ($self, $value) = @_;
115 $CFG->{fast} = $value; 118 $CFG->{fast} = $value;
116 }); 119 });
117 120
118 $table->add (0, 3, new CFClient::UI::Label align => 1, text => "Fog of War"); 121 $table->add (0, 3, new CFClient::UI::Label align => 1, text => "Fog of War");
122 $table->add (1, 3, new CFClient::UI::CheckBox state => $CFG->{fow_enable}, connect_changed => sub {
123 my ($self, $value) = @_;
124 $CFG->{fow_enable} = $value;
125 });
126
127 $table->add (0, 4, new CFClient::UI::Label align => 1, text => "FoW Intensity");
119 $table->add (1, 3, new CFClient::UI::Slider range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], connect_changed => sub { 128 $table->add (1, 4, new CFClient::UI::Slider range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], connect_changed => sub {
120 my ($self, $value) = @_; 129 my ($self, $value) = @_;
121 $CFG->{fow_intensity} = $value; 130 $CFG->{fow_intensity} = $value;
122 }); 131 });
123 132
124 $table->add (0, 4, new CFClient::UI::Label align => 1, text => "Smooth FoW"); 133 $table->add (0, 5, new CFClient::UI::Label align => 1, text => "FoW Smooth");
125 $table->add (1, 4, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub { 134 $table->add (1, 5, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub {
126 my ($self, $value) = @_; 135 my ($self, $value) = @_;
127 $CFG->{fow_smooth} = $value; 136 $CFG->{fow_smooth} = $value;
128 }); 137 });
129 138
130 $table->add (1, 5, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { 139 $table->add (1, 6, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub {
131 destroy_screen (); 140 destroy_screen ();
132 init_screen (); 141 init_screen ();
133 }); 142 });
134 143
135 $vbox->add (new CFClient::UI::Label align => 0, text => "Server Setup"); 144 $vbox->add (new CFClient::UI::Label align => 0, text => "Server Setup");
169 }); 178 });
170 $CFClient::UI::TOPLEVEL->add ($dialog); 179 $CFClient::UI::TOPLEVEL->add ($dialog);
171} 180}
172 181
173sub sdl_init { 182sub sdl_init {
174 SDL::Init SDL_INIT_AUDIO | SDL_INIT_VIDEO 183 SDL::Init SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE
175 and die "SDL::Init failed!\n"; 184 and die "SDL::Init failed!\n";
176} 185}
177 186
178sub init_screen { 187sub init_screen {
179 sdl_init; 188 sdl_init;
317 326
318 $self->send ($command); 327 $self->send ($command);
319 status $command; 328 status $command;
320} 329}
321 330
322sub conn::map_update { 331sub conn::feed_map1a {
323 my ($self, $dirty) = @_; 332 my ($self, $data) = @_;
324 333
334# $self->Crossfire::Protocol::feed_map1a ($data);
335
336 $MAP->scroll (delete $self->{delayed_scroll_x}, delete $self->{delayed_scroll_y});
337 $MAP->map1a_update ($data);
325 $MAPWIDGET->update; 338 $MAPWIDGET->update;
326} 339}
327 340
328sub conn::map_scroll { 341#sub conn::map_update {
329 my ($self, $dx, $dy) = @_; 342# my ($self, $dirty) = @_;
330 343#
331# refresh; 344# $MAPWIDGET->update;
332} 345#}
333 346
334sub conn::map_clear { 347sub conn::map_clear {
335 my ($self) = @_; 348 my ($self) = @_;
336 349
350 $MAP->clear;
351
337# refresh; 352# refresh;
338} 353}
339 354
340sub conn::face_find { 355sub conn::face_find {
341 my ($self, $face) = @_; 356 my ($self, $face) = @_;
342 357
343 $FACECACHE->{"$face->{chksum},$face->{name}"} 358 $FACECACHE->{"$face->{chksum},$face->{name}"}
344} 359}
345 360
346sub conn::face_update { 361sub conn::face_update {
347 my ($self, $face) = @_; 362 my ($self, $facenum, $face) = @_;
348 363
349 $FACECACHE->{"$face->{chksum},$face->{name}"} = $face->{image}; 364 $FACECACHE->{"$face->{chksum},$face->{name}"} = $face->{image};
350 365
351 $face->{texture} = new_from_image CFClient::Texture delete $face->{image}; 366 my $tex = $face->{texture} = new_from_image CFClient::Texture delete $face->{image};
367
368 $MAP->set_texture ($facenum, @$tex{qw(name w h s t)});
369 $MAPWIDGET->update;
352} 370}
353 371
354sub conn::query { 372sub conn::query {
355 my ($self, $flags, $prompt) = @_; 373 my ($self, $flags, $prompt) = @_;
356 374
399 417
400my %DEF_CFG = ( 418my %DEF_CFG = (
401 width => 640, 419 width => 640,
402 height => 480, 420 height => 480,
403 fast => 0, 421 fast => 0,
422 fow_enable => 1,
404 fow_intensity => 0.45, 423 fow_intensity => 0.45,
405 fow_smooth => 0, 424 fow_smooth => 0,
406 fullscreen => 0, 425 fullscreen => 0,
407 sdl_mode => 0, 426 sdl_mode => 0,
408 mapsize => 100, 427 mapsize => 100,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines