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.116 by root, Sun Apr 16 07:25:30 2006 UTC vs.
Revision 1.120 by root, Mon Apr 17 07:51:24 2006 UTC

310 expand => 1, 310 expand => 1,
311 fontsize => $::CFG->{log_fontsize}, 311 fontsize => $::CFG->{log_fontsize},
312 ); 312 );
313 313
314 $vbox->add (my $input = new CFClient::UI::LineEntry 314 $vbox->add (my $input = new CFClient::UI::LineEntry
315 connect_focus_in => sub {
316 my ($input, $prev_focus) = @_;
317
318 delete $input->{refocus_map};
319
320 if ($prev_focus == $MAPWIDGET && $input->{auto_activated}) {
321 $input->{refocus_map} = 1;
322 }
323 delete $input->{auto_activated};
324 },
315 connect_activate => sub { 325 connect_activate => sub {
316 my ($input, $text) = @_; 326 my ($input, $text) = @_;
317 $input->set_text (''); 327 $input->set_text ('');
318 328
319 if ($text =~ /^\/(.*)/) { 329 if ($text =~ /^\/(.*)/) {
320 $::CONN->user_send ("command $1"); 330 $::CONN->user_send ("command $1");
321 } else { 331 } else {
322 my $say_cmd = $::CFG->{say_command} || 'say'; 332 my $say_cmd = $::CFG->{say_command} || 'say';
323 $::CONN->user_send ("command $say_cmd $text"); 333 $::CONN->user_send ("command $say_cmd $text");
334 }
335 if ($input->{refocus_map}) {
336 delete $input->{refocus_map};
337 $MAPWIDGET->focus_in
324 } 338 }
325 }, 339 },
326 connect_escape => sub { 340 connect_escape => sub {
327 $MAPWIDGET->focus_in 341 $MAPWIDGET->focus_in
328 }, 342 },
402 $MAPWIDGET->focus_in; 416 $MAPWIDGET->focus_in;
403 $MAPWIDGET->connect (activate_console => sub { 417 $MAPWIDGET->connect (activate_console => sub {
404 my ($mapwidget, $preset) = @_; 418 my ($mapwidget, $preset) = @_;
405 419
406 if ($CONSOLE) { 420 if ($CONSOLE) {
421 $CONSOLE->{input}->{auto_activated} = 1;
407 $CONSOLE->{input}->focus_in; 422 $CONSOLE->{input}->focus_in;
408 423
409 if ($preset && $CONSOLE->{input}->get_text eq '') { 424 if ($preset && $CONSOLE->{input}->get_text eq '') {
410 $CONSOLE->{input}->set_text ($preset); 425 $CONSOLE->{input}->set_text ($preset);
411 } 426 }
421 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { 436 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub {
422 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; 437 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
423 status "Configuration Saved"; 438 status "Configuration Saved";
424 }); 439 });
425 440
426 $BUTTONBAR->{children}[0]->emit ("activate"); 441 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup
427} 442}
428 443
429sub destroy_screen { 444sub destroy_screen {
430 $CFClient::UI::ROOT->{children} = []; 445 $CFClient::UI::ROOT->{children} = [];
431 undef $SDL_ACTIVE; 446 undef $SDL_ACTIVE;
494 509
495 $self->send ($command); 510 $self->send ($command);
496 status $command; 511 status $command;
497} 512}
498 513
514sub conn::map_scroll {
515 my ($self, $dx, $dy) = @_;
516
517 $MAP->scroll ($dx, $dy);
518}
519
499sub conn::feed_map1a { 520sub conn::feed_map1a {
500 my ($self, $data) = @_; 521 my ($self, $data) = @_;
501 522
502# $self->Crossfire::Protocol::feed_map1a ($data); 523# $self->Crossfire::Protocol::feed_map1a ($data);
503 524
504 $MAP->scroll (delete $self->{delayed_scroll_x}, delete $self->{delayed_scroll_y});
505 $MAP->map1a_update ($data); 525 $MAP->map1a_update ($data);
506 $MAPWIDGET->update; 526 $MAPWIDGET->update;
507} 527}
508 528
509sub conn::flush_map { 529sub conn::flush_map {
523 543
524sub conn::map_clear { 544sub conn::map_clear {
525 my ($self) = @_; 545 my ($self) = @_;
526 546
527 $self->flush_map; 547 $self->flush_map;
548 delete $self->{neigh};
528 549
529 $MAP->clear; 550 $MAP->clear;
530} 551}
531 552
532sub conn::map_info {
533 my ($self, $mode, $flags, $x, $y, $w, $h, $hash) = @_;
534 553
535 $self->flush_map; 554sub conn::load_map($$$) {
536 555 my ($self, $hash, $x, $y) = @_;
537 $x = $::MAP->ox - $x;
538 $y = $::MAP->oy - $y;
539
540 $self->{map_info} = [$hash, $x, $y, $w, $h];
541 556
542 if (defined (my $data = $MAPCACHE->get ($hash))) { 557 if (defined (my $data = $MAPCACHE->get ($hash))) {
543 $data = Compress::LZF::decompress $data; 558 $data = Compress::LZF::decompress $data;
544 warn sprintf "LOADmap[%s] length %d\n", $hash, length $data;#d# 559 warn sprintf "LOADmap[%s,%d,%d] length %d\n", $hash, $x, $y, length $data;#d#
545 for my $id ($MAP->set_rect ($x, $y, $data)) { 560 for my $id ($MAP->set_rect ($x, $y, $data)) {
546 my $data = $TILECACHE->get ($id) 561 my $data = $TILECACHE->get ($id)
547 or next; 562 or next;
548 563
549 $self->set_texture ($id => $data); 564 $self->set_texture ($id => $data);
550 } 565 }
551 } 566 }
567}
568
569sub conn::flood_fill {
570 my ($self, $path, $hash, $flags, $x0, $y0, $x1, $y1) = @_;
571
572 # the server doe snot allow map paths > 6
573 return if 6 <= length $path;
574
575 for my $tile (1..4) {
576 next if $self->{neigh}{$hash}[$tile];
577 next unless $flags & (1 << ($tile - 1));
578
579 my $neigh = $self->{neigh}{$hash} ||= [];
580
581 $self->send_mapinfo ("spatial $path$tile", sub {
582 my ($mode, $flags, $x, $y, $w, $h, $hash) = @_;
583
584 warn "map<$path>_$tile=<$mode,$x,$y,$w,$h,$hash>\n";#d#
585 return if $mode ne "spatial";
586
587 $x += $MAP->ox;
588 $y += $MAP->oy;
589
590 $self->load_map ($hash, $x, $y);
591
592 $neigh->[$tile] = [$x, $y, $w, $h];
593
594 $self->flood_fill ("$path$tile", $hash, $flags, $x0, $y0, $x1, $y1)
595 if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1;
596 });
597 }
598}
599
600sub conn::map_change {
601 my ($self, $mode, $flags, $x, $y, $w, $h, $hash) = @_;
602
603 $self->flush_map;
604
605 my ($ox, $oy) = ($::MAP->ox, $::MAP->oy);
606
607 warn "$ox $oy map_info<$flags, $x, $y, $w, $h, $hash>\n";#d#
608
609 my $mapmapw = 250;
610 my $mapmaph = 250;
611
612 $self->flood_fill ("", $hash, $flags,
613 $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5,
614 $ox + $mapmapw * 0.5, $oy + $mapmapw * 0.5);
615
616 $x += $ox;
617 $y += $oy;
618
619 $self->{map_info} = [$hash, $x, $y, $w, $h];
620
621 $self->load_map ($hash, $x, $y);
552} 622}
553 623
554sub conn::face_find { 624sub conn::face_find {
555 my ($self, $facenum, $face) = @_; 625 my ($self, $facenum, $face) = @_;
556 626
619 my ($self, $color, $text) = @_; 689 my ($self, $color, $text) = @_;
620 690
621 my @color = ( 691 my @color = (
622 [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00], 692 [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00],
623 [1.00, 1.00, 1.00], 693 [1.00, 1.00, 1.00],
624 [0.50, 0.50, 1.00], # changed 694 [0.50, 0.50, 1.00], #[0.00, 0.00, 0.55]
625 [1.00, 0.00, 0.00], 695 [1.00, 0.00, 0.00],
626 [1.00, 0.54, 0.00], 696 [1.00, 0.54, 0.00],
627 [0.11, 0.56, 1.00], 697 [0.11, 0.56, 1.00],
628 [0.93, 0.46, 0.00], 698 [0.93, 0.46, 0.00],
629 [0.18, 0.54, 0.34], 699 [0.18, 0.54, 0.34],

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines