--- deliantra/Deliantra-Client/Client.xs 2006/08/19 02:49:53 1.146 +++ deliantra/Deliantra-Client/Client.xs 2006/08/19 03:57:08 1.147 @@ -173,7 +173,7 @@ typedef struct { uint16_t darkness; mapface face[3]; - uint8_t stat_hp; + uint8_t stat_width, stat_hp; } mapcell; typedef struct { @@ -1307,14 +1307,21 @@ ext = *data++; cmd = ext & 0x3f; - if (ext < 4) + if (cmd < 4) cell->darkness = 255 - ext * 64 + 1; - else if (ext == 5) // health - cell->stat_hp = *data++; + else if (cmd == 5) // health + { + cell->stat_width = 1; + cell->stat_hp = *data++; + } + else if (cmd == 6) // monster width + cell->stat_width = *data++ + 1; else if (ext & 0x40) // unknown, multibyte => skip data += *data + 1; + else + data++; } - while (cmd & 0x80); + while (ext & 0x80); } else cell->darkness = *data++ + 1; @@ -1475,7 +1482,6 @@ glEnd (); glDisable (GL_TEXTURE_2D); - glDisable (GL_BLEND); // top layer: overlays such as the health bar for (y = 0; y < sh; y++) @@ -1493,16 +1499,22 @@ if (cell->stat_hp) { - int width = sh / 28 + 1; - - glColor3ub (0, 0, 0); - glRectf (px + 1, py, px + 31, py + width + 2); + int width = cell->stat_width * 32; + int thick = sh / 28 + 1 + cell->stat_width; - glColor3ub (cell->stat_hp, 255 - cell->stat_hp, 0); - glRectf (px + 2, py + 1, px + 30 - cell->stat_hp * 28 / 255, py + width + 1); + glColor4ub (0, 0, 0, 128); + glRectf (px + 1, py, + px + width - 1, py + thick + 2); + + glColor4ub (cell->stat_hp, 255 - cell->stat_hp, 0, 192); + glRectf (px + 2, + py + 1, + px + width - 2 - cell->stat_hp * (width - 4) / 255, py + thick + 1); } } } + + glDisable (GL_BLEND); } void