| 2598 | } |
| 2599 | |
| 2600 | void 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 | { |
no test coverage detected