… | |
… | |
1441 | { |
1441 | { |
1442 | mapcell *cell = row->col + (x + vx - row->c0); |
1442 | mapcell *cell = row->col + (x + vx - row->c0); |
1443 | |
1443 | |
1444 | face = cell->face [z]; |
1444 | face = cell->face [z]; |
1445 | |
1445 | |
1446 | if (face) |
1446 | if (face && face < self->texs) |
1447 | { |
1447 | { |
1448 | maptex tex = self->tex [face]; |
1448 | maptex tex = self->tex [face]; |
1449 | |
1449 | |
1450 | int px = (x + 1) * 32 - tex.w; |
1450 | int px = (x + 1) * 32 - tex.w; |
1451 | int py = (y + 1) * 32 - tex.h; |
1451 | int py = (y + 1) * 32 - tex.h; |
… | |
… | |
1469 | glEnd (); |
1469 | glEnd (); |
1470 | |
1470 | |
1471 | glDisable (GL_TEXTURE_2D); |
1471 | glDisable (GL_TEXTURE_2D); |
1472 | glDisable (GL_BLEND); |
1472 | glDisable (GL_BLEND); |
1473 | |
1473 | |
|
|
1474 | // top layer: overlays such as the health bar |
1474 | for (y = 0; y < sh; y++) |
1475 | for (y = 0; y < sh; y++) |
1475 | if (0 <= y + vy && y + vy < self->rows) |
1476 | if (0 <= y + vy && y + vy < self->rows) |
1476 | { |
1477 | { |
1477 | maprow *row = self->row + (y + vy); |
1478 | maprow *row = self->row + (y + vy); |
1478 | |
1479 | |
… | |
… | |
1484 | int px = x * 32; |
1485 | int px = x * 32; |
1485 | int py = y * 32; |
1486 | int py = y * 32; |
1486 | |
1487 | |
1487 | if (cell->stat_hp) |
1488 | if (cell->stat_hp) |
1488 | { |
1489 | { |
|
|
1490 | int width = sh / 28 + 1; |
|
|
1491 | |
1489 | glColor3ub (0, 0, 0); |
1492 | glColor3ub (0, 0, 0); |
1490 | glRectf (px + 1, py + 1, px + 31, py + 4); |
1493 | glRectf (px + 1, py, px + 31, py + width + 2); |
1491 | |
1494 | |
1492 | glColor3ub (0, 255, 0); |
1495 | glColor3ub (cell->stat_hp, 255 - cell->stat_hp, 0); |
1493 | glBegin (GL_LINES); |
|
|
1494 | glVertex2f (px + 2, py + 2.5f); |
|
|
1495 | glVertex2f (px + 29.f - cell->stat_hp * (28.f / 255.f), py + 2.5f); |
1496 | glRectf (px + 2, py + 1, px + 30 - cell->stat_hp * 28 / 255, py + width + 1); |
1496 | glEnd (); |
|
|
1497 | } |
1497 | } |
1498 | } |
1498 | } |
1499 | } |
1499 | } |
1500 | } |
1500 | } |
1501 | |
1501 | |