MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / DetatchSpark

Function DetatchSpark

TombEngine/Game/effects/effects.cpp:92–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90};
91
92void DetatchSpark(int number, SpriteEnumFlag type)
93{
94 auto* sptr = &Particles[0];
95
96 for (int lp = 0; lp < MAX_PARTICLES; lp++, sptr++)
97 {
98 if (sptr->on && (sptr->flags & type) && sptr->fxObj == number)
99 {
100 switch (type)
101 {
102 case SP_FX:
103 if (sptr->flags & SP_DAMAGE)
104 sptr->on = false;
105 else
106 {
107 auto* fx = &EffectList[number];
108
109 sptr->x += fx->pos.Position.x;
110 sptr->y += fx->pos.Position.y;
111 sptr->z += fx->pos.Position.z;
112 sptr->flags &= ~SP_FX;
113 }
114
115 break;
116
117 case SP_ITEM:
118 if (sptr->flags & SP_DAMAGE)
119 sptr->on = false;
120 else
121 {
122 auto* item = &g_Level.Items[number];
123
124 sptr->x += item->Pose.Position.x;
125 sptr->y += item->Pose.Position.y;
126 sptr->z += item->Pose.Position.z;
127 sptr->flags &= ~SP_ITEM;
128 }
129
130 break;
131 }
132 }
133 }
134}
135
136Particle* GetFreeParticle()
137{

Callers 2

KillItemFunction · 0.85
KillEffectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected