… | |
… | |
1512 | $tex->draw_quad (($x + 1) * 32 - $w, ($y + 1) * 32 - $h, $w, $h); |
1512 | $tex->draw_quad (($x + 1) * 32 - $w, ($y + 1) * 32 - $h, $w, $h); |
1513 | } |
1513 | } |
1514 | } |
1514 | } |
1515 | } |
1515 | } |
1516 | |
1516 | |
1517 | # if (1) { # higher quality darkness |
|
|
1518 | # $lighting =~ s/(.)/$1$1$1/gs; |
|
|
1519 | # my $pb = new_from_data Gtk2::Gdk::Pixbuf $lighting, "rgb", 0, 8, $sw4, $sh, $sw4 * 3; |
|
|
1520 | # |
|
|
1521 | # $pb = $pb->scale_simple ($sw4 * 0.5, $sh * 0.5, "bilinear"); |
|
|
1522 | # |
|
|
1523 | # $lighting = $pb->get_pixels; |
|
|
1524 | # $lighting =~ s/(.)../$1/gs; |
|
|
1525 | # } |
|
|
1526 | |
|
|
1527 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
1517 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
|
|
1518 | |
|
|
1519 | if ($::CFG->{fow_smooth}) { # smooth fog of war |
|
|
1520 | my @conv = ( |
|
|
1521 | 0.1, 0.1, 0.1, |
|
|
1522 | 0.1, 0.2, 0.1, |
|
|
1523 | 0.1, 0.1, 0.1, |
|
|
1524 | ); |
|
|
1525 | glConvolutionParameter GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER; |
|
|
1526 | glConvolutionFilter2D GL_CONVOLUTION_2D, |
|
|
1527 | GL_ALPHA, 3, 3, GL_ALPHA, GL_FLOAT, |
|
|
1528 | pack "f*", @conv; |
|
|
1529 | glEnable GL_CONVOLUTION_2D; |
|
|
1530 | } |
1528 | |
1531 | |
1529 | $darkness = new CFClient::Texture |
1532 | $darkness = new CFClient::Texture |
1530 | w => $sw4, |
1533 | w => $sw4, |
1531 | h => $sh, |
1534 | h => $sh, |
1532 | data => $darkness, |
1535 | data => $darkness, |
1533 | internalformat => GL_ALPHA, |
1536 | internalformat => GL_ALPHA, |
1534 | format => GL_ALPHA; |
1537 | format => GL_ALPHA; |
1535 | |
1538 | |
1536 | glColor 0.45, 0.45, 0.45, 1; |
1539 | glColor +($::CFG->{fow_intensity}) x 3, 1; |
1537 | $darkness->draw_quad (0, 0, $sw4 * 32, $sh * 32); |
1540 | $darkness->draw_quad (0, 0, $sw4 * 32, $sh * 32); |
|
|
1541 | |
|
|
1542 | glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth}; |
1538 | |
1543 | |
1539 | glDisable GL_TEXTURE_2D; |
1544 | glDisable GL_TEXTURE_2D; |
1540 | glDisable GL_BLEND; |
1545 | glDisable GL_BLEND; |
1541 | |
1546 | |
1542 | glEndList; |
1547 | glEndList; |
… | |
… | |
1578 | |
1583 | |
1579 | my $mod = $ev->key_mod; |
1584 | my $mod = $ev->key_mod; |
1580 | my $sym = $ev->key_sym; |
1585 | my $sym = $ev->key_sym; |
1581 | |
1586 | |
1582 | if ($sym == SDLK_KP5) { |
1587 | if ($sym == SDLK_KP5) { |
1583 | $::CONN->send ("command stay fire"); |
1588 | $::CONN->user_send ("command stay fire"); |
1584 | } elsif ($sym == SDLK_a) { |
1589 | } elsif ($sym == SDLK_a) { |
1585 | $::CONN->send ("command apply"); |
1590 | $::CONN->user_send ("command apply"); |
1586 | } elsif (exists $DIR{$sym}) { |
1591 | } elsif (exists $DIR{$sym}) { |
1587 | if ($mod & KMOD_SHIFT) { |
1592 | if ($mod & KMOD_SHIFT) { |
1588 | $self->{shft}++; |
1593 | $self->{shft}++; |
1589 | $::CONN->send ("command fire $DIR{$sym}[0]"); |
1594 | $::CONN->user_send ("command fire $DIR{$sym}[0]"); |
1590 | } elsif ($mod & KMOD_CTRL) { |
1595 | } elsif ($mod & KMOD_CTRL) { |
1591 | $self->{ctrl}++; |
1596 | $self->{ctrl}++; |
1592 | $::CONN->send ("command run $DIR{$sym}[0]"); |
1597 | $::CONN->user_send ("command run $DIR{$sym}[0]"); |
1593 | } else { |
1598 | } else { |
1594 | $::CONN->send ("command $DIR{$sym}[1]"); |
1599 | $::CONN->user_send ("command $DIR{$sym}[1]"); |
1595 | } |
1600 | } |
1596 | } |
1601 | } |
1597 | } |
1602 | } |
1598 | |
1603 | |
1599 | sub key_up { |
1604 | sub key_up { |
… | |
… | |
1601 | |
1606 | |
1602 | my $mod = $ev->key_mod; |
1607 | my $mod = $ev->key_mod; |
1603 | my $sym = $ev->key_sym; |
1608 | my $sym = $ev->key_sym; |
1604 | |
1609 | |
1605 | if (!($mod & KMOD_SHIFT) && delete $self->{shft}) { |
1610 | if (!($mod & KMOD_SHIFT) && delete $self->{shft}) { |
1606 | $::CONN->send ("command fire_stop"); |
1611 | $::CONN->user_send ("command fire_stop"); |
1607 | } |
1612 | } |
1608 | if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) { |
1613 | if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) { |
1609 | $::CONN->send ("command run_stop"); |
1614 | $::CONN->user_send ("command run_stop"); |
1610 | } |
1615 | } |
1611 | } |
1616 | } |
1612 | |
1617 | |
1613 | ############################################################################# |
1618 | ############################################################################# |
1614 | |
1619 | |