… | |
… | |
1286 | { |
1286 | { |
1287 | cell->darkness = 256; |
1287 | cell->darkness = 256; |
1288 | cell->face [0] = 0; |
1288 | cell->face [0] = 0; |
1289 | cell->face [1] = 0; |
1289 | cell->face [1] = 0; |
1290 | cell->face [2] = 0; |
1290 | cell->face [2] = 0; |
|
|
1291 | cell->stat_hp = 0; |
1291 | } |
1292 | } |
1292 | |
1293 | |
1293 | //TODO: don't trust server data to be in-range(!) |
1294 | //TODO: don't trust server data to be in-range(!) |
1294 | |
1295 | |
1295 | if (flags & 8) |
1296 | if (flags & 8) |
… | |
… | |
1465 | |
1466 | |
1466 | glEnd (); |
1467 | glEnd (); |
1467 | |
1468 | |
1468 | glDisable (GL_TEXTURE_2D); |
1469 | glDisable (GL_TEXTURE_2D); |
1469 | glDisable (GL_BLEND); |
1470 | glDisable (GL_BLEND); |
|
|
1471 | |
|
|
1472 | for (y = 0; y < sh; y++) |
|
|
1473 | if (0 <= y + vy && y + vy < self->rows) |
|
|
1474 | { |
|
|
1475 | maprow *row = self->row + (y + vy); |
|
|
1476 | |
|
|
1477 | for (x = 0; x < sw; x++) |
|
|
1478 | if (row->c0 <= x + vx && x + vx < row->c1) |
|
|
1479 | { |
|
|
1480 | mapcell *cell = row->col + (x + vx - row->c0); |
|
|
1481 | |
|
|
1482 | int px = x * 32; |
|
|
1483 | int py = y * 32; |
|
|
1484 | |
|
|
1485 | if (cell->stat_hp) |
|
|
1486 | { |
|
|
1487 | glColor3ub (0, 0, 0); |
|
|
1488 | glRectf (px + 1, py + 1, px + 31, py + 4); |
|
|
1489 | |
|
|
1490 | glColor3ub (0, 255, 0); |
|
|
1491 | glBegin (GL_LINES); |
|
|
1492 | glVertex2f (px + 2, py + 2.5f); |
|
|
1493 | glVertex2f (px + 29.f - cell->stat_hp * (28.f / 255.f), py + 2.5f); |
|
|
1494 | glEnd (); |
|
|
1495 | } |
|
|
1496 | } |
|
|
1497 | } |
1470 | } |
1498 | } |
1471 | |
1499 | |
1472 | void |
1500 | void |
1473 | draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) |
1501 | draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) |
1474 | CODE: |
1502 | CODE: |
… | |
… | |
1555 | if (row->c0 <= x + vx && x + vx < row->c1) |
1583 | if (row->c0 <= x + vx && x + vx < row->c1) |
1556 | { |
1584 | { |
1557 | mapcell *cell = row->col + (x + vx - row->c0); |
1585 | mapcell *cell = row->col + (x + vx - row->c0); |
1558 | |
1586 | |
1559 | darkness[y * sw4 + x] = cell->darkness |
1587 | darkness[y * sw4 + x] = cell->darkness |
1560 | ? 255 - cell->darkness + 1 |
1588 | ? 255 - (cell->darkness - 1) |
1561 | : 255 - FOW_DARKNESS; |
1589 | : 255 - FOW_DARKNESS; |
1562 | } |
1590 | } |
1563 | } |
1591 | } |
1564 | |
1592 | |
1565 | EXTEND (SP, 3); |
1593 | EXTEND (SP, 3); |
… | |
… | |
1681 | |
1709 | |
1682 | if (flags & 1) { face[0] = *data++ << 8; face[0] |= *data++; } |
1710 | if (flags & 1) { face[0] = *data++ << 8; face[0] |= *data++; } |
1683 | if (flags & 2) { face[1] = *data++ << 8; face[1] |= *data++; } |
1711 | if (flags & 2) { face[1] = *data++ << 8; face[1] |= *data++; } |
1684 | if (flags & 4) { face[2] = *data++ << 8; face[2] |= *data++; } |
1712 | if (flags & 4) { face[2] = *data++ << 8; face[2] |= *data++; } |
1685 | |
1713 | |
1686 | if (cell->darkness <= 1) |
1714 | if (cell->darkness == 0) |
1687 | { |
1715 | { |
1688 | cell->darkness = 0; |
1716 | cell->darkness = 0; |
1689 | |
1717 | |
1690 | for (z = 0; z <= 2; z++) |
1718 | for (z = 0; z <= 2; z++) |
1691 | { |
1719 | { |