Skip to content

Commit

Permalink
+ Added support for rpm_mode_2 and cycle_down variables for weapon co…
Browse files Browse the repository at this point in the history
…nfigs; used to emulate Abakan/AN-94's 1800 rpm two-shot burst and the cycle down to 600 RPM.
  • Loading branch information
revolucas authored and Xottab-DUTY committed Aug 19, 2017
1 parent 41431b5 commit 7b30bdd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/xrGame/ShootingObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,16 @@ void CShootingObject::Load(LPCSTR section)

//время затрачиваемое на выстрел
fOneShotTime = pSettings->r_float(section, "rpm");
//Alundaio: Two-shot burst rpm; used for Abakan/AN-94
modeShotTime = READ_IF_EXISTS(pSettings, r_float, section, "rpm_mode_2", fOneShotTime);

VERIFY(fOneShotTime > 0.f);
fOneShotTime = 60.f / fOneShotTime;
modeShotTime = 60.f / modeShotTime;

//Cycle down RPM after first 2 shots; used for Abakan/AN-94
cycleDown = READ_IF_EXISTS(pSettings, r_bool, section, "cycle_down", false);
//Alundaio: END

LoadFireParams(section);
LoadLights(section, "");
Expand Down
2 changes: 2 additions & 0 deletions src/xrGame/ShootingObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class CShootingObject : public IAnticheatDumpable
bool bWorking;

float fOneShotTime;
float modeShotTime;
bool cycleDown;
Fvector4 fvHitPower;
Fvector4 fvHitPowerCritical;
float fHitImpulse;
Expand Down
18 changes: 17 additions & 1 deletion src/xrGame/WeaponMagazined.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,12 @@ void CWeaponMagazined::state_Fire(float dt)

VERIFY(!m_magazine.empty());

//Alundaio: Use fModeShotTime instead of fOneShotTime if current fire mode is 2-shot burst
float rpm = fOneShotTime;
if (GetCurrentFireMode() == 2)
rpm = modeShotTime;
//Alundaio: END

while (!m_magazine.empty() && fShotTimeCounter < 0 && (IsWorking() || m_bFireSingleShot) &&
(m_iQueueSize < 0 || m_iShotNum < m_iQueueSize))
{
Expand All @@ -547,7 +553,17 @@ void CWeaponMagazined::state_Fire(float dt)

m_bFireSingleShot = false;

fShotTimeCounter += fOneShotTime;
//Alundaio: Cycle down RPM after two shots; used for Abakan/AN-94
if (cycleDown == true)
{
if (m_iShotNum <= 2)
rpm = modeShotTime;
else
rpm = fOneShotTime;
}

fShotTimeCounter += rpm;
//Alundaio: END

++m_iShotNum;

Expand Down

0 comments on commit 7b30bdd

Please sign in to comment.