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

Function AddProcFountain

Descent3/procedurals.cpp:652–677  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

650 }
651}
652void AddProcFountain(int handle, static_proc_element *proc) {
653 if (proc->frequency == 0 || (FrameCount % proc->frequency) == 0) {
654 // Add a new fizzle
655 int num = (prand() % 4) + 1;
656 for (int i = 0; i < num; i++) {
657 int index = ProcElementAllocate();
658 if (index > -1) {
659 ProcElementLink(index, handle);
660 DynamicProcElements[index].type = proc->type;
661
662 DynamicProcElements[index].x1 = IntToFix(proc->x1);
663 DynamicProcElements[index].y1 = IntToFix(proc->y1);
664 DynamicProcElements[index].color = BRIGHT_COLOR;
665 DynamicProcElements[index].speed = proc->speed;
666 DynamicProcElements[index].dx = FloatToFix(((prand() % 100) - 50) / 200.0);
667 if ((prand() % 10) == 0) {
668 DynamicProcElements[index].dy = FloatToFix(-((prand() % 100) / 300.0));
669 DynamicProcElements[index].frames_left = (prand() % 6) + 3;
670 } else {
671 DynamicProcElements[index].dy = FloatToFix((prand() % 100) / 50.0);
672 DynamicProcElements[index].frames_left = (prand() % 10) + 15;
673 }
674 }
675 }
676 }
677}
678void DoDynamicFountain(int handle, dynamic_proc_element *proc) {
679 PlaceProcPoint(FixToInt(proc->x1), FixToInt(proc->y1), proc->color);
680 proc->frames_left--;

Callers 1

EvaluateFireProceduralFunction · 0.85

Calls 3

prandFunction · 0.85
ProcElementAllocateFunction · 0.85
ProcElementLinkFunction · 0.85

Tested by

no test coverage detected