… | |
… | |
78 | $self->SUPER::update; |
78 | $self->SUPER::update; |
79 | } |
79 | } |
80 | |
80 | |
81 | sub draw { |
81 | sub draw { |
82 | my ($self) = @_; |
82 | my ($self) = @_; |
|
|
83 | |
|
|
84 | return |
|
|
85 | unless $CFClient::UI::FOCUS == $self || !$::FAST; |
83 | |
86 | |
84 | if (delete $self->{need_update}) { |
87 | if (delete $self->{need_update}) { |
85 | glNewList $self->{list}; |
88 | glNewList $self->{list}; |
86 | |
89 | |
87 | if ($::MAP) { |
90 | if ($::MAP) { |
… | |
… | |
143 | |
146 | |
144 | glPushMatrix; |
147 | glPushMatrix; |
145 | glCallList $self->{list}; |
148 | glCallList $self->{list}; |
146 | glPopMatrix; |
149 | glPopMatrix; |
147 | |
150 | |
|
|
151 | # TNT2 emulates logops in software (or worse :) |
148 | if ($CFClient::UI::FOCUS != $self) { |
152 | if ($CFClient::UI::FOCUS != $self) { |
149 | glColor 64/255, 64/255, 64/255; |
153 | glColor 0.4, 0.2, 0.2, 0.9; |
150 | glLogicOp GL_AND; |
154 | glEnable GL_BLEND; |
151 | glEnable GL_COLOR_LOGIC_OP; |
155 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
152 | glBegin GL_QUADS; |
156 | glBegin GL_QUADS; |
153 | glVertex 0, 0; |
157 | glVertex 0, 0; |
154 | glVertex 0, $::HEIGHT; |
158 | glVertex 0, $::HEIGHT; |
155 | glVertex $::WIDTH, $::HEIGHT; |
159 | glVertex $::WIDTH, $::HEIGHT; |
156 | glVertex $::WIDTH, 0; |
160 | glVertex $::WIDTH, 0; |
157 | glEnd; |
161 | glEnd; |
158 | glDisable GL_COLOR_LOGIC_OP; |
162 | glDisable GL_BLEND; |
159 | } |
163 | } |
160 | } |
164 | } |
161 | |
165 | |
162 | my %DIR = ( |
166 | my %DIR = ( |
163 | CFClient::SDLK_KP8, [1, "north"], |
167 | CFClient::SDLK_KP8, [1, "north"], |
… | |
… | |
186 | |
190 | |
187 | if ($sym == CFClient::SDLK_KP5) { |
191 | if ($sym == CFClient::SDLK_KP5) { |
188 | $::CONN->user_send ("stay fire"); |
192 | $::CONN->user_send ("stay fire"); |
189 | } elsif ($uni == ord ",") { |
193 | } elsif ($uni == ord ",") { |
190 | $::CONN->user_send ("take"); |
194 | $::CONN->user_send ("take"); |
191 | } elsif ($uni == ord "\t") { |
195 | } elsif ($uni == ord "\t" or $uni == ord " ") { |
192 | $::CONN->user_send ("apply"); |
196 | $::CONN->user_send ("apply"); |
|
|
197 | } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") { |
|
|
198 | $::CONN->user_send ("rotateshoottype +"); |
|
|
199 | } elsif ($sym == CFClient::SDLK_KP_MINUS || $uni == ord "-") { |
|
|
200 | $::CONN->user_send ("rotateshoottype -"); |
193 | } elsif ($uni == ord "'") { |
201 | } elsif ($uni == ord "'") { |
194 | $self->emit ('activate_console'); |
202 | $self->emit ('activate_console'); |
195 | } elsif ($uni == ord "/") { |
203 | } elsif ($uni == ord "/") { |
196 | $self->emit (activate_console => '/'); |
204 | $self->emit (activate_console => '/'); |
197 | } elsif (exists $DIR{$sym}) { |
205 | } elsif (exists $DIR{$sym}) { |
… | |
… | |
249 | |
257 | |
250 | $tooltip = "<big>$data</big>\n\n$tooltip"; |
258 | $tooltip = "<big>$data</big>\n\n$tooltip"; |
251 | |
259 | |
252 | $tooltip =~ s/\s+$//; |
260 | $tooltip =~ s/\s+$//; |
253 | |
261 | |
254 | $self->{command}{$command} = [$data, $tooltip, $widget, $cb]; |
262 | $self->{command}{$command} = [$data, $tooltip, $widget, $cb, ++$self->{command_id}]; |
255 | } |
263 | } |
256 | |
264 | |
257 | sub clr_commands { |
265 | sub clr_commands { |
258 | my ($self) = @_; |
266 | my ($self) = @_; |
259 | |
267 | |
… | |
… | |
362 | CFClient::UI::Label->new ( |
370 | CFClient::UI::Label->new ( |
363 | can_hover => 1, |
371 | can_hover => 1, |
364 | can_events => 1, |
372 | can_events => 1, |
365 | tooltip_width => 0.33, |
373 | tooltip_width => 0.33, |
366 | fontsize => $_, |
374 | fontsize => $_, |
367 | ), (0.8) x 6 |
375 | ), (0.8) x 16 |
368 | ]; |
376 | ]; |
369 | |
377 | |
370 | $self->{entry} = new CFClient::UI::Entry |
378 | $self->{entry} = new CFClient::UI::Entry |
371 | connect_changed => sub { |
379 | connect_changed => sub { |
372 | $self->update_labels; |
380 | $self->update_labels; |
… | |
… | |
446 | } |
454 | } |
447 | |
455 | |
448 | @match = map $self->{command}{$_->[0]}, |
456 | @match = map $self->{command}{$_->[0]}, |
449 | sort { |
457 | sort { |
450 | $a->[1] <=> $b->[1] |
458 | $a->[1] <=> $b->[1] |
451 | or (length $a->[0]) <=> (length $b->[0]) |
459 | or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4] |
452 | } @match; |
460 | } @match; |
453 | |
461 | |
454 | $self->{last_search} = $cmd; |
462 | $self->{last_search} = $cmd; |
455 | $self->{last_match} = \@match; |
463 | $self->{last_match} = \@match; |
456 | |
464 | |