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

Function AddProcSphereLightning

Descent3/procedurals.cpp:487–501  ·  view source on GitHub ↗

Adds a sphere lightning bolt

Source from the content-addressed store, hash-verified

485}
486// Adds a sphere lightning bolt
487void AddProcSphereLightning(int handle, static_proc_element *proc) {
488 int procnum = proc - GameTextures[handle].procedural->static_proc_elements;
489
490 if (Detail_settings.Procedurals_enabled) {
491 if (proc->frequency != 0 && ((FrameCount) % proc->frequency) != 0)
492 return;
493 }
494 float norm = ((float)proc->size / 255.0);
495 int len = norm * (float)PROC_SIZE;
496 len /= 2;
497 int dir = prand() * 2;
498 int dest_x = proc->x1 + (FixCos(dir) * (float)len);
499 int dest_y = proc->y1 + (FixSin(dir) * (float)len);
500 AddProcLightning(proc->x1, proc->y1, dest_x, dest_y, BRIGHT_COLOR, proc);
501}
502void AddProcRisingEmber(int handle, static_proc_element *proc) {
503 if (proc->frequency == 0 || (FrameCount % proc->frequency) == 0) {
504 // Add a new fizzle

Callers 1

EvaluateFireProceduralFunction · 0.85

Calls 4

prandFunction · 0.85
AddProcLightningFunction · 0.85
FixCosFunction · 0.50
FixSinFunction · 0.50

Tested by

no test coverage detected