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

Function FindFreeLightning

src/SB/Game/zLightning.cpp:206–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206static zLightning* FindFreeLightning()
207{
208 for (int i = 0; i != (sizeof(sLightning) / sizeof(zLightning*)); i++)
209 {
210 if (sLightning[i] != NULL)
211 {
212 if (!(sLightning[i]->flags & 1))
213 {
214 return sLightning[i];
215 }
216 }
217 else
218 {
219 sLightning[i] = (zLightning*)xMemAlloc(gActiveHeap, 0x234, 0);
220 return sLightning[i];
221 }
222 }
223
224 return 0;
225}
226
227// FIXME: Logic is nearly perfect but there are some incorrect values used causing register mismatches
228// inside the loop logic, as well as incorrect r1 local offsets throughout

Callers 1

zLightningAddFunction · 0.85

Calls 1

xMemAllocFunction · 0.50

Tested by

no test coverage detected