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

Function AddProcFallRight

Descent3/procedurals.cpp:735–754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733 }
734}
735void AddProcFallRight(int handle, static_proc_element *proc) {
736 if (proc->frequency == 0 || (FrameCount % proc->frequency) == 0) {
737 // Add a new fizzle
738 int num = (prand() % 2) + 1;
739 for (int i = 0; i < num; i++) {
740 int index = ProcElementAllocate();
741 if (index > -1) {
742 ProcElementLink(index, handle);
743 DynamicProcElements[index].type = proc->type;
744
745 DynamicProcElements[index].x1 = IntToFix(proc->x1 + ((ps_rand() % 5) - 2));
746 DynamicProcElements[index].y1 = IntToFix(proc->y1 + ((ps_rand() % 5) - 2));
747 DynamicProcElements[index].color = BRIGHT_COLOR;
748 DynamicProcElements[index].dx = IntToFix(1);
749 DynamicProcElements[index].dy = FloatToFix((-(prand() % 100)) / 300.0);
750 DynamicProcElements[index].frames_left = (prand() % 15) + 25;
751 }
752 }
753 }
754}
755void DoDynamicFallRight(int handle, dynamic_proc_element *proc) {
756 PlaceProcPoint(FixToInt(proc->x1), FixToInt(proc->y1), proc->color);
757 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