… | |
… | |
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 | our $TEX_HIDDEN = new_from_resource DC::Texture |
|
|
24 | "hidden.png", minify => 1, mipmap => 1; |
|
|
25 | |
|
|
26 | sub MIN_TEXTURE_UNUSED() { 1 }#d# |
22 | |
27 | |
23 | sub new { |
28 | sub 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}"; |
… | |
… | |
545 | 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), |
546 | ]; |
572 | ]; |
547 | |
573 | |
548 | my @add = @$sw; |
574 | my @add = @$sw; |
549 | |
575 | |
550 | 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>"; |
551 | |
577 | |
552 | 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); |
553 | 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); |
554 | |
580 | |
555 | my ($x, $y) = (0, 1); |
581 | my ($x, $y) = (0, 1); |
… | |
… | |
655 | for my $tile (@$missing) { |
681 | for my $tile (@$missing) { |
656 | next if $self->{delay}{$tile}; |
682 | next if $self->{delay}{$tile}; |
657 | |
683 | |
658 | $delay = 1; |
684 | $delay = 1; |
659 | |
685 | |
660 | if (my $tex = $::CONN->{texture}[$tile]) { |
686 | if (my $tex = $self->{texture}[$tile]) { |
661 | $tex->upload; |
687 | $tex->upload; |
662 | } else { |
688 | } else { |
663 | $self->{delay}{$tile} = 1; |
689 | $self->{delay}{$tile} = 1; |
664 | |
690 | |
665 | # we assume the face is in-flight and will eventually come |
691 | # we assume the face is in-flight and will eventually arrive |
666 | push @{$self->{tile_cb}{$tile}}, sub { |
692 | push @{$self->{tile_cb}{$tile}}, sub { |
667 | delete $self->{delay}{$tile}; |
693 | delete $self->{delay}{$tile}; |
668 | $_[0]->upload; |
694 | $_[0]->upload; |
669 | }; |
695 | }; |
670 | } |
696 | } |
671 | } |
697 | } |
672 | |
698 | |
673 | if ($delay) { |
699 | if ($delay) { |
674 | # 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 |
675 | EV::once undef, 0, 0.03, sub { |
701 | EV::once undef, 0, 0.03, sub { |
676 | $self->{map_widget}->update |
702 | $self->{map_widget}->update |
677 | if $self->{map_widget}; |
703 | if $self->{map_widget}; |
678 | }; |
704 | }; |
679 | } else { |
705 | } else { |
… | |
… | |
1096 | |
1122 | |
1097 | ## try to create single paragraphs of multiple lines sent by the server |
1123 | ## try to create single paragraphs of multiple lines sent by the server |
1098 | # no longer neecssary with TRT servers |
1124 | # no longer neecssary with TRT servers |
1099 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
1125 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
1100 | |
1126 | |
1101 | for (split /\n/, $text) { |
|
|
1102 | ::message ({ |
1127 | ::message ({ |
1103 | fg => $fg, |
1128 | fg => $fg, |
1104 | markup => $_, |
1129 | markup => $text, |
1105 | type => $type, |
1130 | type => $type, |
1106 | extra => [@extra], |
1131 | extra => [@extra], |
1107 | color_flags => $color, #d# ugly, kill |
1132 | color_flags => $color, #d# ugly, kill |
1108 | }); |
1133 | }); |
1109 | |
1134 | |
1110 | $color &= ~NDI_CLEAR; # only clear once for multiline messages |
1135 | # $color &= ~NDI_CLEAR; # only clear once for multiline messages |
1111 | # actually, this is an ugly design. _we_ should control the channels, |
1136 | # # actually, this is an ugly design. _we_ should control the channels, |
1112 | # not some random other widget, as the channels are clearly protocol-specific. |
1137 | # # not some random other widget, as the channels are clearly protocol-specific. |
1113 | # then we could also react to flags such as CLEAR without resorting to |
1138 | # # then we could also react to flags such as CLEAR without resorting to |
1114 | # hacks such as color_flags, above. |
1139 | # # hacks such as color_flags, above. |
1115 | } |
|
|
1116 | |
1140 | |
1117 | $self->{statusbox}->add ($text, |
1141 | $self->{statusbox}->add ($text, |
1118 | group => $text, |
1142 | group => $text, |
1119 | fg => $fg, |
1143 | fg => $fg, |
1120 | timeout => $color >= 2 ? 180 : 10, |
1144 | timeout => $color >= 2 ? 180 : 10, |
… | |
… | |
1544 | } |
1568 | } |
1545 | |
1569 | |
1546 | sub send { |
1570 | sub send { |
1547 | my ($self, $msg) = @_; |
1571 | my ($self, $msg) = @_; |
1548 | |
1572 | |
1549 | $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 | }); |
1550 | $self->{textview}->scroll_to_bottom; |
1579 | $self->{textview}->scroll_to_bottom; |
1551 | |
1580 | |
1552 | $self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg); |
1581 | $self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg); |
1553 | } |
1582 | } |
1554 | |
1583 | |