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.202 by root, Tue Sep 9 10:27:26 2008 UTC vs.
Revision 1.208 by root, Sun Jan 11 03:19:47 2009 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,
73 for values %{delete $ws->{w} || {}}; 78 for values %{delete $ws->{w} || {}};
74 } 79 }
75 80
76 delete $self->{items}; 81 delete $self->{items};
77 $::INV->clear; 82 $::INV->clear;
83 $::INVR->clear;
78 $::INVR_HB->clear; 84 $::INVR_HB->clear;
79 $::FLOORBOX->clear; 85 $::FLOORBOX->clear;
80 }); 86 });
81 87
82 $self->{map_widget}->add_command (@$_) 88 $self->{map_widget}->add_command (@$_)
89 95
90 { 96 {
91 $self->{noface} = my $tex = $TEX_NOFACE; 97 $self->{noface} = my $tex = $TEX_NOFACE;
92 $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}});
93 } 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# };
94 120
95 $self->{open_container} = 0; 121 $self->{open_container} = 0;
96 122
97 # per server 123 # per server
98 $self->{mapcache} = "mapcache_$self->{host}_$self->{port}"; 124 $self->{mapcache} = "mapcache_$self->{host}_$self->{port}";
259 my %wkw = ( 285 my %wkw = (
260 root => $DC::UI::ROOT, 286 root => $DC::UI::ROOT,
261 tooltip => $DC::UI::TOOLTIP, 287 tooltip => $DC::UI::TOOLTIP,
262 288
263 mapwidget => $::MAPWIDGET, 289 mapwidget => $::MAPWIDGET,
290 menubar => $::MENUBAR,
291 menupopup => $::MENUPOPUP,
264 buttonbar => $::BUTTONBAR, 292 buttonbar => $::BUTTONBAR,
265 metaserver => $::METASERVER, 293 metaserver => $::METASERVER,
266 buttonbar => $::BUTTONBAR, 294 buttonbar => $::BUTTONBAR,
267 login_button => $::LOGIN_BUTTON, 295 login_button => $::LOGIN_BUTTON,
268 quit_dialog => $::QUIT_DIALOG, 296 quit_dialog => $::QUIT_DIALOG,
285 313
286 floorbox => $::FLOORBOX, 314 floorbox => $::FLOORBOX,
287 help_window => $::HELP_WINDOW, 315 help_window => $::HELP_WINDOW,
288 message_window => $::MESSAGE_WINDOW, 316 message_window => $::MESSAGE_WINDOW,
289 message_dist => $::MESSAGE_DIST, 317 message_dist => $::MESSAGE_DIST,
290 statusbox => $::SDTATUSBOX, 318 statusbox => $::STATUSBOX,
291 319
292 inv => $::INV, 320 inv => $::INV,
293 invr => $::INVR, 321 invr => $::INVR,
294 invr_hb => $::INVR_HB, 322 invr_hb => $::INVR_HB,
295 ); 323 );
545 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), 573 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0),
546 ]; 574 ];
547 575
548 my @add = @$sw; 576 my @add = @$sw;
549 577
550 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; 578 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use skill\nRight click - further options</small>";
551 579
552 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); 580 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
553 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); 581 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
554 582
555 my ($x, $y) = (0, 1); 583 my ($x, $y) = (0, 1);
655 for my $tile (@$missing) { 683 for my $tile (@$missing) {
656 next if $self->{delay}{$tile}; 684 next if $self->{delay}{$tile};
657 685
658 $delay = 1; 686 $delay = 1;
659 687
660 if (my $tex = $::CONN->{texture}[$tile]) { 688 if (my $tex = $self->{texture}[$tile]) {
661 $tex->upload; 689 $tex->upload;
662 } else { 690 } else {
663 $self->{delay}{$tile} = 1; 691 $self->{delay}{$tile} = 1;
664 692
665 # we assume the face is in-flight and will eventually come 693 # we assume the face is in-flight and will eventually arrive
666 push @{$self->{tile_cb}{$tile}}, sub { 694 push @{$self->{tile_cb}{$tile}}, sub {
667 delete $self->{delay}{$tile}; 695 delete $self->{delay}{$tile};
668 $_[0]->upload; 696 $_[0]->upload;
669 }; 697 };
670 } 698 }
671 } 699 }
672 700
673 if ($delay) { 701 if ($delay) {
674 # delay the map drawing a tiny bit in the hope of getting the missing fetched 702 # delay the map drawing a tiny bit in the hope of getting the missing tiles fetched
675 EV::once undef, 0, 0.03, sub { 703 EV::once undef, 0, 0.03, sub {
676 $self->{map_widget}->update 704 $self->{map_widget}->update
677 if $self->{map_widget}; 705 if $self->{map_widget};
678 }; 706 };
679 } else { 707 } else {
1542} 1570}
1543 1571
1544sub send { 1572sub send {
1545 my ($self, $msg) = @_; 1573 my ($self, $msg) = @_;
1546 1574
1547 $self->{textview}->add_paragraph ({ markup => "\n" . DC::asxml $msg }); 1575 $self->{textview}->add_paragraph ({
1576 markup =>
1577 "\n<span foreground='#ffff00'><b>"
1578 . (DC::asxml $msg)
1579 . "</b></span>"
1580 });
1548 $self->{textview}->scroll_to_bottom; 1581 $self->{textview}->scroll_to_bottom;
1549 1582
1550 $self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg); 1583 $self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg);
1551} 1584}
1552 1585

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines