Fix impossible bullets & turn speed on heavy guns

This commit is contained in:
erorcun
2021-08-16 21:06:06 +03:00
parent 8641e9d0bb
commit 79856dac25
5 changed files with 116 additions and 23 deletions

View File

@@ -504,7 +504,7 @@ CPlayerPed::DoWeaponSmoothSpray(void)
if (m_nPedState == PED_ATTACK && !m_pPointGunAt) {
eWeaponType weapon = GetWeapon()->m_eWeaponType;
#ifdef FREE_CAM
if(TheCamera.Cams[0].Using3rdPersonMouseCam() && (weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI))
if(CCamera::bFreeCam && TheCamera.Cams[0].Using3rdPersonMouseCam() && (weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI))
return false;
#endif
if (weapon == WEAPONTYPE_FLAMETHROWER || weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI || weapon == WEAPONTYPE_SHOTGUN ||
@@ -1060,7 +1060,9 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
#ifdef FREE_CAM
static int8 changedHeadingRate = 0;
static int8 pointedGun = 0;
if (changedHeadingRate == 2) changedHeadingRate = 1;
if (pointedGun == 2) pointedGun = 1;
// Rotate player/arm when shooting. We don't have auto-rotation anymore
if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam &&
@@ -1071,22 +1073,28 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
if ((padUsed->GetTarget() && weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) || padUsed->GetWeapon()) {
float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
m_cachedCamSource = TheCamera.Cams[TheCamera.ActiveCam].Source;
m_cachedCamFront = TheCamera.Cams[TheCamera.ActiveCam].Front;
m_cachedCamUp = TheCamera.Cams[TheCamera.ActiveCam].Up;
// On this one we can rotate arm.
if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) {
if (!padUsed->GetWeapon()) { // making this State != ATTACK still stops it after attack. Re-start it immediately!
SetPointGunAt(nil);
bIsPointingGunAt = false; // to not stop after attack
}
pointedGun = 2;
m_bFreeAimActive = true;
SetLookFlag(limitedCam, true);
SetAimFlag(limitedCam);
#ifdef VC_PED_PORTS
SetLookTimer(INT32_MAX); // removing this makes head move for real, but I experinced some bugs.
#endif
((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
if (m_nPedState != PED_ATTACK && m_nPedState != PED_AIM_GUN) {
// This is a seperate ped state just for pointing gun. Used for target button
SetPointGunAt(nil);
}
} else {
m_fRotationDest = limitedCam;
changedHeadingRate = 2;
m_headingRate = 50.0f;
m_headingRate = 12.5f;
// Anim. fix for shotgun, ak47 and m16 (we must finish rot. it quickly)
if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM) && padUsed->WeaponJustDown()) {
@@ -1102,14 +1110,27 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
m_fRotationCur += (limitedRotDest - m_fRotationCur) / 2;
}
}
} else if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM) && m_nPedState != PED_ATTACK)
ClearPointGunAt();
}
}
}
if (changedHeadingRate == 1) {
changedHeadingRate = 0;
RestoreHeadingRate();
}
if (pointedGun == 1) {
if (m_nPedState == PED_ATTACK) {
if (!padUsed->GetWeapon() && (m_pedIK.m_flags & CPedIK::GUN_POINTED_SUCCESSFULLY) == 0) {
float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
SetAimFlag(limitedCam);
((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
m_bFreeAimActive = true;
}
} else {
pointedGun = 0;
ClearPointGunAt();
}
}
#endif
if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
@@ -1188,7 +1209,7 @@ CPlayerPed::PlayerControlZelda(CPad *padUsed)
}
#ifdef FREE_CAM
if(TheCamera.Cams[0].Using3rdPersonMouseCam() && doSmoothSpray) {
if(CCamera::bFreeCam && TheCamera.Cams[0].Using3rdPersonMouseCam() && doSmoothSpray) {
padMoveInGameUnit = 0.0f;
smoothSprayWithoutMove = false;
}