… | |
… | |
115 | 0.05, 0.13, 0.05, |
115 | 0.05, 0.13, 0.05, |
116 | ); |
116 | ); |
117 | glEnable GL_CONVOLUTION_2D; |
117 | glEnable GL_CONVOLUTION_2D; |
118 | } |
118 | } |
119 | |
119 | |
120 | undef $self->{fow_texture};#d# remove |
120 | $self->{fow_texture_name} ||= glGenTexture; |
|
|
121 | # try to re-use the texture name: TODO improve texture class instead |
|
|
122 | |
121 | $self->{fow_texture} = new CFClient::Texture |
123 | $self->{fow_texture} = new CFClient::Texture |
122 | w => $w, |
124 | w => $w, |
123 | h => $h, |
125 | h => $h, |
124 | data => $data, |
126 | data => $data, |
|
|
127 | name => $self->{fow_texture_name}, |
125 | internalformat => GL_ALPHA, |
128 | internalformat => GL_ALPHA, |
126 | format => GL_ALPHA; |
129 | format => GL_ALPHA; |
127 | |
130 | |
128 | glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth}; |
131 | glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth}; |
129 | |
132 | |
130 | glEnable GL_BLEND; |
|
|
131 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
|
|
132 | glEnable GL_TEXTURE_2D; |
133 | glEnable GL_TEXTURE_2D; |
133 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
134 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
134 | |
135 | |
135 | glColor +($::CFG->{fow_intensity}) x 3, 0.8; |
136 | glColor +($::CFG->{fow_intensity}) x 3, 0.8; |
136 | $self->{fow_texture}->draw_quad (0, 0, $w * 32, $h * 32); |
137 | $self->{fow_texture}->draw_quad_alpha (0, 0, $w * 32, $h * 32); |
137 | |
138 | |
138 | glDisable GL_TEXTURE_2D; |
139 | glDisable GL_TEXTURE_2D; |
139 | glDisable GL_BLEND; |
|
|
140 | } |
140 | } |
141 | |
141 | |
142 | glPopMatrix; |
142 | glPopMatrix; |
143 | } |
143 | } |
144 | |
144 | |
… | |
… | |
148 | glPushMatrix; |
148 | glPushMatrix; |
149 | glCallList $self->{list}; |
149 | glCallList $self->{list}; |
150 | glPopMatrix; |
150 | glPopMatrix; |
151 | |
151 | |
152 | # TNT2 emulates logops in software (or worse :) |
152 | # TNT2 emulates logops in software (or worse :) |
153 | if ($CFClient::UI::FOCUS != $self) { |
153 | if ($CFClient::UI::FOCUS == $self) { |
|
|
154 | (delete $self->{out_of_focus})->destroy |
|
|
155 | if $self->{out_of_focus}; |
|
|
156 | } else { |
154 | glColor 0.4, 0.2, 0.2, 0.9; |
157 | glColor 0.4, 0.2, 0.2, 0.6; |
155 | glEnable GL_BLEND; |
158 | glEnable GL_BLEND; |
156 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
159 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
157 | glBegin GL_QUADS; |
160 | glBegin GL_QUADS; |
158 | glVertex 0, 0; |
161 | glVertex 0, 0; |
159 | glVertex 0, $::HEIGHT; |
162 | glVertex 0, $::HEIGHT; |
160 | glVertex $::WIDTH, $::HEIGHT; |
163 | glVertex $::WIDTH, $::HEIGHT; |
161 | glVertex $::WIDTH, 0; |
164 | glVertex $::WIDTH, 0; |
162 | glEnd; |
165 | glEnd; |
163 | glDisable GL_BLEND; |
166 | glDisable GL_BLEND; |
|
|
167 | |
|
|
168 | $self->{out_of_focus} ||= do { |
|
|
169 | my $label = new CFClient::UI::Label |
|
|
170 | x => 0, |
|
|
171 | y => 0, |
|
|
172 | z => 1, |
|
|
173 | ellipsise => 0, |
|
|
174 | text => "map out of focus (click map to play)"; |
|
|
175 | |
|
|
176 | $label->show; |
|
|
177 | $label->update; |
|
|
178 | |
|
|
179 | $CFClient::UI::ROOT->on_post_alloc ("$self$label" => sub { |
|
|
180 | $label->move ( |
|
|
181 | ($::WIDTH - $label->{w}) * 0.5, |
|
|
182 | ($::HEIGHT - $label->{h}) * 0.5, |
|
|
183 | ); |
|
|
184 | }); |
|
|
185 | |
|
|
186 | $label |
|
|
187 | }; |
164 | } |
188 | } |
165 | } |
189 | } |
166 | |
190 | |
167 | my %DIR = ( |
191 | my %DIR = ( |
168 | CFClient::SDLK_KP8, [1, "north"], |
192 | CFClient::SDLK_KP8, [1, "north"], |
… | |
… | |
456 | |
480 | |
457 | @match = map $self->{command}{$_->[0]}, |
481 | @match = map $self->{command}{$_->[0]}, |
458 | sort { |
482 | sort { |
459 | $a->[1] <=> $b->[1] |
483 | $a->[1] <=> $b->[1] |
460 | or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4] |
484 | or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4] |
|
|
485 | or (length $a->[0]) <=> (length $b->[0]) |
461 | } @match; |
486 | } @match; |
462 | |
487 | |
463 | $self->{last_search} = $cmd; |
488 | $self->{last_search} = $cmd; |
464 | $self->{last_match} = \@match; |
489 | $self->{last_match} = \@match; |
465 | |
490 | |