Skip to content

Commit

Permalink
Recoil parity (#577)
Browse files Browse the repository at this point in the history
* Recoil parity
  • Loading branch information
Agiel committed Sep 14, 2024
1 parent 797c385 commit b2291c5
Show file tree
Hide file tree
Showing 46 changed files with 347 additions and 524 deletions.
27 changes: 8 additions & 19 deletions mp/src/game/shared/neo/weapons/weapon_aa13.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,13 @@ CWeaponAA13::CWeaponAA13(void)
// m_flAccuracyPenalty = 0.0f;

// m_nNumShotsFired = 0;
}

void CWeaponAA13::AddViewKick()
{
CNEO_Player *pOwner = ToNEOPlayer((GetOwner()));

if (!pOwner)
{
return;
}

QAngle viewPunch;

viewPunch.x = SharedRandomFloat("aa13px", 0.33f, 0.5f);
viewPunch.y = SharedRandomFloat("aa13py", -1.5f, 1.5f);
viewPunch.z = 0.0f;

pOwner->ViewPunch(viewPunch);
m_weaponSeeds = {
"aa13px",
"aa13py",
"aa13rx",
"aa13ry",
};
}

void CWeaponAA13::PrimaryAttack(void)
Expand Down Expand Up @@ -97,8 +86,6 @@ void CWeaponAA13::PrimaryAttack(void)
return;
}

pPlayer->ViewPunchReset();

// MUST call sound before removing a round from the clip of a CMachineGun
WeaponSound(SINGLE);

Expand Down Expand Up @@ -128,5 +115,7 @@ void CWeaponAA13::PrimaryAttack(void)
// HEV suit - indicate out of ammo condition
pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}

pPlayer->ViewPunchReset();
AddViewKick();
}
1 change: 0 additions & 1 deletion mp/src/game/shared/neo/weapons/weapon_aa13.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class CWeaponAA13 : public CNEOBaseCombatWeapon
CWeaponAA13(void);

virtual void PrimaryAttack(void) OVERRIDE;
virtual void AddViewKick(void) OVERRIDE;

virtual NEO_WEP_BITS_UNDERLYING_TYPE GetNeoWepBits(void) const OVERRIDE { return NEO_WEP_AA13; }
virtual int GetNeoWepXPCost(const int neoClass) const OVERRIDE { return 20; }
Expand Down
23 changes: 6 additions & 17 deletions mp/src/game/shared/neo/weapons/weapon_jitte.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,11 @@ CWeaponJitte::CWeaponJitte()
m_flAccuracyPenalty = 0;

m_nNumShotsFired = 0;
}

void CWeaponJitte::AddViewKick()
{
auto owner = ToBasePlayer(GetOwner());

if (!owner)
{
return;
}

QAngle viewPunch;

viewPunch.x = SharedRandomFloat("jittepx", 0.25f, 0.5f);
viewPunch.y = SharedRandomFloat("jittepy", -0.6f, 0.6f);
viewPunch.z = 0;

owner->ViewPunch(viewPunch);
m_weaponSeeds = {
"jittepx",
"jittepy",
"jitterx",
"jittery",
};
}
2 changes: 0 additions & 2 deletions mp/src/game/shared/neo/weapons/weapon_jitte.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class CWeaponJitte : public CNEOBaseCombatWeapon

CWeaponJitte();

virtual void AddViewKick(void) OVERRIDE;

virtual NEO_WEP_BITS_UNDERLYING_TYPE GetNeoWepBits(void) const OVERRIDE { return NEO_WEP_JITTE; }
virtual int GetNeoWepXPCost(const int neoClass) const OVERRIDE { return 0; }

Expand Down
23 changes: 6 additions & 17 deletions mp/src/game/shared/neo/weapons/weapon_jittes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,11 @@ CWeaponJitteS::CWeaponJitteS()
m_flAccuracyPenalty = 0;

m_nNumShotsFired = 0;
}

void CWeaponJitteS::AddViewKick()
{
auto owner = ToBasePlayer(GetOwner());

if (!owner)
{
return;
}

QAngle viewPunch;

viewPunch.x = SharedRandomFloat("jittespx", 0.25f, 0.5f);
viewPunch.y = SharedRandomFloat("jittespy", -0.6f, 0.6f);
viewPunch.z = 0;

owner->ViewPunch(viewPunch);
m_weaponSeeds = {
"jittespx",
"jittespy",
"jittesrx",
"jittesry",
};
}
2 changes: 0 additions & 2 deletions mp/src/game/shared/neo/weapons/weapon_jittes.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class CWeaponJitteS : public CNEOBaseCombatWeapon

CWeaponJitteS();

virtual void AddViewKick(void) OVERRIDE;

virtual NEO_WEP_BITS_UNDERLYING_TYPE GetNeoWepBits(void) const OVERRIDE { return NEO_WEP_JITTE | NEO_WEP_SUPPRESSED; }
virtual int GetNeoWepXPCost(const int neoClass) const OVERRIDE { return 0; }

Expand Down
85 changes: 9 additions & 76 deletions mp/src/game/shared/neo/weapons/weapon_kyla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,83 +33,16 @@ CWeaponKyla::CWeaponKyla(void)
{
m_bReloadsSingly = false;
m_bFiresUnderwater = false;

m_weaponSeeds = {
"kylapx",
"kylapy",
"kylarx",
"kylary",
};
}

void CWeaponKyla::PrimaryAttack(void)
Activity CWeaponKyla::GetPrimaryAttackActivity()
{
if (ShootingIsPrevented())
{
return;
}

if (m_iClip1 == 0)
{
if (!m_bFireOnEmpty)
{
CheckReload();
}
else
{
DryFire();
}

return;
}

// Only the player fires this way so we can cast
CBasePlayer* pPlayer = ToBasePlayer(GetOwner());

if (!pPlayer)
{
return;
}
WeaponSound(SINGLE);
pPlayer->DoMuzzleFlash();

SendWeaponAnim(ACT_VM_PRIMARYATTACK);
pPlayer->SetAnimation(PLAYER_ATTACK1);

m_flNextPrimaryAttack = gpGlobals->curtime + GetFireRate();

m_iClip1--;

Vector vecSrc = pPlayer->Weapon_ShootPosition();
Vector vecAiming = pPlayer->GetAutoaimVector(AUTOAIM_5DEGREES);

FireBulletsInfo_t info(1, vecSrc, vecAiming, vec3_origin, MAX_TRACE_LENGTH, m_iPrimaryAmmoType);
info.m_pAttacker = pPlayer;

// Fire the bullets, and force the first shot to be perfectly accuracy
pPlayer->FireBullets(info);

// HL2 revolver does this view jerk, but it doesn't play nice with prediction.
// We could enable it with shared random vals and taking .z lean into account,
// but disabling entirely for now since the view punch seems sufficient.
#if(0)
#ifndef CLIENT_DLL
//Disorient the player
QAngle angles = pPlayer->GetLocalAngles();

angles.x += random->RandomInt(-1, 1);
angles.y += random->RandomInt(-1, 1);
angles.z = 0;

//pPlayer->SnapEyeAngles(angles);
#endif
#endif

const float punchIntensity = 1.0f;

pPlayer->ViewPunch(QAngle(
-punchIntensity,
SharedRandomFloat("kylaPunch", -punchIntensity, punchIntensity),
0));

if (!m_iClip1 && pPlayer->GetAmmoCount(m_iPrimaryAmmoType) <= 0)
{
// HEV suit - indicate out of ammo condition
pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}

m_flAccuracyPenalty = min(GetMaxAccuracyPenalty(), m_flAccuracyPenalty + GetAccuracyPenalty());
return ACT_VM_PRIMARYATTACK;
}
4 changes: 2 additions & 2 deletions mp/src/game/shared/neo/weapons/weapon_kyla.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ class CWeaponKyla : public CNEOBaseCombatWeapon

CWeaponKyla(void);

virtual void PrimaryAttack(void) OVERRIDE;

virtual NEO_WEP_BITS_UNDERLYING_TYPE GetNeoWepBits(void) const override { return NEO_WEP_KYLA; }
virtual int GetNeoWepXPCost(const int neoClass) const override { return 0; }

virtual float GetSpeedScale(void) const override { return 1.0; }

virtual Activity GetPrimaryAttackActivity(void) override;

protected:
virtual float GetFastestDryRefireTime() const OVERRIDE { return 0.2f; }

Expand Down
23 changes: 6 additions & 17 deletions mp/src/game/shared/neo/weapons/weapon_m41.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,11 @@ CWeaponM41::CWeaponM41()
m_flAccuracyPenalty = 0;

m_nNumShotsFired = 0;
}

void CWeaponM41::AddViewKick()
{
auto owner = ToBasePlayer(GetOwner());

if (!owner)
{
return;
}

QAngle viewPunch;

viewPunch.x = SharedRandomFloat("m41px", 0.25f, 0.5f);
viewPunch.y = SharedRandomFloat("m41py", -0.6f, 0.6f);
viewPunch.z = 0;

owner->ViewPunch(viewPunch);
m_weaponSeeds = {
"m41px",
"m41py",
"m41rx",
"m41ry",
};
}
2 changes: 0 additions & 2 deletions mp/src/game/shared/neo/weapons/weapon_m41.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class CWeaponM41 : public CNEOBaseCombatWeapon

CWeaponM41();

void AddViewKick(void) override;

virtual NEO_WEP_BITS_UNDERLYING_TYPE GetNeoWepBits(void) const override { return NEO_WEP_M41; }
virtual int GetNeoWepXPCost(const int neoClass) const override { return 0; }

Expand Down
23 changes: 6 additions & 17 deletions mp/src/game/shared/neo/weapons/weapon_m41l.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,11 @@ CWeaponM41L::CWeaponM41L()
m_flAccuracyPenalty = 0;

m_nNumShotsFired = 0;
}

void CWeaponM41L::AddViewKick()
{
auto owner = ToBasePlayer(GetOwner());

if (!owner)
{
return;
}

QAngle viewPunch;

viewPunch.x = SharedRandomFloat("m41lpx", 0.25f, 0.5f);
viewPunch.y = SharedRandomFloat("m41lpy", -0.6f, 0.6f);
viewPunch.z = 0;

owner->ViewPunch(viewPunch);
m_weaponSeeds = {
"m41lpx",
"m41lpy",
"m41lrx",
"m41lry",
};
}
2 changes: 0 additions & 2 deletions mp/src/game/shared/neo/weapons/weapon_m41l.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class CWeaponM41L : public CNEOBaseCombatWeapon

CWeaponM41L();

virtual void AddViewKick(void) OVERRIDE;

virtual NEO_WEP_BITS_UNDERLYING_TYPE GetNeoWepBits(void) const OVERRIDE { return NEO_WEP_M41_L; }
virtual int GetNeoWepXPCost(const int neoClass) const OVERRIDE { return 0; }

Expand Down
21 changes: 5 additions & 16 deletions mp/src/game/shared/neo/weapons/weapon_m41s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,11 @@ CWeaponM41S::CWeaponM41S()
m_flAccuracyPenalty = 0;

m_nNumShotsFired = 0;
}

void CWeaponM41S::AddViewKick()
{
auto pOwner = ToBasePlayer(GetOwner());

if (!pOwner)
{
return;
}

const QAngle viewPunch {
SharedRandomFloat("m41spx", 0.25f, 0.5f),
SharedRandomFloat("m41spy", -0.6f, 0.6f),
0.0f
m_weaponSeeds = {
"m41spx",
"m41spy",
"m41srx",
"m41sry",
};

pOwner->ViewPunch(viewPunch);
}
2 changes: 0 additions & 2 deletions mp/src/game/shared/neo/weapons/weapon_m41s.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class CWeaponM41S : public CNEOBaseCombatWeapon

CWeaponM41S();

virtual void AddViewKick(void) OVERRIDE;

virtual NEO_WEP_BITS_UNDERLYING_TYPE GetNeoWepBits(void) const OVERRIDE { return NEO_WEP_M41_S | NEO_WEP_SUPPRESSED; }
virtual int GetNeoWepXPCost(const int neoClass) const OVERRIDE { return 0; }

Expand Down
22 changes: 5 additions & 17 deletions mp/src/game/shared/neo/weapons/weapon_milso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,11 @@ CWeaponMilso::CWeaponMilso()
m_flAccuracyPenalty = 0.0f;

m_bFiresUnderwater = true;
}

void CWeaponMilso::AddViewKick(void)
{
CBasePlayer *pPlayer = ToBasePlayer(GetOwner());

if (!pPlayer)
{
return;
}

const QAngle viewPunch{
SharedRandomFloat("milsopax", 0.25f, 0.5f),
SharedRandomFloat("milsopay", -0.6f, 0.6f),
0.0f
m_weaponSeeds = {
"milsopx",
"milsopy",
"milsorx",
"milsory",
};

// Add it to the view punch
pPlayer->ViewPunch(viewPunch);
}
2 changes: 0 additions & 2 deletions mp/src/game/shared/neo/weapons/weapon_milso.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class CWeaponMilso : public CNEOBaseCombatWeapon

CWeaponMilso();

void AddViewKick(void) override;

virtual NEO_WEP_BITS_UNDERLYING_TYPE GetNeoWepBits(void) const override { return NEO_WEP_MILSO | NEO_WEP_SUPPRESSED; }
virtual int GetNeoWepXPCost(const int neoClass) const override { return 0; }

Expand Down
Loading

0 comments on commit b2291c5

Please sign in to comment.