1 | /* |
1 | /* |
2 | * static char *rcsid_init_c = |
2 | * static char *rcsid_init_c = |
3 | * "$Id: request.C,v 1.3 2006/08/18 02:06:58 root Exp $"; |
3 | * "$Id: request.C,v 1.6 2006/08/19 03:54:23 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
1272 | { |
1272 | { |
1273 | cell->faces[0] = face0; |
1273 | cell->faces[0] = face0; |
1274 | cell->faces[1] = face1; |
1274 | cell->faces[1] = face1; |
1275 | cell->faces[2] = face2; |
1275 | cell->faces[2] = face2; |
1276 | cell->count = count; |
1276 | cell->count = count; |
1277 | cell->stat_hp = 255; |
1277 | cell->stat_hp = 0; |
1278 | } |
1278 | } |
1279 | |
1279 | |
1280 | #define MAX_HEAD_POS MAX(MAX_CLIENT_X, MAX_CLIENT_Y) |
1280 | #define MAX_HEAD_POS MAX(MAX_CLIENT_X, MAX_CLIENT_Y) |
1281 | #define MAX_LAYERS 3 |
1281 | #define MAX_LAYERS 3 |
1282 | |
1282 | |
… | |
… | |
1829 | lastcell.count = d; |
1829 | lastcell.count = d; |
1830 | |
1830 | |
1831 | if (socket.extmap) |
1831 | if (socket.extmap) |
1832 | { |
1832 | { |
1833 | uint8 stat_hp = 0; |
1833 | uint8 stat_hp = 0; |
|
|
1834 | uint8 stat_width = 0; |
1834 | |
1835 | |
1835 | // send hp information, if applicable |
1836 | // send hp information, if applicable |
1836 | if (object *op = GET_MAP_FACE_OBJ (m, nx, ny, 0)) |
1837 | if (object *op = GET_MAP_FACE_OBJ (m, nx, ny, 0)) |
|
|
1838 | if (!op->head |
1837 | if (op->stats.maxhp > 0 |
1839 | && op->stats.maxhp > 0 |
1838 | && (unsigned)op->stats.maxhp + 1 > (unsigned)op->stats.hp |
1840 | && (unsigned)op->stats.maxhp > (unsigned)op->stats.hp |
1839 | && IS_LIVE (op)) |
1841 | && IS_LIVE (op)) |
|
|
1842 | { |
1840 | stat_hp = 255 - op->stats.hp * 255 / op->stats.maxhp; |
1843 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
|
|
1844 | stat_width = op->arch->tail_x; |
|
|
1845 | } |
1841 | |
1846 | |
1842 | if (lastcell.stat_hp != stat_hp) |
1847 | if (lastcell.stat_hp != stat_hp) |
1843 | { |
1848 | { |
1844 | lastcell.stat_hp = stat_hp; |
1849 | lastcell.stat_hp = stat_hp; |
1845 | |
1850 | |
1846 | mask |= 0x8; |
1851 | mask |= 0x8; |
1847 | *last_ext |= 0x80; last_ext = sl.buf + sl.len; SockList_AddChar (&sl, 5); |
1852 | *last_ext |= 0x80; last_ext = sl.buf + sl.len; SockList_AddChar (&sl, 5); |
1848 | SockList_AddChar (&sl, stat_hp); |
1853 | SockList_AddChar (&sl, stat_hp); |
|
|
1854 | |
|
|
1855 | if (stat_width > 1) |
|
|
1856 | { |
|
|
1857 | *last_ext |= 0x80; last_ext = sl.buf + sl.len; SockList_AddChar (&sl, 6); |
|
|
1858 | SockList_AddChar (&sl, stat_width); |
|
|
1859 | } |
1849 | } |
1860 | } |
1850 | } |
1861 | } |
1851 | |
1862 | |
1852 | /* Floor face */ |
1863 | /* Floor face */ |
1853 | if (update_space(&sl, &socket, m, nx, ny, ax, ay, 2)) |
1864 | if (update_space(&sl, &socket, m, nx, ny, ax, ay, 2)) |