Add ball particles, even for invalid projectiles

This commit is contained in:
Jupeyy 2020-11-17 20:58:49 +01:00
parent f8b07f705e
commit 2a7ba8fe30

View file

@ -24,20 +24,22 @@ void CItems::OnReset()
void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
{
int CurWeapon = clamp(pCurrent->m_Type, 0, NUM_WEAPONS - 1);
// get positions
float Curvature = 0;
float Speed = 0;
if(pCurrent->m_Type == WEAPON_GRENADE)
if(CurWeapon == WEAPON_GRENADE)
{
Curvature = m_pClient->m_Tuning[g_Config.m_ClDummy].m_GrenadeCurvature;
Speed = m_pClient->m_Tuning[g_Config.m_ClDummy].m_GrenadeSpeed;
}
else if(pCurrent->m_Type == WEAPON_SHOTGUN)
else if(CurWeapon == WEAPON_SHOTGUN)
{
Curvature = m_pClient->m_Tuning[g_Config.m_ClDummy].m_ShotgunCurvature;
Speed = m_pClient->m_Tuning[g_Config.m_ClDummy].m_ShotgunSpeed;
}
else if(pCurrent->m_Type == WEAPON_GUN)
else if(CurWeapon == WEAPON_GUN)
{
Curvature = m_pClient->m_Tuning[g_Config.m_ClDummy].m_GunCurvature;
Speed = m_pClient->m_Tuning[g_Config.m_ClDummy].m_GunSpeed;
@ -77,20 +79,11 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
Alpha = g_Config.m_ClShowOthersAlpha / 100.0f;
}
int CurWeapon = clamp(pCurrent->m_Type, 0, NUM_WEAPONS - 1);
if(GameClient()->m_GameSkin.m_SpriteWeaponProjectiles[CurWeapon] != -1)
{
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpriteWeaponProjectiles[CurWeapon]);
Graphics()->SetColor(1.f, 1.f, 1.f, Alpha);
int QuadOffset = 2 + 8 + NUM_WEAPONS + CurWeapon;
vec2 Vel = Pos - PrevPos;
//vec2 pos = mix(vec2(prev->x, prev->y), vec2(current->x, current->y), Client()->IntraGameTick(g_Config.m_ClDummy));
// add particle for this projectile
if(pCurrent->m_Type == WEAPON_GRENADE)
// don't check for validity of the projectile for the current weapon here, so particle effects are rendered for mod compability
if(CurWeapon == WEAPON_GRENADE)
{
m_pClient->m_pEffects->SmokeTrail(Pos, Vel * -1, Alpha);
static float s_Time = 0.0f;
@ -121,6 +114,13 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
Graphics()->QuadsSetRotation(0);
}
if(GameClient()->m_GameSkin.m_SpriteWeaponProjectiles[CurWeapon] != -1)
{
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpriteWeaponProjectiles[CurWeapon]);
Graphics()->SetColor(1.f, 1.f, 1.f, Alpha);
int QuadOffset = 2 + 8 + NUM_WEAPONS + CurWeapon;
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, QuadOffset, Pos.x, Pos.y);
}
}