steveo3861
07-01-2007, 04:17 AM
While browsing valve developer I found this:
Posted by DeathGiver
Actually found a way to make the muzzle flashes appear for the CS:S weapons in HL2. I found it on Steampowered.com's SDK Coding forum.
In c_baseanimating.cpp, at line 3024 (after the big ??? switch statement), comment out the code so it looks like this
//if ( iAttachment != -1 && m_Attachments.Count() > iAttachment )
{
//GetAttachment( iAttachment+1, attachOrigin, attachAngles );
//int entId = render->GetViewEntity();
//tempents->MuzzleFlash( attachOrigin, attachAngles, atoi( options ), entId, bFirstPerson );
and place the following below it. (be sure not to comment out the ending brakets and final breaks)
if ( iAttachment != -1 && m_Attachments.Count() > iAttachment )
{
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, line 227 (under the statement "pParticle->m_vecVelocity.Init();"), place the following code.
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
Vector velocity = pPlayer->GetLocalVelocity();
pParticle->m_vecVelocity += velocity;
There you go, working muzzle flashes for CS:S weapons in HL2
Hope this helps someone ;)
Posted by DeathGiver
Actually found a way to make the muzzle flashes appear for the CS:S weapons in HL2. I found it on Steampowered.com's SDK Coding forum.
In c_baseanimating.cpp, at line 3024 (after the big ??? switch statement), comment out the code so it looks like this
//if ( iAttachment != -1 && m_Attachments.Count() > iAttachment )
{
//GetAttachment( iAttachment+1, attachOrigin, attachAngles );
//int entId = render->GetViewEntity();
//tempents->MuzzleFlash( attachOrigin, attachAngles, atoi( options ), entId, bFirstPerson );
and place the following below it. (be sure not to comment out the ending brakets and final breaks)
if ( iAttachment != -1 && m_Attachments.Count() > iAttachment )
{
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, line 227 (under the statement "pParticle->m_vecVelocity.Init();"), place the following code.
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
Vector velocity = pPlayer->GetLocalVelocity();
pParticle->m_vecVelocity += velocity;
There you go, working muzzle flashes for CS:S weapons in HL2
Hope this helps someone ;)