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

Function GetFreeBlood

TombEngine/Game/effects/tomb4fx.cpp:685–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683}
684
685int GetFreeBlood()
686{
687 BLOOD_STRUCT* blood = &Blood[NextBlood];
688 int bloodNum = NextBlood;
689 int minLife = 4095;
690 int minIndex = 0;
691 int count = 0;
692
693 while (blood->on)
694 {
695 if (blood->life < minLife)
696 {
697 minIndex = bloodNum;
698 minLife = blood->life;
699 }
700
701 if (bloodNum == MAX_SPARKS_BLOOD - 1)
702 {
703 blood = &Blood[0];
704 bloodNum = 0;
705 }
706 else
707 {
708 blood++;
709 bloodNum++;
710 }
711
712 if (++count >= MAX_SPARKS_BLOOD)
713 {
714 NextBlood = (minIndex + 1) & 31;
715 return minIndex;
716 }
717 }
718
719 NextBlood = (bloodNum + 1) & 31;
720 return bloodNum;
721}
722
723void TriggerBlood(int x, int y, int z, int unk, int num)
724{

Callers 1

TriggerBloodFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected