Skip to content

Commit

Permalink
CL: Add weapon for One In the Chamber gamemode
Browse files Browse the repository at this point in the history
  • Loading branch information
sabianroberts committed Aug 29, 2024
1 parent 55773ec commit c4100fb
Show file tree
Hide file tree
Showing 5 changed files with 361 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cl_dll/hl/hl_weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ int giOldWeapons = 0;

// HLDM Weapon placeholder entities.
CGlock g_Glock;
COne g_One;
CCrowbar g_Crowbar;
CPython g_Python;
CMP5 g_Mp5;
Expand Down Expand Up @@ -653,6 +654,7 @@ void HUD_InitClientWeapons( void )

// Allocate slot(s) for each weapon that we are going to be predicting
HUD_PrepEntity( &g_Glock , &player );
HUD_PrepEntity(&g_One, &player);
HUD_PrepEntity( &g_Crowbar , &player );
HUD_PrepEntity( &g_Python , &player );
HUD_PrepEntity( &g_Mp5 , &player );
Expand Down Expand Up @@ -720,6 +722,7 @@ CBasePlayerWeapon* GetLocalWeapon(int id)
{
case WEAPON_CROWBAR: return &g_Crowbar;
case WEAPON_GLOCK: return &g_Glock;
case WEAPON_ONE: return &g_One;
case WEAPON_PYTHON: return &g_Python;
case WEAPON_MP5: return &g_Mp5;
case WEAPON_CROSSBOW: return &g_Crossbow;
Expand Down
36 changes: 36 additions & 0 deletions cl_dll/weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class CGrenade : public CBaseMonster
#define WEAPON_SNIPERRIFLE 24
#define WEAPON_KNIFE 25
#define WEAPON_PENGUIN 26
#define WEAPON_ONE 27

#define WEAPON_ALLWEAPONS (~(1<<WEAPON_SUIT))

Expand Down Expand Up @@ -150,12 +151,14 @@ class CGrenade : public CBaseMonster
#define M249_MAX_CARRY 200
#define PENGUIN_MAX_CARRY 9
#define SNIPERRIFLE_MAX_CARRY 15
#define ONE_MAX_CARRY 1

// the maximum amount of ammo each weapon's clip can hold
#define WEAPON_NOCLIP -1

//#define CROWBAR_MAX_CLIP WEAPON_NOCLIP
#define GLOCK_MAX_CLIP 18
#define ONE_MAX_CLIP WEAPON_NOCLIP
#define PYTHON_MAX_CLIP 6
#define MP5_MAX_CLIP 60
#define MP5_DEFAULT_AMMO 60
Expand All @@ -179,6 +182,7 @@ class CGrenade : public CBaseMonster

// the default amount of ammo that comes with each gun when it spawns
#define GLOCK_DEFAULT_GIVE 18
#define ONE_DEFAULT_GIVE 1
#define PYTHON_DEFAULT_GIVE 6
#define MP5_DEFAULT_GIVE 60
#define MP5_DEFAULT_AMMO 60
Expand Down Expand Up @@ -561,6 +565,38 @@ class CGlock : public CBasePlayerWeapon
unsigned short m_usFireGlock2;
};

class COne : public CBasePlayerWeapon
{
public:
void Spawn(void);
void Precache(void);
int iItemSlot(void) { return 2; }
int GetItemInfo(ItemInfo* p);

void PrimaryAttack(void);
void SecondaryAttack(void);
void GlockFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);
BOOL Deploy(void);
void Reload(void);
void WeaponIdle(void);

virtual BOOL UseDecrement(void)
{
#if defined( CLIENT_WEAPONS )
return TRUE;
#else
return FALSE;
#endif
}

private:
int m_iShell;


unsigned short m_usFireGlock1;
unsigned short m_usFireGlock2;
};


class CCrowbar : public CBasePlayerWeapon
{
Expand Down
36 changes: 36 additions & 0 deletions dlls/weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class CGrenade : public CBaseMonster
#define WEAPON_SNIPERRIFLE 24
#define WEAPON_KNIFE 25
#define WEAPON_PENGUIN 26
#define WEAPON_ONE 27

#define WEAPON_ALLWEAPONS (~(1<<WEAPON_SUIT))

Expand Down Expand Up @@ -150,12 +151,14 @@ class CGrenade : public CBaseMonster
#define M249_MAX_CARRY 200
#define PENGUIN_MAX_CARRY 9
#define SNIPERRIFLE_MAX_CARRY 15
#define ONE_MAX_CARRY 1

// the maximum amount of ammo each weapon's clip can hold
#define WEAPON_NOCLIP -1

//#define CROWBAR_MAX_CLIP WEAPON_NOCLIP
#define GLOCK_MAX_CLIP 18
#define ONE_MAX_CLIP WEAPON_NOCLIP
#define PYTHON_MAX_CLIP 6
#define MP5_MAX_CLIP 60
#define MP5_DEFAULT_AMMO 60
Expand All @@ -179,6 +182,7 @@ class CGrenade : public CBaseMonster

// the default amount of ammo that comes with each gun when it spawns
#define GLOCK_DEFAULT_GIVE 18
#define ONE_DEFAULT_GIVE 1
#define PYTHON_DEFAULT_GIVE 6
#define MP5_DEFAULT_GIVE 60
#define MP5_DEFAULT_AMMO 60
Expand Down Expand Up @@ -561,6 +565,38 @@ class CGlock : public CBasePlayerWeapon
unsigned short m_usFireGlock2;
};

class COne : public CBasePlayerWeapon
{
public:
void Spawn(void);
void Precache(void);
int iItemSlot(void) { return 2; }
int GetItemInfo(ItemInfo* p);

void PrimaryAttack(void);
void SecondaryAttack(void);
void GlockFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);
BOOL Deploy(void);
void Reload(void);
void WeaponIdle(void);

virtual BOOL UseDecrement(void)
{
#if defined( CLIENT_WEAPONS )
return TRUE;
#else
return FALSE;
#endif
}

private:
int m_iShell;


unsigned short m_usFireGlock1;
unsigned short m_usFireGlock2;
};


class CCrowbar : public CBasePlayerWeapon
{
Expand Down
3 changes: 2 additions & 1 deletion dlls/wpn_shared/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
add_sources(
hl_wpn_glock.cpp)
hl_wpn_glock.cpp
oitc.cpp)
Loading

0 comments on commit c4100fb

Please sign in to comment.