Article Fixing bones

DREDD

Administrator
Administrator

DREDD

Administrator
Administrator
Status
Offline
Joined
Apr 18, 2019
Messages
190
Reaction score
323
bT9H5q1.jpg


Here's what the problem looked like before:
FQU0YN5.jpg

Code:
void BuildBones( EntityRecord_t* record, C_CSEntity* target )
{
    auto hdr = target->m_pUnknown();
 
    if ( !hdr )
        return;
 
    auto accessor = target->m_BoneAccessor();
 
    if ( !accessor )
        return;
 
    auto oldBones = accessor->GetBones();
 
    matrix3x4 baseMatrix;
 
    g_Math.AngleMatrix( target->AbsAngles(), target->AbsOrigin(), baseMatrix );
 
    target->m_nEffects() |= EF_NOINTERP;
 
    g_bPVSFix = true;
 
    auto m_pUnknown = *( DWORD* )( (DWORD) target + 1040 );
 
    if ( m_pUnknown )
    {
        typedef void( __thiscall *fn )( void* aids, CStudioHdr*, Vector&, Vector&, float, int, int );
 
        static fn _fn = (fn) FindPatternInModule( g_hClientDLL, "55 8B EC 83 EC 08 8B 45 08 56 57 8B F9 82" );
 
        _fn( m_pUnknown, hdr, target->AbsAngles(), target->AbsOrigin(), g_pGlobals->curtime, g_pGlobals->framecount, BONE_USED_BY_HITBOX );
    }
 
    Vector pos[ 128 ];
    Quaternion q[ 128 ];
 
    accessor->SetBones( record->m_pBones );
 
    target->StandardBlendingRules( hdr, pos, q, g_pGlobals->curtime );
 
    byte boneComputed[ 0x100 ] = { 0 };
 
    if ( m_pUnknown )
    {
        target->unknown2( g_pGlobals->curtime );
 
        typedef void( __thiscall *fn )( void* aids, Vector*, Quaternion*, void*, byte* );
 
        static fn _fn = (fn) FindPatternInModule( g_hClientDLL, "55 8B EC 83 E4 F0 81 EC ? ? ? ? 34" );
        static fn _fn2 = (fn) FindPatternInModule( g_hClientDLL, "55 8B EC 83 E4 F0 81 EC ? ? ? ? 8B 82" );
 
        _fn( m_pUnknown, pos, q, record->m_pBones, boneComputed );
 
        target->unknown3( g_pGlobals->curtime );
 
        _fn2( m_pUnknown, pos, q, record->m_pBones, boneComputed );
 
    }
 
    target->BuildTransformations( hdr, pos, q, baseMatrix, boneComputed );
 
    accessor->SetBones( oldBones );
}
 
Top