1 | /* |
1 | /* |
2 | * static char *rcsid_init_c = |
2 | * static char *rcsid_init_c = |
3 | * "$Id: request.C,v 1.7 2006/08/21 07:13:32 root Exp $"; |
3 | * "$Id: request.C,v 1.8 2006/08/24 10:58:39 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 | |
… | |
… | |
1847 | |
1847 | |
1848 | lastcell.count = d; |
1848 | lastcell.count = d; |
1849 | |
1849 | |
1850 | if (socket.extmap) |
1850 | if (socket.extmap) |
1851 | { |
1851 | { |
1852 | uint8 stat_hp = 0; |
1852 | uint8 stat_hp = 0; |
1853 | uint8 stat_width = 0; |
1853 | uint8 stat_width = 0; |
|
|
1854 | tag_t player = 0; |
1854 | |
1855 | |
1855 | // send hp information, if applicable |
1856 | // send hp information, if applicable |
1856 | if (object *op = GET_MAP_FACE_OBJ (m, nx, ny, 0)) |
1857 | if (object *op = GET_MAP_FACE_OBJ (m, nx, ny, 0)) |
|
|
1858 | { |
|
|
1859 | if (op->head || op->invisible) |
|
|
1860 | continue; |
|
|
1861 | |
1857 | if (!op->head |
1862 | if (op->type == PLAYER |
1858 | && op->stats.maxhp > 0 |
1863 | || QUERY_FLAG(op, FLAG_MONSTER) |
1859 | && (unsigned)op->stats.maxhp > (unsigned)op->stats.hp |
1864 | || QUERY_FLAG(op, FLAG_ALIVE) |
1860 | && IS_LIVE (op)) |
1865 | || QUERY_FLAG(op, FLAG_GENERATOR)) |
1861 | { |
1866 | { |
|
|
1867 | if (op->stats.maxhp > 0 |
|
|
1868 | && (unsigned)op->stats.maxhp > (unsigned)op->stats.hp) |
|
|
1869 | { |
1862 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
1870 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
1863 | stat_width = op->arch->tail_x; |
1871 | stat_width = op->arch->tail_x; |
|
|
1872 | } |
1864 | } |
1873 | } |
|
|
1874 | |
|
|
1875 | if (op->type == PLAYER && op != pl) |
|
|
1876 | player = op->count; |
|
|
1877 | } |
1865 | |
1878 | |
1866 | if (lastcell.stat_hp != stat_hp) |
1879 | if (lastcell.stat_hp != stat_hp) |
1867 | { |
1880 | { |
1868 | lastcell.stat_hp = stat_hp; |
1881 | lastcell.stat_hp = stat_hp; |
1869 | |
1882 | |
… | |
… | |
1874 | if (stat_width > 1) |
1887 | if (stat_width > 1) |
1875 | { |
1888 | { |
1876 | *last_ext |= 0x80; last_ext = sl.buf + sl.len; SockList_AddChar (&sl, 6); |
1889 | *last_ext |= 0x80; last_ext = sl.buf + sl.len; SockList_AddChar (&sl, 6); |
1877 | SockList_AddChar (&sl, stat_width); |
1890 | SockList_AddChar (&sl, stat_width); |
1878 | } |
1891 | } |
|
|
1892 | } |
|
|
1893 | |
|
|
1894 | if (lastcell.player != player) |
|
|
1895 | { |
|
|
1896 | lastcell.player = player; |
|
|
1897 | mask |= 0x8; |
|
|
1898 | *last_ext |= 0x80; last_ext = sl.buf + sl.len; SockList_AddChar (&sl, 0x47); |
|
|
1899 | SockList_AddChar (&sl, 4); |
|
|
1900 | SockList_AddInt (&sl, player); |
1879 | } |
1901 | } |
1880 | } |
1902 | } |
1881 | |
1903 | |
1882 | /* Floor face */ |
1904 | /* Floor face */ |
1883 | if (update_space(&sl, &socket, m, nx, ny, ax, ay, 2)) |
1905 | if (update_space(&sl, &socket, m, nx, ny, ax, ay, 2)) |