@@ -2095,19 +2095,74 @@ void R_AddEntitySurfaces()
20952095 }
20962096 else
20972097 {
2098- switch ( tr.currentModel ->type )
2099- {
2098+ switch ( tr.currentModel ->type ) {
21002099 case modtype_t ::MOD_MESH:
21012100 R_AddMDVSurfaces ( ent );
21022101 break ;
21032102
21042103 case modtype_t ::MOD_MD5:
2104+ /* Log::Warn("%i %s: old: %i-%i %f new: %i-%i %f | %f %f", ent->e.animationHandle,
2105+ R_GetAnimationByHandle( ent->e.animationHandle )->name, ent->e.startFrame,
2106+ ent->e.endFrame, ent->e.lerp, ent->e.startFrame2, ent->e.endFrame2, ent->e.lerp2,
2107+ ent->e.blendLerp, ent->e.scale ); */
2108+ if ( ent->e .scale == 0 ) {
2109+ ent->e .scale = 1 ;
2110+ }
2111+ if ( ent->e .animationHandle == 0 ) {
2112+ ent->e .animationHandle = ent->e .animationHandle2 ;
2113+ } else if ( ent->e .animationHandle2 == 0 ) {
2114+ ent->e .animationHandle2 = ent->e .animationHandle ;
2115+ }
2116+
2117+ RE_BuildSkeleton ( &ent->e .skeleton , ent->e .animationHandle , ent->e .startFrame , ent->e .endFrame ,
2118+ ent->e .lerp , ent->e .clearOrigin );
2119+ ent->e .skeleton .scale = ent->e .scale ;
2120+ if ( ent->e .blendLerp > 0.0 ) {
2121+ refSkeleton_t skel;
2122+ RE_BuildSkeleton ( &skel, ent->e .animationHandle2 , ent->e .startFrame2 , ent->e .endFrame2 ,
2123+ ent->e .lerp2 , ent->e .clearOrigin2 );
2124+ RE_BlendSkeleton ( &ent->e .skeleton , &skel, ent->e .blendLerp );
2125+ }
2126+
2127+ for ( const BoneMod& boneMod : ent->e .boneMods ) {
2128+ QuatMultiply2 ( ent->e .skeleton .bones [boneMod.index ].t .rot , boneMod.rotation );
2129+ }
21052130 R_AddMD5Surfaces ( ent );
21062131 break ;
21072132
21082133 case modtype_t ::MOD_IQM:
2134+ {
2135+ /* Log::Warn("%i %s: old: %i-%i %f new: %i-%i %f | %f %f", ent->e.animationHandle,
2136+ R_GetAnimationByHandle( ent->e.animationHandle )->name, ent->e.startFrame,
2137+ ent->e.endFrame, ent->e.lerp, ent->e.startFrame2, ent->e.endFrame2, ent->e.lerp2,
2138+ ent->e.blendLerp, ent->e.scale ); */
2139+ bool transform = true ;
2140+ if ( ent->e .scale == 0 ) {
2141+ ent->e .scale = 1 ;
2142+ }
2143+ if ( ent->e .animationHandle == 0 ) {
2144+ ent->e .animationHandle = ent->e .animationHandle2 ;
2145+ } else if ( ent->e .animationHandle2 == 0 ) {
2146+ ent->e .animationHandle2 = ent->e .animationHandle ;
2147+ }
2148+
2149+ ent->e .skeleton .scale = ent->e .scale ;
2150+ RE_BuildSkeleton ( &ent->e .skeleton , ent->e .animationHandle , ent->e .startFrame , ent->e .endFrame ,
2151+ ent->e .lerp , ent->e .clearOrigin );
2152+ if ( ent->e .blendLerp > 0.0 ) {
2153+ refSkeleton_t skel;
2154+ RE_BuildSkeleton ( &skel, ent->e .animationHandle2 , ent->e .startFrame2 , ent->e .endFrame2 ,
2155+ ent->e .lerp2 , ent->e .clearOrigin2 );
2156+ RE_BlendSkeleton ( &ent->e .skeleton , &skel, ent->e .blendLerp );
2157+ }
2158+
2159+ for ( const BoneMod& boneMod : ent->e .boneMods ) {
2160+ QuatMultiply2 ( ent->e .skeleton .bones [boneMod.index ].t .rot , boneMod.rotation );
2161+ }
2162+ R_TransformSkeleton ( &ent->e .skeleton , ent->e .scale );
21092163 R_AddIQMSurfaces ( ent );
21102164 break ;
2165+ }
21112166
21122167 case modtype_t ::MOD_BSP:
21132168 R_AddBSPModelSurfaces ( ent );
0 commit comments