--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/05/17 10:14:52 1.24
+++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/05/19 23:18:42 1.31
@@ -81,6 +81,9 @@
sub draw {
my ($self) = @_;
+ return
+ unless $CFClient::UI::FOCUS == $self || !$::FAST;
+
if (delete $self->{need_update}) {
glNewList $self->{list};
@@ -114,25 +117,26 @@
glEnable GL_CONVOLUTION_2D;
}
+ # try to re-use the texture name: TODO improve texture class instead
+ my $prev_name = ((delete $self->{fow_texture}) || {})->{name};
+
$self->{fow_texture} = new CFClient::Texture
w => $w,
h => $h,
data => $data,
+ name => $prev_name, # a bit hackish
internalformat => GL_ALPHA,
format => GL_ALPHA;
glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth};
- glEnable GL_BLEND;
- glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
glEnable GL_TEXTURE_2D;
glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
glColor +($::CFG->{fow_intensity}) x 3, 0.8;
- $self->{fow_texture}->draw_quad (0, 0, $w * 32, $h * 32);
+ $self->{fow_texture}->draw_quad_alpha (0, 0, $w * 32, $h * 32);
glDisable GL_TEXTURE_2D;
- glDisable GL_BLEND;
}
glPopMatrix;
@@ -145,17 +149,18 @@
glCallList $self->{list};
glPopMatrix;
+ # TNT2 emulates logops in software (or worse :)
if ($CFClient::UI::FOCUS != $self) {
- glColor 64/255, 64/255, 64/255;
- glLogicOp GL_AND;
- glEnable GL_COLOR_LOGIC_OP;
+ glColor 0.4, 0.2, 0.2, 0.9;
+ glEnable GL_BLEND;
+ glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
glBegin GL_QUADS;
glVertex 0, 0;
glVertex 0, $::HEIGHT;
glVertex $::WIDTH, $::HEIGHT;
glVertex $::WIDTH, 0;
glEnd;
- glDisable GL_COLOR_LOGIC_OP;
+ glDisable GL_BLEND;
}
}
@@ -188,8 +193,12 @@
$::CONN->user_send ("stay fire");
} elsif ($uni == ord ",") {
$::CONN->user_send ("take");
- } elsif ($uni == ord "\t") {
+ } elsif ($uni == ord "\t" or $uni == ord " ") {
$::CONN->user_send ("apply");
+ } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") {
+ $::CONN->user_send ("rotateshoottype +");
+ } elsif ($sym == CFClient::SDLK_KP_MINUS || $uni == ord "-") {
+ $::CONN->user_send ("rotateshoottype -");
} elsif ($uni == ord "'") {
$self->emit ('activate_console');
} elsif ($uni == ord "/") {
@@ -247,12 +256,11 @@
$tooltip =~ s/^\s+//;
- $tooltip = "" . (CFClient::UI::Label::escape $data) . "\n\n"
- . CFClient::UI::Label::escape $tooltip;
+ $tooltip = "$data\n\n$tooltip";
$tooltip =~ s/\s+$//;
- $self->{command}{$command} = [$data, $tooltip, $widget, $cb];
+ $self->{command}{$command} = [$data, $tooltip, $widget, $cb, ++$self->{command_id}];
}
sub clr_commands {
@@ -361,10 +369,11 @@
$self->{label} = [
map
CFClient::UI::Label->new (
- can_hover => 1,
- can_events => 1,
- fontsize => $_,
- ), (0.8) x 6
+ can_hover => 1,
+ can_events => 1,
+ tooltip_width => 0.33,
+ fontsize => $_,
+ ), (0.8) x 16
];
$self->{entry} = new CFClient::UI::Entry
@@ -448,7 +457,7 @@
@match = map $self->{command}{$_->[0]},
sort {
$a->[1] <=> $b->[1]
- or (length $a->[0]) <=> (length $b->[0])
+ or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4]
} @match;
$self->{last_search} = $cmd;