… | |
… | |
11 | use DC::Pod; |
11 | use DC::Pod; |
12 | use DC::Macro; |
12 | use DC::Macro; |
13 | use DC::Item; |
13 | use DC::Item; |
14 | |
14 | |
15 | use base 'Deliantra::Protocol::Base'; |
15 | use base 'Deliantra::Protocol::Base'; |
|
|
16 | |
|
|
17 | our $TEX_DIALOGUE = new_from_resource DC::Texture |
|
|
18 | "dialogue.png", minify => 1, mipmap => 1; |
|
|
19 | |
|
|
20 | our $TEX_NOFACE = new_from_resource DC::Texture |
|
|
21 | "noface.png", minify => 1, mipmap => 1; |
16 | |
22 | |
17 | sub new { |
23 | sub new { |
18 | my ($class, %arg) = @_; |
24 | my ($class, %arg) = @_; |
19 | |
25 | |
20 | my $self = $class->SUPER::new (%arg, |
26 | my $self = $class->SUPER::new (%arg, |
… | |
… | |
75 | |
81 | |
76 | $self->{map_widget}->add_command (@$_) |
82 | $self->{map_widget}->add_command (@$_) |
77 | for @cmd_help; |
83 | for @cmd_help; |
78 | |
84 | |
79 | { |
85 | { |
80 | $self->{dialogue} = my $tex = new_from_file DC::Texture |
86 | $self->{dialogue} = my $tex = $TEX_DIALOGUE; |
81 | DC::find_rcfile "dialogue.png", minify => 1, mipmap => 1; |
|
|
82 | $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
87 | $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
83 | } |
88 | } |
84 | |
89 | |
85 | { |
90 | { |
86 | $self->{noface} = my $tex = new_from_file DC::Texture |
91 | $self->{noface} = my $tex = $TEX_NOFACE; |
87 | DC::find_rcfile "noface.png", minify => 1, mipmap => 1; |
|
|
88 | $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
92 | $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
89 | } |
93 | } |
90 | |
94 | |
91 | $self->{open_container} = 0; |
95 | $self->{open_container} = 0; |
92 | |
96 | |
… | |
… | |
1092 | |
1096 | |
1093 | ## try to create single paragraphs of multiple lines sent by the server |
1097 | ## try to create single paragraphs of multiple lines sent by the server |
1094 | # no longer neecssary with TRT servers |
1098 | # no longer neecssary with TRT servers |
1095 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
1099 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
1096 | |
1100 | |
1097 | for (split /\n/, $text) { |
|
|
1098 | ::message ({ |
1101 | ::message ({ |
1099 | fg => $fg, |
1102 | fg => $fg, |
1100 | markup => $_, |
1103 | markup => $text, |
1101 | type => $type, |
1104 | type => $type, |
1102 | extra => [@extra], |
1105 | extra => [@extra], |
1103 | color_flags => $color, #d# ugly, kill |
1106 | color_flags => $color, #d# ugly, kill |
1104 | }); |
1107 | }); |
1105 | |
1108 | |
1106 | $color &= ~NDI_CLEAR; # only clear once for multiline messages |
1109 | # $color &= ~NDI_CLEAR; # only clear once for multiline messages |
1107 | # actually, this is an ugly design. _we_ should control the channels, |
1110 | # # actually, this is an ugly design. _we_ should control the channels, |
1108 | # not some random other widget, as the channels are clearly protocol-specific. |
1111 | # # not some random other widget, as the channels are clearly protocol-specific. |
1109 | # then we could also react to flags such as CLEAR without resorting to |
1112 | # # then we could also react to flags such as CLEAR without resorting to |
1110 | # hacks such as color_flags, above. |
1113 | # # hacks such as color_flags, above. |
1111 | } |
|
|
1112 | |
1114 | |
1113 | $self->{statusbox}->add ($text, |
1115 | $self->{statusbox}->add ($text, |
1114 | group => $text, |
1116 | group => $text, |
1115 | fg => $fg, |
1117 | fg => $fg, |
1116 | timeout => $color >= 2 ? 180 : 10, |
1118 | timeout => $color >= 2 ? 180 : 10, |