--- deliantra/Deliantra-Client/Client.xs 2006/08/18 01:01:00 1.141 +++ deliantra/Deliantra-Client/Client.xs 2006/08/18 01:27:15 1.142 @@ -171,8 +171,9 @@ } maptex; typedef struct { - int16_t darkness; + uint16_t darkness; mapface face[3]; + uint8_t stat_hp; } mapcell; typedef struct { @@ -310,7 +311,7 @@ if (x >= row->c1) break; - row->col[x - row->c0].darkness = -1; + row->col[x - row->c0].darkness = 0; } } } @@ -1281,40 +1282,38 @@ if (flags & 15) { - if (cell->darkness < 0) + if (!cell->darkness) { - cell->darkness = 0; + cell->darkness = 256; cell->face [0] = 0; cell->face [1] = 0; cell->face [2] = 0; } + //TODO: don't trust server data to be in-range(!) + 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; + cell->darkness = 255 - ext * 64 + 1; + else if (ext == 5) // health + cell->stat_hp = *data++; } while (cmd & 0x80); } else - cell->darkness = flags & 8 ? *data++ : 255; + cell->darkness = *data++ + 1; } - //TODO: don't trust server data to be in-range(!) - if (flags & 4) { cell->face [0] = self->face [(data [0] << 8) + data [1]]; data += 2; @@ -1331,7 +1330,7 @@ } } else - cell->darkness = -1; + cell->darkness = 0; } } @@ -1557,9 +1556,9 @@ { mapcell *cell = row->col + (x + vx - row->c0); - darkness[y * sw4 + x] = cell->darkness < 0 - ? 255 - FOW_DARKNESS - : 255 - cell->darkness; + darkness[y * sw4 + x] = cell->darkness + ? 255 - cell->darkness + 1 + : 255 - FOW_DARKNESS; } } @@ -1684,9 +1683,9 @@ if (flags & 2) { face[1] = *data++ << 8; face[1] |= *data++; } if (flags & 4) { face[2] = *data++ << 8; face[2] |= *data++; } - if (cell->darkness <= 0) + if (cell->darkness <= 1) { - cell->darkness = -1; + cell->darkness = 0; for (z = 0; z <= 2; z++) {