… | |
… | |
1709 | my ($self) = @_; |
1709 | my ($self) = @_; |
1710 | |
1710 | |
1711 | if (delete $self->{need_update}) { |
1711 | if (delete $self->{need_update}) { |
1712 | glNewList $self->{list}, GL_COMPILE; |
1712 | glNewList $self->{list}, GL_COMPILE; |
1713 | |
1713 | |
1714 | my $sw = int $::WIDTH / 32; |
|
|
1715 | my $sh = int $::HEIGHT / 32; |
|
|
1716 | |
|
|
1717 | if ($::MAP) { |
1714 | if ($::MAP) { |
1718 | my $sx = $::CFG->{map_shift_x}; |
1715 | my $sw = int $::WIDTH / 32; |
1719 | my $sy = $::CFG->{map_shift_y}; |
1716 | my $sh = int $::HEIGHT / 32; |
1720 | |
1717 | |
|
|
1718 | my $sx = $::CFG->{map_shift_x}; my $sx0 = $sx & 31; $sx = ($sx - $sx0) / 32; |
|
|
1719 | my $sy = $::CFG->{map_shift_y}; my $sy0 = $sy & 31; $sy = ($sy - $sy0) / 32; |
|
|
1720 | |
1721 | glTranslate +($sx & 31) - 32, ($sy & 31) - 32, 0; |
1721 | glTranslate $sx0 - 32, $sy0 - 32, 0; |
1722 | |
1722 | |
1723 | my ($w, $h, $data) = $::MAP->draw ($sx >> 5, $sy >> 5, 0, 0, $sw + 1, $sh + 1); |
1723 | my ($w, $h, $data) = $::MAP->draw ($sx, $sy, 0, 0, $sw + 1, $sh + 1); |
1724 | |
1724 | |
1725 | if ($::CFG->{fow_enable}) { |
1725 | if ($::CFG->{fow_enable}) { |
1726 | if ($::CFG->{fow_smooth}) { # smooth fog of war |
1726 | if ($::CFG->{fow_smooth}) { # smooth fog of war |
1727 | glConvolutionParameter GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER; |
1727 | glConvolutionParameter GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER; |
1728 | glConvolutionFilter2D |
1728 | glConvolutionFilter2D |
… | |
… | |
1746 | format => GL_ALPHA; |
1746 | format => GL_ALPHA; |
1747 | |
1747 | |
1748 | glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth}; |
1748 | glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth}; |
1749 | |
1749 | |
1750 | glEnable GL_BLEND; |
1750 | glEnable GL_BLEND; |
|
|
1751 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
1751 | glEnable GL_TEXTURE_2D; |
1752 | glEnable GL_TEXTURE_2D; |
1752 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
1753 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
1753 | |
1754 | |
1754 | glColor +($::CFG->{fow_intensity}) x 3, 1; |
1755 | glColor +($::CFG->{fow_intensity}) x 3, 1; |
1755 | $tex->draw_quad (0, 0, $w * 32, $h * 32); |
1756 | $tex->draw_quad (0, 0, $w * 32, $h * 32); |
1756 | |
1757 | |
1757 | glDisable GL_TEXTURE_2D; |
1758 | glDisable GL_TEXTURE_2D; |
1758 | glDisable GL_BLEND; |
1759 | glDisable GL_BLEND; |
1759 | } |
1760 | } |
|
|
1761 | |
|
|
1762 | # HACK BEGIN |
|
|
1763 | { |
|
|
1764 | glTranslate -($sx0 - 32), -($sy0 - 32), 0;#remove |
|
|
1765 | my ($w, $h) = (250, 250); |
|
|
1766 | |
|
|
1767 | glEnable GL_BLEND; |
|
|
1768 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
|
|
1769 | glEnable GL_TEXTURE_2D; |
|
|
1770 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
|
|
1771 | |
|
|
1772 | CFClient::Texture->new ( |
|
|
1773 | w => $w, |
|
|
1774 | h => $h, |
|
|
1775 | data => $::MAP->mapmap ($w, $h), |
|
|
1776 | type => GL_UNSIGNED_INT_8_8_8_8_REV |
|
|
1777 | )->draw_quad (100, 100); |
|
|
1778 | |
|
|
1779 | glDisable GL_TEXTURE_2D; |
|
|
1780 | glDisable GL_BLEND; |
|
|
1781 | } |
|
|
1782 | # HACK END |
1760 | } |
1783 | } |
1761 | |
1784 | |
1762 | glEndList; |
1785 | glEndList; |
1763 | } |
1786 | } |
1764 | |
1787 | |