| 280 | } |
| 281 | |
| 282 | uint32 CSkeletonAnim::AnimationToQueue(const ModelAnimationHeader* pAnim, int nAnimID, f32 btime, const CryCharAnimationParams& AnimParams) |
| 283 | { |
| 284 | const int MAX_ANIMATIONS_IN_QUEUE = 0x10; |
| 285 | |
| 286 | const uint32 numAnimsInQueue = m_layers[AnimParams.m_nLayerID].m_transitionQueue.m_animations.size(); |
| 287 | if (numAnimsInQueue >= MAX_ANIMATIONS_IN_QUEUE) |
| 288 | { |
| 289 | gEnv->pLog->LogError("Animation-queue overflow. More then %u entries. This is a serious performance problem. Model: %s. CharInst: %p.", numAnimsInQueue, m_pInstance->m_pDefaultSkeleton->GetModelFilePath(), m_pInstance); |
| 290 | return 0; |
| 291 | } |
| 292 | |
| 293 | CDefaultSkeleton* pDefaultSkeleton = m_pInstance->m_pDefaultSkeleton; |
| 294 | CAnimationSet* pAnimationSet = pDefaultSkeleton->m_pAnimationSet; |
| 295 | uint32 status = 0; |
| 296 | |
| 297 | if (pAnim) |
| 298 | { |
| 299 | uint32 nGlobalAnimId = pAnim->m_nGlobalAnimId; |
| 300 | if (pAnim->m_nAssetType == LMG_File) |
| 301 | { |
| 302 | GlobalAnimationHeaderLMG& rLMG = g_AnimationManager.m_arrGlobalLMG[nGlobalAnimId]; |
| 303 | if (rLMG.IsAssetLMG()) |
| 304 | status |= 1; |
| 305 | rLMG.m_nTouchedCounter++; |
| 306 | } |
| 307 | |
| 308 | } |
| 309 | |
| 310 | uint32 aar = AnimParams.m_nFlags & CA_ALLOW_ANIM_RESTART; |
| 311 | if (aar == 0) |
| 312 | { |
| 313 | //don't allow to start the same animation twice |
| 314 | uint32 numAnimsOnStack = m_layers[AnimParams.m_nLayerID].m_transitionQueue.m_animations.size(); |
| 315 | if (numAnimsOnStack) |
| 316 | { |
| 317 | //check is it the same animation only if the aim poses are different |
| 318 | const CAnimation& lastAnimation = m_layers[AnimParams.m_nLayerID].m_transitionQueue.m_animations[numAnimsOnStack - 1]; |
| 319 | int32 id0 = lastAnimation.GetAnimationId(); |
| 320 | if (0 <= id0) |
| 321 | if (id0 == nAnimID) |
| 322 | return 0; |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | if (AnimParams.m_nFlags & CA_REMOVE_FROM_FIFO) |
| 327 | { |
| 328 | RemoveAnimFromFIFO(AnimParams.m_nLayerID, 0, true); |
| 329 | } |
| 330 | |
| 331 | CAnimation AnimOnStack; |
| 332 | if (pAnim) |
| 333 | { |
| 334 | AnimOnStack.m_animationId = nAnimID; |
| 335 | if (pAnim->m_nAssetType == LMG_File) |
| 336 | { |
| 337 | GlobalAnimationHeaderLMG& rLMG = g_AnimationManager.m_arrGlobalLMG[pAnim->m_nGlobalAnimId]; |
| 338 | assert(rLMG.IsAssetLMG()); |
| 339 | if (rLMG.IsAssetLMG() == 0) |
nothing calls this directly
no test coverage detected