Importing CSS Weapons Into HL2: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(Rewrite Template:Lang to Template:LanguageBar. This action was performed by a bot.)
 
(18 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{cleanup}} {{tutpov}}
{{LanguageBar|Importing_CSS_Weapons_Into_HL2}}
{{cleanup}}{{pov}}


Update 9th Jan 14: Okay so I wrote this original monstrosity nearly 10 years ago (holy hell) and it is now very much so out of date and horribly untidy, I've gone through and removed anything that is no longer useful and had a general tidy up. This now conforms with the latest 2013 SDK.
{{tip|The source code for a {{mapbase|4}} mod that achieves this is also available.}}
'''Update 9th Jan 14:''' Okay so I wrote this original monstrosity nearly 9 years ago (holy hell) and it was very much out of date and untidy, I've gone through and removed anything that is no longer useful and had a general tidy up. This now conforms with the latest 2013 SDK.


-------------------------------------------
== Requirements ==
'''SECTION 1 - MODEL EDITING'''
-------------------------------------------


EDIT: SNIPPED THIS SECTION OUT (The 2013 SDK will work with any existing CSS model without model editing, just a little bit of coding is required to remove one or two bugs)
*A Source mod running on {{src13|3.1}} (or {{src07|3.1}})
*Knowledge of C++


-------------------------------------------
= Model Editing =
'''SECTION 2 - FINE TUNING THE MODEL'''
-------------------------------------------


Once you have your v_model.mdl and w_model.mdl set up you will need to assign the models to a weapon using its weapon script file. Locate your new weapons script file eg. weapon_357.txt inside the 'scripts' folder (C:\Program Files\Steam\SteamApps\sourcemods\MODNAME\scripts).
{{Note|If your mod is based on the 2013 SDK, CSS model models will work out of the box without any model editing, just a little bit of coding is required to remove/fix the things in the other sections.}}
 
= Fine-Tuning the Model =
 
Once you have both your v_ and w_ models set up you will need to assign the models to a weapon using its weapon script file. Locate your new weapons script file (e.g. {{file|weapon_357|txt}}) inside your mod's {{file|scripts/}} folder.


Now to fix the issue of CSS weapons only displaying on the left side of the screen we can do the following.
Now to fix the issue of CSS weapons only displaying on the left side of the screen we can do the following.


Inside the weapon script file, add these two lines:  
Inside the weapon script file, add these two lines:
<code>
<pre>
"BuiltRightHanded" "0"  
"BuiltRightHanded" "0"
"AllowFlipping" "1"
"AllowFlipping"   "1"
</code>
</pre>
This will send information to the client regarding cl_righthand command, which we will enable next; go to your Mods Src folder (C:\MODNAME\src\cl_dll) and open 'c_baseviewmodel.cpp' and scroll down to line 25 and find the line that looks like this:
 
<code>
This will send information to the Client regarding the {{command|cl_righthand}} command, which we will enable next.
#ifdef CSTRIKE_DLL
 
ConVar cl_righthand( "cl_righthand", "1", FCVAR_ARCHIVE, "Use right-handed view models." );
In {{file|c_baseviewmodel|cpp}}, at around line 30, find the line that looks like this and simply comment out the <code>#ifdef</code> block like so:
#endif 
<source lang=cpp highlight=1,3>
</code>
//#ifdef CSTRIKE_DLL  
And simply comment out the top and bottom lines like so:  
ConVar cl_righthand( "cl_righthand", "1", FCVAR_ARCHIVE, "Use right-handed view models." );  
<code>
//#endif   
// #ifdef CSTRIKE_DLL  
</source>
ConVar cl_righthand( "cl_righthand", "1", FCVAR_ARCHIVE, "Use right-handed view models." );  
 
// #endif   
Then, go to line 173 and comment out these lines as follows:
</code>
<source lang=cpp highlight=1,9>
And go to line 173 and comment out these lines as follows:
//#ifdef CSTRIKE_DLL
<code>
// If cl_righthand is set, then we want them all right-handed.
// #ifdef CSTRIKE_DLL
CBaseCombatWeapon *pWeapon = m_hWeapon.Get();
// If cl_righthand is set, then we want them all right-handed.
if ( pWeapon )
CBaseCombatWeapon *pWeapon = m_hWeapon.Get();
{
if ( pWeapon )
const FileWeaponInfo_t *pInfo = &pWeapon->GetWpnData();
{
return pInfo->m_bAllowFlipping && pInfo->m_bBuiltRightHanded != cl_righthand.GetBool();
const FileWeaponInfo_t *pInfo = &pWeapon->GetWpnData();
}
return pInfo->m_bAllowFlipping && pInfo->m_bBuiltRightHanded != cl_righthand.GetBool();
//#endif
}
</source>
// #endif
This will enable the <code>cl_righthand</code> ConVar to be activated and your weapon model will not display on the wrong side of the screen. Now just save and compile.
</code>
 
This will enable the cl_righthand cvar to be activated and your weapon model will no display on the correct side of the screen. Now just save and compile.
= Particle Muzzle Flashes =
 
If you aren't using particle muzzle flashes (which you really should be, they're very pretty!) you may have some issues with the old-style muzzle flashes when using CSS weapons. In that case, you can use the fix below.
 
In {{file|c_baseanimating|cpp}}, inside the <code>FireObsoleteEvent( ... )</code> function at around line 4197 (after the big switch statement), comment out the following marked code and insert this new piece of code (also marked) like so:
<source lang=cpp highlight=3,8,10-22>
if ( iAttachment != -1 && m_Attachments.Count() > iAttachment )
{
/*
GetAttachment( iAttachment+1, attachOrigin, attachAngles );
int entId = render->GetViewEntity();
ClientEntityHandle_t hEntity = ClientEntityList().EntIndexToHandle( entId );
tempents->MuzzleFlash( attachOrigin, attachAngles, atoi( options ), hEntity, bFirstPerson );
*/
 
if ( input->CAM_IsThirdPerson() )
{
C_BaseCombatWeapon *pWeapon = GetActiveWeapon();
pWeapon->GetAttachment( iAttachment+1, attachOrigin, attachAngles );
}
else
{
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
CBaseViewModel *vm = pPlayer->GetViewModel();
vm->GetAttachment( iAttachment+1, attachOrigin, attachAngles );
engine->GetViewAngles( attachAngles );
}
g_pEffects->MuzzleFlash( attachOrigin, attachAngles, 1.0, MUZZLEFLASH_TYPE_DEFAULT );
}
</source>
 
Go to {{file|fx|cpp}}, under the statement <code>pParticle->m_vecVelocity.Init();</code> in <code>FX_MuzzleEffect</code>, place the following code:
<source lang=cpp>
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
Vector velocity = pPlayer->GetLocalVelocity();
pParticle->m_vecVelocity += velocity;
</source>
 
= Recoil Animation Fix =
 
Ever seen the CSS recoil animation choking up while shooting at a high fire rate? This is how to fix that.
 
Open up the weapon(s) that use a CSS viewmodel (e.g. {{file|weapon_pistol|cpp}}). Then scroll down to the <code>GetPrimaryAttackActivity( void )</code> function and replace everything inside of it with the following:
<source lang=cpp>
return ACT_VM_PRIMARYATTACK;
</source>
 
= Shell Casing Ejection =
 
You'll probably notice that your newly imported CSS weapons don't eject any shell casings like your stock HL2 weapons, so let's fix that.
 
In your Client project {{file|src/game/client/}} add a new file called {{file|fx_cs_weaponfx|cpp}} and paste the following into it:
<source lang=cpp>
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Game-specific impact effect hooks
//
//=============================================================================//
 
#include "cbase.h"
#include "fx_impact.h"
#include "tempent.h"
#include "c_te_effect_dispatch.h"
#include "c_te_legacytempents.h"
 
//-----------------------------------------------------------------------------
// Purpose: Handle weapon effect callbacks
//-----------------------------------------------------------------------------
void CStrike_EjectBrass( int shell, const CEffectData &data )
{
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
 
if ( !pPlayer )
return;
 
tempents->CSEjectBrass( data.m_vOrigin, data.m_vAngles, data.m_fFlags, shell, pPlayer );
}
 
void CStrike_FX_EjectBrass_9mm_Callback( const CEffectData &data )
{
CStrike_EjectBrass( CS_SHELL_9MM, data );
}
 
void CStrike_FX_EjectBrass_57_Callback( const CEffectData &data )
{
CStrike_EjectBrass( CS_SHELL_57, data );
}
 
void CStrike_FX_EjectBrass_12Gauge_Callback( const CEffectData &data )
{
CStrike_EjectBrass( CS_SHELL_12GAUGE, data );
}
 
void CStrike_FX_EjectBrass_556_Callback( const CEffectData &data )
{
CStrike_EjectBrass( CS_SHELL_556, data );
}
 
void CStrike_FX_EjectBrass_762Nato_Callback( const CEffectData &data )
{
CStrike_EjectBrass( CS_SHELL_762NATO, data );
}
 
void CStrike_FX_EjectBrass_338Mag_Callback( const CEffectData &data )
{
CStrike_EjectBrass( CS_SHELL_338MAG, data );
}
 
DECLARE_CLIENT_EFFECT( "EjectBrass_9mm", CStrike_FX_EjectBrass_9mm_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_12Gauge", CStrike_FX_EjectBrass_12Gauge_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_57", CStrike_FX_EjectBrass_57_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_556", CStrike_FX_EjectBrass_556_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_762Nato", CStrike_FX_EjectBrass_762Nato_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_338Mag", CStrike_FX_EjectBrass_338Mag_Callback );
</source>
 
Now head over to '''c_te_legacytempents.h''' and you'll find two instances of this block <code>#if defined( CSTRIKE_DLL ) || defined( SDK_DLL )</code>, and all you have to do is comment them out like so:
<source lang=cpp highlight=1,11,15,22>
//#if defined( CSTRIKE_DLL ) || defined( SDK_DLL )
enum
{
CS_SHELL_9MM = 0,
CS_SHELL_57,
CS_SHELL_12GAUGE,
CS_SHELL_556,
CS_SHELL_762NATO,
CS_SHELL_338MAG
};
//#endif
 
...
 
//#if defined( CSTRIKE_DLL ) || defined ( SDK_DLL )
struct model_t *m_pCS_9MMShell;
struct model_t *m_pCS_57Shell;
struct model_t *m_pCS_12GaugeShell;
struct model_t *m_pCS_556Shell;
struct model_t *m_pCS_762NATOShell;
struct model_t *m_pCS_338MAGShell;
//#endif
</source>
 
And finally, head over to '''c_te_legacytempents.cpp''' where we'll comment out five more <code>#ifdef</code> blocks.
 
The first block will be in the <code>C_LocalTempEntity</code> constructor:
<source lang=cpp highlight=1,7>
//#if defined( CSTRIKE_DLL ) || defined (SDK_DLL )
 
#define TE_RIFLE_SHELL 1024
#define TE_PISTOL_SHELL 2048
#define TE_SHOTGUN_SHELL 4096
 
//#endif
</source>
 
The second one will be in the <code>PlaySound ( C_LocalTempEntity *pTemp, float damp )</code> function:
<source lang=cpp highlight=1,20>
//#ifdef CSTRIKE_DLL
 
case TE_PISTOL_SHELL:
{
soundname = "Bounce.PistolShell";
}
break;
 
case TE_RIFLE_SHELL:
{
soundname = "Bounce.RifleShell";
}
break;
 
case TE_SHOTGUN_SHELL:
{
soundname = "Bounce.ShotgunShell";
}
break;
//#endif
</source>
 
The third one will be in the <code>LevelInit()</code> function:
<source lang=cpp hightlight=1,8>
//#if defined( CSTRIKE_DLL ) || defined ( SDK_DLL )
m_pCS_9MMShell = (model_t *)engine->LoadModel( "models/Shells/shell_9mm.mdl" );
m_pCS_57Shell = (model_t *)engine->LoadModel( "models/Shells/shell_57.mdl" );
m_pCS_12GaugeShell = (model_t *)engine->LoadModel( "models/Shells/shell_12gauge.mdl" );
m_pCS_556Shell = (model_t *)engine->LoadModel( "models/Shells/shell_556.mdl" );
m_pCS_762NATOShell = (model_t *)engine->LoadModel( "models/Shells/shell_762nato.mdl" );
m_pCS_338MAGShell = (model_t *)engine->LoadModel( "models/Shells/shell_338mag.mdl" );
//#endif
</source>
 
The fourth one will be in the <code>Init (void)</code> function, right below the last one:
<source lang=cpp highlight=1,8>
//#if defined( CSTRIKE_DLL ) || defined ( SDK_DLL )
m_pCS_9MMShell = NULL;
m_pCS_57Shell = NULL;
m_pCS_12GaugeShell = NULL;
m_pCS_556Shell = NULL;
m_pCS_762NATOShell = NULL;
m_pCS_338MAGShell = NULL;
//#endif
</source>


-------------------------------------------
And the last one will be in the <code>CSEjectBrass( ... )</code> function, at the bottom of the file:
'''SECTION 3 - OPTIONAL TWEAKS'''
<source lang=cpp highlight=1,31>
-------------------------------------------
//#if defined ( CSTRIKE_DLL ) || defined ( SDK_DLL )


If you aren't using particle muzzle flashes (which you really should be, they're very pretty!) you may have some issues with the old style muzzle flashes when using CSS weapons. In that case there is a fix in the Snippets section of the Programming page on the VDC Wiki.
switch( shellType )
{
default:
case CS_SHELL_9MM:
hitsound = TE_PISTOL_SHELL;
pModel = m_pCS_9MMShell;
break;
case CS_SHELL_57:
hitsound = TE_PISTOL_SHELL;
pModel = m_pCS_57Shell;
break;
case CS_SHELL_12GAUGE:
hitsound = TE_SHOTGUN_SHELL;
pModel = m_pCS_12GaugeShell;
break;
case CS_SHELL_556:
hitsound = TE_RIFLE_SHELL;
pModel = m_pCS_556Shell;
break;
case CS_SHELL_762NATO:
hitsound = TE_RIFLE_SHELL;
pModel = m_pCS_762NATOShell;
break;
case CS_SHELL_338MAG:
hitsound = TE_RIFLE_SHELL;
pModel = m_pCS_338MAGShell;
break;
}
//#endif
</source>


Enjoy!
= Conclusion =


Ferrety (ferrety6012@gmail.com)
And that's it for now, enjoy!


[[Category:Tutorials]]
[[Category:Tutorials]]

Latest revision as of 17:25, 18 July 2025

English (en)Русский (ru)Translate (Translate)
Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.
Broom icon.png
This article or section should be converted to third person to conform to wiki standards.
Tip.pngTip:The source code for a Mapbase Mapbase mod that achieves this is also available.

Update 9th Jan 14: Okay so I wrote this original monstrosity nearly 9 years ago (holy hell) and it was very much out of date and untidy, I've gone through and removed anything that is no longer useful and had a general tidy up. This now conforms with the latest 2013 SDK.

Requirements

Model Editing

Note.pngNote:If your mod is based on the 2013 SDK, CSS model models will work out of the box without any model editing, just a little bit of coding is required to remove/fix the things in the other sections.

Fine-Tuning the Model

Once you have both your v_ and w_ models set up you will need to assign the models to a weapon using its weapon script file. Locate your new weapons script file (e.g. 🖿weapon_357.txt) inside your mod's 🖿scripts/ folder.

Now to fix the issue of CSS weapons only displaying on the left side of the screen we can do the following.

Inside the weapon script file, add these two lines:

"BuiltRightHanded" "0"
"AllowFlipping"    "1"

This will send information to the Client regarding the cl_righthand command, which we will enable next.

In 🖿c_baseviewmodel.cpp, at around line 30, find the line that looks like this and simply comment out the #ifdef block like so:

//#ifdef CSTRIKE_DLL 
ConVar cl_righthand( "cl_righthand", "1", FCVAR_ARCHIVE, "Use right-handed view models." ); 
//#endif

Then, go to line 173 and comment out these lines as follows:

//#ifdef CSTRIKE_DLL
	// If cl_righthand is set, then we want them all right-handed.
	CBaseCombatWeapon *pWeapon = m_hWeapon.Get();
	if ( pWeapon )
	{
		const FileWeaponInfo_t *pInfo = &pWeapon->GetWpnData();
		return pInfo->m_bAllowFlipping && pInfo->m_bBuiltRightHanded != cl_righthand.GetBool();
	}
//#endif

This will enable the cl_righthand ConVar to be activated and your weapon model will not display on the wrong side of the screen. Now just save and compile.

Particle Muzzle Flashes

If you aren't using particle muzzle flashes (which you really should be, they're very pretty!) you may have some issues with the old-style muzzle flashes when using CSS weapons. In that case, you can use the fix below.

In 🖿c_baseanimating.cpp, inside the FireObsoleteEvent( ... ) function at around line 4197 (after the big switch statement), comment out the following marked code and insert this new piece of code (also marked) like so:

			if ( iAttachment != -1 && m_Attachments.Count() > iAttachment )
			{
				/*
				GetAttachment( iAttachment+1, attachOrigin, attachAngles );
				int entId = render->GetViewEntity();
				ClientEntityHandle_t hEntity = ClientEntityList().EntIndexToHandle( entId );
				tempents->MuzzleFlash( attachOrigin, attachAngles, atoi( options ), hEntity, bFirstPerson );
				*/

				if ( input->CAM_IsThirdPerson() )
				{
					C_BaseCombatWeapon *pWeapon = GetActiveWeapon();
					pWeapon->GetAttachment( iAttachment+1, attachOrigin, attachAngles );
				}
				else
				{
					C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
					CBaseViewModel *vm = pPlayer->GetViewModel();
					vm->GetAttachment( iAttachment+1, attachOrigin, attachAngles );
					engine->GetViewAngles( attachAngles );
				}
				g_pEffects->MuzzleFlash( attachOrigin, attachAngles, 1.0, MUZZLEFLASH_TYPE_DEFAULT );
			}

Go to 🖿fx.cpp, under the statement pParticle->m_vecVelocity.Init(); in FX_MuzzleEffect, place the following code:

		C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
		Vector velocity = pPlayer->GetLocalVelocity();
		pParticle->m_vecVelocity += velocity;

Recoil Animation Fix

Ever seen the CSS recoil animation choking up while shooting at a high fire rate? This is how to fix that.

Open up the weapon(s) that use a CSS viewmodel (e.g. 🖿weapon_pistol.cpp). Then scroll down to the GetPrimaryAttackActivity( void ) function and replace everything inside of it with the following:

return ACT_VM_PRIMARYATTACK;

Shell Casing Ejection

You'll probably notice that your newly imported CSS weapons don't eject any shell casings like your stock HL2 weapons, so let's fix that.

In your Client project 🖿src/game/client/ add a new file called 🖿fx_cs_weaponfx.cpp and paste the following into it:

//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Game-specific impact effect hooks
//
//=============================================================================//

#include "cbase.h"
#include "fx_impact.h"
#include "tempent.h"
#include "c_te_effect_dispatch.h"
#include "c_te_legacytempents.h"

//-----------------------------------------------------------------------------
// Purpose: Handle weapon effect callbacks
//-----------------------------------------------------------------------------
void CStrike_EjectBrass( int shell, const CEffectData &data )
{
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();

	if ( !pPlayer )
		return;

	tempents->CSEjectBrass( data.m_vOrigin, data.m_vAngles, data.m_fFlags, shell, pPlayer );
}

void CStrike_FX_EjectBrass_9mm_Callback( const CEffectData &data )
{
	CStrike_EjectBrass( CS_SHELL_9MM, data );
}

void CStrike_FX_EjectBrass_57_Callback( const CEffectData &data )
{
	CStrike_EjectBrass( CS_SHELL_57, data );
}

void CStrike_FX_EjectBrass_12Gauge_Callback( const CEffectData &data )
{
	CStrike_EjectBrass( CS_SHELL_12GAUGE, data );
}

void CStrike_FX_EjectBrass_556_Callback( const CEffectData &data )
{
	CStrike_EjectBrass( CS_SHELL_556, data );
}

void CStrike_FX_EjectBrass_762Nato_Callback( const CEffectData &data )
{
	CStrike_EjectBrass( CS_SHELL_762NATO, data );
}

void CStrike_FX_EjectBrass_338Mag_Callback( const CEffectData &data )
{
	CStrike_EjectBrass( CS_SHELL_338MAG, data );
}

DECLARE_CLIENT_EFFECT( "EjectBrass_9mm",		CStrike_FX_EjectBrass_9mm_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_12Gauge",	CStrike_FX_EjectBrass_12Gauge_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_57",			CStrike_FX_EjectBrass_57_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_556",		CStrike_FX_EjectBrass_556_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_762Nato",	CStrike_FX_EjectBrass_762Nato_Callback );
DECLARE_CLIENT_EFFECT( "EjectBrass_338Mag",		CStrike_FX_EjectBrass_338Mag_Callback );

Now head over to c_te_legacytempents.h and you'll find two instances of this block #if defined( CSTRIKE_DLL ) || defined( SDK_DLL ), and all you have to do is comment them out like so:

//#if defined( CSTRIKE_DLL ) || defined( SDK_DLL )
enum
{
	CS_SHELL_9MM = 0,
	CS_SHELL_57,
	CS_SHELL_12GAUGE,
	CS_SHELL_556,
	CS_SHELL_762NATO,
	CS_SHELL_338MAG
};
//#endif

...

//#if defined( CSTRIKE_DLL ) || defined ( SDK_DLL )
	struct model_t			*m_pCS_9MMShell;
	struct model_t			*m_pCS_57Shell;
	struct model_t			*m_pCS_12GaugeShell;
	struct model_t			*m_pCS_556Shell;
	struct model_t			*m_pCS_762NATOShell;
	struct model_t			*m_pCS_338MAGShell;
//#endif

And finally, head over to c_te_legacytempents.cpp where we'll comment out five more #ifdef blocks.

The first block will be in the C_LocalTempEntity constructor:

//#if defined( CSTRIKE_DLL ) || defined (SDK_DLL )

#define TE_RIFLE_SHELL 1024
#define TE_PISTOL_SHELL 2048
#define TE_SHOTGUN_SHELL 4096

//#endif

The second one will be in the PlaySound ( C_LocalTempEntity *pTemp, float damp ) function:

//#ifdef CSTRIKE_DLL

		case TE_PISTOL_SHELL:
		{
			soundname = "Bounce.PistolShell";
		}
		break;

		case TE_RIFLE_SHELL:
		{
			soundname = "Bounce.RifleShell";
		}
		break;

		case TE_SHOTGUN_SHELL:
		{
			soundname = "Bounce.ShotgunShell";
		}
		break;
//#endif

The third one will be in the LevelInit() function:

//#if defined( CSTRIKE_DLL ) || defined ( SDK_DLL )
	m_pCS_9MMShell		= (model_t *)engine->LoadModel( "models/Shells/shell_9mm.mdl" );
	m_pCS_57Shell		= (model_t *)engine->LoadModel( "models/Shells/shell_57.mdl" );
	m_pCS_12GaugeShell	= (model_t *)engine->LoadModel( "models/Shells/shell_12gauge.mdl" );
	m_pCS_556Shell		= (model_t *)engine->LoadModel( "models/Shells/shell_556.mdl" );
	m_pCS_762NATOShell	= (model_t *)engine->LoadModel( "models/Shells/shell_762nato.mdl" );
	m_pCS_338MAGShell	= (model_t *)engine->LoadModel( "models/Shells/shell_338mag.mdl" );
//#endif

The fourth one will be in the Init (void) function, right below the last one:

//#if defined( CSTRIKE_DLL ) || defined ( SDK_DLL )
	m_pCS_9MMShell		= NULL;
	m_pCS_57Shell		= NULL;
	m_pCS_12GaugeShell	= NULL;
	m_pCS_556Shell		= NULL;
	m_pCS_762NATOShell	= NULL;
	m_pCS_338MAGShell	= NULL;
//#endif

And the last one will be in the CSEjectBrass( ... ) function, at the bottom of the file:

//#if defined ( CSTRIKE_DLL ) || defined ( SDK_DLL )

	switch( shellType )
	{
	default:
	case CS_SHELL_9MM:
		hitsound = TE_PISTOL_SHELL;
		pModel = m_pCS_9MMShell;
		break;
	case CS_SHELL_57:
		hitsound = TE_PISTOL_SHELL;
		pModel = m_pCS_57Shell;
		break;
	case CS_SHELL_12GAUGE:
		hitsound = TE_SHOTGUN_SHELL;
		pModel = m_pCS_12GaugeShell;
		break;
	case CS_SHELL_556:
		hitsound = TE_RIFLE_SHELL;
		pModel = m_pCS_556Shell;
		break;
	case CS_SHELL_762NATO:
		hitsound = TE_RIFLE_SHELL;
		pModel = m_pCS_762NATOShell;
		break;
	case CS_SHELL_338MAG:
		hitsound = TE_RIFLE_SHELL;
		pModel = m_pCS_338MAGShell;
		break;
	}
//#endif

Conclusion

And that's it for now, enjoy!