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

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.220 by root, Thu Aug 9 11:02:08 2007 UTC vs.
Revision 1.221 by root, Fri Aug 10 04:02:13 2007 UTC

1550 self->rows += MAP_EXTEND_Y; 1550 self->rows += MAP_EXTEND_Y;
1551 self->y += MAP_EXTEND_Y; 1551 self->y += MAP_EXTEND_Y;
1552 } 1552 }
1553} 1553}
1554 1554
1555void 1555SV *
1556map1a_update (CFPlus::Map self, SV *data_, int extmap) 1556map1a_update (CFPlus::Map self, SV *data_, int extmap)
1557 CODE: 1557 CODE:
1558{ 1558{
1559 uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); 1559 uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_);
1560 uint8_t *data_end = (uint8_t *)SvEND (data_); 1560 uint8_t *data_end = (uint8_t *)SvEND (data_);
1561 mapcell *cell; 1561 mapcell *cell;
1562 int x, y, flags; 1562 int x, y, z, flags;
1563 AV *missing = newAV ();
1564 RETVAL = newRV_noinc ((SV *)missing);
1563 1565
1564 while (data < data_end - 1) 1566 while (data < data_end - 1)
1565 { 1567 {
1566 flags = (data [0] << 8) + data [1]; data += 2; 1568 flags = (data [0] << 8) + data [1]; data += 2;
1567 1569
1618 } 1620 }
1619 else 1621 else
1620 cell->darkness = *data++ + 1; 1622 cell->darkness = *data++ + 1;
1621 } 1623 }
1622 1624
1625 for (z = 0; z <= 2; ++z)
1623 if (flags & 4) 1626 if (flags & (4 >> z))
1624 { 1627 {
1625 faceid face = (data [0] << 8) + data [1]; data += 2; 1628 faceid face = (data [0] << 8) + data [1]; data += 2;
1626 need_facenum (self, face); 1629 need_facenum (self, face);
1627 cell->tile [0] = self->face2tile [face]; 1630 cell->tile [z] = self->face2tile [face];
1631
1632 if (cell->tile [z])
1633 {
1634 maptex *tex = self->tex + cell->tile [z];
1635 if (!tex->name)
1636 av_push (missing, newSViv (cell->tile [z]));
1637
1638 if (tex->smoothtile)
1639 {
1640 maptex *smooth = self->tex + tex->smoothtile;
1641 if (!smooth->name)
1642 av_push (missing, newSViv (tex->smoothtile));
1643 }
1644 }
1628 } 1645 }
1629
1630 if (flags & 2)
1631 {
1632 faceid face = (data [0] << 8) + data [1]; data += 2;
1633 need_facenum (self, face);
1634 cell->tile [1] = self->face2tile [face];
1635 }
1636
1637 if (flags & 1)
1638 {
1639 faceid face = (data [0] << 8) + data [1]; data += 2;
1640 need_facenum (self, face);
1641 cell->tile [2] = self->face2tile [face];
1642 }
1643 } 1646 }
1644 else 1647 else
1645 cell->darkness = 0; 1648 cell->darkness = 0;
1646 } 1649 }
1647} 1650}
1651 OUTPUT:
1652 RETVAL
1648 1653
1649SV * 1654SV *
1650mapmap (CFPlus::Map self, int x0, int y0, int w, int h) 1655mapmap (CFPlus::Map self, int x0, int y0, int w, int h)
1651 CODE: 1656 CODE:
1652{ 1657{
1699 RETVAL = map_sv; 1704 RETVAL = map_sv;
1700} 1705}
1701 OUTPUT: 1706 OUTPUT:
1702 RETVAL 1707 RETVAL
1703 1708
1704SV * 1709void
1705draw (CFPlus::Map self, int mx, int my, int sw, int sh, int T) 1710draw (CFPlus::Map self, int mx, int my, int sw, int sh, int T)
1706 CODE: 1711 CODE:
1707{ 1712{
1708 HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); 1713 HV *smooth = (HV *)sv_2mortal ((SV *)newHV ());
1709 uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level 1714 uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level
1710 static uint8_t smooth_max[256][256]; // egad, fats and wasteful on memory (64k) 1715 static uint8_t smooth_max[256][256]; // egad, fats and wasteful on memory (64k)
1711 smooth_key skey; 1716 smooth_key skey;
1712 int x, y, z; 1717 int x, y, z;
1713 int last_name; 1718 int last_name;
1714 AV *missing = newAV ();
1715 RETVAL = newRV_noinc ((SV *)missing);
1716 1719
1717 // thats current max. sorry. 1720 // thats current max. sorry.
1718 if (sw > 255) sw = 255; 1721 if (sw > 255) sw = 255;
1719 if (sh > 255) sh = 255; 1722 if (sh > 255) sh = 255;
1720 1723
1780 // suppressing texture state switches here 1783 // suppressing texture state switches here
1781 // is only moderately effective, but worth the extra effort 1784 // is only moderately effective, but worth the extra effort
1782 if (last_name != tex.name) 1785 if (last_name != tex.name)
1783 { 1786 {
1784 if (!tex.name) 1787 if (!tex.name)
1785 {
1786 av_push (missing, newSViv (tile));
1787 tex = self->tex [2]; /* missing, replace by noface */ 1788 tex = self->tex [2]; /* missing, replace by noface */
1788 }
1789 1789
1790 glEnd (); 1790 glEnd ();
1791 glBindTexture (GL_TEXTURE_2D, last_name = tex.name); 1791 glBindTexture (GL_TEXTURE_2D, last_name = tex.name);
1792 glBegin (GL_QUADS); 1792 glBegin (GL_QUADS);
1793 } 1793 }
1897 // this time naively avoiding texture state changes 1897 // this time naively avoiding texture state changes
1898 // save gobs of state changes. 1898 // save gobs of state changes.
1899 if (last_name != tex.name) 1899 if (last_name != tex.name)
1900 { 1900 {
1901 if (!tex.name) 1901 if (!tex.name)
1902 {
1903 av_push (missing, newSViv (skey->tile));
1904 continue; // smoothing not yet available 1902 continue; // smoothing not yet available
1905 }
1906 1903
1907 glEnd (); 1904 glEnd ();
1908 glBindTexture (GL_TEXTURE_2D, last_name = tex.name); 1905 glBindTexture (GL_TEXTURE_2D, last_name = tex.name);
1909 glBegin (GL_QUADS); 1906 glBegin (GL_QUADS);
1910 } 1907 }
1971 px + width - 2 - cell->stat_hp * (width - 4) / 255, py - 1); 1968 px + width - 2 - cell->stat_hp * (width - 4) / 255, py - 1);
1972 } 1969 }
1973 } 1970 }
1974 } 1971 }
1975} 1972}
1976 OUTPUT:
1977 RETVAL
1978 1973
1979void 1974void
1980draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) 1975draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data)
1981 CODE: 1976 CODE:
1982{ 1977{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines