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

Function AddProcCone

Descent3/procedurals.cpp:693–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

691 }
692}
693void AddProcCone(int handle, static_proc_element *proc) {
694 if (proc->frequency == 0 || (FrameCount % proc->frequency) == 0) {
695 // Add a new fizzle
696 int num = (prand() % 4) + 1;
697 for (int i = 0; i < num; i++) {
698 int index = ProcElementAllocate();
699 if (index > -1) {
700 ProcElementLink(index, handle);
701 DynamicProcElements[index].type = proc->type;
702
703 DynamicProcElements[index].x1 = IntToFix(proc->x1);
704 DynamicProcElements[index].y1 = IntToFix(proc->y1);
705
706 DynamicProcElements[index].color = BRIGHT_COLOR;
707 DynamicProcElements[index].speed = proc->speed;
708 DynamicProcElements[index].dx = FloatToFix(((prand() % 100) - 50) / 80.0);
709 if ((prand() % 10) == 0) {
710 DynamicProcElements[index].dy = FloatToFix(-((prand() % 100) / 300.0));
711 DynamicProcElements[index].frames_left = (prand() % 6) + 3;
712 } else {
713 DynamicProcElements[index].dy = IntToFix(1);
714 DynamicProcElements[index].frames_left = (prand() % 10) + 15;
715 }
716 }
717 }
718 }
719}
720void DoDynamicCone(int handle, dynamic_proc_element *proc) {
721 PlaceProcPoint(FixToInt(proc->x1), FixToInt(proc->y1), proc->color);
722 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