summaryrefslogtreecommitdiffstats
path: root/src/peds/PlayerPed.cpp
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-08-14 21:11:33 +0200
committererorcun <erorcunerorcun@hotmail.com.tr>2021-08-15 17:34:43 +0200
commit435b8fe52e7564bfcf6ff32d36b0625316cbf12f (patch)
tree7de898a800ea9f71ea4c5892d0994dc8bbed775e /src/peds/PlayerPed.cpp
parentSwitch PR & remove X11 part from CMakeLists (diff)
downloadre3-435b8fe52e7564bfcf6ff32d36b0625316cbf12f.tar
re3-435b8fe52e7564bfcf6ff32d36b0625316cbf12f.tar.gz
re3-435b8fe52e7564bfcf6ff32d36b0625316cbf12f.tar.bz2
re3-435b8fe52e7564bfcf6ff32d36b0625316cbf12f.tar.lz
re3-435b8fe52e7564bfcf6ff32d36b0625316cbf12f.tar.xz
re3-435b8fe52e7564bfcf6ff32d36b0625316cbf12f.tar.zst
re3-435b8fe52e7564bfcf6ff32d36b0625316cbf12f.zip
Diffstat (limited to 'src/peds/PlayerPed.cpp')
-rw-r--r--src/peds/PlayerPed.cpp38
1 files changed, 28 insertions, 10 deletions
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 1d96ba6d..b0b82640 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
@@ -1342,17 +1345,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;
@@ -1380,9 +1388,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