… | |
… | |
519 | * change_map_light function |
519 | * change_map_light function |
520 | */ |
520 | */ |
521 | void |
521 | void |
522 | update_all_map_los (maptile *map) |
522 | update_all_map_los (maptile *map) |
523 | { |
523 | { |
524 | player *pl; |
524 | for_all_players (pl) |
525 | |
|
|
526 | for (pl = first_player; pl != NULL; pl = pl->next) |
|
|
527 | { |
|
|
528 | if (pl->ob->map == map) |
525 | if (pl->ob->map == map) |
529 | pl->do_los = 1; |
526 | pl->do_los = 1; |
530 | } |
|
|
531 | } |
527 | } |
532 | |
528 | |
533 | |
529 | |
534 | /* |
530 | /* |
535 | * This function makes sure that update_los() will be called for all |
531 | * This function makes sure that update_los() will be called for all |
… | |
… | |
545 | */ |
541 | */ |
546 | |
542 | |
547 | void |
543 | void |
548 | update_all_los (const maptile *map, int x, int y) |
544 | update_all_los (const maptile *map, int x, int y) |
549 | { |
545 | { |
550 | player *pl; |
546 | for_all_players (pl) |
551 | |
|
|
552 | for (pl = first_player; pl; pl = pl->next) |
|
|
553 | { |
547 | { |
554 | /* Player should not have a null map, but do this |
548 | /* Player should not have a null map, but do this |
555 | * check as a safety |
549 | * check as a safety |
556 | */ |
550 | */ |
557 | if (!pl->ob->map) |
551 | if (!pl->ob->map) |
… | |
… | |
612 | |
606 | |
613 | /* |
607 | /* |
614 | * Debug-routine which dumps the array which specifies the visible |
608 | * Debug-routine which dumps the array which specifies the visible |
615 | * area of a player. Triggered by the z key in DM mode. |
609 | * area of a player. Triggered by the z key in DM mode. |
616 | */ |
610 | */ |
617 | |
|
|
618 | void |
611 | void |
619 | print_los (object *op) |
612 | print_los (object *op) |
620 | { |
613 | { |
621 | int x, y; |
614 | int x, y; |
622 | char buf[50], buf2[10]; |
615 | char buf[50], buf2[10]; |
623 | |
616 | |
624 | strcpy (buf, " "); |
617 | strcpy (buf, " "); |
|
|
618 | |
625 | for (x = 0; x < op->contr->ns->mapx; x++) |
619 | for (x = 0; x < op->contr->ns->mapx; x++) |
626 | { |
620 | { |
627 | sprintf (buf2, "%2d", x); |
621 | sprintf (buf2, "%2d", x); |
628 | strcat (buf, buf2); |
622 | strcat (buf, buf2); |
629 | } |
623 | } |
|
|
624 | |
630 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
625 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
|
|
626 | |
631 | for (y = 0; y < op->contr->ns->mapy; y++) |
627 | for (y = 0; y < op->contr->ns->mapy; y++) |
632 | { |
628 | { |
633 | sprintf (buf, "%2d:", y); |
629 | sprintf (buf, "%2d:", y); |
|
|
630 | |
634 | for (x = 0; x < op->contr->ns->mapx; x++) |
631 | for (x = 0; x < op->contr->ns->mapx; x++) |
635 | { |
632 | { |
636 | sprintf (buf2, " %1d", op->contr->blocked_los[x][y]); |
633 | sprintf (buf2, " %1d", op->contr->blocked_los[x][y]); |
637 | strcat (buf, buf2); |
634 | strcat (buf, buf2); |
638 | } |
635 | } |
|
|
636 | |
639 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
637 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
640 | } |
638 | } |
641 | } |
639 | } |
642 | |
640 | |
643 | /* |
641 | /* |
… | |
… | |
646 | */ |
644 | */ |
647 | |
645 | |
648 | void |
646 | void |
649 | make_sure_seen (const object *op) |
647 | make_sure_seen (const object *op) |
650 | { |
648 | { |
651 | player *pl; |
649 | for_all_players (pl) |
652 | |
|
|
653 | for (pl = first_player; pl; pl = pl->next) |
|
|
654 | if (pl->ob->map == op->map && |
650 | if (pl->ob->map == op->map && |
655 | pl->ob->y - pl->ns->mapy / 2 <= op->y && |
651 | pl->ob->y - pl->ns->mapy / 2 <= op->y && |
656 | pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x) |
652 | pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x) |
657 | pl->blocked_los[pl->ns->mapx / 2 + op->x - pl->ob->x][pl->ns->mapy / 2 + op->y - pl->ob->y] = 0; |
653 | pl->blocked_los[pl->ns->mapx / 2 + op->x - pl->ob->x][pl->ns->mapy / 2 + op->y - pl->ob->y] = 0; |
658 | } |
654 | } |
… | |
… | |
664 | */ |
660 | */ |
665 | |
661 | |
666 | void |
662 | void |
667 | make_sure_not_seen (const object *op) |
663 | make_sure_not_seen (const object *op) |
668 | { |
664 | { |
669 | player *pl; |
665 | for_all_players (pl) |
670 | |
|
|
671 | for (pl = first_player; pl; pl = pl->next) |
|
|
672 | if (pl->ob->map == op->map && |
666 | if (pl->ob->map == op->map && |
673 | pl->ob->y - pl->ns->mapy / 2 <= op->y && |
667 | pl->ob->y - pl->ns->mapy / 2 <= op->y && |
674 | pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x) |
668 | pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x) |
675 | pl->do_los = 1; |
669 | pl->do_los = 1; |
676 | } |
670 | } |