Skip to content

Commit

Permalink
Shield constants code cleaning (#843)
Browse files Browse the repository at this point in the history
* Change constant name (SHIELDREN -> SHIELDGREN)

* Correct and separate constant names
  • Loading branch information
dystopm authored Jul 12, 2023
1 parent 8a18969 commit 11d6b08
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 32 deletions.
32 changes: 29 additions & 3 deletions regamedll/dlls/weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ enum usp_shield_e
USP_SHIELD_SHOOT_EMPTY,
USP_SHIELD_RELOAD,
USP_SHIELD_DRAW,
USP_SHIELD_UP_IDLE,
USP_SHIELD_IDLE_UP,
USP_SHIELD_UP,
USP_SHIELD_DOWN,
};
Expand Down Expand Up @@ -900,6 +900,19 @@ enum deagle_e
DEAGLE_DRAW,
};

enum deagle_shield_e
{
DEAGLE_SHIELD_IDLE1,
DEAGLE_SHIELD_SHOOT,
DEAGLE_SHIELD_SHOOT2,
DEAGLE_SHIELD_SHOOT_EMPTY,
DEAGLE_SHIELD_RELOAD,
DEAGLE_SHIELD_DRAW,
DEAGLE_SHIELD_IDLE_UP,
DEAGLE_SHIELD_UP,
DEAGLE_SHIELD_DOWN,
};

class CDEAGLE: public CBasePlayerWeapon
{
public:
Expand Down Expand Up @@ -1065,7 +1078,7 @@ enum glock18_shield_e
GLOCK18_SHIELD_SHOOT_EMPTY,
GLOCK18_SHIELD_RELOAD,
GLOCK18_SHIELD_DRAW,
GLOCK18_SHIELD_IDLE,
GLOCK18_SHIELD_IDLE_UP,
GLOCK18_SHIELD_UP,
GLOCK18_SHIELD_DOWN,
};
Expand Down Expand Up @@ -1180,7 +1193,7 @@ enum knife_shield_e
KNIFE_SHIELD_SLASH,
KNIFE_SHIELD_ATTACKHIT,
KNIFE_SHIELD_DRAW,
KNIFE_SHIELD_UPIDLE,
KNIFE_SHIELD_IDLE_UP,
KNIFE_SHIELD_UP,
KNIFE_SHIELD_DOWN,
};
Expand Down Expand Up @@ -1858,6 +1871,19 @@ enum fiveseven_e
FIVESEVEN_DRAW,
};

enum fiveseven_shield_e
{
FIVESEVEN_SHIELD_IDLE1,
FIVESEVEN_SHIELD_SHOOT,
FIVESEVEN_SHIELD_SHOOT2,
FIVESEVEN_SHIELD_SHOOT_EMPTY,
FIVESEVEN_SHIELD_RELOAD,
FIVESEVEN_SHIELD_DRAW,
FIVESEVEN_SHIELD_IDLE_UP,
FIVESEVEN_SHIELD_UP,
FIVESEVEN_SHIELD_DOWN,
};

class CFiveSeven: public CBasePlayerWeapon
{
public:
Expand Down
19 changes: 3 additions & 16 deletions regamedll/dlls/weapontype.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,25 +318,12 @@ enum AmmoBuyAmount
AMMO_SMOKEGRENADE_BUY = 1,
};

enum shieldgun_e
{
SHIELDGUN_IDLE,
SHIELDGUN_SHOOT1,
SHIELDGUN_SHOOT2,
SHIELDGUN_SHOOT_EMPTY,
SHIELDGUN_RELOAD,
SHIELDGUN_DRAW,
SHIELDGUN_DRAWN_IDLE,
SHIELDGUN_UP,
SHIELDGUN_DOWN,
};

// custom
enum shieldgren_e
{
SHIELDREN_IDLE = 4,
SHIELDREN_UP,
SHIELDREN_DOWN
SHIELDGREN_IDLE = 4, // 3 is last grenade viewmodel sequence
SHIELDGREN_UP,
SHIELDGREN_DOWN
};

enum InventorySlotType
Expand Down
4 changes: 2 additions & 2 deletions regamedll/dlls/wpn_shared/wpn_deagle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void CDEAGLE::PrimaryAttack()

void CDEAGLE::SecondaryAttack()
{
ShieldSecondaryFire(SHIELDGUN_UP, SHIELDGUN_DOWN);
ShieldSecondaryFire(DEAGLE_SHIELD_UP, DEAGLE_SHIELD_DOWN);
}

void CDEAGLE::DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseSemi)
Expand Down Expand Up @@ -204,7 +204,7 @@ void CDEAGLE::WeaponIdle()

if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(SHIELDGUN_DRAWN_IDLE, UseDecrement() != FALSE);
SendWeaponAnim(DEAGLE_SHIELD_IDLE_UP, UseDecrement() != FALSE);
}
}
}
4 changes: 2 additions & 2 deletions regamedll/dlls/wpn_shared/wpn_fiveseven.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void CFiveSeven::PrimaryAttack()

void CFiveSeven::SecondaryAttack()
{
ShieldSecondaryFire(SHIELDGUN_UP, SHIELDGUN_DOWN);
ShieldSecondaryFire(FIVESEVEN_SHIELD_UP, FIVESEVEN_SHIELD_DOWN);
}

void CFiveSeven::FiveSevenFire(float flSpread, float flCycleTime, BOOL fUseSemi)
Expand Down Expand Up @@ -208,7 +208,7 @@ void CFiveSeven::WeaponIdle()

if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(SHIELDGUN_DRAWN_IDLE, UseDecrement() != FALSE);
SendWeaponAnim(FIVESEVEN_SHIELD_IDLE_UP, UseDecrement() != FALSE);
}
}
else if (m_iClip)
Expand Down
4 changes: 2 additions & 2 deletions regamedll/dlls/wpn_shared/wpn_flashbang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ bool CFlashbang::ShieldSecondaryFire(int iUpAnim, int iDownAnim)

void CFlashbang::SecondaryAttack()
{
ShieldSecondaryFire(SHIELDGUN_DRAW, SHIELDGUN_DRAWN_IDLE);
ShieldSecondaryFire(SHIELDGREN_UP, SHIELDGREN_DOWN);
}

void CFlashbang::SetPlayerShieldAnim()
Expand Down Expand Up @@ -236,7 +236,7 @@ void CFlashbang::WeaponIdle()

if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);
SendWeaponAnim(SHIELDGREN_IDLE, UseDecrement() != FALSE);
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_glock18.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ void CGLOCK18::WeaponIdle()

if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(GLOCK18_SHIELD_IDLE, UseDecrement() != FALSE);
SendWeaponAnim(GLOCK18_SHIELD_IDLE_UP, UseDecrement() != FALSE);
}
}
// only idle if the slid isn't back
Expand Down
4 changes: 2 additions & 2 deletions regamedll/dlls/wpn_shared/wpn_hegrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ bool CHEGrenade::ShieldSecondaryFire(int iUpAnim, int iDownAnim)

void CHEGrenade::SecondaryAttack()
{
ShieldSecondaryFire(SHIELDGUN_DRAW, SHIELDGUN_DRAWN_IDLE);
ShieldSecondaryFire(SHIELDGREN_UP, SHIELDGREN_DOWN);
}

void CHEGrenade::SetPlayerShieldAnim()
Expand Down Expand Up @@ -247,7 +247,7 @@ void CHEGrenade::WeaponIdle()

if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);
SendWeaponAnim(SHIELDGREN_IDLE, UseDecrement() != FALSE);
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_p228.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void CP228::PrimaryAttack()

void CP228::SecondaryAttack()
{
ShieldSecondaryFire(SHIELDGUN_UP, SHIELDGUN_DOWN);
ShieldSecondaryFire(P228_SHIELD_UP, P228_SHIELD_DOWN);
}

void CP228::P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi)
Expand Down
4 changes: 2 additions & 2 deletions regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ bool CSmokeGrenade::ShieldSecondaryFire(int iUpAnim, int iDownAnim)

void CSmokeGrenade::SecondaryAttack()
{
ShieldSecondaryFire(SHIELDGUN_DRAW, SHIELDGUN_DRAWN_IDLE);
ShieldSecondaryFire(SHIELDGREN_UP, SHIELDGREN_DOWN);
}

void CSmokeGrenade::SetPlayerShieldAnim()
Expand Down Expand Up @@ -251,7 +251,7 @@ void CSmokeGrenade::WeaponIdle()

if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);
SendWeaponAnim(SHIELDGREN_IDLE, UseDecrement() != FALSE);
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_usp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void CUSP::WeaponIdle()

if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(USP_DRAW, UseDecrement());
SendWeaponAnim(USP_SHIELD_IDLE_UP, UseDecrement());
}
}
else if (m_iClip)
Expand Down

0 comments on commit 11d6b08

Please sign in to comment.