MCPcopy Create free account
hub / github.com/ddnet/ddnet / SkidTrail

Method SkidTrail

src/game/client/components/effects.cpp:145–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void CEffects::SkidTrail(vec2 Pos, vec2 Vel, int Direction, float Alpha, float Volume)
146{
147 if(m_Add100hz)
148 {
149 CParticle p;
150 p.SetDefault();
151 p.m_Spr = SPRITE_PART_SMOKE;
152 p.m_Pos = Pos + vec2(-Direction * 6.0f, 12.0f);
153 p.m_Vel = vec2(-Direction * 100.0f * length(Vel), -50.0f) + random_direction() * 50.0f;
154 p.m_LifeSpan = random_float(0.5f, 1.0f);
155 p.m_StartSize = random_float(24.0f, 36.0f);
156 p.m_EndSize = 0.0f;
157 p.m_Friction = 0.7f;
158 p.m_Gravity = random_float(-500.0f);
159 p.m_Color = ColorRGBA(0.75f, 0.75f, 0.75f, Alpha);
160 p.m_StartAlpha = Alpha;
161 GameClient()->m_Particles.Add(CParticles::GROUP_GENERAL, &p);
162 }
163 if(g_Config.m_SndGame)
164 {
165 int64_t Now = time();
166 if(Now - m_SkidSoundTimer > time_freq() / 10)
167 {
168 m_SkidSoundTimer = Now;
169 GameClient()->m_Sounds.PlayAt(CSounds::CHN_WORLD, SOUND_PLAYER_SKID, Volume, Pos);
170 }
171 }
172}
173
174void CEffects::BulletTrail(vec2 Pos, float Alpha, float TimePassed)
175{

Callers 1

RenderPlayerMethod · 0.80

Calls 8

lengthFunction · 0.85
random_directionFunction · 0.85
random_floatFunction · 0.85
time_freqFunction · 0.85
SetDefaultMethod · 0.80
ColorRGBAClass · 0.70
AddMethod · 0.45
PlayAtMethod · 0.45

Tested by

no test coverage detected