diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-23 19:07:30 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-23 19:07:30 +0200 |
commit | 2966be41ba98906126b68cd780ff81bdf644c72f (patch) | |
tree | 04f057aea609a4a36f744aa77324626a592ef010 /src/peds/PedIK.cpp | |
parent | set pieces (diff) | |
parent | Merge branch 'miami' of https://github.com/GTAmodding/re3 into miami (diff) | |
download | re3-2966be41ba98906126b68cd780ff81bdf644c72f.tar re3-2966be41ba98906126b68cd780ff81bdf644c72f.tar.gz re3-2966be41ba98906126b68cd780ff81bdf644c72f.tar.bz2 re3-2966be41ba98906126b68cd780ff81bdf644c72f.tar.lz re3-2966be41ba98906126b68cd780ff81bdf644c72f.tar.xz re3-2966be41ba98906126b68cd780ff81bdf644c72f.tar.zst re3-2966be41ba98906126b68cd780ff81bdf644c72f.zip |
Diffstat (limited to 'src/peds/PedIK.cpp')
-rw-r--r-- | src/peds/PedIK.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp index 6543e9a3..2925667a 100644 --- a/src/peds/PedIK.cpp +++ b/src/peds/PedIK.cpp @@ -7,7 +7,7 @@ #include "General.h" #include "RwHelper.h" -//--MIAMI: file almost done (only some special weapon cases left) +//--MIAMI: file done LimbMovementInfo CPedIK::ms_torsoInfo = { DEGTORAD(50.0f), DEGTORAD(-50.0f), DEGTORAD(8.0f), DEGTORAD(45.0f), DEGTORAD(-45.0f), DEGTORAD(5.0f) }; LimbMovementInfo CPedIK::ms_headInfo = { DEGTORAD(90.0f), DEGTORAD(-90.0f), DEGTORAD(15.0f), DEGTORAD(45.0f), DEGTORAD(-45.0f), DEGTORAD(8.0f) }; @@ -57,9 +57,9 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change } void -CPedIK::GetComponentPosition(RwV3d *pos, uint32 node) +CPedIK::GetComponentPosition(RwV3d &pos, uint32 node) { - *pos = GetComponentMatrix(m_ped, node)->pos; + pos = GetComponentMatrix(m_ped, node)->pos; } LimbMoveStatus @@ -292,13 +292,20 @@ CPedIK::PointGunInDirectionUsingArm(float targetYaw, float targetPitch) bool CPedIK::PointGunAtPosition(CVector const& position) { - // TODO(MIAMI): special cases for some weapons + CVector startPoint; + if (m_ped->GetWeapon()->m_eWeaponType == WEAPONTYPE_SPAS12_SHOTGUN || m_ped->GetWeapon()->m_eWeaponType == WEAPONTYPE_STUBBY_SHOTGUN) + startPoint = m_ped->GetPosition(); + else { + RwV3d armPos; + GetComponentPosition(armPos, PED_UPPERARMR); + startPoint.x = m_ped->GetPosition().x; + startPoint.y = m_ped->GetPosition().y; + startPoint.z = armPos.z; + } - RwV3d armPos; - GetComponentPosition(&armPos, PED_UPPERARMR); return PointGunInDirection( - CGeneral::GetRadianAngleBetweenPoints(position.x, position.y, m_ped->GetPosition().x, m_ped->GetPosition().y), - CGeneral::GetRadianAngleBetweenPoints(position.z, Distance2D(m_ped->GetPosition(), position.x, position.y), armPos.z, 0.0f)); + CGeneral::GetRadianAngleBetweenPoints(position.x, position.y, startPoint.x, startPoint.y), + CGeneral::GetRadianAngleBetweenPoints(position.z, Distance2D(m_ped->GetPosition(), position.x, position.y), startPoint.z, 0.0f)); } bool |