MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / xParGroupAnimate

Function xParGroupAnimate

src/SB/Core/x/xParGroup.cpp:134–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132#define clamp(x, a, b) (((x) < (a)) ? (a) : (((x) > (b)) ? (b) : (x)))
133
134void xParGroupAnimate(xParGroup* ps, F32 dt)
135{
136 xPar* i = ps->m_root;
137 xPar* tmp;
138 F32 age = dt;
139
140 if (ps->m_flags & XPARGROUP_NOAGING)
141 {
142 age = 0.0f;
143 }
144
145 if (!ps->m_root)
146 {
147 ps->m_alive = 0;
148 }
149
150 while (i)
151 {
152 if (i->m_lifetime < 0.0f)
153 {
154 tmp = i;
155
156 i = i->m_next;
157
158 xParGroupKillPar(ps, tmp);
159 }
160 else
161 {
162 i->m_c[0] = i->m_cfl[0] = clamp(i->m_cvel[0] * dt + i->m_cfl[0], 0.0f, 255.0f);
163 i->m_c[1] = i->m_cfl[1] = clamp(i->m_cvel[1] * dt + i->m_cfl[1], 0.0f, 255.0f);
164 i->m_c[2] = i->m_cfl[2] = clamp(i->m_cvel[2] * dt + i->m_cfl[2], 0.0f, 255.0f);
165 i->m_c[3] = i->m_cfl[3] = clamp(i->m_cvel[3] * dt + i->m_cfl[3], 0.0f, 255.0f);
166 i->m_size += i->m_sizeVel * dt;
167 i->m_lifetime -= age;
168
169 i = i->m_next;
170 }
171 }
172}
173
174void xParGroupAddParP(xParGroup* ps, xPar* p)
175{

Callers 1

xParSysUpdateFunction · 0.70

Calls 1

xParGroupKillParFunction · 0.85

Tested by

no test coverage detected