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

Method PlayerDeath

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

Source from the content-addressed store, hash-verified

214}
215
216void CEffects::PlayerDeath(vec2 Pos, int ClientId, float Alpha)
217{
218 ColorRGBA BloodColor(1.0f, 1.0f, 1.0f);
219
220 if(ClientId >= 0)
221 {
222 // Use m_RenderInfo.m_CustomColoredSkin instead of m_UseCustomColor
223 // m_UseCustomColor says if the player's skin has a custom color (value sent from the client side)
224
225 // m_RenderInfo.m_CustomColoredSkin Defines if in the context of the game the color is being customized,
226 // Using this value if the game is teams (red and blue), this value will be true even if the skin is with the normal color.
227 // And will use the team body color to create player death effect instead of tee color
228 if(GameClient()->Client()->IsSixup())
229 {
230 if(GameClient()->m_aClients[ClientId].m_RenderInfo.m_aSixup[g_Config.m_ClDummy].m_aUseCustomColors[protocol7::SKINPART_BODY])
231 {
232 BloodColor = GameClient()->m_aClients[ClientId].m_RenderInfo.m_aSixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_BODY];
233 }
234 else
235 {
236 BloodColor = GameClient()->m_aClients[ClientId].m_RenderInfo.m_aSixup[g_Config.m_ClDummy].m_BloodColor;
237 }
238 }
239 else
240 {
241 if(GameClient()->m_aClients[ClientId].m_RenderInfo.m_CustomColoredSkin)
242 {
243 BloodColor = GameClient()->m_aClients[ClientId].m_RenderInfo.m_ColorBody;
244 }
245 else
246 {
247 BloodColor = GameClient()->m_aClients[ClientId].m_RenderInfo.m_BloodColor;
248 }
249 }
250 }
251
252 for(int i = 0; i < 64; i++)
253 {
254 CParticle p;
255 p.SetDefault();
256 p.m_Spr = SPRITE_PART_SPLAT01 + (rand() % 3);
257 p.m_Pos = Pos;
258 p.m_Vel = random_direction() * (random_float(0.1f, 1.1f) * 900.0f);
259 p.m_LifeSpan = random_float(0.3f, 0.6f);
260 p.m_StartSize = random_float(24.0f, 40.0f);
261 p.m_EndSize = 0.0f;
262 p.m_Rot = random_angle();
263 p.m_Rotspeed = random_float(-0.5f, 0.5f) * pi;
264 p.m_Gravity = 800.0f;
265 p.m_Friction = 0.8f;
266 p.m_Color = BloodColor.Multiply(random_float(0.75f, 1.0f)).WithAlpha(0.75f * Alpha);
267 p.m_StartAlpha = Alpha;
268 GameClient()->m_Particles.Add(CParticles::GROUP_GENERAL, &p);
269 }
270}
271
272void CEffects::Confetti(vec2 Pos, float Alpha)
273{

Callers 1

ProcessEventsMethod · 0.80

Calls 9

random_directionFunction · 0.85
random_floatFunction · 0.85
random_angleFunction · 0.85
SetDefaultMethod · 0.80
WithAlphaMethod · 0.80
MultiplyMethod · 0.80
IsSixupMethod · 0.45
ClientMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected