--- deliantra/Deliantra-Client/Client.xs 2007/08/06 02:11:45 1.218 +++ deliantra/Deliantra-Client/Client.xs 2007/08/06 05:06:32 1.219 @@ -1352,6 +1352,9 @@ float t = SvNV (*hv_fetch (hv, "t", 1, 1)); int name = SvIV (*hv_fetch (hv, "name", 4, 1)); + if (name <= 0) + XSRETURN_EMPTY; + if (items < 5) { w = SvNV (*hv_fetch (hv, "w", 1, 1)); @@ -1698,7 +1701,7 @@ OUTPUT: RETVAL -void +SV * draw (CFPlus::Map self, int mx, int my, int sw, int sh, int T) CODE: { @@ -1708,6 +1711,8 @@ smooth_key skey; int x, y, z; int last_name; + AV *missing = newAV (); + RETVAL = newRV_noinc ((SV *)missing); // thats current max. sorry. if (sw > 255) sw = 255; @@ -1725,7 +1730,7 @@ glBegin (GL_QUADS); - last_name = 0; + last_name = -1; mx += self->x; my += self->y; @@ -1770,21 +1775,26 @@ if (tile) { maptex tex = self->tex [tile]; - int px = (x + 1) * T - tex.w; - int py = (y + 1) * T - tex.h; + int px, py; // suppressing texture state switches here // is only moderately effective, but worth the extra effort if (last_name != tex.name) { if (!tex.name) - tex = self->tex [2]; /* missing, replace by noface */ + { + av_push (missing, newSViv (tile)); + tex = self->tex [2]; /* missing, replace by noface */ + } glEnd (); glBindTexture (GL_TEXTURE_2D, last_name = tex.name); glBegin (GL_QUADS); } + px = (x + 1) * T - tex.w; + py = (y + 1) * T - tex.h; + glTexCoord2f (0 , 0 ); glVertex2f (px , py ); glTexCoord2f (0 , tex.t); glVertex2f (px , py + tex.h); glTexCoord2f (tex.s, tex.t); glVertex2f (px + tex.w, py + tex.h); @@ -1889,7 +1899,10 @@ if (last_name != tex.name) { if (!tex.name) - continue; // smoothing not yet available + { + av_push (missing, newSViv (skey->tile)); + continue; // smoothing not yet available + } glEnd (); glBindTexture (GL_TEXTURE_2D, last_name = tex.name); @@ -1960,6 +1973,8 @@ } } } + OUTPUT: + RETVAL void draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data)