1 | |
|
|
2 | /* |
|
|
3 | * static char *rcsid_init_c = |
|
|
4 | * "$Id: request.C,v 1.18 2006/09/14 19:08:41 root Exp $"; |
|
|
5 | */ |
|
|
6 | |
|
|
7 | /* |
1 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
9 | |
3 | |
10 | Copyright (C) 2001 Mark Wedel |
4 | Copyright (C) 2001 Mark Wedel |
11 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
22 | |
16 | |
23 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
24 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | |
20 | |
27 | The author can be reached via e-mail to crossfire-devel@real-time.com |
21 | The author can be reached via e-mail to <crossfire@schmorp.de> |
28 | */ |
22 | */ |
29 | |
23 | |
30 | /** |
24 | /** |
31 | * \file |
25 | * \file |
32 | * Client handling. |
26 | * Client handling. |
… | |
… | |
264 | if (!strncmp (buf, "spatial ", 8)) |
258 | if (!strncmp (buf, "spatial ", 8)) |
265 | { |
259 | { |
266 | buf += 8; |
260 | buf += 8; |
267 | |
261 | |
268 | // initial map and its origin |
262 | // initial map and its origin |
269 | mapstruct *map = pl->ob->map; |
263 | maptile *map = pl->ob->map; |
270 | sint16 dx, dy; |
264 | sint16 dx, dy; |
271 | int mapx = pl->socket.mapx / 2 - pl->ob->x; |
265 | int mapx = pl->socket.mapx / 2 - pl->ob->x; |
272 | int mapy = pl->socket.mapy / 2 - pl->ob->y; |
266 | int mapy = pl->socket.mapy / 2 - pl->ob->y; |
273 | int max_distance = 8; // limit maximum path length to something generous |
267 | int max_distance = 8; // limit maximum path length to something generous |
274 | |
268 | |
… | |
… | |
1547 | * the case, it seems to make more sense to have these layer values |
1541 | * the case, it seems to make more sense to have these layer values |
1548 | * actually match. |
1542 | * actually match. |
1549 | */ |
1543 | */ |
1550 | |
1544 | |
1551 | static int |
1545 | static int |
1552 | update_space (SockList * sl, NewSocket * ns, mapstruct *mp, int mx, int my, int sx, int sy, int layer) |
1546 | update_space (SockList * sl, NewSocket * ns, maptile *mp, int mx, int my, int sx, int sy, int layer) |
1553 | { |
1547 | { |
1554 | object *ob, *head; |
1548 | object *ob, *head; |
1555 | uint16 face_num; |
1549 | uint16 face_num; |
1556 | int bx, by, i; |
1550 | int bx, by, i; |
1557 | |
1551 | |
… | |
… | |
1771 | * top layer (this matches what the GET_MAP_FACE and GET_MAP_FACE_OBJ |
1765 | * top layer (this matches what the GET_MAP_FACE and GET_MAP_FACE_OBJ |
1772 | * take. |
1766 | * take. |
1773 | */ |
1767 | */ |
1774 | |
1768 | |
1775 | static inline int |
1769 | static inline int |
1776 | update_smooth (SockList * sl, NewSocket * ns, mapstruct *mp, int mx, int my, int sx, int sy, int layer) |
1770 | update_smooth (SockList * sl, NewSocket * ns, maptile *mp, int mx, int my, int sx, int sy, int layer) |
1777 | { |
1771 | { |
1778 | object *ob; |
1772 | object *ob; |
1779 | int smoothlevel; /* old face_num; */ |
1773 | int smoothlevel; /* old face_num; */ |
1780 | |
1774 | |
1781 | ob = GET_MAP_FACE_OBJ (mp, mx, my, layer); |
1775 | ob = GET_MAP_FACE_OBJ (mp, mx, my, layer); |
… | |
… | |
1859 | SockList esl; /*For extended Map info */ |
1853 | SockList esl; /*For extended Map info */ |
1860 | uint16 mask, emask; |
1854 | uint16 mask, emask; |
1861 | uint8 eentrysize; |
1855 | uint8 eentrysize; |
1862 | uint16 ewhatstart, ewhatflag; |
1856 | uint16 ewhatstart, ewhatflag; |
1863 | uint8 extendedinfos; |
1857 | uint8 extendedinfos; |
1864 | mapstruct *m; |
1858 | maptile *m; |
1865 | |
1859 | |
1866 | NewSocket & socket = pl->contr->socket; |
1860 | NewSocket & socket = pl->contr->socket; |
1867 | |
1861 | |
1868 | check_map_change (pl->contr); |
1862 | check_map_change (pl->contr); |
1869 | |
1863 | |
… | |
… | |
2132 | SockList_AddChar (&sl, 6); |
2126 | SockList_AddChar (&sl, 6); |
2133 | SockList_AddChar (&sl, stat_width); |
2127 | SockList_AddChar (&sl, stat_width); |
2134 | } |
2128 | } |
2135 | } |
2129 | } |
2136 | |
2130 | |
2137 | if (lastcell.player !=player) |
2131 | if (lastcell.player != player) |
2138 | { |
2132 | { |
2139 | lastcell.player = player; |
2133 | lastcell.player = player; |
2140 | |
2134 | |
2141 | mask |= 0x8; |
2135 | mask |= 0x8; |
2142 | *last_ext |= 0x80; |
2136 | *last_ext |= 0x80; |
… | |
… | |
2247 | sint16 ax, ay, nx, ny; /* ax and ay goes from 0 to max-size of arrays */ |
2241 | sint16 ax, ay, nx, ny; /* ax and ay goes from 0 to max-size of arrays */ |
2248 | New_Face *face, *floor; |
2242 | New_Face *face, *floor; |
2249 | New_Face *floor2; |
2243 | New_Face *floor2; |
2250 | int d, mflags; |
2244 | int d, mflags; |
2251 | struct Map newmap; |
2245 | struct Map newmap; |
2252 | mapstruct *m, *pm; |
2246 | maptile *m, *pm; |
2253 | |
2247 | |
2254 | if (pl->type != PLAYER) |
2248 | if (pl->type != PLAYER) |
2255 | { |
2249 | { |
2256 | LOG (llevError, "draw_client_map called with non player/non eric-server\n"); |
2250 | LOG (llevError, "draw_client_map called with non player/non eric-server\n"); |
2257 | return; |
2251 | return; |