MCPcopy Create free account
hub / github.com/JACoders/OpenJK / NPC_SetAnim

Function NPC_SetAnim

code/game/NPC.cpp:2600–2677  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2598}
2599
2600void NPC_SetAnim(gentity_t *ent,int setAnimParts,int anim,int setAnimFlags, int iBlend)
2601{ // FIXME : once torsoAnim and legsAnim are in the same structure for NCP and Players
2602 // rename PM_SETAnimFinal to PM_SetAnim and have both NCP and Players call PM_SetAnim
2603
2604 if ( !ent )
2605 {
2606 return;
2607 }
2608
2609 if ( ent->health > 0 )
2610 {//don't lock anims if the guy is dead
2611 if ( ent->client->ps.torsoAnimTimer
2612 && PM_LockedAnim( ent->client->ps.torsoAnim )
2613 && !PM_LockedAnim( anim ) )
2614 {//nothing can override these special anims
2615 setAnimParts &= ~SETANIM_TORSO;
2616 }
2617
2618 if ( ent->client->ps.legsAnimTimer
2619 && PM_LockedAnim( ent->client->ps.legsAnim )
2620 && !PM_LockedAnim( anim ) )
2621 {//nothing can override these special anims
2622 setAnimParts &= ~SETANIM_LEGS;
2623 }
2624 }
2625
2626 if ( !setAnimParts )
2627 {
2628 return;
2629 }
2630
2631 if(ent->client)
2632 {//Players, NPCs
2633 if (setAnimFlags&SETANIM_FLAG_OVERRIDE)
2634 {
2635 if (setAnimParts & SETANIM_TORSO)
2636 {
2637 if( (setAnimFlags & SETANIM_FLAG_RESTART) || ent->client->ps.torsoAnim != anim )
2638 {
2639 PM_SetTorsoAnimTimer( ent, &ent->client->ps.torsoAnimTimer, 0 );
2640 }
2641 }
2642 if (setAnimParts & SETANIM_LEGS)
2643 {
2644 if( (setAnimFlags & SETANIM_FLAG_RESTART) || ent->client->ps.legsAnim != anim )
2645 {
2646 PM_SetLegsAnimTimer( ent, &ent->client->ps.legsAnimTimer, 0 );
2647 }
2648 }
2649 }
2650
2651 PM_SetAnimFinal(&ent->client->ps.torsoAnim,&ent->client->ps.legsAnim,setAnimParts,anim,setAnimFlags,
2652 &ent->client->ps.torsoAnimTimer,&ent->client->ps.legsAnimTimer,ent, iBlend );
2653 }
2654 else
2655 {//bodies, etc.
2656 if (setAnimFlags&SETANIM_FLAG_OVERRIDE)
2657 {

Callers 15

player_dieFunction · 0.70
PlayerPainFunction · 0.70
G_KnockdownFunction · 0.70
SetLowerAnimFunction · 0.70
SetUpperAnimFunction · 0.70
NPC_ChoosePainAnimationFunction · 0.70
Touch_MultiFunction · 0.70
Wampa_CheckRoarFunction · 0.70
Wampa_MoveFunction · 0.70
Wampa_SlashFunction · 0.70
Wampa_AttackFunction · 0.70
NPC_Wampa_PainFunction · 0.70

Calls 4

PM_LockedAnimFunction · 0.85
PM_SetTorsoAnimTimerFunction · 0.70
PM_SetLegsAnimTimerFunction · 0.70
PM_SetAnimFinalFunction · 0.70

Tested by

no test coverage detected