… | |
… | |
288 | } |
288 | } |
289 | |
289 | |
290 | sub connect { |
290 | sub connect { |
291 | my ($self, $signal, $cb) = @_; |
291 | my ($self, $signal, $cb) = @_; |
292 | |
292 | |
293 | push @{ $self->{cb}{$signal} }, $cb; |
293 | push @{ $self->{signal_cb}{$signal} }, $cb; |
294 | } |
294 | } |
295 | |
295 | |
296 | sub emit { |
296 | sub emit { |
297 | my ($self, $signal, @args) = @_; |
297 | my ($self, $signal, @args) = @_; |
298 | |
298 | |
|
|
299 | for my $cb (@{$self->{signal_cb}{$signal} || []}) { |
299 | $_->($self, @args) |
300 | $cb->($self, @args); |
300 | for @{$self->{cb}{$signal} || []}; |
301 | } |
301 | } |
302 | } |
302 | |
303 | |
303 | sub DESTROY { |
304 | sub DESTROY { |
304 | my ($self) = @_; |
305 | my ($self) = @_; |
305 | |
306 | |
… | |
… | |
1494 | my $h1 = $self->{h} - $ycut * $self->{h}; |
1495 | my $h1 = $self->{h} - $ycut * $self->{h}; |
1495 | my $h2 = $ycut * $self->{h}; |
1496 | my $h2 = $ycut * $self->{h}; |
1496 | |
1497 | |
1497 | my $yp = 0; |
1498 | my $yp = 0; |
1498 | |
1499 | |
1499 | glBindTexture (GL_TEXTURE_2D, $t1->{name}); |
1500 | glBindTexture GL_TEXTURE_2D, $t1->{name}; |
1500 | glBegin (GL_QUADS); |
1501 | glBegin GL_QUADS; |
1501 | glTexCoord (0, 0); glVertex (0 , $yp); |
1502 | glTexCoord 0 , 0; glVertex 0 , $yp; |
1502 | glTexCoord (0, (1 - $ycut)); glVertex (0 , $yp + $h1); |
1503 | glTexCoord 0 , $t1->{t} * (1 - $ycut); glVertex 0 , $yp + $h1; |
1503 | glTexCoord (1, (1 - $ycut)); glVertex (0 + $w, $yp + $h1); |
1504 | glTexCoord $t1->{s}, $t1->{t} * (1 - $ycut); glVertex 0 + $w, $yp + $h1; |
1504 | glTexCoord (1, 0); glVertex (0 + $w, $yp); |
1505 | glTexCoord $t1->{s}, 0; glVertex 0 + $w, $yp; |
1505 | glEnd (); |
1506 | glEnd; |
1506 | |
1507 | |
1507 | $yp += $h1; |
1508 | $yp += $h1; |
1508 | |
1509 | |
1509 | glBindTexture (GL_TEXTURE_2D, $t2->{name}); |
1510 | glBindTexture GL_TEXTURE_2D, $t2->{name}; |
1510 | glBegin (GL_QUADS); |
1511 | glBegin GL_QUADS; |
1511 | glTexCoord (0, (1 - $ycut)); glVertex (0 , $yp); |
1512 | glTexCoord 0 , $t2->{t} * (1 - $ycut); glVertex 0 , $yp; |
1512 | glTexCoord (0, 1); glVertex (0 , $yp + $h2); |
1513 | glTexCoord 0 , $t2->{t}; glVertex 0 , $yp + $h2; |
1513 | glTexCoord (1, 1); glVertex (0 + $w, $yp + $h2); |
1514 | glTexCoord $t2->{s}, $t2->{t}; glVertex 0 + $w, $yp + $h2; |
1514 | glTexCoord (1, (1 - $ycut)); glVertex (0 + $w, $yp); |
1515 | glTexCoord $t2->{s}, $t2->{t} * (1 - $ycut); glVertex 0 + $w, $yp; |
1515 | glEnd (); |
1516 | glEnd; |
1516 | |
1517 | |
1517 | glDisable GL_BLEND; |
1518 | glDisable GL_BLEND; |
1518 | glDisable GL_TEXTURE_2D; |
1519 | glDisable GL_TEXTURE_2D; |
1519 | } |
1520 | } |
1520 | |
1521 | |
… | |
… | |
1913 | glTranslate $sx0 - 32, $sy0 - 32, 0; |
1914 | glTranslate $sx0 - 32, $sy0 - 32, 0; |
1914 | |
1915 | |
1915 | my ($w, $h, $data) = $::MAP->draw ($sx, $sy, 0, 0, $sw + 1, $sh + 1); |
1916 | my ($w, $h, $data) = $::MAP->draw ($sx, $sy, 0, 0, $sw + 1, $sh + 1); |
1916 | |
1917 | |
1917 | if ($::CFG->{fow_enable}) { |
1918 | if ($::CFG->{fow_enable}) { |
1918 | if ($::CFG->{fow_smooth}) { # smooth fog of war |
1919 | if ($::CFG->{fow_smooth} && $CFClient::GL_VERSION >= 1.2) { # smooth fog of war |
1919 | glConvolutionParameter (GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER); |
1920 | glConvolutionParameter (GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER); |
1920 | glConvolutionFilter2D ( |
1921 | glConvolutionFilter2D ( |
1921 | GL_CONVOLUTION_2D, |
1922 | GL_CONVOLUTION_2D, |
1922 | GL_ALPHA, |
1923 | GL_ALPHA, |
1923 | 3, 3, |
1924 | 3, 3, |
… | |
… | |
1964 | $self->{mapmap_texture} = |
1965 | $self->{mapmap_texture} = |
1965 | new CFClient::Texture |
1966 | new CFClient::Texture |
1966 | w => $w, |
1967 | w => $w, |
1967 | h => $h, |
1968 | h => $h, |
1968 | data => $::MAP->mapmap ($w, $h), |
1969 | data => $::MAP->mapmap ($w, $h), |
1969 | type => GL_UNSIGNED_INT_8_8_8_8_REV; |
1970 | type => $CFClient::GL_VERSION >= 1.2 ? GL_UNSIGNED_INT_8_8_8_8_REV : GL_UNSIGNED_BYTE; |
1970 | |
1971 | |
1971 | $self->{mapmap_texture}->draw_quad (100, 100); |
1972 | $self->{mapmap_texture}->draw_quad (100, 100); |
1972 | |
1973 | |
1973 | glDisable GL_TEXTURE_2D; |
1974 | glDisable GL_TEXTURE_2D; |
1974 | glDisable GL_BLEND; |
1975 | glDisable GL_BLEND; |