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.279 by root, Thu Oct 2 15:59:40 2008 UTC vs.
Revision 1.280 by root, Wed Nov 26 23:08:34 2008 UTC

233 int w, h; 233 int w, h;
234 float s, t; 234 float s, t;
235 uint8_t r, g, b, a; 235 uint8_t r, g, b, a;
236 tileid smoothtile; 236 tileid smoothtile;
237 uint8_t smoothlevel; 237 uint8_t smoothlevel;
238 uint8_t unused; /* set to zero on use */
238} maptex; 239} maptex;
239 240
240typedef struct { 241typedef struct {
241 uint32_t player; 242 uint32_t player;
242 tileid tile[3]; 243 tileid tile[3];
1206#if DEBUG 1207#if DEBUG
1207 VALGRIND_DO_LEAK_CHECK; 1208 VALGRIND_DO_LEAK_CHECK;
1208#endif 1209#endif
1209} 1210}
1210 1211
1212int
1213SvREFCNT (SV *sv)
1214 CODE:
1215 RETVAL = SvREFCNT (sv);
1216 OUTPUT:
1217 RETVAL
1218
1211MODULE = Deliantra::Client PACKAGE = DC::Font 1219MODULE = Deliantra::Client PACKAGE = DC::Font
1212 1220
1213PROTOTYPES: DISABLE 1221PROTOTYPES: DISABLE
1214 1222
1215DC::Font 1223DC::Font
1759 //glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 1767 //glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
1760 // use uglier nearest interpolation because linear suffers 1768 // use uglier nearest interpolation because linear suffers
1761 // from transparent color bleeding and ugly wrapping effects. 1769 // from transparent color bleeding and ugly wrapping effects.
1762 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 1770 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1763} 1771}
1772
1773void
1774expire_textures (DC::Map self, int texid, int count)
1775 PPCODE:
1776 for (; texid < self->texs && count; ++texid, --count)
1777 {
1778 maptex *tex = self->tex + texid;
1779
1780 if (tex->name)
1781 {
1782 if (tex->unused)
1783 {
1784 tex->name = 0;
1785 tex->unused = 0,
1786 XPUSHs (sv_2mortal (newSViv (texid)));
1787 }
1788 else
1789 tex->unused = 1;
1790 }
1791 }
1764 1792
1765int 1793int
1766ox (DC::Map self) 1794ox (DC::Map self)
1767 ALIAS: 1795 ALIAS:
1768 oy = 1 1796 oy = 1
1889 cell->tile [z] = self->face2tile [face]; 1917 cell->tile [z] = self->face2tile [face];
1890 1918
1891 if (cell->tile [z]) 1919 if (cell->tile [z])
1892 { 1920 {
1893 maptex *tex = self->tex + cell->tile [z]; 1921 maptex *tex = self->tex + cell->tile [z];
1922 tex->unused = 0;
1894 if (!tex->name) 1923 if (!tex->name)
1895 av_push (missing, newSViv (cell->tile [z])); 1924 av_push (missing, newSViv (cell->tile [z]));
1896 1925
1897 if (tex->smoothtile) 1926 if (tex->smoothtile)
1898 { 1927 {
1899 maptex *smooth = self->tex + tex->smoothtile; 1928 maptex *smooth = self->tex + tex->smoothtile;
1929 smooth->unused = 0;
1900 if (!smooth->name) 1930 if (!smooth->name)
1901 av_push (missing, newSViv (tex->smoothtile)); 1931 av_push (missing, newSViv (tex->smoothtile));
1902 } 1932 }
1903 } 1933 }
1904 } 1934 }
2049 int px = (x + 1) * T - tex.w; 2079 int px = (x + 1) * T - tex.w;
2050 int py = (y + 1) * T - tex.h; 2080 int py = (y + 1) * T - tex.h;
2051 2081
2052 if (key.texname != tex.name) 2082 if (key.texname != tex.name)
2053 { 2083 {
2084 self->tex [tile].unused = 0;
2085
2054 if (!tex.name) 2086 if (!tex.name)
2055 tex = self->tex [2]; /* missing, replace by noface */ 2087 tex = self->tex [2]; /* missing, replace by noface */
2056 2088
2057 key.texname = tex.name; 2089 key.texname = tex.name;
2058 arr = rc_array (rc, &key); 2090 arr = rc_array (rc, &key);
2180 { 2212 {
2181 // this time avoiding texture state changes 2213 // this time avoiding texture state changes
2182 // save gobs of state changes. 2214 // save gobs of state changes.
2183 if (key.texname != tex.name) 2215 if (key.texname != tex.name)
2184 { 2216 {
2217 self->tex [skey->tile].unused = 0;
2218
2185 glEnd (); 2219 glEnd ();
2186 glBindTexture (GL_TEXTURE_2D, key.texname = tex.name); 2220 glBindTexture (GL_TEXTURE_2D, key.texname = tex.name);
2187 glBegin (GL_QUADS); 2221 glBegin (GL_QUADS);
2188 } 2222 }
2189 2223

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines