--- deliantra/Deliantra-Client/Client.xs 2007/08/09 11:02:08 1.220 +++ deliantra/Deliantra-Client/Client.xs 2007/08/10 04:02:13 1.221 @@ -1552,14 +1552,16 @@ } } -void +SV * map1a_update (CFPlus::Map self, SV *data_, int extmap) CODE: { uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); uint8_t *data_end = (uint8_t *)SvEND (data_); mapcell *cell; - int x, y, flags; + int x, y, z, flags; + AV *missing = newAV (); + RETVAL = newRV_noinc ((SV *)missing); while (data < data_end - 1) { @@ -1620,31 +1622,34 @@ cell->darkness = *data++ + 1; } - if (flags & 4) - { - faceid face = (data [0] << 8) + data [1]; data += 2; - need_facenum (self, face); - cell->tile [0] = self->face2tile [face]; - } + for (z = 0; z <= 2; ++z) + if (flags & (4 >> z)) + { + faceid face = (data [0] << 8) + data [1]; data += 2; + need_facenum (self, face); + cell->tile [z] = self->face2tile [face]; - if (flags & 2) - { - faceid face = (data [0] << 8) + data [1]; data += 2; - need_facenum (self, face); - cell->tile [1] = self->face2tile [face]; - } + if (cell->tile [z]) + { + maptex *tex = self->tex + cell->tile [z]; + if (!tex->name) + av_push (missing, newSViv (cell->tile [z])); - if (flags & 1) - { - faceid face = (data [0] << 8) + data [1]; data += 2; - need_facenum (self, face); - cell->tile [2] = self->face2tile [face]; - } + if (tex->smoothtile) + { + maptex *smooth = self->tex + tex->smoothtile; + if (!smooth->name) + av_push (missing, newSViv (tex->smoothtile)); + } + } + } } else cell->darkness = 0; } } + OUTPUT: + RETVAL SV * mapmap (CFPlus::Map self, int x0, int y0, int w, int h) @@ -1701,7 +1706,7 @@ OUTPUT: RETVAL -SV * +void draw (CFPlus::Map self, int mx, int my, int sw, int sh, int T) CODE: { @@ -1711,8 +1716,6 @@ 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; @@ -1782,10 +1785,7 @@ if (last_name != tex.name) { if (!tex.name) - { - av_push (missing, newSViv (tile)); - tex = self->tex [2]; /* missing, replace by noface */ - } + tex = self->tex [2]; /* missing, replace by noface */ glEnd (); glBindTexture (GL_TEXTURE_2D, last_name = tex.name); @@ -1899,10 +1899,7 @@ if (last_name != tex.name) { if (!tex.name) - { - av_push (missing, newSViv (skey->tile)); - continue; // smoothing not yet available - } + continue; // smoothing not yet available glEnd (); glBindTexture (GL_TEXTURE_2D, last_name = tex.name); @@ -1973,8 +1970,6 @@ } } } - OUTPUT: - RETVAL void draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data)