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.94 by root, Thu Apr 13 01:55:39 2006 UTC vs.
Revision 1.95 by root, Thu Apr 13 23:07:58 2006 UTC

18use CFClient; 18use CFClient;
19use CFClient::UI; 19use CFClient::UI;
20 20
21our $VERSION = '0.1'; 21our $VERSION = '0.1';
22 22
23my $MAX_FPS = 60; 23my $MAX_FPS = 500;
24my $MIN_FPS = 5; # unused as of yet 24my $MIN_FPS = 5; # unused as of yet
25 25
26our $FACECACHE; 26our $FACECACHE;
27 27
28our $LAST_REFRESH; 28our $LAST_REFRESH;
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},
169 }); 172 });
170 $CFClient::UI::TOPLEVEL->add ($dialog); 173 $CFClient::UI::TOPLEVEL->add ($dialog);
171} 174}
172 175
173sub sdl_init { 176sub sdl_init {
174 SDL::Init SDL_INIT_AUDIO | SDL_INIT_VIDEO 177 SDL::Init SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE
175 and die "SDL::Init failed!\n"; 178 and die "SDL::Init failed!\n";
176} 179}
177 180
178sub init_screen { 181sub init_screen {
179 sdl_init; 182 sdl_init;
255 258
256sub force_refresh { 259sub force_refresh {
257 $fps = $fps * 0.95 + 1 / ($NOW - $LAST_REFRESH) * 0.05; 260 $fps = $fps * 0.95 + 1 / ($NOW - $LAST_REFRESH) * 0.05;
258 debug sprintf "%3.2f", $fps; 261 debug sprintf "%3.2f", $fps;
259 262
260 $want_refresh = 0; 263# $want_refresh = 0;#d#
261 $can_refresh = 0; 264 $can_refresh = 0;
262 265
263 glViewport 0, 0, $WIDTH, $HEIGHT; 266 glViewport 0, 0, $WIDTH, $HEIGHT;
264 267
265 glMatrixMode GL_PROJECTION; 268 glMatrixMode GL_PROJECTION;
317 320
318 $self->send ($command); 321 $self->send ($command);
319 status $command; 322 status $command;
320} 323}
321 324
322my $MAP = new CFClient::Map 63, 63;#d#
323
324sub conn::feed_map1a { 325sub conn::feed_map1a {
325 my ($self, $data) = @_; 326 my ($self, $data) = @_;
326 327
327 $self->Crossfire::Protocol::feed_map1a ($data); 328# $self->Crossfire::Protocol::feed_map1a ($data);
328 329
329 #$MAP->scroll (delete $self->{_dx}, delete $self->{_dy}); 330 $MAP->scroll (delete $self->{delayed_scroll_x}, delete $self->{delayed_scroll_y});
330 #$MAP->map1a_update ($data); 331 $MAP->map1a_update ($data);
331}
332
333sub conn::map_update {
334 my ($self, $dirty) = @_;
335
336 $MAPWIDGET->update; 332 $MAPWIDGET->update;
337} 333}
338 334
339sub conn::map_scroll { 335#sub conn::map_update {
340 my ($self, $dx, $dy) = @_; 336# my ($self, $dirty) = @_;
341 337#
342 $self->{_dx} += $dx; 338# $MAPWIDGET->update;
343 $self->{_dy} += $dy; 339#}
344
345# refresh;
346}
347 340
348sub conn::map_clear { 341sub conn::map_clear {
349 my ($self) = @_; 342 my ($self) = @_;
350 343
344 $MAP->clear;
345
351# refresh; 346# refresh;
352} 347}
353 348
354sub conn::face_find { 349sub conn::face_find {
355 my ($self, $face) = @_; 350 my ($self, $face) = @_;
356 351
357 $FACECACHE->{"$face->{chksum},$face->{name}"} 352 $FACECACHE->{"$face->{chksum},$face->{name}"}
358} 353}
359 354
360sub conn::face_update { 355sub conn::face_update {
361 my ($self, $face) = @_; 356 my ($self, $facenum, $face) = @_;
362 357
363 $FACECACHE->{"$face->{chksum},$face->{name}"} = $face->{image}; 358 $FACECACHE->{"$face->{chksum},$face->{name}"} = $face->{image};
364 359
365 $face->{texture} = new_from_image CFClient::Texture delete $face->{image}; 360 my $tex = $face->{texture} = new_from_image CFClient::Texture delete $face->{image};
361
362 $MAP->set_texture ($facenum, @$tex{qw(name w h s t)});
363 $MAPWIDGET->update;
366} 364}
367 365
368sub conn::query { 366sub conn::query {
369 my ($self, $flags, $prompt) = @_; 367 my ($self, $flags, $prompt) = @_;
370 368

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines