--- deliantra/Deliantra-Client/Client.xs 2006/08/14 01:21:01 1.138 +++ deliantra/Deliantra-Client/Client.xs 2006/08/18 01:01:00 1.141 @@ -146,12 +146,19 @@ static void layout_get_pixel_size (CFPlus__Layout self, int *w, int *h) { - pango_layout_get_pixel_size (self->pl, w, h); + PangoRectangle rect; - if (!*w) *w = 1; - if (!*h) *h = 1; + // get_pixel_* wrongly rounds down + pango_layout_get_extents (self->pl, 0, &rect); - *w = (*w + 3) & ~3; + rect.width = (rect.width + PANGO_SCALE - 1) / PANGO_SCALE; + rect.height = (rect.height + PANGO_SCALE - 1) / PANGO_SCALE; + + if (!rect.width) rect.width = 1; + if (!rect.height) rect.height = 1; + + *w = rect.width; + *h = rect.height; } typedef uint16_t mapface; @@ -1255,7 +1262,7 @@ } void -map1a_update (CFPlus::Map self, SV *data_) +map1a_update (CFPlus::Map self, SV *data_, int extmap) CODE: { uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); @@ -1282,7 +1289,29 @@ cell->face [2] = 0; } - cell->darkness = flags & 8 ? *data++ : 255; + if (flags & 8) + { + fprintf (stderr, "oi\n");//D + if (extmap) + { + uint8_t ext, cmd; + + do + { + + ext = *data++; + cmd = ext & 0x7f; + + fprintf (stderr, "extcmd = %x\n", ext);//D + + if (ext < 4) + cell->darkness = 255 - ext * 64; + } + while (cmd & 0x80); + } + else + cell->darkness = flags & 8 ? *data++ : 255; + } //TODO: don't trust server data to be in-range(!)