aboutsummaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-08-16 10:09:39 +0300
committerSergeanur <s.anureev@yandex.ua>2021-08-16 10:09:39 +0300
commitd7e764d519a9b96969786a99494eba8c3af988b9 (patch)
tree811331933b6959a1071d452536c4eca7873621ac /src/peds
parentf4894952fcf2b906051801d86959776b31908c95 (diff)
parentd6fbf9fbe775ea838e8e8d8d607b88562f1c695b (diff)
Merge branch 'miami' into lcs
# Conflicts: # README.md # gamefiles/TEXT/american.gxt # gamefiles/TEXT/french.gxt # gamefiles/TEXT/german.gxt # gamefiles/TEXT/italian.gxt # gamefiles/TEXT/spanish.gxt # src/audio/AudioLogic.cpp # src/core/config.h # src/vehicles/Automobile.cpp # utils/gxt/american.txt # utils/gxt/french.txt # utils/gxt/german.txt # utils/gxt/italian.txt # utils/gxt/spanish.txt
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/Ped.cpp6
-rw-r--r--src/peds/PedFight.cpp28
-rw-r--r--src/peds/PlayerPed.cpp38
-rw-r--r--src/peds/PlayerPed.h6
4 files changed, 62 insertions, 16 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 6d88db99..8657c426 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -1237,8 +1237,12 @@ CPed::ClearAimFlag(void)
m_lookTimer = 0;
}
- if (IsPlayer())
+ if (IsPlayer()) {
((CPlayerPed*)this)->m_fFPSMoveHeading = 0.0f;
+#ifdef FREE_CAM
+ ((CPlayerPed*)this)->m_bFreeAimActive = false;
+#endif
+ }
}
void
diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp
index 6fd1e949..eda59f2e 100644
--- a/src/peds/PedFight.cpp
+++ b/src/peds/PedFight.cpp
@@ -347,11 +347,17 @@ CPed::SetAttack(CEntity *victim)
if (m_pLookTarget) {
SetAimFlag(m_pLookTarget);
- } else if (this == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam()) {
- SetAimFlag(m_fRotationCur);
- ((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
- } else if (curWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) {
- SetAimFlag(m_fRotationCur);
+#ifdef FREE_CAM
+ } else if (this != FindPlayerPed() || !((CPlayerPed*)this)->m_bFreeAimActive) {
+#else
+ } else {
+#endif
+ if (this == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam()) {
+ SetAimFlag(m_fRotationCur);
+ ((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
+ } else if (curWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) {
+ SetAimFlag(m_fRotationCur);
+ }
}
}
#ifdef FIX_BUGS
@@ -823,6 +829,9 @@ CPed::Attack(void)
if (!bIsDucking && !GetFireAnimNotDucking(ourWeapon) && ourWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM))
m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM;
else
+#ifdef FREE_CAM
+ if (!IsPlayer() || !((CPlayerPed*)this)->m_bFreeAimActive)
+#endif
m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM;
}
@@ -1019,6 +1028,15 @@ CPed::Attack(void)
weaponAnimAssoc->SetCurrentTime(animLoopEnd);
weaponAnimAssoc->flags &= ~ASSOC_RUNNING;
SetPointGunAt(m_pPointGunAt);
+#ifdef FREE_CAM
+ } else if (IsPlayer() && ((CPlayerPed*)this)->m_bFreeAimActive && GetWeapon()->m_eWeaponState != WEAPONSTATE_RELOADING) {
+ float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
+ SetLookFlag(limitedCam, true, true);
+ SetAimFlag(limitedCam);
+ SetLookTimer(INT32_MAX);
+ SetPointGunAt(nil);
+ ((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
+#endif
} else {
ClearAimFlag();
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 88c1e6bf..3da6c500 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -98,6 +98,9 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
m_nAttackDirToCheck = 0;
m_nLastBusFareCollected = 0;
idleAnimBlockIndex = CAnimManager::GetAnimationBlockIndex("playidles");
+#ifdef FREE_CAM
+ m_bFreeAimActive = false;
+#endif
}
void
@@ -1343,17 +1346,22 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
if ((padUsed->GetTarget() && CAN_AIM_WITH_ARM) || 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 (CAN_AIM_WITH_ARM) {
- 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;
- SetLookFlag(limitedCam, true);
+ m_bFreeAimActive = true;
+ SetLookFlag(limitedCam, true, true);
SetAimFlag(limitedCam);
- SetLookTimer(INT32_MAX); // removing this makes head move for real, but I experinced some bugs.
-
+ SetLookTimer(INT32_MAX);
+ ((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;
@@ -1381,9 +1389,19 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
changedHeadingRate = 0;
RestoreHeadingRate();
}
- if (pointedGun == 1 && m_nPedState != PED_ATTACK) {
- pointedGun = 0;
- ClearPointGunAt();
+ 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
diff --git a/src/peds/PlayerPed.h b/src/peds/PlayerPed.h
index 1b7158b5..30b67199 100644
--- a/src/peds/PlayerPed.h
+++ b/src/peds/PlayerPed.h
@@ -44,6 +44,12 @@ public:
float m_fGunSpinAngle;
unsigned int m_nPadDownPressedInMilliseconds;
unsigned int m_nLastBusFareCollected;
+#ifdef FREE_CAM
+ bool m_bFreeAimActive;
+ CVector m_cachedCamSource;
+ CVector m_cachedCamFront;
+ CVector m_cachedCamUp;
+#endif
static bool bDontAllowWeaponChange;
#ifndef MASTER