Fix free cam aiming 2

This commit is contained in:
erorcun 2020-12-20 21:53:06 +03:00
parent f60b450ee8
commit ca4602d788

View file

@ -1331,7 +1331,9 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
#ifdef FREE_CAM #ifdef FREE_CAM
static int8 changedHeadingRate = 0; static int8 changedHeadingRate = 0;
static int8 pointedGun = 0;
if (changedHeadingRate == 2) changedHeadingRate = 1; if (changedHeadingRate == 2) changedHeadingRate = 1;
if (pointedGun == 2) pointedGun = 1;
// Rotate player/arm when shooting. We don't have auto-rotation anymore // Rotate player/arm when shooting. We don't have auto-rotation anymore
if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam && if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam &&
@ -1349,7 +1351,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
SetWeaponLockOnTarget(nil); SetWeaponLockOnTarget(nil);
bIsPointingGunAt = false; // to not stop after attack bIsPointingGunAt = false; // to not stop after attack
} }
pointedGun = 2;
SetLookFlag(limitedCam, true); SetLookFlag(limitedCam, true);
SetAimFlag(limitedCam); SetAimFlag(limitedCam);
SetLookTimer(INT32_MAX); // removing this makes head move for real, but I experinced some bugs. SetLookTimer(INT32_MAX); // removing this makes head move for real, but I experinced some bugs.
@ -1373,8 +1375,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
m_fRotationCur += (limitedRotDest - m_fRotationCur) / 2; m_fRotationCur += (limitedRotDest - m_fRotationCur) / 2;
} }
} }
} else if (CAN_AIM_WITH_ARM && m_nPedState != PED_ATTACK) }
ClearPointGunAt();
} }
#undef CAN_AIM_WITH_ARM #undef CAN_AIM_WITH_ARM
} }
@ -1382,6 +1383,10 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
changedHeadingRate = 0; changedHeadingRate = 0;
RestoreHeadingRate(); RestoreHeadingRate();
} }
if (pointedGun == 1 && m_nPedState != PED_ATTACK) {
pointedGun = 0;
ClearPointGunAt();
}
#endif #endif
if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT && !TheCamera.Using1stPersonWeaponMode() && weaponInfo->m_bCanAim) { if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT && !TheCamera.Using1stPersonWeaponMode() && weaponInfo->m_bCanAim) {