humanitems.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // *************************************************************************************
  2. // ! HumanItemBehaviorCfg - per item config of stances / movements
  3. // *************************************************************************************
  4. class HumanItemBehaviorCfg
  5. {
  6. // static int DEFMOVEMENT = MOVEMENT_IDLE | MOVEMENT_WALK | MOVEMENT_RUN | SPRINT;
  7. //! bit mask of ik settings
  8. static int IKSETTING_AIMING = 0x1;
  9. static int IKSETTING_RHAND = 0x2;
  10. static int IKSETTING_LHAND = 0x4;
  11. int m_iType;
  12. int m_iStanceMask; //!< combinations of STANCEMASK_
  13. int m_StanceMovements[6]; //! 6 stances -> all has movement mask, STANCEIDX_ ... is index
  14. int m_StanceRotation[6]; //!
  15. int m_IKSettings[24]; //! [stance][movement] mask for ik
  16. int m_IKSettingsMelee[2]; //! [inpact type] mask for ik (0 - light/1 - heavy)
  17. int m_iPerItemCameraUserData; //! per item camera user data - can be obtained in runtime by DayZPlayer.GetPerItemCameraUD()
  18. //! movement caps
  19. float m_fMoveHeadingFilterSpan; //! default delay of alignment when moving
  20. float m_fMoveHeadingSprintFilterSpan; //! delay of alignment when sprintinh
  21. float m_fMoveHeadingProneFilterSpan; //! delay of alignment when moving in prone stance
  22. float m_fMoveHeadingFilterSpeed; //! max speed of alignment when moving
  23. //! evade caps
  24. float m_fMeleeEvadeHeadingFilterSpan; //! delay of alignment when evading
  25. float m_fMeleeEvadeHeadingFilterSpeed; //! max speed of alignment when evading
  26. //! per weapon lean forward
  27. bool m_bAttackLean; //! default false
  28. //! per weapon lean forward
  29. bool m_bJumpAllowed; //! default true
  30. private bool m_bPlaceholder;
  31. void SetIK(int pStance, int pMovement, bool pAim, bool pRArm, bool pLArm)
  32. {
  33. int val = 0;
  34. if (pAim) val |= IKSETTING_AIMING;
  35. if (pRArm) val |= IKSETTING_RHAND;
  36. if (pLArm) val |= IKSETTING_LHAND;
  37. // Print("Setting ik " + pStance.ToString() + "," + pMovement.ToString() );
  38. pStance = pStance * 4;
  39. pStance = pStance + pMovement;
  40. // Print("Setting ik " + pStance.ToString() + " to value " + val.ToString() );
  41. m_IKSettings[pStance] = val;
  42. }
  43. void SetIKStance(int pStance, bool pAim, bool pRArm, bool pLArm)
  44. {
  45. int val = 0;
  46. if (pAim) val |= IKSETTING_AIMING;
  47. if (pRArm) val |= IKSETTING_RHAND;
  48. if (pLArm) val |= IKSETTING_LHAND;
  49. int bo = pStance * 4;
  50. for (int i = 0; i < 4; i++)
  51. {
  52. m_IKSettings[bo+i] = val;
  53. }
  54. }
  55. void SetIKMelee(int pHitType, bool pAim, bool pRArm, bool pLArm)
  56. {
  57. int val = 0;
  58. if (pAim) val |= IKSETTING_AIMING;
  59. if (pRArm) val |= IKSETTING_RHAND;
  60. if (pLArm) val |= IKSETTING_LHAND;
  61. m_IKSettingsMelee[pHitType] = val;
  62. }
  63. void SetIKAll(bool pAim, bool pRArm, bool pLArm)
  64. {
  65. int val = 0;
  66. if (pAim) val |= IKSETTING_AIMING;
  67. if (pRArm) val |= IKSETTING_RHAND;
  68. if (pLArm) val |= IKSETTING_LHAND;
  69. int i;
  70. for (i = 0; i < 24; i++)
  71. {
  72. m_IKSettings[i] = val;
  73. }
  74. for (i = 0; i < 2; i++)
  75. {
  76. m_IKSettingsMelee[i] = val;
  77. }
  78. }
  79. }
  80. // *************************************************************************************
  81. // ! HumanItemAccessor - item helpers
  82. // *************************************************************************************
  83. class HumanItemAccessor
  84. {
  85. //! signalization from script to engine that item in hands changed
  86. proto native void OnItemInHandsChanged(bool pInstant = false);
  87. //! reset weapon anim override in case of premature death
  88. proto native void ResetWeaponInHands();
  89. //! hides item in hands visually
  90. proto native void HideItemInHands(bool pState);
  91. //! returns if item in hands is hidden visually
  92. proto native bool IsItemInHandsHidden();
  93. //! returns true if item in hands is a weapon
  94. proto native bool IsItemInHandsWeapon();
  95. //! returns true if weapon is item and it has camera point - local pos, dir in weapon space
  96. proto native bool WeaponGetCameraPoint(out vector pPos, out vector pRot);
  97. //! returns true if weapon is item and it has camera point - model space matrix -
  98. proto native bool WeaponGetCameraPointMSTransform (notnull EntityAI pCamEntity, vector pCamPoint, vector pCamDir, out vector pTm[4]);
  99. //! returns true if weapon is item and it has camera point - model space matrix -
  100. proto native bool WeaponGetCameraPointBoneRelative(notnull EntityAI pCamEntity, vector pCamPoint, vector pCamDir, int pBoneIndex, out vector pTm[4]);
  101. //! return current aiming point from aiming model (additive swaying applied - no recoil points)
  102. proto native bool WeaponGetAimingModelDirTm(out vector pTm[4]);
  103. //!
  104. proto native HumanItemBehaviorCfg GetItemInHandsBehaviourCfg();
  105. private void HumanItemAccessor()
  106. {
  107. }
  108. private void ~HumanItemAccessor()
  109. {
  110. }
  111. }