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

Function AddProcRandomEmber

Descent3/procedurals.cpp:576–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574 }
575}
576void AddProcRandomEmber(int handle, static_proc_element *proc) {
577 if (proc->frequency == 0 || (FrameCount % proc->frequency) == 0) {
578 // Add a new fizzle
579 int num = (prand() % 4) + 1;
580 for (int i = 0; i < num; i++) {
581 int index = ProcElementAllocate();
582 if (index > -1) {
583 ProcElementLink(index, handle);
584 DynamicProcElements[index].type = proc->type;
585
586 DynamicProcElements[index].x1 = IntToFix(proc->x1);
587 DynamicProcElements[index].y1 = IntToFix(proc->y1);
588 DynamicProcElements[index].color = BRIGHT_COLOR;
589 DynamicProcElements[index].speed = proc->speed;
590 DynamicProcElements[index].frames_left = (prand() % 10) + 15;
591 }
592 }
593 }
594}
595void DoDynamicRandomEmber(int handle, dynamic_proc_element *proc) {
596 PlaceProcPoint(FixToInt(proc->x1), FixToInt(proc->y1), proc->color);
597 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