… | |
… | |
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 | # try to re-use the texture name: TODO improve texture class instead |
|
|
121 | my $prev_name = ((delete $self->{fow_texture}) || {})->{name}; |
|
|
122 | |
120 | $self->{fow_texture} = new CFClient::Texture |
123 | $self->{fow_texture} = new CFClient::Texture |
121 | w => $w, |
124 | w => $w, |
122 | h => $h, |
125 | h => $h, |
123 | data => $data, |
126 | data => $data, |
|
|
127 | name => $prev_name, # a bit hackish |
124 | internalformat => GL_ALPHA, |
128 | internalformat => GL_ALPHA, |
125 | format => GL_ALPHA; |
129 | format => GL_ALPHA; |
126 | |
130 | |
127 | glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth}; |
131 | glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth}; |
128 | |
132 | |
129 | glEnable GL_BLEND; |
|
|
130 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
|
|
131 | glEnable GL_TEXTURE_2D; |
133 | glEnable GL_TEXTURE_2D; |
132 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
134 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
133 | |
135 | |
134 | glColor +($::CFG->{fow_intensity}) x 3, 0.8; |
136 | glColor +($::CFG->{fow_intensity}) x 3, 0.8; |
135 | $self->{fow_texture}->draw_quad (0, 0, $w * 32, $h * 32); |
137 | $self->{fow_texture}->draw_quad_alpha (0, 0, $w * 32, $h * 32); |
136 | |
138 | |
137 | glDisable GL_TEXTURE_2D; |
139 | glDisable GL_TEXTURE_2D; |
138 | glDisable GL_BLEND; |
|
|
139 | } |
140 | } |
140 | |
141 | |
141 | glPopMatrix; |
142 | glPopMatrix; |
142 | } |
143 | } |
143 | |
144 | |
… | |
… | |
146 | |
147 | |
147 | glPushMatrix; |
148 | glPushMatrix; |
148 | glCallList $self->{list}; |
149 | glCallList $self->{list}; |
149 | glPopMatrix; |
150 | glPopMatrix; |
150 | |
151 | |
|
|
152 | # TNT2 emulates logops in software (or worse :) |
151 | if ($CFClient::UI::FOCUS != $self) { |
153 | if ($CFClient::UI::FOCUS != $self) { |
152 | glColor 64/255, 64/255, 64/255; |
154 | glColor 0.4, 0.2, 0.2, 0.9; |
153 | glLogicOp GL_AND; |
155 | glEnable GL_BLEND; |
154 | glEnable GL_COLOR_LOGIC_OP; |
156 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
155 | glBegin GL_QUADS; |
157 | glBegin GL_QUADS; |
156 | glVertex 0, 0; |
158 | glVertex 0, 0; |
157 | glVertex 0, $::HEIGHT; |
159 | glVertex 0, $::HEIGHT; |
158 | glVertex $::WIDTH, $::HEIGHT; |
160 | glVertex $::WIDTH, $::HEIGHT; |
159 | glVertex $::WIDTH, 0; |
161 | glVertex $::WIDTH, 0; |
160 | glEnd; |
162 | glEnd; |
161 | glDisable GL_COLOR_LOGIC_OP; |
163 | glDisable GL_BLEND; |
162 | } |
164 | } |
163 | } |
165 | } |
164 | |
166 | |
165 | my %DIR = ( |
167 | my %DIR = ( |
166 | CFClient::SDLK_KP8, [1, "north"], |
168 | CFClient::SDLK_KP8, [1, "north"], |
… | |
… | |
189 | |
191 | |
190 | if ($sym == CFClient::SDLK_KP5) { |
192 | if ($sym == CFClient::SDLK_KP5) { |
191 | $::CONN->user_send ("stay fire"); |
193 | $::CONN->user_send ("stay fire"); |
192 | } elsif ($uni == ord ",") { |
194 | } elsif ($uni == ord ",") { |
193 | $::CONN->user_send ("take"); |
195 | $::CONN->user_send ("take"); |
194 | } elsif ($uni == ord "\t") { |
196 | } elsif ($uni == ord "\t" or $uni == ord " ") { |
195 | $::CONN->user_send ("apply"); |
197 | $::CONN->user_send ("apply"); |
|
|
198 | } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") { |
|
|
199 | $::CONN->user_send ("rotateshoottype +"); |
|
|
200 | } elsif ($sym == CFClient::SDLK_KP_MINUS || $uni == ord "-") { |
|
|
201 | $::CONN->user_send ("rotateshoottype -"); |
196 | } elsif ($uni == ord "'") { |
202 | } elsif ($uni == ord "'") { |
197 | $self->emit ('activate_console'); |
203 | $self->emit ('activate_console'); |
198 | } elsif ($uni == ord "/") { |
204 | } elsif ($uni == ord "/") { |
199 | $self->emit (activate_console => '/'); |
205 | $self->emit (activate_console => '/'); |
200 | } elsif (exists $DIR{$sym}) { |
206 | } elsif (exists $DIR{$sym}) { |
… | |
… | |
252 | |
258 | |
253 | $tooltip = "<big>$data</big>\n\n$tooltip"; |
259 | $tooltip = "<big>$data</big>\n\n$tooltip"; |
254 | |
260 | |
255 | $tooltip =~ s/\s+$//; |
261 | $tooltip =~ s/\s+$//; |
256 | |
262 | |
257 | $self->{command}{$command} = [$data, $tooltip, $widget, $cb]; |
263 | $self->{command}{$command} = [$data, $tooltip, $widget, $cb, ++$self->{command_id}]; |
258 | } |
264 | } |
259 | |
265 | |
260 | sub clr_commands { |
266 | sub clr_commands { |
261 | my ($self) = @_; |
267 | my ($self) = @_; |
262 | |
268 | |
… | |
… | |
365 | CFClient::UI::Label->new ( |
371 | CFClient::UI::Label->new ( |
366 | can_hover => 1, |
372 | can_hover => 1, |
367 | can_events => 1, |
373 | can_events => 1, |
368 | tooltip_width => 0.33, |
374 | tooltip_width => 0.33, |
369 | fontsize => $_, |
375 | fontsize => $_, |
370 | ), (0.8) x 6 |
376 | ), (0.8) x 16 |
371 | ]; |
377 | ]; |
372 | |
378 | |
373 | $self->{entry} = new CFClient::UI::Entry |
379 | $self->{entry} = new CFClient::UI::Entry |
374 | connect_changed => sub { |
380 | connect_changed => sub { |
375 | $self->update_labels; |
381 | $self->update_labels; |
… | |
… | |
449 | } |
455 | } |
450 | |
456 | |
451 | @match = map $self->{command}{$_->[0]}, |
457 | @match = map $self->{command}{$_->[0]}, |
452 | sort { |
458 | sort { |
453 | $a->[1] <=> $b->[1] |
459 | $a->[1] <=> $b->[1] |
454 | or (length $a->[0]) <=> (length $b->[0]) |
460 | or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4] |
455 | } @match; |
461 | } @match; |
456 | |
462 | |
457 | $self->{last_search} = $cmd; |
463 | $self->{last_search} = $cmd; |
458 | $self->{last_match} = \@match; |
464 | $self->{last_match} = \@match; |
459 | |
465 | |