I told you that there may be more things to handle, and if I remember well you said you could take care of them. Well, nvm. Also, my code only handle the smoke grenade case, you need to check for other grenades too.
Edit: Or, wait, maybe not. The only thing that is different on grenades is the animation in my code, but looking at the weapons code animations index are the same, and it should work ok.
To find a way, you must understand what CS do. Look at what I highlighted(will talk about sg, it should be mostly the same for all of them):
https://github.com/Arkshine/CSSDK/bl...enade.cpp#L116
When you execute
PrimaryAttack on the grenade, it sets
m_flStartThrow offset to current game time. Then, in
WeaponIdle this offset is checked, if bigger than 0 a grenade throw will be initialized(
https://github.com/Arkshine/CSSDK/bl...enade.cpp#L151). My answer will be mostly the same as before, redo this:
PHP Code:
if( angleThrow.x < 0 )
angleThrow.x = -10 + angleThrow.x * ( ( 90 - 10 ) / 90.0 );
else
angleThrow.x = -10 + angleThrow.x * ( ( 90 + 10 ) / 90.0 );
float flVel = ( 90 - angleThrow.x ) * 6;
if( flVel > 750 )
flVel = 750;
UTIL_MakeVectors( angleThrow );
Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16;
Vector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity;
Then, find and call
CGrenade::ShootSmokeGrenade with orpheu. You may need to also alter the offsets like game do:
PHP Code:
m_flStartThrow = 0;
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ]--;
if( !m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ] )
{
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
}
Edit2: Hold on a minute, I'll try to get the signature for the needed functions.
__________________