! Starts an animation of a character @param pos Number of the character slot @param animname Name of the animation from the .chrparams file @see CScriptBind_Entity::LoadCharacter @see CEntity::StartAnimation */
| 2768 | @see CEntity::StartAnimation |
| 2769 | */ |
| 2770 | int CScriptBind_Entity::StartAnimation(IFunctionHandler* pH) |
| 2771 | { |
| 2772 | GET_ENTITY; |
| 2773 | |
| 2774 | //SCRIPT_CHECK_PARAMETERS(2); |
| 2775 | const char* animname; |
| 2776 | int pos, layer = 0; |
| 2777 | |
| 2778 | bool bLooping = false; |
| 2779 | bool bRecursive(false); |
| 2780 | bool partial(false); |
| 2781 | bool bForceSingleFrame(false); |
| 2782 | |
| 2783 | float fBlendTime = 0.15f; |
| 2784 | float fAniSpeed = 1.0f; |
| 2785 | |
| 2786 | pH->GetParam(1, pos); |
| 2787 | if (!pH->GetParam(2, animname)) |
| 2788 | { |
| 2789 | m_pISystem->Warning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, 0, |
| 2790 | 0, "CScriptBind_Entity::StartAnimation, animation name not specified, in Entity %s", pEntity->GetName()); |
| 2791 | return pH->EndFunction(false); |
| 2792 | } |
| 2793 | |
| 2794 | if (pH->GetParamCount() > 2) |
| 2795 | { |
| 2796 | pH->GetParam(3, layer); |
| 2797 | if (pH->GetParamCount() > 3) |
| 2798 | { |
| 2799 | pH->GetParam(4, fBlendTime); |
| 2800 | if (pH->GetParamCount() > 4) |
| 2801 | { |
| 2802 | pH->GetParam(5, fAniSpeed); |
| 2803 | if (pH->GetParamCount() > 5) |
| 2804 | { |
| 2805 | pH->GetParam(6, bLooping); |
| 2806 | |
| 2807 | if (pH->GetParamCount() > 6) |
| 2808 | { |
| 2809 | pH->GetParam(7, bRecursive); |
| 2810 | |
| 2811 | if (pH->GetParamCount() > 7) |
| 2812 | { |
| 2813 | pH->GetParam(8, partial); |
| 2814 | |
| 2815 | if (pH->GetParamCount() > 8) |
| 2816 | pH->GetParam(9, bForceSingleFrame); |
| 2817 | } |
| 2818 | } |
| 2819 | } |
| 2820 | } |
| 2821 | } |
| 2822 | } |
| 2823 | |
| 2824 | ICharacterInstance* pCharacter = pEntity->GetCharacter(pos); |
| 2825 | // no character no animation |
| 2826 | if (!pCharacter) |
| 2827 | return pH->EndFunction(false); |
nothing calls this directly
no test coverage detected