|
|
1 | |
1 | /* |
2 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
3 | CrossFire, A Multiplayer game for X-windows |
3 | |
4 | |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 1992 Frank Tore Johansen |
6 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
349 | /** |
350 | /** |
350 | * Writes to everyone on the map *except* op. This is useful for emotions. |
351 | * Writes to everyone on the map *except* op. This is useful for emotions. |
351 | */ |
352 | */ |
352 | |
353 | |
353 | void |
354 | void |
354 | new_info_map_except (int color, mapstruct *map, object *op, const char *str) |
355 | new_info_map_except (int color, maptile * map, object *op, const char *str) |
355 | { |
356 | { |
356 | player *pl; |
357 | player *pl; |
357 | |
358 | |
358 | for (pl = first_player; pl != NULL; pl = pl->next) |
359 | for (pl = first_player; pl != NULL; pl = pl->next) |
359 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op) |
360 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op) |
… | |
… | |
365 | /** |
366 | /** |
366 | * Writes to everyone on the map except op1 and op2 |
367 | * Writes to everyone on the map except op1 and op2 |
367 | */ |
368 | */ |
368 | |
369 | |
369 | void |
370 | void |
370 | new_info_map_except2 (int color, mapstruct *map, object *op1, object *op2, const char *str) |
371 | new_info_map_except2 (int color, maptile * map, object *op1, object *op2, const char *str) |
371 | { |
372 | { |
372 | player *pl; |
373 | player *pl; |
373 | |
374 | |
374 | for (pl = first_player; pl != NULL; pl = pl->next) |
375 | for (pl = first_player; pl != NULL; pl = pl->next) |
375 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op1 && pl->ob != op2) |
376 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op1 && pl->ob != op2) |
… | |
… | |
381 | /** |
382 | /** |
382 | * Writes to everyone on the specified map |
383 | * Writes to everyone on the specified map |
383 | */ |
384 | */ |
384 | |
385 | |
385 | void |
386 | void |
386 | new_info_map (int color, mapstruct *map, const char *str) |
387 | new_info_map (int color, maptile * map, const char *str) |
387 | { |
388 | { |
388 | player *pl; |
389 | player *pl; |
389 | |
390 | |
390 | for (pl = first_player; pl != NULL; pl = pl->next) |
391 | for (pl = first_player; pl != NULL; pl = pl->next) |
391 | if (pl->ob != NULL && pl->ob->map == map) |
392 | if (pl->ob != NULL && pl->ob->map == map) |
… | |
… | |
411 | void |
412 | void |
412 | rangetostring (object *pl, char *obuf) |
413 | rangetostring (object *pl, char *obuf) |
413 | { |
414 | { |
414 | switch (pl->contr->shoottype) |
415 | switch (pl->contr->shoottype) |
415 | { |
416 | { |
416 | case range_none: |
417 | case range_none: |
417 | strcpy (obuf, "Range: nothing"); |
418 | strcpy (obuf, "Range: nothing"); |
418 | break; |
419 | break; |
419 | |
420 | |
420 | case range_bow: |
421 | case range_bow: |
|
|
422 | { |
|
|
423 | object *op; |
|
|
424 | |
|
|
425 | for (op = pl->inv; op; op = op->below) |
|
|
426 | if (op->type == BOW && QUERY_FLAG (op, FLAG_APPLIED)) |
|
|
427 | break; |
|
|
428 | |
|
|
429 | if (op == NULL) |
|
|
430 | break; |
|
|
431 | |
|
|
432 | sprintf (obuf, "Range: %s (%s)", query_base_name (op, 0), op->race ? (const char *) op->race : "nothing"); |
|
|
433 | } |
|
|
434 | break; |
|
|
435 | |
|
|
436 | case range_magic: |
|
|
437 | if (settings.casting_time == TRUE) |
421 | { |
438 | { |
422 | object *op; |
439 | if (pl->casting_time > -1) |
423 | |
440 | { |
424 | for (op = pl->inv; op; op = op->below) |
441 | if (pl->casting_time == 0) |
425 | if (op->type == BOW && QUERY_FLAG (op, FLAG_APPLIED)) |
442 | sprintf (obuf, "Range: Holding spell (%s)", &pl->spell->name); |
426 | break; |
443 | else |
427 | if (op == NULL) |
444 | sprintf (obuf, "Range: Casting spell (%s)", &pl->spell->name); |
428 | break; |
445 | } |
429 | |
446 | else |
430 | sprintf (obuf, "Range: %s (%s)", query_base_name (op, 0), op->race ? (const char *) op->race : "nothing"); |
447 | sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name); |
431 | } |
448 | } |
432 | break; |
|
|
433 | |
|
|
434 | case range_magic: |
|
|
435 | if (settings.casting_time == TRUE) |
|
|
436 | { |
|
|
437 | if (pl->casting_time > -1) |
|
|
438 | { |
|
|
439 | if (pl->casting_time == 0) |
|
|
440 | sprintf (obuf, "Range: Holding spell (%s)", (const char *) pl->spell->name); |
|
|
441 | else |
|
|
442 | sprintf (obuf, "Range: Casting spell (%s)", (const char *) pl->spell->name); |
|
|
443 | } |
|
|
444 | else |
|
|
445 | sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name); |
|
|
446 | } |
|
|
447 | else |
449 | else |
448 | sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name); |
450 | sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name); |
449 | break; |
451 | break; |
450 | |
452 | |
451 | case range_misc: |
453 | case range_misc: |
452 | sprintf (obuf, "Range: %s", pl->contr->ranges[range_misc] ? query_base_name (pl->contr->ranges[range_misc], 0) : "none"); |
454 | sprintf (obuf, "Range: %s", pl->contr->ranges[range_misc] ? query_base_name (pl->contr->ranges[range_misc], 0) : "none"); |
453 | break; |
455 | break; |
454 | |
456 | |
455 | /* range_scroll is only used for controlling golems. If the |
457 | /* range_scroll is only used for controlling golems. If the |
456 | * the player does not have a golem, reset some things. |
458 | * the player does not have a golem, reset some things. |
457 | */ |
459 | */ |
458 | case range_golem: |
460 | case range_golem: |
459 | if (pl->contr->ranges[range_golem] != NULL) |
461 | if (pl->contr->ranges[range_golem] != NULL) |
460 | sprintf (obuf, "Range: golem (%s)", &pl->contr->ranges[range_golem]->name); |
462 | sprintf (obuf, "Range: golem (%s)", &pl->contr->ranges[range_golem]->name); |
461 | else |
463 | else |
462 | { |
464 | { |
463 | pl->contr->shoottype = range_none; |
465 | pl->contr->shoottype = range_none; |
464 | strcpy (obuf, "Range: nothing"); |
466 | strcpy (obuf, "Range: nothing"); |
465 | } |
467 | } |
466 | break; |
468 | break; |
467 | |
469 | |
468 | case range_skill: |
470 | case range_skill: |
469 | sprintf (obuf, "Skill: %s", pl->chosen_skill != NULL ? (const char *) pl->chosen_skill->name : "none"); |
471 | sprintf (obuf, "Skill: %s", pl->chosen_skill != NULL ? (const char *) pl->chosen_skill->name : "none"); |
470 | break; |
472 | break; |
471 | |
473 | |
472 | case range_builder: |
474 | case range_builder: |
473 | sprintf (obuf, "Builder: %s", query_base_name (pl->contr->ranges[range_builder], 0)); |
475 | sprintf (obuf, "Builder: %s", query_base_name (pl->contr->ranges[range_builder], 0)); |
474 | break; |
476 | break; |
475 | |
477 | |
476 | default: |
478 | default: |
477 | strcpy (obuf, "Range: illegal"); |
479 | strcpy (obuf, "Range: illegal"); |
478 | } |
480 | } |
479 | } |
481 | } |
480 | |
482 | |
481 | /** |
483 | /** |
482 | * Sets player title. |
484 | * Sets player title. |
… | |
… | |
506 | static void |
508 | static void |
507 | magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) |
509 | magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) |
508 | { |
510 | { |
509 | int x, y, dx, dy, mflags; |
511 | int x, y, dx, dy, mflags; |
510 | sint16 nx, ny; |
512 | sint16 nx, ny; |
511 | mapstruct *mp; |
513 | maptile *mp; |
512 | New_Face *f; |
514 | New_Face *f; |
513 | |
515 | |
514 | for (dx = -1; dx <= 1; dx++) |
516 | for (dx = -1; dx <= 1; dx++) |
515 | { |
517 | { |
516 | for (dy = -1; dy <= 1; dy++) |
518 | for (dy = -1; dy <= 1; dy++) |
… | |
… | |
572 | void |
574 | void |
573 | magic_mapping_mark (object *pl, char *map_mark, int strength) |
575 | magic_mapping_mark (object *pl, char *map_mark, int strength) |
574 | { |
576 | { |
575 | int x, y, mflags; |
577 | int x, y, mflags; |
576 | sint16 nx, ny; |
578 | sint16 nx, ny; |
577 | mapstruct *mp; |
579 | maptile *mp; |
578 | New_Face *f; |
580 | New_Face *f; |
579 | |
581 | |
580 | for (x = -strength; x < strength; x++) |
582 | for (x = -strength; x < strength; x++) |
581 | { |
583 | { |
582 | for (y = -strength; y < strength; y++) |
584 | for (y = -strength; y < strength; y++) |