From a8d0d70fdf06f5bcab2741188131b66d1ced13a2 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Sun, 5 Nov 2017 21:36:04 +0500 Subject: [PATCH] Add weapon_silencer, weapon_bloodly_9mmAR and weapon_bloodly_shotgun implementations. --- dlls/glock.cpp | 11 +++++++++-- dlls/mp5.cpp | 11 +++++++++-- dlls/shotgun.cpp | 11 +++++++++-- dlls/weapons.cpp | 3 +++ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/dlls/glock.cpp b/dlls/glock.cpp index 1150d8b9..836149ee 100644 --- a/dlls/glock.cpp +++ b/dlls/glock.cpp @@ -236,13 +236,19 @@ class CGlockAmmo : public CBasePlayerAmmo void Spawn( void ) { Precache(); - SET_MODEL( ENT( pev ), "models/w_9mmclip.mdl" ); + if( FClassnameIs( pev, "weapon_silencer" ) ) + SET_MODEL( ENT( pev ), "models/w_silencer.mdl" ); + else + SET_MODEL( ENT( pev ), "models/w_9mmclip.mdl" ); CBasePlayerAmmo::Spawn(); } void Precache( void ) { - PRECACHE_MODEL( "models/w_9mmclip.mdl" ); + if( FClassnameIs( pev, "weapon_silencer" ) ) + PRECACHE_MODEL( "models/w_silencer.mdl" ); + else + PRECACHE_MODEL( "models/w_9mmclip.mdl" ); PRECACHE_SOUND( "items/9mmclip1.wav" ); } @@ -257,5 +263,6 @@ class CGlockAmmo : public CBasePlayerAmmo } }; +LINK_ENTITY_TO_CLASS( weapon_silencer, CGlockAmmo ) LINK_ENTITY_TO_CLASS( ammo_glockclip, CGlockAmmo ) LINK_ENTITY_TO_CLASS( ammo_9mmclip, CGlockAmmo ) diff --git a/dlls/mp5.cpp b/dlls/mp5.cpp index 403efa04..62abe043 100644 --- a/dlls/mp5.cpp +++ b/dlls/mp5.cpp @@ -281,12 +281,18 @@ class CMP5AmmoClip : public CBasePlayerAmmo void Spawn( void ) { Precache(); - SET_MODEL( ENT( pev ), "models/w_9mmARclip.mdl" ); + if( FClassnameIs( pev, "weapon_bloodly_9mmAR" ) ) + SET_MODEL( ENT( pev ), "models/w_bloodly_9mmAR.mdl" ); + else + SET_MODEL( ENT( pev ), "models/w_9mmARclip.mdl" ); CBasePlayerAmmo::Spawn(); } void Precache( void ) { - PRECACHE_MODEL( "models/w_9mmARclip.mdl" ); + if( FClassnameIs( pev, "weapon_bloodly_9mmAR" ) ) + PRECACHE_MODEL( "models/w_bloodly_9mmAR.mdl" ); + else + PRECACHE_MODEL( "models/w_9mmARclip.mdl" ); PRECACHE_SOUND( "items/9mmclip1.wav" ); } BOOL AddAmmo( CBaseEntity *pOther ) @@ -300,6 +306,7 @@ class CMP5AmmoClip : public CBasePlayerAmmo } }; +LINK_ENTITY_TO_CLASS( weapon_bloodly_9mmAR, CMP5AmmoClip ) LINK_ENTITY_TO_CLASS( ammo_mp5clip, CMP5AmmoClip ) LINK_ENTITY_TO_CLASS( ammo_9mmAR, CMP5AmmoClip ) diff --git a/dlls/shotgun.cpp b/dlls/shotgun.cpp index a08770b3..224e96d5 100644 --- a/dlls/shotgun.cpp +++ b/dlls/shotgun.cpp @@ -370,12 +370,18 @@ class CShotgunAmmo : public CBasePlayerAmmo void Spawn( void ) { Precache(); - SET_MODEL( ENT( pev ), "models/w_shotbox.mdl" ); + if( FClassnameIs( pev, "weapon_bloodly_9mmAR" ) ) + SET_MODEL( ENT( pev ), "models/w_bloodly_shotgun.mdl" ); + else + SET_MODEL( ENT( pev ), "models/w_shotbox.mdl" ); CBasePlayerAmmo::Spawn(); } void Precache( void ) { - PRECACHE_MODEL( "models/w_shotbox.mdl" ); + if( FClassnameIs( pev, "weapon_bloodly_9mmAR" ) ) + PRECACHE_MODEL( "models/w_bloodly_shotgun.mdl" ); + else + PRECACHE_MODEL( "models/w_shotbox.mdl" ); PRECACHE_SOUND( "items/9mmclip1.wav" ); } BOOL AddAmmo( CBaseEntity *pOther ) @@ -389,4 +395,5 @@ class CShotgunAmmo : public CBasePlayerAmmo } }; +LINK_ENTITY_TO_CLASS( weapon_bloodly_shotgun, CShotgunAmmo ) LINK_ENTITY_TO_CLASS( ammo_buckshot, CShotgunAmmo ) diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 80a45284..1a33bf32 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -304,6 +304,7 @@ void W_Precache( void ) // shotgun UTIL_PrecacheOtherWeapon( "weapon_shotgun" ); UTIL_PrecacheOther( "ammo_buckshot" ); + UTIL_PrecacheOther( "weapon_bloodly_shotgun" ); // crowbar UTIL_PrecacheOtherWeapon( "weapon_crowbar" ); @@ -311,11 +312,13 @@ void W_Precache( void ) // glock UTIL_PrecacheOtherWeapon( "weapon_9mmhandgun" ); UTIL_PrecacheOther( "ammo_9mmclip" ); + UTIL_PrecacheOther( "weapon_silencer" ); // mp5 UTIL_PrecacheOtherWeapon( "weapon_9mmAR" ); UTIL_PrecacheOther( "ammo_9mmAR" ); UTIL_PrecacheOther( "ammo_ARgrenades" ); + UTIL_PrecacheOther( "weapon_bloodly_9mmAR" ); // 9mm ammo box UTIL_PrecacheOther( "ammo_9mmbox" );