… | |
… | |
660 | |
660 | |
661 | neu->map = map; // not copied by copy_to |
661 | neu->map = map; // not copied by copy_to |
662 | return neu; |
662 | return neu; |
663 | } |
663 | } |
664 | |
664 | |
|
|
665 | // update the anhimation frame of an object, but only if it has an animation |
|
|
666 | // assigned and the frame number if within the animation. |
|
|
667 | void object::update_anim_frame (int frame) |
|
|
668 | { |
|
|
669 | if (ecb_expect_false (!has_anim () || frame >= anim_frames ())) |
|
|
670 | return; |
|
|
671 | |
|
|
672 | set_anim_frame (frame); |
|
|
673 | update_object (this, UP_OBJ_FACE); |
|
|
674 | } |
|
|
675 | |
665 | /* |
676 | /* |
666 | * If an object with the IS_TURNABLE() flag needs to be turned due |
677 | * If an object with the IS_TURNABLE() flag needs to be turned due |
667 | * to the closest player being on the other side, this function can |
678 | * to the closest player being on the other side, this function can |
668 | * be called to update the face variable, _and_ how it looks on the map. |
679 | * be called to update the face variable, _and_ how it looks on the map. |
669 | */ |
680 | */ |
… | |
… | |
671 | update_turn_face (object *op) |
682 | update_turn_face (object *op) |
672 | { |
683 | { |
673 | if (!op->flag [FLAG_IS_TURNABLE] || !op->arch) |
684 | if (!op->flag [FLAG_IS_TURNABLE] || !op->arch) |
674 | return; |
685 | return; |
675 | |
686 | |
676 | SET_ANIMATION (op, op->direction); |
687 | op->update_anim_frame (op->direction); |
677 | update_object (op, UP_OBJ_FACE); |
|
|
678 | } |
688 | } |
679 | |
689 | |
680 | /* |
690 | /* |
681 | * Updates the speed of an object. If the speed changes from 0 to another |
691 | * Updates the speed of an object. If the speed changes from 0 to another |
682 | * value, or vice versa, then add/remove the object from the active list. |
692 | * value, or vice versa, then add/remove the object from the active list. |
… | |
… | |
692 | else |
702 | else |
693 | deactivate (); |
703 | deactivate (); |
694 | } |
704 | } |
695 | |
705 | |
696 | /* |
706 | /* |
697 | * update_object() updates the the map. |
707 | * update_object() updates the map. |
698 | * It takes into account invisible objects (and represent squares covered |
708 | * It takes into account invisible objects (and represent squares covered |
699 | * by invisible objects by whatever is below them (unless it's another |
709 | * by invisible objects by whatever is below them (unless it's another |
700 | * invisible object, etc...) |
710 | * invisible object, etc...) |
701 | * If the object being updated is beneath a player, the look-window |
711 | * If the object being updated is beneath a player, the look-window |
702 | * of that player is updated (this might be a suboptimal way of |
712 | * of that player is updated (this might be a suboptimal way of |