--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/05/17 20:50:19 1.28 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/05/23 21:14:41 1.34 @@ -117,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; @@ -148,17 +149,42 @@ glCallList $self->{list}; glPopMatrix; - if ($CFClient::UI::FOCUS != $self) { - glColor 64/255, 64/255, 64/255; - glLogicOp GL_AND; - glEnable GL_COLOR_LOGIC_OP; + # TNT2 emulates logops in software (or worse :) + if ($CFClient::UI::FOCUS == $self) { + (delete $self->{out_of_focus})->destroy + if $self->{out_of_focus}; + } else { + glColor 0.4, 0.2, 0.2, 0.6; + 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; + + $self->{out_of_focus} ||= do { + my $label = new CFClient::UI::Label + x => 0, + y => 0, + z => 1, + ellipsise => 0, + text => "map out of focus (click map to play)"; + + $label->show; + $label->update; + + $CFClient::UI::ROOT->on_post_alloc ("$self$label" => sub { + $label->move ( + ($::WIDTH - $label->{w}) * 0.5, + ($::HEIGHT - $label->{h}) * 0.5, + ); + }); + + $label + }; } } @@ -456,6 +482,7 @@ sort { $a->[1] <=> $b->[1] or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4] + or (length $a->[0]) <=> (length $b->[0]) } @match; $self->{last_search} = $cmd;