Changeset 174:b994a2789d5f
- Timestamp:
- 05/18/08 23:38:09 (2 years ago)
- Author:
- mdoison@…
- Branch:
- default
- Message:
-
- Fix ticket #153 : assert fails in qcommon/msg.c:883
- Location:
- src
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r145
|
r174
|
|
| 759 | 759 | |
| 760 | 760 | /* |
| 761 | | =============== |
| 762 | | CG_SetWeaponLerpFrameAnimation |
| 763 | | |
| 764 | | may include ANIM_TOGGLEBIT |
| 765 | | =============== |
| 766 | | */ |
| 767 | | static void CG_SetWeaponLerpFrameAnimation( weapon_t weapon, lerpFrame_t *lf, int newAnimation ) |
| 768 | | { |
| 769 | | animation_t *anim; |
| 770 | | |
| 771 | | lf->animationNumber = newAnimation; |
| 772 | | newAnimation &= ~ANIM_TOGGLEBIT; |
| 773 | | |
| 774 | | if( newAnimation < 0 || newAnimation >= MAX_WEAPON_ANIMATIONS ) |
| 775 | | CG_Error( "Bad animation number: %i", newAnimation ); |
| 776 | | |
| 777 | | anim = &cg_weapons[ weapon ].animations[ newAnimation ]; |
| 778 | | |
| 779 | | lf->animation = anim; |
| 780 | | lf->animationTime = lf->frameTime + anim->initialLerp; |
| 781 | | |
| 782 | | if( cg_debugAnim.integer ) |
| 783 | | CG_Printf( "Anim: %i\n", newAnimation ); |
| 784 | | } |
| 785 | | |
| 786 | | /* |
| 787 | | =============== |
| 788 | | CG_WeaponAnimation |
| 789 | | =============== |
| 790 | | */ |
| 791 | | static void CG_WeaponAnimation( centity_t *cent, int *old, int *now, float *backLerp ) |
| 792 | | { |
| 793 | | lerpFrame_t *lf = ¢->pe.weapon; |
| 794 | | entityState_t *es = ¢->currentState; |
| 795 | | |
| 796 | | // see if the animation sequence is switching |
| 797 | | if( es->weaponAnim != lf->animationNumber || !lf->animation ) |
| 798 | | CG_SetWeaponLerpFrameAnimation( es->weapon, lf, es->weaponAnim ); |
| 799 | | |
| 800 | | CG_RunLerpFrame( lf, 1.0f ); |
| 801 | | |
| 802 | | *old = lf->oldFrame; |
| 803 | | *now = lf->frame; |
| 804 | | *backLerp = lf->backlerp; |
| 805 | | } |
| 806 | | |
| 807 | | /* |
| 808 | 761 | ================= |
| 809 | 762 | CG_MapTorsoToWeaponFrame |
| … |
… |
|
| 1013 | 966 | { |
| 1014 | 967 | CG_PositionEntityOnTag( &gun, parent, parent->hModel, "tag_weapon" ); |
| 1015 | | CG_WeaponAnimation( cent, &gun.oldframe, &gun.frame, &gun.backlerp ); |
| 1016 | 968 | |
| 1017 | 969 | trap_R_AddRefEntityToScene( &gun ); |
-
|
r171
|
r174
|
|
| 2900 | 2900 | s->legsAnim = ps->legsAnim; |
| 2901 | 2901 | s->torsoAnim = ps->torsoAnim; |
| 2902 | | s->weaponAnim = ps->weaponAnim; |
| 2903 | 2902 | s->clientNum = ps->clientNum; // ET_PLAYER looks here instead of at number |
| 2904 | 2903 | // so corpses can also reference the proper config |
| … |
… |
|
| 3009 | 3008 | s->legsAnim = ps->legsAnim; |
| 3010 | 3009 | s->torsoAnim = ps->torsoAnim; |
| 3011 | | s->weaponAnim = ps->weaponAnim; |
| 3012 | 3010 | s->clientNum = ps->clientNum; // ET_PLAYER looks here instead of at number |
| 3013 | 3011 | // so corpses can also reference the proper config |
-
|
r159
|
r174
|
|
| 104 | 104 | /* |
| 105 | 105 | =================== |
| 106 | | PM_StartWeaponAnim |
| 107 | | =================== |
| 108 | | */ |
| 109 | | static void PM_StartWeaponAnim( int anim ) |
| 110 | | { |
| 111 | | if( pm->ps->pm_type >= PM_DEAD ) |
| 112 | | return; |
| 113 | | |
| 114 | | pm->ps->weaponAnim = ( ( pm->ps->weaponAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) |
| 115 | | | anim; |
| 116 | | } |
| 117 | | |
| 118 | | /* |
| 119 | | =================== |
| 120 | 106 | PM_StartLegsAnim |
| 121 | 107 | =================== |
| … |
… |
|
| 181 | 167 | |
| 182 | 168 | PM_StartTorsoAnim( anim ); |
| 183 | | } |
| 184 | | |
| 185 | | /* |
| 186 | | =================== |
| 187 | | PM_ContinueWeaponAnim |
| 188 | | =================== |
| 189 | | */ |
| 190 | | static void PM_ContinueWeaponAnim( int anim ) |
| 191 | | { |
| 192 | | if( ( pm->ps->weaponAnim & ~ANIM_TOGGLEBIT ) == anim ) |
| 193 | | return; |
| 194 | | |
| 195 | | PM_StartWeaponAnim( anim ); |
| 196 | 169 | } |
| 197 | 170 | |
| … |
… |
|
| 2649 | 2622 | { |
| 2650 | 2623 | PM_StartTorsoAnim( TORSO_DROP ); |
| 2651 | | PM_StartWeaponAnim( WANIM_DROP ); |
| 2652 | 2624 | } |
| 2653 | 2625 | } |
| … |
… |
|
| 2677 | 2649 | { |
| 2678 | 2650 | PM_StartTorsoAnim( TORSO_RAISE ); |
| 2679 | | PM_StartWeaponAnim( WANIM_RAISE ); |
| 2680 | 2651 | } |
| 2681 | 2652 | } |
| … |
… |
|
| 2699 | 2670 | PM_ContinueTorsoAnim( TORSO_STAND ); |
| 2700 | 2671 | } |
| 2701 | | |
| 2702 | | PM_ContinueWeaponAnim( WANIM_IDLE ); |
| 2703 | 2672 | } |
| 2704 | 2673 | } |
| … |
… |
|
| 2816 | 2785 | } |
| 2817 | 2786 | |
| 2818 | | PM_ContinueWeaponAnim( WANIM_IDLE ); |
| 2819 | | |
| 2820 | 2787 | return; |
| 2821 | 2788 | } |
| … |
… |
|
| 2868 | 2835 | //drop the weapon |
| 2869 | 2836 | PM_StartTorsoAnim( TORSO_DROP ); |
| 2870 | | PM_StartWeaponAnim( WANIM_RELOAD ); |
| 2871 | 2837 | |
| 2872 | 2838 | addTime = BG_Weapon( pm->ps->weapon )->reloadTime; |
| … |
… |
|
| 3044 | 3010 | { |
| 3045 | 3011 | PM_StartTorsoAnim( TORSO_ATTACK ); |
| 3046 | | PM_StartWeaponAnim( WANIM_ATTACK1 ); |
| 3047 | 3012 | } |
| 3048 | 3013 | break; |
| … |
… |
|
| 3050 | 3015 | case WP_BLASTER: |
| 3051 | 3016 | PM_StartTorsoAnim( TORSO_ATTACK2 ); |
| 3052 | | PM_StartWeaponAnim( WANIM_ATTACK1 ); |
| 3053 | 3017 | break; |
| 3054 | 3018 | |
| 3055 | 3019 | default: |
| 3056 | 3020 | PM_StartTorsoAnim( TORSO_ATTACK ); |
| 3057 | | PM_StartWeaponAnim( WANIM_ATTACK1 ); |
| 3058 | 3021 | break; |
| 3059 | 3022 | } |
| … |
… |
|
| 3073 | 3036 | num %= 6; |
| 3074 | 3037 | PM_ForceLegsAnim( NSPA_ATTACK1 ); |
| 3075 | | PM_StartWeaponAnim( WANIM_ATTACK1 + num ); |
| 3076 | 3038 | } |
| 3077 | 3039 | break; |
| … |
… |
|
| 3081 | 3043 | { |
| 3082 | 3044 | PM_ForceLegsAnim( NSPA_ATTACK2 ); |
| 3083 | | PM_StartWeaponAnim( WANIM_ATTACK7 ); |
| 3084 | 3045 | } |
| 3085 | 3046 | case WP_ALEVEL2: |
| … |
… |
|
| 3088 | 3049 | num %= 6; |
| 3089 | 3050 | PM_ForceLegsAnim( NSPA_ATTACK1 ); |
| 3090 | | PM_StartWeaponAnim( WANIM_ATTACK1 + num ); |
| 3091 | 3051 | } |
| 3092 | 3052 | break; |
| … |
… |
|
| 3095 | 3055 | num %= 3; |
| 3096 | 3056 | PM_ForceLegsAnim( NSPA_ATTACK1 + num ); |
| 3097 | | PM_StartWeaponAnim( WANIM_ATTACK1 + num ); |
| 3098 | 3057 | break; |
| 3099 | 3058 | |
| … |
… |
|
| 3102 | 3061 | { |
| 3103 | 3062 | PM_ForceLegsAnim( NSPA_ATTACK1 ); |
| 3104 | | PM_StartWeaponAnim( WANIM_ATTACK1 ); |
| 3105 | 3063 | } |
| 3106 | 3064 | else if( attack2 ) |
| 3107 | 3065 | { |
| 3108 | 3066 | PM_ForceLegsAnim( NSPA_ATTACK2 ); |
| 3109 | | PM_StartWeaponAnim( WANIM_ATTACK2 ); |
| 3110 | 3067 | } |
| 3111 | 3068 | else if( attack3 ) |
| 3112 | 3069 | { |
| 3113 | 3070 | PM_ForceLegsAnim( NSPA_ATTACK3 ); |
| 3114 | | PM_StartWeaponAnim( WANIM_ATTACK3 ); |
| 3115 | 3071 | } |
| 3116 | 3072 | break; |
-
|
r148
|
r174
|
|
| 1060 | 1060 | int torsoAnim; // mask off ANIM_TOGGLEBIT |
| 1061 | 1061 | |
| 1062 | | int weaponAnim; // mask off ANIM_TOGGLEBIT |
| 1063 | | |
| 1064 | 1062 | int movementDir; // a number 0 to 7 that represents the reletive angle |
| 1065 | 1063 | // of movement to the view angle (axial and diagonals) |
| … |
… |
|
| 1217 | 1215 | int legsAnim; // mask off ANIM_TOGGLEBIT |
| 1218 | 1216 | int torsoAnim; // mask off ANIM_TOGGLEBIT |
| 1219 | | int weaponAnim; // mask off ANIM_TOGGLEBIT |
| 1220 | 1217 | |
| 1221 | 1218 | int generic1; |