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

Function zLightningUpdate

src/SB/Game/zLightning.cpp:542–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

540}
541
542void zLightningUpdate(F32 dt)
543{
544 S32 i;
545 for (i = 0; i < NUM_LIGHTNING; i++)
546 {
547 if (sLightning[i] != NULL && sLightning[i]->flags & 0x1)
548 {
549 UpdateLightning(sLightning[i], dt);
550 }
551 }
552
553 sLFuncUVOffset = 1.0f * dt + sLFuncUVOffset;
554 if (sLFuncUVOffset > 1.0f)
555 {
556 sLFuncUVOffset -= 1.0f;
557 }
558
559 sLFuncJerkTime += 20.0f * dt;
560 if (!(sLFuncJerkTime > 1.0f))
561 {
562 return;
563 }
564
565 S32 picker = 9.0f * xurand();
566 if (picker >= 9)
567 {
568 picker = 8;
569 }
570 if (picker < 0)
571 {
572 picker = 0;
573 }
574
575 xVec3Init(&sLFuncVal[picker], 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f));
576 xVec3Init(&sLFuncSlope[picker][0], 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f));
577 xVec3Init(&sLFuncSlope[picker][1], 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f));
578
579 sLFuncEnd[picker] = 0.25f * (xurand() * 0.5f) + (picker + 1);
580
581 for (S32 j = 0; j <= picker + 1; j++)
582 {
583 F32 prevEnd;
584 if (picker == 0)
585 {
586 i = 9;
587 prevEnd = 0.0f;
588 }
589 else
590 {
591 i = picker - 1;
592 prevEnd = sLFuncEnd[i];
593 }
594
595 xFuncPiece_EndPoints(&sLFuncX[j], prevEnd, sLFuncEnd[j], sLFuncVal[j].x, sLFuncVal[i].x);
596 xFuncPiece_EndPoints(&sLFuncY[j], prevEnd, sLFuncEnd[j], sLFuncVal[j].y, sLFuncVal[i].y);
597 xFuncPiece_EndPoints(&sLFuncZ[j], prevEnd, sLFuncEnd[j], sLFuncVal[j].z, sLFuncVal[i].z);
598 }
599

Callers 1

zSceneUpdateFunction · 0.70

Calls 4

xurandFunction · 0.85
xVec3InitFunction · 0.85
UpdateLightningFunction · 0.70
xFuncPiece_EndPointsFunction · 0.50

Tested by

no test coverage detected