diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-25 17:25:37 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-25 17:25:37 (GMT) |
| commit | 41cbd69ac807b79919649865293de2af8c50cbf7 (patch) | |
| tree | 66d13f43cfec7d8abdca032c420072a6600605f0 /src/simulation/elements/SPRK.cpp | |
| parent | de4fe1a38ec1114c384ddbb5ab68c7aa22541eed (diff) | |
| download | powder-41cbd69ac807b79919649865293de2af8c50cbf7.zip powder-41cbd69ac807b79919649865293de2af8c50cbf7.tar.gz | |
TPT: Use atan2 for LIGH angle calculations 966f1dcc23
Diffstat (limited to 'src/simulation/elements/SPRK.cpp')
| -rw-r--r-- | src/simulation/elements/SPRK.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/simulation/elements/SPRK.cpp b/src/simulation/elements/SPRK.cpp index e670cae..aa2efeb 100644 --- a/src/simulation/elements/SPRK.cpp +++ b/src/simulation/elements/SPRK.cpp @@ -111,19 +111,17 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS) r = pmap[y+ry][x+rx]; if (r) continue; - if (rand()%(parts[i].tmp*parts[i].tmp/20+6)==0) + if (parts[i].tmp>4 && rand()%(parts[i].tmp*parts[i].tmp/20+6)==0) { int p = sim->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)+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[p].tmp=atan2(-ry, rx)/M_PI*360; parts[i].temp-=parts[i].tmp*2+parts[i].temp/5; // slight self-cooling if (fabs(sim->pv[y/CELL][x/CELL])!=0.0f) { |
