… | |
… | |
1524 | # $lighting =~ s/(.)../$1/gs; |
1524 | # $lighting =~ s/(.)../$1/gs; |
1525 | # } |
1525 | # } |
1526 | |
1526 | |
1527 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
1527 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
1528 | |
1528 | |
|
|
1529 | if ($::CFG->{fow_smooth}) { # smooth fog of war |
|
|
1530 | my @conv = ( |
|
|
1531 | 0.1, 0.1, 0.1, |
|
|
1532 | 0.1, 0.2, 0.1, |
|
|
1533 | 0.1, 0.1, 0.1, |
|
|
1534 | ); |
|
|
1535 | glConvolutionParameter GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER; |
|
|
1536 | glConvolutionFilter2D GL_CONVOLUTION_2D, |
|
|
1537 | GL_ALPHA, 3, 3, GL_ALPHA, GL_FLOAT, |
|
|
1538 | pack "f*", @conv; |
|
|
1539 | glEnable GL_CONVOLUTION_2D; |
|
|
1540 | } |
|
|
1541 | |
1529 | $darkness = new CFClient::Texture |
1542 | $darkness = new CFClient::Texture |
1530 | w => $sw4, |
1543 | w => $sw4, |
1531 | h => $sh, |
1544 | h => $sh, |
1532 | data => $darkness, |
1545 | data => $darkness, |
1533 | internalformat => GL_ALPHA, |
1546 | internalformat => GL_ALPHA, |
1534 | format => GL_ALPHA; |
1547 | format => GL_ALPHA; |
1535 | |
1548 | |
1536 | glColor 0.45, 0.45, 0.45, 1; |
1549 | glColor +($::CFG->{fow_intensity}) x 3, 1; |
1537 | $darkness->draw_quad (0, 0, $sw4 * 32, $sh * 32); |
1550 | $darkness->draw_quad (0, 0, $sw4 * 32, $sh * 32); |
|
|
1551 | |
|
|
1552 | glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth}; |
1538 | |
1553 | |
1539 | glDisable GL_TEXTURE_2D; |
1554 | glDisable GL_TEXTURE_2D; |
1540 | glDisable GL_BLEND; |
1555 | glDisable GL_BLEND; |
1541 | |
1556 | |
1542 | glEndList; |
1557 | glEndList; |
… | |
… | |
1578 | |
1593 | |
1579 | my $mod = $ev->key_mod; |
1594 | my $mod = $ev->key_mod; |
1580 | my $sym = $ev->key_sym; |
1595 | my $sym = $ev->key_sym; |
1581 | |
1596 | |
1582 | if ($sym == SDLK_KP5) { |
1597 | if ($sym == SDLK_KP5) { |
1583 | $::CONN->send ("command stay fire"); |
1598 | $::CONN->user_send ("command stay fire"); |
1584 | } elsif ($sym == SDLK_a) { |
1599 | } elsif ($sym == SDLK_a) { |
1585 | $::CONN->send ("command apply"); |
1600 | $::CONN->user_send ("command apply"); |
1586 | } elsif (exists $DIR{$sym}) { |
1601 | } elsif (exists $DIR{$sym}) { |
1587 | if ($mod & KMOD_SHIFT) { |
1602 | if ($mod & KMOD_SHIFT) { |
1588 | $self->{shft}++; |
1603 | $self->{shft}++; |
1589 | $::CONN->send ("command fire $DIR{$sym}[0]"); |
1604 | $::CONN->user_send ("command fire $DIR{$sym}[0]"); |
1590 | } elsif ($mod & KMOD_CTRL) { |
1605 | } elsif ($mod & KMOD_CTRL) { |
1591 | $self->{ctrl}++; |
1606 | $self->{ctrl}++; |
1592 | $::CONN->send ("command run $DIR{$sym}[0]"); |
1607 | $::CONN->user_send ("command run $DIR{$sym}[0]"); |
1593 | } else { |
1608 | } else { |
1594 | $::CONN->send ("command $DIR{$sym}[1]"); |
1609 | $::CONN->user_send ("command $DIR{$sym}[1]"); |
1595 | } |
1610 | } |
1596 | } |
1611 | } |
1597 | } |
1612 | } |
1598 | |
1613 | |
1599 | sub key_up { |
1614 | sub key_up { |
… | |
… | |
1601 | |
1616 | |
1602 | my $mod = $ev->key_mod; |
1617 | my $mod = $ev->key_mod; |
1603 | my $sym = $ev->key_sym; |
1618 | my $sym = $ev->key_sym; |
1604 | |
1619 | |
1605 | if (!($mod & KMOD_SHIFT) && delete $self->{shft}) { |
1620 | if (!($mod & KMOD_SHIFT) && delete $self->{shft}) { |
1606 | $::CONN->send ("command fire_stop"); |
1621 | $::CONN->user_send ("command fire_stop"); |
1607 | } |
1622 | } |
1608 | if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) { |
1623 | if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) { |
1609 | $::CONN->send ("command run_stop"); |
1624 | $::CONN->user_send ("command run_stop"); |
1610 | } |
1625 | } |
1611 | } |
1626 | } |
1612 | |
1627 | |
1613 | ############################################################################# |
1628 | ############################################################################# |
1614 | |
1629 | |