~kusabana/vsp-grenade-render-fix
Fix for grenades not rendering at the start of their lifetime
CBaseCSGrenadeProjectile::DrawModel1
int CBaseCSGrenadeProjectile::DrawModel( int flags )
{
// During the first half-second of our life, don't draw ourselves if he's
// still playing his throw animation.
// (better yet, we could draw ourselves in his hand).
if ( GetThrower() != C_BasePlayer::GetLocalPlayer() )
{
if ( gpGlobals->curtime - m_flSpawnTime < 0.5 )
{
C_CSPlayer *pPlayer = dynamic_cast<C_CSPlayer*>( GetThrower() );
if ( pPlayer && pPlayer->m_PlayerAnimState->IsThrowingGrenade() )
{
return 0;
}
}
}
return BaseClass::DrawModel( flags );
}This is however not desireable for some community servers running custom gamemodes that make use of the grenade projectiles, like Trikz.2
There are three variables that control whether or not the game will wait before rendering the grenade projectile:
m_flSpawnTimem_hThrowerm_PlayerAnimState
The m_flSpawnTime variable is set by the client. Since the goal is to resolve the issue without any client-side modifications, this option isn't viable.
While m_PlayerAnimState might technically be usable, it would require interfering with the animation playback.
This leaves m_hThrower, which we can just set to be an invalid handle in order to get past the innermost if statement.