1 | /* |
1 | /* |
2 | * static char *rcsid_init_c = |
2 | * static char *rcsid_init_c = |
3 | * "$Id: request.C,v 1.8 2006/08/24 10:58:39 root Exp $"; |
3 | * "$Id: request.C,v 1.11 2006/08/29 07:34:01 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 | |
… | |
… | |
233 | socket.current_y = ob->y; |
233 | socket.current_y = ob->y; |
234 | } |
234 | } |
235 | |
235 | |
236 | void ExtCmd (char *buf, int len, player *pl) |
236 | void ExtCmd (char *buf, int len, player *pl) |
237 | { |
237 | { |
238 | execute_global_event (EVENT_EXTCMD, pl, buf, len); |
238 | INVOKE_PLAYER (EXTCMD, pl, ARG_DATA (buf, len)); |
239 | } |
239 | } |
240 | |
240 | |
241 | void MapInfoCmd (char *buf, int len, player *pl) |
241 | void MapInfoCmd (char *buf, int len, player *pl) |
242 | { |
242 | { |
243 | // <mapinfo tag spatial tile-path |
243 | // <mapinfo tag spatial tile-path |
… | |
… | |
1292 | cell->faces[0] = face0; |
1292 | cell->faces[0] = face0; |
1293 | cell->faces[1] = face1; |
1293 | cell->faces[1] = face1; |
1294 | cell->faces[2] = face2; |
1294 | cell->faces[2] = face2; |
1295 | cell->count = count; |
1295 | cell->count = count; |
1296 | cell->stat_hp = 0; |
1296 | cell->stat_hp = 0; |
|
|
1297 | cell->player = 0; |
1297 | } |
1298 | } |
1298 | |
1299 | |
1299 | #define MAX_HEAD_POS MAX(MAX_CLIENT_X, MAX_CLIENT_Y) |
1300 | #define MAX_HEAD_POS MAX(MAX_CLIENT_X, MAX_CLIENT_Y) |
1300 | #define MAX_LAYERS 3 |
1301 | #define MAX_LAYERS 3 |
1301 | |
1302 | |
… | |
… | |
1855 | |
1856 | |
1856 | // send hp information, if applicable |
1857 | // send hp information, if applicable |
1857 | if (object *op = GET_MAP_FACE_OBJ (m, nx, ny, 0)) |
1858 | if (object *op = GET_MAP_FACE_OBJ (m, nx, ny, 0)) |
1858 | { |
1859 | { |
1859 | if (op->head || op->invisible) |
1860 | if (op->head || op->invisible) |
1860 | continue; |
1861 | ; // do not show |
1861 | |
|
|
1862 | if (op->type == PLAYER |
1862 | else if (op->type == PLAYER |
1863 | || QUERY_FLAG(op, FLAG_MONSTER) |
1863 | || QUERY_FLAG (op, FLAG_MONSTER) |
1864 | || QUERY_FLAG(op, FLAG_ALIVE) |
1864 | || QUERY_FLAG (op, FLAG_ALIVE) |
1865 | || QUERY_FLAG(op, FLAG_GENERATOR)) |
1865 | || QUERY_FLAG (op, FLAG_GENERATOR)) |
1866 | { |
1866 | { |
1867 | if (op->stats.maxhp > 0 |
1867 | if (op->stats.maxhp > 0 |
1868 | && (unsigned)op->stats.maxhp > (unsigned)op->stats.hp) |
1868 | && (unsigned)op->stats.maxhp > (unsigned)op->stats.hp) |
1869 | { |
1869 | { |
1870 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
1870 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
… | |
… | |
1874 | |
1874 | |
1875 | if (op->type == PLAYER && op != pl) |
1875 | if (op->type == PLAYER && op != pl) |
1876 | player = op->count; |
1876 | player = op->count; |
1877 | } |
1877 | } |
1878 | |
1878 | |
1879 | if (lastcell.stat_hp != stat_hp) |
1879 | if (lastcell.stat_hp != stat_hp && 0) |
1880 | { |
1880 | { |
1881 | lastcell.stat_hp = stat_hp; |
1881 | lastcell.stat_hp = stat_hp; |
1882 | |
1882 | |
1883 | mask |= 0x8; |
1883 | mask |= 0x8; |
1884 | *last_ext |= 0x80; last_ext = sl.buf + sl.len; SockList_AddChar (&sl, 5); |
1884 | *last_ext |= 0x80; last_ext = sl.buf + sl.len; SockList_AddChar (&sl, 5); |
… | |
… | |
1889 | *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); |
1890 | SockList_AddChar (&sl, stat_width); |
1890 | SockList_AddChar (&sl, stat_width); |
1891 | } |
1891 | } |
1892 | } |
1892 | } |
1893 | |
1893 | |
1894 | if (lastcell.player != player) |
1894 | if (lastcell.player != player && 0) |
1895 | { |
1895 | { |
1896 | lastcell.player = player; |
1896 | lastcell.player = player; |
1897 | mask |= 0x8; |
1897 | mask |= 0x8; |
1898 | *last_ext |= 0x80; last_ext = sl.buf + sl.len; SockList_AddChar (&sl, 0x47); |
1898 | *last_ext |= 0x80; last_ext = sl.buf + sl.len; SockList_AddChar (&sl, 0x47); |
1899 | SockList_AddChar (&sl, 4); |
1899 | SockList_AddChar (&sl, 4); |
… | |
… | |
1991 | if (pl->type != PLAYER) { |
1991 | if (pl->type != PLAYER) { |
1992 | LOG(llevError,"draw_client_map called with non player/non eric-server\n"); |
1992 | LOG(llevError,"draw_client_map called with non player/non eric-server\n"); |
1993 | return; |
1993 | return; |
1994 | } |
1994 | } |
1995 | |
1995 | |
1996 | if (pl->contr->transport) { |
|
|
1997 | pm = pl->contr->transport->map; |
|
|
1998 | } |
|
|
1999 | else |
|
|
2000 | pm = pl->map; |
1996 | pm = pl->map; |
2001 | |
1997 | |
2002 | /* If player is just joining the game, he isn't here yet, so the map |
1998 | /* If player is just joining the game, he isn't here yet, so the map |
2003 | * can get swapped out. If so, don't try to send them a map. All will |
1999 | * can get swapped out. If so, don't try to send them a map. All will |
2004 | * be OK once they really log in. |
2000 | * be OK once they really log in. |
2005 | */ |
2001 | */ |