This commit is contained in:
erorcun 2021-08-21 15:13:23 +03:00
parent b683c047dc
commit e33b56b49a
2 changed files with 32 additions and 0 deletions

View file

@ -20,6 +20,10 @@
#define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f #define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f
#ifdef VC_PED_PORTS
bool CPlayerPed::bDontAllowWeaponChange;
#endif
const uint32 CPlayerPed::nSaveStructSize = const uint32 CPlayerPed::nSaveStructSize =
#ifdef COMPATIBLE_SAVES #ifdef COMPATIBLE_SAVES
1520; 1520;
@ -603,7 +607,11 @@ CPlayerPed::ProcessWeaponSwitch(CPad *padUsed)
if (CDarkel::FrenzyOnGoing()) if (CDarkel::FrenzyOnGoing())
goto switchDetectDone; goto switchDetectDone;
#ifdef VC_PED_PORTS
if (padUsed->CycleWeaponRightJustDown() && !m_pPointGunAt && !bDontAllowWeaponChange) {
#else
if (padUsed->CycleWeaponRightJustDown() && !m_pPointGunAt) { if (padUsed->CycleWeaponRightJustDown() && !m_pPointGunAt) {
#endif
if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON_RUNABOUT && TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON_RUNABOUT
@ -619,7 +627,11 @@ CPlayerPed::ProcessWeaponSwitch(CPad *padUsed)
} }
m_nSelectedWepSlot = WEAPONTYPE_UNARMED; m_nSelectedWepSlot = WEAPONTYPE_UNARMED;
} }
#ifdef VC_PED_PORTS
} else if (padUsed->CycleWeaponLeftJustDown() && !m_pPointGunAt && !bDontAllowWeaponChange) {
#else
} else if (padUsed->CycleWeaponLeftJustDown() && !m_pPointGunAt) { } else if (padUsed->CycleWeaponLeftJustDown() && !m_pPointGunAt) {
#endif
if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER && TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_ROCKETLAUNCHER) { && TheCamera.PlayerWeaponMode.Mode != CCam::MODE_ROCKETLAUNCHER) {
@ -857,7 +869,11 @@ CPlayerPed::FindNextWeaponLockOnTarget(CEntity *previousTarget, bool lookToLeft)
// nextTarget = nil; // duplicate // nextTarget = nil; // duplicate
float lastCloseness = -10000.0f; float lastCloseness = -10000.0f;
// CGeneral::GetATanOfXY(GetForward().x, GetForward().y); // unused // CGeneral::GetATanOfXY(GetForward().x, GetForward().y); // unused
#ifdef VC_PED_PORTS
CVector distVec = previousTarget->GetPosition() - TheCamera.GetPosition();
#else
CVector distVec = previousTarget->GetPosition() - GetPosition(); CVector distVec = previousTarget->GetPosition() - GetPosition();
#endif
float referenceBeta = CGeneral::GetATanOfXY(distVec.x, distVec.y); float referenceBeta = CGeneral::GetATanOfXY(distVec.x, distVec.y);
for (int h = CPools::GetPedPool()->GetSize() - 1; h >= 0; h--) { for (int h = CPools::GetPedPool()->GetSize() - 1; h >= 0; h--) {
@ -882,6 +898,9 @@ CPlayerPed::FindNextWeaponLockOnTarget(CEntity *previousTarget, bool lookToLeft)
return false; return false;
SetWeaponLockOnTarget(nextTarget); SetWeaponLockOnTarget(nextTarget);
#ifdef VC_PED_PORTS
bDontAllowWeaponChange = true;
#endif
SetPointGunAt(nextTarget); SetPointGunAt(nextTarget);
return true; return true;
} }
@ -927,6 +946,9 @@ CPlayerPed::FindWeaponLockOnTarget(void)
return false; return false;
SetWeaponLockOnTarget(nextTarget); SetWeaponLockOnTarget(nextTarget);
#ifdef VC_PED_PORTS
bDontAllowWeaponChange = true;
#endif
SetPointGunAt(nextTarget); SetPointGunAt(nextTarget);
return true; return true;
} }
@ -1511,6 +1533,13 @@ CPlayerPed::ProcessControl(void)
m_bSpeedTimerFlag = false; m_bSpeedTimerFlag = false;
} }
#ifdef VC_PED_PORTS
if (bDontAllowWeaponChange && FindPlayerPed() == this) {
if (!CPad::GetPad(0)->GetTarget())
bDontAllowWeaponChange = false;
}
#endif
#ifdef PED_SKIN #ifdef PED_SKIN
if (!bIsVisible && IsClumpSkinned(GetClump())) if (!bIsVisible && IsClumpSkinned(GetClump()))
UpdateRpHAnim(); UpdateRpHAnim();

View file

@ -40,6 +40,9 @@ public:
CVector m_cachedCamFront; CVector m_cachedCamFront;
CVector m_cachedCamUp; CVector m_cachedCamUp;
#endif #endif
#ifdef VC_PED_PORTS
static bool bDontAllowWeaponChange;
#endif
CPlayerPed(); CPlayerPed();
~CPlayerPed(); ~CPlayerPed();