ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.87 by root, Wed Apr 12 17:11:02 2006 UTC vs.
Revision 1.93 by root, Wed Apr 12 23:59:42 2006 UTC

1483 1483
1484 glEnable GL_TEXTURE_2D; 1484 glEnable GL_TEXTURE_2D;
1485 glEnable GL_BLEND; 1485 glEnable GL_BLEND;
1486 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1486 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1487 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1487 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1488 glColor 1, 1, 1, 1;
1488 1489
1489 my $sw4 = ($sw + 3) & ~3; 1490 my $sw4 = ($sw + 3) & ~3;
1490 my $darkness = "\x00" x ($sw4 * $sh); 1491 my $darkness = "\x00" x ($sw4 * $sh);
1491 1492
1492 for my $x (0 .. $sw - 1) { 1493 for my $x (0 .. $sw - 1) {
1511 $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);
1512 } 1513 }
1513 } 1514 }
1514 } 1515 }
1515 1516
1516# if (1) { # higher quality darkness
1517# $lighting =~ s/(.)/$1$1$1/gs;
1518# my $pb = new_from_data Gtk2::Gdk::Pixbuf $lighting, "rgb", 0, 8, $sw4, $sh, $sw4 * 3;
1519#
1520# $pb = $pb->scale_simple ($sw4 * 0.5, $sh * 0.5, "bilinear");
1521#
1522# $lighting = $pb->get_pixels;
1523# $lighting =~ s/(.)../$1/gs;
1524# }
1525
1526 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 }
1527 1531
1528 $darkness = new CFClient::Texture 1532 $darkness = new CFClient::Texture
1529 w => $sw4, 1533 w => $sw4,
1530 h => $sh, 1534 h => $sh,
1531 data => $darkness, 1535 data => $darkness,
1532 internalformat => GL_ALPHA, 1536 internalformat => GL_ALPHA,
1533 format => GL_ALPHA; 1537 format => GL_ALPHA;
1534 1538
1535 glColor 0.45, 0.45, 0.45, 1; 1539 glColor +($::CFG->{fow_intensity}) x 3, 1;
1536 $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};
1537 1543
1538 glDisable GL_TEXTURE_2D; 1544 glDisable GL_TEXTURE_2D;
1539 glDisable GL_BLEND; 1545 glDisable GL_BLEND;
1540 1546
1541 glEndList; 1547 glEndList;
1577 1583
1578 my $mod = $ev->key_mod; 1584 my $mod = $ev->key_mod;
1579 my $sym = $ev->key_sym; 1585 my $sym = $ev->key_sym;
1580 1586
1581 if ($sym == SDLK_KP5) { 1587 if ($sym == SDLK_KP5) {
1582 $::CONN->send ("command stay fire"); 1588 $::CONN->user_send ("command stay fire");
1583 } elsif ($sym == SDLK_a) { 1589 } elsif ($sym == SDLK_a) {
1584 $::CONN->send ("command apply"); 1590 $::CONN->user_send ("command apply");
1585 } elsif (exists $DIR{$sym}) { 1591 } elsif (exists $DIR{$sym}) {
1586 if ($mod & KMOD_SHIFT) { 1592 if ($mod & KMOD_SHIFT) {
1587 $self->{shft}++; 1593 $self->{shft}++;
1588 $::CONN->send ("command fire $DIR{$sym}[0]"); 1594 $::CONN->user_send ("command fire $DIR{$sym}[0]");
1589 } elsif ($mod & KMOD_CTRL) { 1595 } elsif ($mod & KMOD_CTRL) {
1590 $self->{ctrl}++; 1596 $self->{ctrl}++;
1591 $::CONN->send ("command run $DIR{$sym}[0]"); 1597 $::CONN->user_send ("command run $DIR{$sym}[0]");
1592 } else { 1598 } else {
1593 $::CONN->send ("command $DIR{$sym}[1]"); 1599 $::CONN->user_send ("command $DIR{$sym}[1]");
1594 } 1600 }
1595 } 1601 }
1596} 1602}
1597 1603
1598sub key_up { 1604sub key_up {
1600 1606
1601 my $mod = $ev->key_mod; 1607 my $mod = $ev->key_mod;
1602 my $sym = $ev->key_sym; 1608 my $sym = $ev->key_sym;
1603 1609
1604 if (!($mod & KMOD_SHIFT) && delete $self->{shft}) { 1610 if (!($mod & KMOD_SHIFT) && delete $self->{shft}) {
1605 $::CONN->send ("command fire_stop"); 1611 $::CONN->user_send ("command fire_stop");
1606 } 1612 }
1607 if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) { 1613 if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) {
1608 $::CONN->send ("command run_stop"); 1614 $::CONN->user_send ("command run_stop");
1609 } 1615 }
1610} 1616}
1611 1617
1612############################################################################# 1618#############################################################################
1613 1619

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines