Skip to content

Commit 7b30bdd

Browse files
revolucasXottab-DUTY
authored andcommitted
+ Added support for rpm_mode_2 and cycle_down variables for weapon configs; used to emulate Abakan/AN-94's 1800 rpm two-shot burst and the cycle down to 600 RPM.
1 parent 41431b5 commit 7b30bdd

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/xrGame/ShootingObject.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,16 @@ void CShootingObject::Load(LPCSTR section)
6161

6262
//время затрачиваемое на выстрел
6363
fOneShotTime = pSettings->r_float(section, "rpm");
64+
//Alundaio: Two-shot burst rpm; used for Abakan/AN-94
65+
modeShotTime = READ_IF_EXISTS(pSettings, r_float, section, "rpm_mode_2", fOneShotTime);
66+
6467
VERIFY(fOneShotTime > 0.f);
6568
fOneShotTime = 60.f / fOneShotTime;
69+
modeShotTime = 60.f / modeShotTime;
70+
71+
//Cycle down RPM after first 2 shots; used for Abakan/AN-94
72+
cycleDown = READ_IF_EXISTS(pSettings, r_bool, section, "cycle_down", false);
73+
//Alundaio: END
6674

6775
LoadFireParams(section);
6876
LoadLights(section, "");

src/xrGame/ShootingObject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class CShootingObject : public IAnticheatDumpable
6060
bool bWorking;
6161

6262
float fOneShotTime;
63+
float modeShotTime;
64+
bool cycleDown;
6365
Fvector4 fvHitPower;
6466
Fvector4 fvHitPowerCritical;
6567
float fHitImpulse;

src/xrGame/WeaponMagazined.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,12 @@ void CWeaponMagazined::state_Fire(float dt)
536536

537537
VERIFY(!m_magazine.empty());
538538

539+
//Alundaio: Use fModeShotTime instead of fOneShotTime if current fire mode is 2-shot burst
540+
float rpm = fOneShotTime;
541+
if (GetCurrentFireMode() == 2)
542+
rpm = modeShotTime;
543+
//Alundaio: END
544+
539545
while (!m_magazine.empty() && fShotTimeCounter < 0 && (IsWorking() || m_bFireSingleShot) &&
540546
(m_iQueueSize < 0 || m_iShotNum < m_iQueueSize))
541547
{
@@ -547,7 +553,17 @@ void CWeaponMagazined::state_Fire(float dt)
547553

548554
m_bFireSingleShot = false;
549555

550-
fShotTimeCounter += fOneShotTime;
556+
//Alundaio: Cycle down RPM after two shots; used for Abakan/AN-94
557+
if (cycleDown == true)
558+
{
559+
if (m_iShotNum <= 2)
560+
rpm = modeShotTime;
561+
else
562+
rpm = fOneShotTime;
563+
}
564+
565+
fShotTimeCounter += rpm;
566+
//Alundaio: END
551567

552568
++m_iShotNum;
553569

0 commit comments

Comments
 (0)