1 | |
|
|
2 | /* |
1 | /* |
3 | CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game for X-windows |
4 | |
3 | * |
|
|
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | |
7 | * |
8 | This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. |
11 | * (at your option) any later version. |
12 | |
12 | * |
13 | This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | |
17 | * |
18 | You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | |
21 | * |
22 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | * The authors can be reached via e-mail at <crossfire@schmorp.de> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | /** |
25 | /** |
26 | * \file |
26 | * \file |
27 | * Basic client output functions. |
27 | * Basic client output functions. |
28 | * |
28 | * |
… | |
… | |
255 | } |
255 | } |
256 | |
256 | |
257 | void |
257 | void |
258 | draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...) |
258 | draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...) |
259 | { |
259 | { |
260 | |
|
|
261 | char buf[HUGE_BUF]; |
260 | char buf[HUGE_BUF]; |
262 | |
261 | |
263 | if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) |
262 | if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) |
264 | return; |
263 | return; |
265 | |
264 | |
… | |
… | |
294 | */ |
293 | */ |
295 | |
294 | |
296 | void |
295 | void |
297 | new_info_map_except (int color, maptile * map, object *op, const char *str) |
296 | new_info_map_except (int color, maptile * map, object *op, const char *str) |
298 | { |
297 | { |
299 | player *pl; |
|
|
300 | |
|
|
301 | for_all_players (pl) |
298 | for_all_players (pl) |
302 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op) |
299 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op) |
303 | { |
|
|
304 | new_draw_info (color, 0, pl->ob, str); |
300 | new_draw_info (color, 0, pl->ob, str); |
305 | } |
|
|
306 | } |
301 | } |
307 | |
302 | |
308 | /** |
303 | /** |
309 | * Writes to everyone on the map except op1 and op2 |
304 | * Writes to everyone on the map except op1 and op2 |
310 | */ |
305 | */ |
311 | |
306 | |
312 | void |
307 | void |
313 | new_info_map_except2 (int color, maptile * map, object *op1, object *op2, const char *str) |
308 | new_info_map_except2 (int color, maptile * map, object *op1, object *op2, const char *str) |
314 | { |
309 | { |
315 | player *pl; |
|
|
316 | |
|
|
317 | for_all_players (pl) |
310 | for_all_players (pl) |
318 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op1 && pl->ob != op2) |
311 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op1 && pl->ob != op2) |
319 | { |
|
|
320 | new_draw_info (color, 0, pl->ob, str); |
312 | new_draw_info (color, 0, pl->ob, str); |
321 | } |
|
|
322 | } |
313 | } |
323 | |
314 | |
324 | /** |
315 | /** |
325 | * Writes to everyone on the specified map |
316 | * Writes to everyone on the specified map |
326 | */ |
317 | */ |
327 | |
318 | |
328 | void |
319 | void |
329 | new_info_map (int color, maptile * map, const char *str) |
320 | new_info_map (int color, maptile * map, const char *str) |
330 | { |
321 | { |
331 | player *pl; |
|
|
332 | |
|
|
333 | for_all_players (pl) |
322 | for_all_players (pl) |
334 | if (pl->ob != NULL && pl->ob->map == map) |
323 | if (pl->ob != NULL && pl->ob->map == map) |
335 | { |
|
|
336 | new_draw_info (color, 0, pl->ob, str); |
324 | new_draw_info (color, 0, pl->ob, str); |
337 | } |
|
|
338 | } |
325 | } |
339 | |
|
|
340 | |
326 | |
341 | /** |
327 | /** |
342 | * This does nothing now. However, in theory, we should probably send |
328 | * This does nothing now. However, in theory, we should probably send |
343 | * something to the client and let the client figure out how it might want |
329 | * something to the client and let the client figure out how it might want |
344 | * to handle this |
330 | * to handle this |
… | |
… | |
451 | magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) |
437 | magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) |
452 | { |
438 | { |
453 | int x, y, dx, dy, mflags; |
439 | int x, y, dx, dy, mflags; |
454 | sint16 nx, ny; |
440 | sint16 nx, ny; |
455 | maptile *mp; |
441 | maptile *mp; |
456 | New_Face *f; |
442 | facetile *f; |
457 | |
443 | |
458 | for (dx = -1; dx <= 1; dx++) |
444 | for (dx = -1; dx <= 1; dx++) |
459 | { |
445 | { |
460 | for (dy = -1; dy <= 1; dy++) |
446 | for (dy = -1; dy <= 1; dy++) |
461 | { |
447 | { |
… | |
… | |
505 | * being nonzero have been changed to check for 1. Also, since |
491 | * being nonzero have been changed to check for 1. Also, since |
506 | * map_mark is a char value, putting 2 in should cause no problems. |
492 | * map_mark is a char value, putting 2 in should cause no problems. |
507 | * |
493 | * |
508 | * This function examines the map the player is on, and determines what |
494 | * This function examines the map the player is on, and determines what |
509 | * is visible. 2 is set for walls or objects that blocks view. 1 |
495 | * is visible. 2 is set for walls or objects that blocks view. 1 |
510 | * is for open spaces. map_mark should already have been initialized |
496 | * is for open spaces. map_mark should already have been initialised |
511 | * to zero before this is called. |
497 | * to zero before this is called. |
512 | * strength is an initial strength*2 rectangular area that we automatically |
498 | * strength is an initial strength*2 rectangular area that we automatically |
513 | * see in/penetrate through. |
499 | * see in/penetrate through. |
514 | */ |
500 | */ |
515 | |
501 | |
… | |
… | |
517 | magic_mapping_mark (object *pl, char *map_mark, int strength) |
503 | magic_mapping_mark (object *pl, char *map_mark, int strength) |
518 | { |
504 | { |
519 | int x, y, mflags; |
505 | int x, y, mflags; |
520 | sint16 nx, ny; |
506 | sint16 nx, ny; |
521 | maptile *mp; |
507 | maptile *mp; |
522 | New_Face *f; |
508 | facetile *f; |
523 | |
509 | |
524 | for (x = -strength; x < strength; x++) |
510 | for (x = -strength; x < strength; x++) |
525 | { |
511 | { |
526 | for (y = -strength; y < strength; y++) |
512 | for (y = -strength; y < strength; y++) |
527 | { |
513 | { |
… | |
… | |
557 | * The following function is a lot messier than it really should be, |
543 | * The following function is a lot messier than it really should be, |
558 | * but there is no real easy solution. |
544 | * but there is no real easy solution. |
559 | * |
545 | * |
560 | * Mark Wedel |
546 | * Mark Wedel |
561 | */ |
547 | */ |
562 | |
|
|
563 | void |
548 | void |
564 | draw_magic_map (object *pl) |
549 | draw_magic_map (object *pl) |
565 | { |
550 | { |
566 | char *map_mark = (char *)calloc (MAGIC_MAP_SIZE * MAGIC_MAP_SIZE, 1); |
551 | char *map_mark = (char *)calloc (MAGIC_MAP_SIZE * MAGIC_MAP_SIZE, 1); |
567 | int xmin, xmax, ymin, ymax; |
552 | int xmin, xmax, ymin, ymax; |