--- deliantra/Deliantra-Client/Client.xs 2008/07/18 22:32:54 1.264 +++ deliantra/Deliantra-Client/Client.xs 2008/07/20 15:09:29 1.271 @@ -369,6 +369,16 @@ self->rows = 0; } +#define CELL_CLEAR(cell) \ + do { \ + if ((cell)->player) \ + (cell)->tile [2] = 0; \ + (cell)->darkness = 0; \ + (cell)->stat_hp = 0; \ + (cell)->flags = 0; \ + (cell)->player = 0; \ + } while (0) + static void map_blank (DC__Map self, int x0, int y0, int w, int h) { @@ -392,10 +402,7 @@ cell = row->col + x - row->c0; - cell->darkness = 0; - cell->stat_hp = 0; - cell->flags = 0; - cell->player = 0; + CELL_CLEAR (cell); } } } @@ -666,7 +673,9 @@ const_iv (SDL_GL_MULTISAMPLEBUFFERS), const_iv (SDL_GL_MULTISAMPLESAMPLES), const_iv (SDL_GL_ACCELERATED_VISUAL), - const_iv (SDL_GL_SWAP_CONTROL) + const_iv (SDL_GL_SWAP_CONTROL), + + const_iv (FOW_DARKNESS) # undef const_iv }; @@ -758,12 +767,15 @@ if (m && m != (SDL_Rect **)-1) while (*m) { - AV *av = newAV (); - av_push (av, newSViv ((*m)->w)); - av_push (av, newSViv ((*m)->h)); - av_push (av, newSViv (rgb)); - av_push (av, newSViv (alpha)); - XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); + if ((*m)->w >= 400 && (*m)->h >= 300) + { + AV *av = newAV (); + av_push (av, newSViv ((*m)->w)); + av_push (av, newSViv ((*m)->h)); + av_push (av, newSViv (rgb)); + av_push (av, newSViv (alpha)); + XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); + } ++m; } @@ -1779,7 +1791,7 @@ } } else - cell->darkness = 0; + CELL_CLEAR (cell); } } OUTPUT: @@ -1841,7 +1853,7 @@ RETVAL void -draw (DC::Map self, int mx, int my, int sw, int sh, int T, U32 player = 0xffffffff, int pdx = 0, int pdy = 0) +draw (DC::Map self, int mx, int my, int sw, int sh, int T, U32 player = 0xffffffff, int sdx = 0, int sdy = 0) CODE: { int x, y, z; @@ -2098,8 +2110,8 @@ if (pl_tex.name) { maptex tex = pl_tex; - int px = pl_x + pdx; - int py = pl_y + pdy; + int px = pl_x + sdx; + int py = pl_y + sdy; key.texname = tex.name; arr = rc_array (rc, &key); @@ -2226,7 +2238,7 @@ mx += self->x - 1; my += self->y - 1; - memset (darkness1, 255, sw1 * sh1); + memset (darkness1, 255 - FOW_DARKNESS, sw1 * sh1); for (y = 0; y < sh1; y++) if (0 <= y + my && y + my < self->rows)