summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/peds/Ped.cpp82
-rw-r--r--src/peds/PedAI.cpp16
-rw-r--r--src/peds/PlayerPed.cpp15
3 files changed, 62 insertions, 51 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 392ee1d4..d66d71bb 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -2583,6 +2583,48 @@ CPed::ProcessControl(void)
if (m_nWaitState != WAITSTATE_FALSE)
Wait();
+#ifdef CANCELLABLE_CAR_ENTER
+ static bool cancelJack = false;
+ if (IsPlayer()) {
+ if (EnteringCar() && m_pVehicleAnim) {
+ CPad *pad = CPad::GetPad(0);
+
+ if (!pad->ArePlayerControlsDisabled()) {
+ int vehAnim = m_pVehicleAnim->animId;
+
+ int16 padWalkX = pad->GetPedWalkLeftRight();
+ int16 padWalkY = pad->GetPedWalkUpDown();
+ if (Abs(padWalkX) > 0.0f || Abs(padWalkY) > 0.0f) {
+ if (vehAnim == ANIM_CAR_OPEN_LHS || vehAnim == ANIM_CAR_OPEN_RHS || vehAnim == ANIM_COACH_OPEN_L || vehAnim == ANIM_COACH_OPEN_R ||
+ vehAnim == ANIM_VAN_OPEN_L || vehAnim == ANIM_VAN_OPEN) {
+
+ if (!m_pMyVehicle->pDriver) {
+ cancelJack = false;
+ bCancelEnteringCar = true;
+ } else
+ cancelJack = true;
+ } else if (vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f) {
+ cancelJack = true;
+ } else if (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS) {
+ bCancelEnteringCar = true;
+ cancelJack = false;
+ }
+ }
+ if (cancelJack && vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f && m_pVehicleAnim->GetTimeLeft() < 0.78f) {
+ cancelJack = false;
+ QuitEnteringCar();
+ RestorePreviousObjective();
+ }
+ if (cancelJack && (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS)) {
+ cancelJack = false;
+ bCancelEnteringCar = true;
+ }
+ }
+ } else
+ cancelJack = false;
+ }
+#endif
+
switch (m_nPedState) {
case PED_IDLE:
Idle();
@@ -2604,46 +2646,6 @@ CPed::ProcessControl(void)
case PED_ENTER_CAR:
case PED_CARJACK:
{
-#ifdef CANCELLABLE_CAR_ENTER
- if (!IsPlayer() || !m_pVehicleAnim)
- break;
-
- CPad *pad = CPad::GetPad(0);
-
- if (pad->ArePlayerControlsDisabled())
- break;
-
- int vehAnim = m_pVehicleAnim->animId;
-
- static bool cancelJack = false;
- int16 padWalkX = pad->GetPedWalkLeftRight();
- int16 padWalkY = pad->GetPedWalkUpDown();
- if (Abs(padWalkX) > 0.0f || Abs(padWalkY) > 0.0f) {
- if (vehAnim == ANIM_CAR_OPEN_LHS || vehAnim == ANIM_CAR_OPEN_RHS || vehAnim == ANIM_COACH_OPEN_L || vehAnim == ANIM_COACH_OPEN_R ||
- vehAnim == ANIM_VAN_OPEN_L || vehAnim == ANIM_VAN_OPEN) {
-
- if (!m_pMyVehicle->pDriver) {
- cancelJack = false;
- bCancelEnteringCar = true;
- } else
- cancelJack = true;
- } else if (vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f) {
- cancelJack = true;
- } else if (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS) {
- bCancelEnteringCar = true;
- cancelJack = false;
- }
- }
- if (cancelJack && vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f && m_pVehicleAnim->GetTimeLeft() < 0.78f) {
- cancelJack = false;
- QuitEnteringCar();
- RestorePreviousObjective();
- }
- if (cancelJack && (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS)) {
- cancelJack = false;
- bCancelEnteringCar = true;
- }
-#endif
break;
}
case PED_FLEE_POS:
diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp
index d5705a2f..364e18d8 100644
--- a/src/peds/PedAI.cpp
+++ b/src/peds/PedAI.cpp
@@ -5899,17 +5899,21 @@ CPed::Duck(void)
ClearDuck();
else if (bIsDucking && bCrouchWhenShooting) {
CWeaponInfo *weapon = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType);
- CAnimBlendAssociation *attackAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_CROUCH);
- if (!attackAssoc) {
+ CAnimBlendAssociation *crouchAnim = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_CROUCH);
+ if (!crouchAnim) {
if(GetCrouchFireAnim(weapon))
- attackAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchFireAnim(weapon));
+ crouchAnim = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchFireAnim(weapon));
}
- if (!attackAssoc) {
+ if (!crouchAnim) {
if(GetCrouchReloadAnim(weapon))
- attackAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchReloadAnim(weapon));
+ crouchAnim = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchReloadAnim(weapon));
}
- if (!attackAssoc) {
+ if (!crouchAnim) {
bIsDucking = false;
+#if defined FIX_BUGS || defined FREE_CAM
+ if (IsPlayer())
+ bCrouchWhenShooting = false;
+#endif
}
}
}
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 74db3055..7d11f77e 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -1331,7 +1331,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 &&
@@ -1346,14 +1348,14 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
// 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!
- SetWeaponLockOnTarget(nil);
+ SetPointGunAt(nil);
bIsPointingGunAt = false; // to not stop after attack
}
-
+ pointedGun = 2;
SetLookFlag(limitedCam, true);
SetAimFlag(limitedCam);
SetLookTimer(INT32_MAX); // removing this makes head move for real, but I experinced some bugs.
-
+
} else {
m_fRotationDest = limitedCam;
changedHeadingRate = 2;
@@ -1373,8 +1375,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
m_fRotationCur += (limitedRotDest - m_fRotationCur) / 2;
}
}
- } else if (CAN_AIM_WITH_ARM && m_nPedState != PED_ATTACK)
- ClearPointGunAt();
+ }
}
#undef CAN_AIM_WITH_ARM
}
@@ -1382,6 +1383,10 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
changedHeadingRate = 0;
RestoreHeadingRate();
}
+ if (pointedGun == 1 && m_nPedState != PED_ATTACK) {
+ pointedGun = 0;
+ ClearPointGunAt();
+ }
#endif
if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT && !TheCamera.Using1stPersonWeaponMode() && weaponInfo->m_bCanAim) {