MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / AddProcFallLeft

Function AddProcFallLeft

Descent3/procedurals.cpp:774–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

772 }
773}
774void AddProcFallLeft(int handle, static_proc_element *proc) {
775 if (proc->frequency == 0 || (FrameCount % proc->frequency) == 0) {
776 // Add a new fizzle
777 int num = (prand() % 2) + 1;
778 for (int i = 0; i < num; i++) {
779 int index = ProcElementAllocate();
780 if (index > -1) {
781 ProcElementLink(index, handle);
782 DynamicProcElements[index].type = proc->type;
783
784 DynamicProcElements[index].x1 = IntToFix(proc->x1 + ((ps_rand() % 5) - 2));
785 DynamicProcElements[index].y1 = IntToFix(proc->y1 + ((ps_rand() % 5) - 2));
786 DynamicProcElements[index].color = BRIGHT_COLOR;
787 DynamicProcElements[index].dx = IntToFix(-1);
788 DynamicProcElements[index].dy = FloatToFix((-(prand() % 100)) / 300.0);
789 DynamicProcElements[index].frames_left = (prand() % 15) + 25;
790 }
791 }
792 }
793}
794void DoDynamicFallLeft(int handle, dynamic_proc_element *proc) {
795 PlaceProcPoint(FixToInt(proc->x1), FixToInt(proc->y1), proc->color);
796 proc->frames_left--;

Callers 1

EvaluateFireProceduralFunction · 0.85

Calls 4

prandFunction · 0.85
ProcElementAllocateFunction · 0.85
ProcElementLinkFunction · 0.85
ps_randFunction · 0.85

Tested by

no test coverage detected