--- deliantra/Deliantra-Client/Client.xs 2018/11/18 01:48:39 1.323 +++ deliantra/Deliantra-Client/Client.xs 2018/11/18 01:58:53 1.324 @@ -34,6 +34,7 @@ #include #include +#include #define USE_RWOPS 1 // for SDL_mixer:LoadMUS_RW @@ -2225,9 +2226,7 @@ { int x, y, z; - uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level - static uint8_t smooth_max[256][256]; // egad, fast and wasteful on memory (64k) - smooth_key skey; + static uint8_t smooth_max[256][256]; // egad, fast and wasteful on memory (64k), also, static! int pl_x, pl_y; maptex pl_tex; rc_t *rc = rc_alloc (); @@ -2241,9 +2240,6 @@ if (sw > 255) sw = 255; if (sh > 255) sh = 255; - // clear key, in case of extra padding - memset (&skey, 0, sizeof (skey)); - memset (&key, 0, sizeof (key)); key.r = 255; key.g = 255; @@ -2258,7 +2254,7 @@ // first pass: determine smooth_max // rather ugly, if you ask me // could also be stored inside mapcell and updated on change - memset (smooth_max, 0, sizeof (smooth_max)); + memset (smooth_max, 0, sizeof (smooth_max[0]) * (sh + 1)); for (y = 0; y < sh; y++) if (0 <= y + my && y + my < self->rows) @@ -2283,6 +2279,8 @@ for (z = 0; z <= 2; z++) { + uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level + smooth_key skey; smooth_hash smooth; memset (smooth_level, 0, sizeof (smooth_level)); key.texname = -1;