diff options
Diffstat (limited to 'src/elements/sprk.c')
| -rw-r--r-- | src/elements/sprk.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/elements/sprk.c b/src/elements/sprk.c index 2633a65..f8f64f8 100644 --- a/src/elements/sprk.c +++ b/src/elements/sprk.c @@ -54,38 +54,38 @@ int update_SPRK(UPDATE_FUNC_ARGS) { } else if (ct==PT_TESC) // tesla coil code { - if (parts[i].tmp>300) - parts[i].tmp=300; - for (rx=-1; rx<2; rx++) + if (parts[i].tmp>300) + parts[i].tmp=300; + for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) - if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) + if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) { r = pmap[y+ry][x+rx]; if ((r>>8)>=NPART || r) continue; - if (rand()%(parts[i].tmp*parts[i].tmp/20+6)==0) - { - int p=create_part(-1, x+rx*2, y+ry*2, PT_LIGH); - if (p!=-1) - { + if (rand()%(parts[i].tmp*parts[i].tmp/20+6)==0) + { + int p=create_part(-1, x+rx*2, y+ry*2, PT_LIGH); + if (p!=-1) + { if(parts[i].tmp<=4) //Prevent Arithmetic errors with zero values continue; parts[p].life=rand()%(2+parts[i].tmp/15)+4+parts[i].tmp/7; - if (parts[i].life>60) - parts[i].life=60; - parts[p].temp=parts[p].life*parts[i].tmp/2.5; - parts[p].tmp2=1; - parts[p].tmp=acos(1.0*rx/sqrt(rx*rx+ry*ry))/M_PI*360; - parts[i].temp-=parts[i].tmp*2+parts[i].temp/5; // slight self-cooling - if (fabs(pv[y/CELL][x/CELL])!=0.0f) - { - if (fabs(pv[y/CELL][x/CELL])<=0.5f) - pv[y/CELL][x/CELL]=0; - else - pv[y/CELL][x/CELL]-=(pv[y/CELL][x/CELL]>0)?0.5:-0.5; - } - } - } + if (parts[i].life>60) + parts[i].life=60; + parts[p].temp=parts[p].life*parts[i].tmp/2.5; + parts[p].tmp2=1; + parts[p].tmp=acos(1.0*rx/sqrt(rx*rx+ry*ry))/M_PI*360; + parts[i].temp-=parts[i].tmp*2+parts[i].temp/5; // slight self-cooling + if (fabs(pv[y/CELL][x/CELL])!=0.0f) + { + if (fabs(pv[y/CELL][x/CELL])<=0.5f) + pv[y/CELL][x/CELL]=0; + else + pv[y/CELL][x/CELL]-=(pv[y/CELL][x/CELL]>0)?0.5:-0.5; + } + } + } } } else if (ct==PT_IRON) { |
