ValveSoftware / source-sdk-2013

The 2013 edition of the Source SDK
https://developer.valvesoftware.com/wiki/SDK2013_GettingStarted
Other
3.73k stars 1.99k forks source link

ResetAnimation is missing one else? #384

Open BinarySootGremlin opened 8 years ago

BinarySootGremlin commented 8 years ago

I found a bug where the player would T-Pose in mid-air while moving and changing weapons.. `void CHL2MP_Player::ResetAnimation( void ) { if ( IsAlive() ) { SetSequence ( -1 ); SetActivity( ACT_INVALID );

    if (!GetAbsVelocity().x && !GetAbsVelocity().y)
    { 
        SetAnimation( PLAYER_IDLE );
    }
    else if ((GetAbsVelocity().x || GetAbsVelocity().y) && ( GetFlags() & FL_ONGROUND ))
    { 
        SetAnimation( PLAYER_WALK );
    }
    else if (GetWaterLevel() > 1)
    { 
        SetAnimation( PLAYER_WALK );
    }
}

}`

This code is going to get called everytime we change our weapon.. But it's not handling animation in mid-air while moving. A simple fix would be something like: `void CHL2MP_Player::ResetAnimation( void ) { if ( IsAlive() ) { SetSequence ( -1 ); SetActivity( ACT_INVALID );

    if (!GetAbsVelocity().x && !GetAbsVelocity().y)
    { 
        SetAnimation( PLAYER_IDLE );
    }
    else if ((GetAbsVelocity().x || GetAbsVelocity().y) && ( GetFlags() & FL_ONGROUND ))
    { 
        SetAnimation( PLAYER_WALK );
    }
    else
    { 
        SetAnimation( PLAYER_WALK );
    }
}

}`