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.276 by root, Sat Aug 30 08:04:01 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];
528 if (!svp || !SvTRUE (*svp)) 529 if (!svp || !SvTRUE (*svp))
529 return 0; 530 return 0;
530 531
531 return 1; 532 return 1;
532} 533}
534
535/******************************************************************************/
533 536
534/* process keyboard modifiers */ 537/* process keyboard modifiers */
535static int 538static int
536mod_munge (int mod) 539mod_munge (int mod)
537{ 540{
1204#if DEBUG 1207#if DEBUG
1205 VALGRIND_DO_LEAK_CHECK; 1208 VALGRIND_DO_LEAK_CHECK;
1206#endif 1209#endif
1207} 1210}
1208 1211
1212int
1213SvREFCNT (SV *sv)
1214 CODE:
1215 RETVAL = SvREFCNT (sv);
1216 OUTPUT:
1217 RETVAL
1218
1209MODULE = Deliantra::Client PACKAGE = DC::Font 1219MODULE = Deliantra::Client PACKAGE = DC::Font
1210 1220
1211PROTOTYPES: DISABLE 1221PROTOTYPES: DISABLE
1212 1222
1213DC::Font 1223DC::Font
1757 //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);
1758 // use uglier nearest interpolation because linear suffers 1768 // use uglier nearest interpolation because linear suffers
1759 // from transparent color bleeding and ugly wrapping effects. 1769 // from transparent color bleeding and ugly wrapping effects.
1760 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 1770 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1761} 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 }
1762 1792
1763int 1793int
1764ox (DC::Map self) 1794ox (DC::Map self)
1765 ALIAS: 1795 ALIAS:
1766 oy = 1 1796 oy = 1
1887 cell->tile [z] = self->face2tile [face]; 1917 cell->tile [z] = self->face2tile [face];
1888 1918
1889 if (cell->tile [z]) 1919 if (cell->tile [z])
1890 { 1920 {
1891 maptex *tex = self->tex + cell->tile [z]; 1921 maptex *tex = self->tex + cell->tile [z];
1922 tex->unused = 0;
1892 if (!tex->name) 1923 if (!tex->name)
1893 av_push (missing, newSViv (cell->tile [z])); 1924 av_push (missing, newSViv (cell->tile [z]));
1894 1925
1895 if (tex->smoothtile) 1926 if (tex->smoothtile)
1896 { 1927 {
1897 maptex *smooth = self->tex + tex->smoothtile; 1928 maptex *smooth = self->tex + tex->smoothtile;
1929 smooth->unused = 0;
1898 if (!smooth->name) 1930 if (!smooth->name)
1899 av_push (missing, newSViv (tex->smoothtile)); 1931 av_push (missing, newSViv (tex->smoothtile));
1900 } 1932 }
1901 } 1933 }
1902 } 1934 }
2047 int px = (x + 1) * T - tex.w; 2079 int px = (x + 1) * T - tex.w;
2048 int py = (y + 1) * T - tex.h; 2080 int py = (y + 1) * T - tex.h;
2049 2081
2050 if (key.texname != tex.name) 2082 if (key.texname != tex.name)
2051 { 2083 {
2084 self->tex [tile].unused = 0;
2085
2052 if (!tex.name) 2086 if (!tex.name)
2053 tex = self->tex [2]; /* missing, replace by noface */ 2087 tex = self->tex [2]; /* missing, replace by noface */
2054 2088
2055 key.texname = tex.name; 2089 key.texname = tex.name;
2056 arr = rc_array (rc, &key); 2090 arr = rc_array (rc, &key);
2178 { 2212 {
2179 // this time avoiding texture state changes 2213 // this time avoiding texture state changes
2180 // save gobs of state changes. 2214 // save gobs of state changes.
2181 if (key.texname != tex.name) 2215 if (key.texname != tex.name)
2182 { 2216 {
2217 self->tex [skey->tile].unused = 0;
2218
2183 glEnd (); 2219 glEnd ();
2184 glBindTexture (GL_TEXTURE_2D, key.texname = tex.name); 2220 glBindTexture (GL_TEXTURE_2D, key.texname = tex.name);
2185 glBegin (GL_QUADS); 2221 glBegin (GL_QUADS);
2186 } 2222 }
2187 2223
2249 { 2285 {
2250 mapcell *cell = row->col + (x + mx - row->c0); 2286 mapcell *cell = row->col + (x + mx - row->c0);
2251 2287
2252 int px = x * T; 2288 int px = x * T;
2253 int py = y * T; 2289 int py = y * T;
2290
2291 if (expect_false (cell->player == player))
2292 {
2293 px += sdx;
2294 py += sdy;
2295 }
2254 2296
2255 if (cell->stat_hp) 2297 if (cell->stat_hp)
2256 { 2298 {
2257 int width = cell->stat_width * T; 2299 int width = cell->stat_width * T;
2258 int thick = (sh * T / 32 + 27) / 28 + 1 + cell->stat_width; 2300 int thick = (sh * T / 32 + 27) / 28 + 1 + cell->stat_width;
2999void glRotate (float angle, float x, float y, float z) 3041void glRotate (float angle, float x, float y, float z)
3000 CODE: 3042 CODE:
3001 glRotatef (angle, x, y, z); 3043 glRotatef (angle, x, y, z);
3002 3044
3003void glColor (float r, float g, float b, float a = 1.0) 3045void glColor (float r, float g, float b, float a = 1.0)
3046 PROTOTYPE: @
3004 ALIAS: 3047 ALIAS:
3005 glColor_premultiply = 1 3048 glColor_premultiply = 1
3006 CODE: 3049 CODE:
3007 if (ix) 3050 if (ix)
3008 { 3051 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines