… | |
… | |
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 | } |
… | |
… | |
338 | int got_one = 0, start_look = 0, end_look = 0; |
338 | int got_one = 0, start_look = 0, end_look = 0; |
339 | char buf[MAX_BUF]; |
339 | char buf[MAX_BUF]; |
340 | |
340 | |
341 | if (!pl->contr->ns->update_look) |
341 | if (!pl->contr->ns->update_look) |
342 | { |
342 | { |
343 | LOG (llevDebug, "esrv_draw_look called when update_look was not set\n"); |
343 | LOG (llevDebug, "esrv_draw_look called when update_look was not set (player %s)\n", &pl->name); |
344 | return; |
344 | return; |
345 | } |
345 | } |
346 | else |
346 | else |
347 | pl->contr->ns->update_look = 0; |
347 | pl->contr->ns->update_look = 0; |
348 | |
348 | |
… | |
… | |
502 | * |
502 | * |
503 | * flags is a list of values to update |
503 | * flags is a list of values to update |
504 | * to the client (as defined in newclient.h - might as well use the |
504 | * to the client (as defined in newclient.h - might as well use the |
505 | * same value both places. |
505 | * same value both places. |
506 | */ |
506 | */ |
507 | |
|
|
508 | void |
507 | void |
509 | esrv_update_item (int flags, object *pl, object *op) |
508 | esrv_update_item (int flags, object *pl, object *op) |
510 | { |
509 | { |
511 | /* If we have a request to send the player item, skip a few checks. */ |
510 | /* If we have a request to send the player item, skip a few checks. */ |
512 | if (op != pl) |
511 | if (op != pl) |
… | |
… | |
604 | { |
603 | { |
605 | if (op->anim_speed) |
604 | if (op->anim_speed) |
606 | anim_speed = op->anim_speed; |
605 | anim_speed = op->anim_speed; |
607 | else |
606 | else |
608 | { |
607 | { |
609 | if (FABS (op->speed) < 0.001) |
608 | if (fabs (op->speed) < 0.001) |
610 | anim_speed = 255; |
609 | anim_speed = 255; |
611 | else if (FABS (op->speed) >= 1.0) |
610 | else if (fabs (op->speed) >= 1.0) |
612 | anim_speed = 1; |
611 | anim_speed = 1; |
613 | else |
612 | else |
614 | anim_speed = (int) (1.0 / FABS (op->speed)); |
613 | anim_speed = (int) (1.0 / fabs (op->speed)); |
615 | } |
614 | } |
616 | |
615 | |
617 | if (anim_speed > 255) |
616 | if (anim_speed > 255) |
618 | anim_speed = 255; |
617 | anim_speed = 255; |
619 | } |
618 | } |
… | |
… | |
670 | |
669 | |
671 | /** |
670 | /** |
672 | * Tells the client to delete an item. Uses the item |
671 | * Tells the client to delete an item. Uses the item |
673 | * command with a -1 location. |
672 | * command with a -1 location. |
674 | */ |
673 | */ |
675 | |
|
|
676 | void |
674 | void |
677 | esrv_del_item (player *pl, int tag) |
675 | esrv_del_item (player *pl, int tag) |
678 | { |
676 | { |
|
|
677 | if (!pl->ns) |
|
|
678 | return; |
|
|
679 | |
679 | packet sl ("delitem"); |
680 | packet sl ("delitem"); |
680 | |
681 | |
681 | sl << uint32 (tag); |
682 | sl << uint32 (tag); |
682 | |
683 | |
683 | pl->ns->send_packet (sl); |
684 | pl->ns->send_packet (sl); |
… | |
… | |
879 | else |
880 | else |
880 | new_draw_info (NDI_UNIQUE, 0, op, "You see nothing."); |
881 | new_draw_info (NDI_UNIQUE, 0, op, "You see nothing."); |
881 | } |
882 | } |
882 | } |
883 | } |
883 | |
884 | |
884 | |
|
|
885 | |
|
|
886 | /** Client wants to look at some object. Lets do so. */ |
885 | /** Client wants to look at some object. Lets do so. */ |
887 | void |
886 | void |
888 | LookAt (char *buf, int len, player *pl) |
887 | LookAt (char *buf, int len, player *pl) |
889 | { |
888 | { |
890 | int dx, dy; |
889 | int dx, dy; |
… | |
… | |
895 | { |
894 | { |
896 | return; |
895 | return; |
897 | } |
896 | } |
898 | dy = atoi (cp); |
897 | dy = atoi (cp); |
899 | |
898 | |
900 | if (FABS (dx) > pl->ns->mapx / 2 || FABS (dy) > pl->ns->mapy / 2) |
899 | if (fabs (dx) > pl->ns->mapx / 2 || fabs (dy) > pl->ns->mapy / 2) |
901 | return; |
900 | return; |
902 | |
901 | |
903 | if (pl->blocked_los[dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2]) |
902 | if (pl->blocked_los[dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2]) |
904 | return; |
903 | return; |
905 | |
904 | |