Skip to content

Commit

Permalink
VC bits
Browse files Browse the repository at this point in the history
  • Loading branch information
erorcun committed Aug 21, 2021
1 parent b683c04 commit e33b56b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/peds/PlayerPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

#define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f

#ifdef VC_PED_PORTS
bool CPlayerPed::bDontAllowWeaponChange;
#endif

const uint32 CPlayerPed::nSaveStructSize =
#ifdef COMPATIBLE_SAVES
1520;
Expand Down Expand Up @@ -603,7 +607,11 @@ CPlayerPed::ProcessWeaponSwitch(CPad *padUsed)
if (CDarkel::FrenzyOnGoing())
goto switchDetectDone;

#ifdef VC_PED_PORTS
if (padUsed->CycleWeaponRightJustDown() && !m_pPointGunAt && !bDontAllowWeaponChange) {
#else
if (padUsed->CycleWeaponRightJustDown() && !m_pPointGunAt) {
#endif

if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON_RUNABOUT
Expand All @@ -619,7 +627,11 @@ CPlayerPed::ProcessWeaponSwitch(CPad *padUsed)
}
m_nSelectedWepSlot = WEAPONTYPE_UNARMED;
}
#ifdef VC_PED_PORTS
} else if (padUsed->CycleWeaponLeftJustDown() && !m_pPointGunAt && !bDontAllowWeaponChange) {
#else
} else if (padUsed->CycleWeaponLeftJustDown() && !m_pPointGunAt) {
#endif
if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_ROCKETLAUNCHER) {
Expand Down Expand Up @@ -857,7 +869,11 @@ CPlayerPed::FindNextWeaponLockOnTarget(CEntity *previousTarget, bool lookToLeft)
// nextTarget = nil; // duplicate
float lastCloseness = -10000.0f;
// CGeneral::GetATanOfXY(GetForward().x, GetForward().y); // unused
#ifdef VC_PED_PORTS
CVector distVec = previousTarget->GetPosition() - TheCamera.GetPosition();
#else
CVector distVec = previousTarget->GetPosition() - GetPosition();
#endif
float referenceBeta = CGeneral::GetATanOfXY(distVec.x, distVec.y);

for (int h = CPools::GetPedPool()->GetSize() - 1; h >= 0; h--) {
Expand All @@ -882,6 +898,9 @@ CPlayerPed::FindNextWeaponLockOnTarget(CEntity *previousTarget, bool lookToLeft)
return false;

SetWeaponLockOnTarget(nextTarget);
#ifdef VC_PED_PORTS
bDontAllowWeaponChange = true;
#endif
SetPointGunAt(nextTarget);
return true;
}
Expand Down Expand Up @@ -927,6 +946,9 @@ CPlayerPed::FindWeaponLockOnTarget(void)
return false;

SetWeaponLockOnTarget(nextTarget);
#ifdef VC_PED_PORTS
bDontAllowWeaponChange = true;
#endif
SetPointGunAt(nextTarget);
return true;
}
Expand Down Expand Up @@ -1511,6 +1533,13 @@ CPlayerPed::ProcessControl(void)
m_bSpeedTimerFlag = false;
}

#ifdef VC_PED_PORTS
if (bDontAllowWeaponChange && FindPlayerPed() == this) {
if (!CPad::GetPad(0)->GetTarget())
bDontAllowWeaponChange = false;
}
#endif

#ifdef PED_SKIN
if (!bIsVisible && IsClumpSkinned(GetClump()))
UpdateRpHAnim();
Expand Down
3 changes: 3 additions & 0 deletions src/peds/PlayerPed.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class CPlayerPed : public CPed
CVector m_cachedCamFront;
CVector m_cachedCamUp;
#endif
#ifdef VC_PED_PORTS
static bool bDontAllowWeaponChange;
#endif

CPlayerPed();
~CPlayerPed();
Expand Down

0 comments on commit e33b56b

Please sign in to comment.