… | |
… | |
17 | our $TEX_DIALOGUE = new_from_resource DC::Texture |
17 | our $TEX_DIALOGUE = new_from_resource DC::Texture |
18 | "dialogue.png", minify => 1, mipmap => 1; |
18 | "dialogue.png", minify => 1, mipmap => 1; |
19 | |
19 | |
20 | our $TEX_NOFACE = new_from_resource DC::Texture |
20 | our $TEX_NOFACE = new_from_resource DC::Texture |
21 | "noface.png", minify => 1, mipmap => 1; |
21 | "noface.png", minify => 1, mipmap => 1; |
|
|
22 | |
|
|
23 | sub MIN_TEXTURE_UNUSED() { 1 }#d# |
22 | |
24 | |
23 | sub new { |
25 | sub new { |
24 | my ($class, %arg) = @_; |
26 | my ($class, %arg) = @_; |
25 | |
27 | |
26 | my $self = $class->SUPER::new (%arg, |
28 | my $self = $class->SUPER::new (%arg, |
… | |
… | |
73 | for values %{delete $ws->{w} || {}}; |
75 | for values %{delete $ws->{w} || {}}; |
74 | } |
76 | } |
75 | |
77 | |
76 | delete $self->{items}; |
78 | delete $self->{items}; |
77 | $::INV->clear; |
79 | $::INV->clear; |
|
|
80 | $::INVR->clear; |
78 | $::INVR_HB->clear; |
81 | $::INVR_HB->clear; |
79 | $::FLOORBOX->clear; |
82 | $::FLOORBOX->clear; |
80 | }); |
83 | }); |
81 | |
84 | |
82 | $self->{map_widget}->add_command (@$_) |
85 | $self->{map_widget}->add_command (@$_) |
… | |
… | |
89 | |
92 | |
90 | { |
93 | { |
91 | $self->{noface} = my $tex = $TEX_NOFACE; |
94 | $self->{noface} = my $tex = $TEX_NOFACE; |
92 | $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
95 | $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
93 | } |
96 | } |
|
|
97 | |
|
|
98 | # $self->{expire_count} = DC::DB::FIRST_TILE_ID; # minimum non-fixed tile id |
|
|
99 | # $self->{expire_w} = EV::timer 1, 1, sub { |
|
|
100 | # my $count = (int @{ $self->{texture} } / MIN_TEXTURE_UNUSED) || 1; |
|
|
101 | # |
|
|
102 | # for ($self->{map}->expire_textures ($self->{expire_count}, $count)) { |
|
|
103 | # warn DC::SvREFCNT $self->{texture}[$_]; |
|
|
104 | # $self->{texture}[$_]->unload; |
|
|
105 | # warn "expire texture $_\n";#d# |
|
|
106 | # } |
|
|
107 | # |
|
|
108 | # ($self->{expire_count} += $count) < @{ $self->{texture} } |
|
|
109 | # or $self->{expire_count} = DC::DB::FIRST_TILE_ID; |
|
|
110 | # warn "count is $count\n";#d# |
|
|
111 | # }; |
94 | |
112 | |
95 | $self->{open_container} = 0; |
113 | $self->{open_container} = 0; |
96 | |
114 | |
97 | # per server |
115 | # per server |
98 | $self->{mapcache} = "mapcache_$self->{host}_$self->{port}"; |
116 | $self->{mapcache} = "mapcache_$self->{host}_$self->{port}"; |
… | |
… | |
545 | 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), |
563 | 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), |
546 | ]; |
564 | ]; |
547 | |
565 | |
548 | my @add = @$sw; |
566 | my @add = @$sw; |
549 | |
567 | |
550 | my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; |
568 | my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use skill\nRight click - further options</small>"; |
551 | |
569 | |
552 | my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); |
570 | 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); |
571 | my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); |
554 | |
572 | |
555 | my ($x, $y) = (0, 1); |
573 | my ($x, $y) = (0, 1); |
… | |
… | |
655 | for my $tile (@$missing) { |
673 | for my $tile (@$missing) { |
656 | next if $self->{delay}{$tile}; |
674 | next if $self->{delay}{$tile}; |
657 | |
675 | |
658 | $delay = 1; |
676 | $delay = 1; |
659 | |
677 | |
660 | if (my $tex = $::CONN->{texture}[$tile]) { |
678 | if (my $tex = $self->{texture}[$tile]) { |
661 | $tex->upload; |
679 | $tex->upload; |
662 | } else { |
680 | } else { |
663 | $self->{delay}{$tile} = 1; |
681 | $self->{delay}{$tile} = 1; |
664 | |
682 | |
665 | # we assume the face is in-flight and will eventually come |
683 | # we assume the face is in-flight and will eventually arrive |
666 | push @{$self->{tile_cb}{$tile}}, sub { |
684 | push @{$self->{tile_cb}{$tile}}, sub { |
667 | delete $self->{delay}{$tile}; |
685 | delete $self->{delay}{$tile}; |
668 | $_[0]->upload; |
686 | $_[0]->upload; |
669 | }; |
687 | }; |
670 | } |
688 | } |
671 | } |
689 | } |
672 | |
690 | |
673 | if ($delay) { |
691 | if ($delay) { |
674 | # delay the map drawing a tiny bit in the hope of getting the missing fetched |
692 | # delay the map drawing a tiny bit in the hope of getting the missing tiles fetched |
675 | EV::once undef, 0, 0.03, sub { |
693 | EV::once undef, 0, 0.03, sub { |
676 | $self->{map_widget}->update |
694 | $self->{map_widget}->update |
677 | if $self->{map_widget}; |
695 | if $self->{map_widget}; |
678 | }; |
696 | }; |
679 | } else { |
697 | } else { |
… | |
… | |
1542 | } |
1560 | } |
1543 | |
1561 | |
1544 | sub send { |
1562 | sub send { |
1545 | my ($self, $msg) = @_; |
1563 | my ($self, $msg) = @_; |
1546 | |
1564 | |
1547 | $self->{textview}->add_paragraph ({ markup => "\n" . DC::asxml $msg }); |
1565 | $self->{textview}->add_paragraph ({ |
|
|
1566 | markup => |
|
|
1567 | "\n<span foreground='#ffff00'><b>" |
|
|
1568 | . (DC::asxml $msg) |
|
|
1569 | . "</b></span>" |
|
|
1570 | }); |
1548 | $self->{textview}->scroll_to_bottom; |
1571 | $self->{textview}->scroll_to_bottom; |
1549 | |
1572 | |
1550 | $self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg); |
1573 | $self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg); |
1551 | } |
1574 | } |
1552 | |
1575 | |