--- deliantra/Deliantra-Client/Client.xs 2006/08/18 02:23:39 1.143 +++ deliantra/Deliantra-Client/Client.xs 2006/08/18 03:19:58 1.145 @@ -1302,12 +1302,14 @@ do { ext = *data++; - cmd = ext & 0x7f; + cmd = ext & 0x3f; if (ext < 4) cell->darkness = 255 - ext * 64 + 1; else if (ext == 5) // health cell->stat_hp = *data++; + else if (ext & 0x40) // unknown, multibyte => skip + data += *data + 1; } while (cmd & 0x80); } @@ -1441,7 +1443,7 @@ face = cell->face [z]; - if (face) + if (face && face < self->texs) { maptex tex = self->tex [face]; @@ -1469,6 +1471,7 @@ glDisable (GL_TEXTURE_2D); glDisable (GL_BLEND); + // top layer: overlays such as the health bar for (y = 0; y < sh; y++) if (0 <= y + vy && y + vy < self->rows) { @@ -1484,14 +1487,13 @@ if (cell->stat_hp) { + int width = sh / 28 + 1; + glColor3ub (0, 0, 0); - glRectf (px + 1, py + 1, px + 31, py + 4); + glRectf (px + 1, py, px + 31, py + width + 2); - glColor3ub (0, 255, 0); - glBegin (GL_LINES); - glVertex2f (px + 2, py + 2.5f); - glVertex2f (px + 29.f - cell->stat_hp * (28.f / 255.f), py + 2.5f); - glEnd (); + glColor3ub (cell->stat_hp, 255 - cell->stat_hp, 0); + glRectf (px + 2, py + 1, px + 30 - cell->stat_hp * 28 / 255, py + width + 1); } } }