Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.2 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "bone_accessor.h"
  8. // NOTE: This has to be the last file included!
  9. #include "tier0/memdbgon.h"
  10. bool CBoneAccessor::isBoneAvailableForRead( int iBone ) const
  11. {
  12. if ( m_pAnimating )
  13. {
  14. CStudioHdr *pHdr = m_pAnimating->GetModelPtr();
  15. if ( pHdr )
  16. {
  17. return ( pHdr->boneFlags( iBone ) & m_ReadableBones ) != 0;
  18. }
  19. }
  20. return false;
  21. }
  22. bool CBoneAccessor::isBoneAvailableForWrite( int iBone ) const
  23. {
  24. if ( m_pAnimating )
  25. {
  26. CStudioHdr *pHdr = m_pAnimating->GetModelPtr();
  27. if ( pHdr )
  28. {
  29. // double check consistency
  30. // !!! DbgAssert( pHdr->pBone( iBone )->flags == pHdr->boneFlags( iBone ) );
  31. return ( pHdr->boneFlags( iBone ) & m_WritableBones ) != 0;
  32. }
  33. }
  34. return false;
  35. }
  36. #if defined( CLIENT_DLL ) && defined( _DEBUG )
  37. void CBoneAccessor::SanityCheckBone( int iBone, bool bReadable ) const
  38. {
  39. if ( !m_pAnimating )
  40. {
  41. return;
  42. }
  43. if ( bReadable )
  44. {
  45. Assert( isBoneAvailableForRead( iBone ) );
  46. }
  47. else
  48. {
  49. Assert( isBoneAvailableForWrite( iBone ) );
  50. }
  51. }
  52. #endif