MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / startAni_Stand

Method startAni_Stand

src/logic/NpcAnimationHandler.cpp:402–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400}
401
402void NpcAnimationHandler::startAni_Stand(bool force, bool allowTurning)
403{
404 // Always overwrite an invalid animation ( = none plays )
405 if(!isAnimationActive(Handle::AnimationHandle::makeInvalidHandle()))
406 {
407 if (!force)
408 {
409 if (allowTurning && isTurningAnimationPlaying())
410 return;
411
412 if (!isStateAnimationPlaying())
413 return; // Can't do anything if we're currently inside a transition
414 }
415
416 if (isStanding(false)) // Set allowTurning false here, since we already filtered that out before
417 return;
418 }
419
420 // Contains "S_RUN", "S_WALK", "S_DIVE", etc
421 std::string standAniName = buildStateAnimationNameBasedOnWeapon(getWalkModeTag(m_WalkMode));
422
423 if(!doesAnimationExist(standAniName))
424 standAniName = getDefaultStandAniName();
425
426 // Check if the general transition exists. Otherwise, some animations use "STAND" as target
427 std::string transition = buildTransitionAnimationFromCurrentToGiven(getWalkModeTag(m_WalkMode));
428
429 if(!doesAnimationExist(transition))
430 {
431 if(!playAnimationTrans("S_STAND")) // This animation does not exist, but the transition may
432 {
433 playAnimation(standAniName); // Snap straight to the target animation
434 }
435 }
436 else
437 {
438 playAnimationTrans(standAniName);
439 }
440
441/*
442 if (isAnimationActive(Handle::AnimationHandle::makeInvalidHandle()))
443 {
444 // Default to idle-animation here
445 playAnimation(standAniName);
446 }
447 else if (isAnimationActive(getActiveSet().s_walk)) // Standing in walk-mode
448 {
449 }
450 else if (isAnimationActive(getActiveSet().s_walkl)) // Forward in walk-mode
451 {
452 playAnimation(getActiveSet().t_walkl_2_walk);
453 }
454 else if (isAnimationActive(getActiveSet().s_walkbl)) // Backward in walk-mode
455 {
456 playAnimation(getActiveSet().t_walkbl_2_walk);
457 }
458 else if (isAnimationActive(getActiveSet().s_run)) // Standing in run-mode
459 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected