… | |
… | |
304 | { |
304 | { |
305 | if (head->anim_speed) |
305 | if (head->anim_speed) |
306 | anim_speed = head->anim_speed; |
306 | anim_speed = head->anim_speed; |
307 | else |
307 | else |
308 | { |
308 | { |
309 | if (FABS (head->speed) < 0.001) |
309 | if (fabs (head->speed) < 0.001) |
310 | anim_speed = 255; |
310 | anim_speed = 255; |
311 | else if (FABS (head->speed) >= 1.0) |
311 | else if (fabs (head->speed) >= 1.0) |
312 | anim_speed = 1; |
312 | anim_speed = 1; |
313 | else |
313 | else |
314 | anim_speed = (int) (1.0 / FABS (head->speed)); |
314 | anim_speed = (int) (1.0 / fabs (head->speed)); |
315 | } |
315 | } |
316 | |
316 | |
317 | if (anim_speed > 255) |
317 | if (anim_speed > 255) |
318 | anim_speed = 255; |
318 | anim_speed = 255; |
319 | } |
319 | } |
… | |
… | |
604 | { |
604 | { |
605 | if (op->anim_speed) |
605 | if (op->anim_speed) |
606 | anim_speed = op->anim_speed; |
606 | anim_speed = op->anim_speed; |
607 | else |
607 | else |
608 | { |
608 | { |
609 | if (FABS (op->speed) < 0.001) |
609 | if (fabs (op->speed) < 0.001) |
610 | anim_speed = 255; |
610 | anim_speed = 255; |
611 | else if (FABS (op->speed) >= 1.0) |
611 | else if (fabs (op->speed) >= 1.0) |
612 | anim_speed = 1; |
612 | anim_speed = 1; |
613 | else |
613 | else |
614 | anim_speed = (int) (1.0 / FABS (op->speed)); |
614 | anim_speed = (int) (1.0 / fabs (op->speed)); |
615 | } |
615 | } |
616 | |
616 | |
617 | if (anim_speed > 255) |
617 | if (anim_speed > 255) |
618 | anim_speed = 255; |
618 | anim_speed = 255; |
619 | } |
619 | } |
… | |
… | |
631 | * Sends item's info to player. |
631 | * Sends item's info to player. |
632 | */ |
632 | */ |
633 | void |
633 | void |
634 | esrv_send_item (object *pl, object *op) |
634 | esrv_send_item (object *pl, object *op) |
635 | { |
635 | { |
|
|
636 | if (!pl->contr->ns) |
|
|
637 | return; |
|
|
638 | |
636 | /* If this is not the player object, do some more checks */ |
639 | /* If this is not the player object, do some more checks */ |
637 | if (op != pl) |
640 | if (op != pl) |
638 | { |
641 | { |
639 | /* We only send 'visibile' objects to the client */ |
642 | /* We only send 'visibile' objects to the client */ |
640 | if (!op->client_visible ()) |
643 | if (!op->client_visible ()) |
… | |
… | |
671 | */ |
674 | */ |
672 | |
675 | |
673 | void |
676 | void |
674 | esrv_del_item (player *pl, int tag) |
677 | esrv_del_item (player *pl, int tag) |
675 | { |
678 | { |
|
|
679 | if (!pl->ns) |
|
|
680 | return; |
|
|
681 | |
676 | packet sl ("delitem"); |
682 | packet sl ("delitem"); |
677 | |
683 | |
678 | sl << uint32 (tag); |
684 | sl << uint32 (tag); |
679 | |
685 | |
680 | pl->ns->send_packet (sl); |
686 | pl->ns->send_packet (sl); |
… | |
… | |
892 | { |
898 | { |
893 | return; |
899 | return; |
894 | } |
900 | } |
895 | dy = atoi (cp); |
901 | dy = atoi (cp); |
896 | |
902 | |
897 | if (FABS (dx) > pl->ns->mapx / 2 || FABS (dy) > pl->ns->mapy / 2) |
903 | if (fabs (dx) > pl->ns->mapx / 2 || fabs (dy) > pl->ns->mapy / 2) |
898 | return; |
904 | return; |
899 | |
905 | |
900 | if (pl->blocked_los[dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2]) |
906 | if (pl->blocked_los[dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2]) |
901 | return; |
907 | return; |
902 | |
908 | |