ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.203 by elmex, Sun Sep 21 12:34:14 2008 UTC vs.
Revision 1.207 by root, Sat Dec 20 19:45:50 2008 UTC

17our $TEX_DIALOGUE = new_from_resource DC::Texture 17our $TEX_DIALOGUE = new_from_resource DC::Texture
18 "dialogue.png", minify => 1, mipmap => 1; 18 "dialogue.png", minify => 1, mipmap => 1;
19 19
20our $TEX_NOFACE = new_from_resource DC::Texture 20our $TEX_NOFACE = new_from_resource DC::Texture
21 "noface.png", minify => 1, mipmap => 1; 21 "noface.png", minify => 1, mipmap => 1;
22
23our $TEX_HIDDEN = new_from_resource DC::Texture
24 "hidden.png", minify => 1, mipmap => 1;
25
26sub MIN_TEXTURE_UNUSED() { 1 }#d#
22 27
23sub new { 28sub new {
24 my ($class, %arg) = @_; 29 my ($class, %arg) = @_;
25 30
26 my $self = $class->SUPER::new (%arg, 31 my $self = $class->SUPER::new (%arg,
90 95
91 { 96 {
92 $self->{noface} = my $tex = $TEX_NOFACE; 97 $self->{noface} = my $tex = $TEX_NOFACE;
93 $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); 98 $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}});
94 } 99 }
100
101 {
102 $self->{hidden} = my $tex = $TEX_HIDDEN;
103 $self->{map}->set_texture (3, @$tex{qw(name w h s t)}, @{$tex->{minified}});
104 }
105
106# $self->{expire_count} = DC::DB::FIRST_TILE_ID; # minimum non-fixed tile id
107# $self->{expire_w} = EV::timer 1, 1, sub {
108# my $count = (int @{ $self->{texture} } / MIN_TEXTURE_UNUSED) || 1;
109#
110# for ($self->{map}->expire_textures ($self->{expire_count}, $count)) {
111# warn DC::SvREFCNT $self->{texture}[$_];
112# $self->{texture}[$_]->unload;
113# warn "expire texture $_\n";#d#
114# }
115#
116# ($self->{expire_count} += $count) < @{ $self->{texture} }
117# or $self->{expire_count} = DC::DB::FIRST_TILE_ID;
118# warn "count is $count\n";#d#
119# };
95 120
96 $self->{open_container} = 0; 121 $self->{open_container} = 0;
97 122
98 # per server 123 # per server
99 $self->{mapcache} = "mapcache_$self->{host}_$self->{port}"; 124 $self->{mapcache} = "mapcache_$self->{host}_$self->{port}";
546 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), 571 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0),
547 ]; 572 ];
548 573
549 my @add = @$sw; 574 my @add = @$sw;
550 575
551 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; 576 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use skill\nRight click - further options</small>";
552 577
553 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); 578 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
554 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); 579 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
555 580
556 my ($x, $y) = (0, 1); 581 my ($x, $y) = (0, 1);
656 for my $tile (@$missing) { 681 for my $tile (@$missing) {
657 next if $self->{delay}{$tile}; 682 next if $self->{delay}{$tile};
658 683
659 $delay = 1; 684 $delay = 1;
660 685
661 if (my $tex = $::CONN->{texture}[$tile]) { 686 if (my $tex = $self->{texture}[$tile]) {
662 $tex->upload; 687 $tex->upload;
663 } else { 688 } else {
664 $self->{delay}{$tile} = 1; 689 $self->{delay}{$tile} = 1;
665 690
666 # we assume the face is in-flight and will eventually come 691 # we assume the face is in-flight and will eventually arrive
667 push @{$self->{tile_cb}{$tile}}, sub { 692 push @{$self->{tile_cb}{$tile}}, sub {
668 delete $self->{delay}{$tile}; 693 delete $self->{delay}{$tile};
669 $_[0]->upload; 694 $_[0]->upload;
670 }; 695 };
671 } 696 }
672 } 697 }
673 698
674 if ($delay) { 699 if ($delay) {
675 # delay the map drawing a tiny bit in the hope of getting the missing fetched 700 # delay the map drawing a tiny bit in the hope of getting the missing tiles fetched
676 EV::once undef, 0, 0.03, sub { 701 EV::once undef, 0, 0.03, sub {
677 $self->{map_widget}->update 702 $self->{map_widget}->update
678 if $self->{map_widget}; 703 if $self->{map_widget};
679 }; 704 };
680 } else { 705 } else {
1543} 1568}
1544 1569
1545sub send { 1570sub send {
1546 my ($self, $msg) = @_; 1571 my ($self, $msg) = @_;
1547 1572
1548 $self->{textview}->add_paragraph ({ markup => "\n" . DC::asxml $msg }); 1573 $self->{textview}->add_paragraph ({
1574 markup =>
1575 "\n<span foreground='#ffff00'><b>"
1576 . (DC::asxml $msg)
1577 . "</b></span>"
1578 });
1549 $self->{textview}->scroll_to_bottom; 1579 $self->{textview}->scroll_to_bottom;
1550 1580
1551 $self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg); 1581 $self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg);
1552} 1582}
1553 1583

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines