--- deliantra/Deliantra-Client/Client.xs 2007/04/10 09:39:48 1.176 +++ deliantra/Deliantra-Client/Client.xs 2007/04/16 21:06:36 1.181 @@ -347,7 +347,7 @@ static void smooth_or_bits (HV *hv, smooth_key *key, IV bits) { - SV **sv = hv_fetch (hv, (char *)key, sizeof (key), 1); + SV **sv = hv_fetch (hv, (char *)key, sizeof (*key), 1); if (SvIOK (*sv)) SvIV_set (*sv, SvIVX (*sv) | bits); @@ -703,9 +703,7 @@ void lowdelay (int fd, int val = 1) CODE: -#ifndef _WIN32 - setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); -#endif + setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, (void *)&val, sizeof (val)); void win32_proxy_info () @@ -1569,7 +1567,7 @@ { HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level - uint8_t smooth_max[256][256]; + static uint8_t smooth_max[256][256]; // egad, fats and wasteful on memory (64k) smooth_key skey; int x, y, z; int last_name; @@ -1610,12 +1608,10 @@ { mapcell *cell = row->col + (x + mx - row->c0); - for (z = 0; z <= 2; z++) - { - uint8_t level = self->tex [cell->tile [z]].smoothlevel; - if (level > smooth_max [x + 1][y + 1]) - smooth_max [x + 1][y + 1] = level; - } + smooth_max[x + 1][y + 1] = + MAX (self->tex [cell->tile [0]].smoothlevel, + MAX (self->tex [cell->tile [1]].smoothlevel, + self->tex [cell->tile [2]].smoothlevel)); } } @@ -1687,12 +1683,24 @@ // add bits to current tile and all neighbours. skey.x|y is // shifted +1|+1 so we always stay positive. + // bits is ___n cccc CCCC bbbb + // n do not draw borders&corners + // c draw these corners, but... + // C ... not these + // b draw these borders + + // borders: 1 ┃· 2 ━━ 4 ·┃ 8 ·· + // ┃· ·· ·┃ ━━ + + // corners: 1 ┛· 2 ·┗ 4 ·· 8 ·· + // ·· ·· ·┏ ┓· + // full tile skey.x = x + 1; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x1000); // borders - skey.x = x + 2; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x0031); - skey.x = x + 1; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0092); + skey.x = x + 2; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x0091); + skey.x = x + 1; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0032); skey.x = x ; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x0064); skey.x = x + 1; skey.y = y ; smooth_or_bits (smooth, &skey, 0x00c8); @@ -1706,7 +1714,7 @@ } } - // go through all smoothlevels, lowest to highest, then draw + // go through all smoothlevels, lowest to highest, then draw. // this is basically counting sort { int w, b; @@ -1727,12 +1735,6 @@ smooth_key *skey = (smooth_key *)HeKEY (he); IV bits = SvIVX (HeVAL (he)); - // bits is ___n cccc CCCC bbbb - // n do not draw borders&corners - // c draw these corners, but... - // C ... not these - // b draw these borders - if (!(bits & 0x1000) && skey->level == level && level >= smooth_max [skey->x][skey->y])