@@ -87,15 +87,35 @@ static void BuildSkeleton( trRefEntity_t* ent ) {
8787 }
8888 }
8989
90- refSkeleton_t skel;
90+ refSkeleton_t skel {};
91+
92+ /* This follows the original weird and buggy code in cgame
93+ This is used to make alien attack animations blend with the movement animation
94+ Unlike human models, aliens use the same refEntity_t for all their animations (referred to as `legs` in cgame)
95+ The intent seems to have been to blend last and current movement animation, then blend them with the attack animation
96+ (the attack animation isn't blended with the one from the previous frame for whatever reason) */
97+ for ( const BoneMod& boneMod : ent->e .boneMods ) {
98+ if ( boneMod.type == BUILD_EXTRA_BLEND_SKELETON ) {
99+ if ( ent->e .animationHandle ) {
100+ RE_BuildSkeleton ( &skel, boneMod.animationHandle , boneMod.startFrame , boneMod.endFrame ,
101+ boneMod.lerp , ent->e .clearOrigin );
102+ RE_BlendSkeleton ( &ent->skeleton , &skel, boneMod.blendLerp );
103+ }
104+
105+ break ;
106+ }
107+ }
108+
91109 if ( ent->e .animationHandle2 ) {
92110 refSkeleton_t* skeleton2 = ent->e .animationHandle ? &skel : &ent->skeleton ;
93111
94112 RE_BuildSkeleton ( skeleton2, ent->e .animationHandle2 , ent->e .startFrame2 , ent->e .endFrame2 ,
95113 ent->e .lerp2 , ent->e .clearOrigin2 );
96114
97115 for ( const BoneMod& boneMod : ent->e .boneMods ) {
98- QuatMultiply2 ( skeleton2->bones [boneMod.index ].t .rot , boneMod.rotation );
116+ if ( boneMod.type == BONE_ROTATE ) {
117+ QuatMultiply2 ( skeleton2->bones [boneMod.index ].t .rot , boneMod.rotation );
118+ }
99119 }
100120
101121 if ( ent->e .animationHandle && ent->e .blendLerp > 0.0 ) {
0 commit comments