diff options
| author | jacob1 <jfu614@gmail.com> | 2013-02-24 16:52:09 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-02-24 16:52:09 (GMT) |
| commit | f138e10917b1bcdd7d270997312e8d672c182c3a (patch) | |
| tree | 47455c512132496256570ef21143932ef46d064d /src/simulation/elements/dcel.cpp | |
| parent | 7379a6b5ba65ff106ec5656bdeb3a9707e9fac62 (diff) | |
| parent | 8dfb1ecf8756e930c45482f707d00f188ff2ce53 (diff) | |
| download | powder-f138e10917b1bcdd7d270997312e8d672c182c3a.zip powder-f138e10917b1bcdd7d270997312e8d672c182c3a.tar.gz | |
Merge
Diffstat (limited to 'src/simulation/elements/dcel.cpp')
| -rw-r--r-- | src/simulation/elements/dcel.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/simulation/elements/dcel.cpp b/src/simulation/elements/dcel.cpp index 294c840..f079c56 100644 --- a/src/simulation/elements/dcel.cpp +++ b/src/simulation/elements/dcel.cpp @@ -50,23 +50,23 @@ Element_DCEL::Element_DCEL() int Element_DCEL::update(UPDATE_FUNC_ARGS) { int r, rx, ry; - parts[i].tmp = 0; - 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) && !(rx && ry)) - { - r = pmap[y+ry][x+rx]; - if(!r) - r = sim->photons[y+ry][x+rx]; - if ((r>>8)>=NPART || !r) - continue; - if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)) - { - if (parts[i].ctype) - { - int change = parts[i].ctype > 100 ? 100 : parts[i].ctype < 0 ? 0 : parts[i].ctype; - parts[r>>8].vx *= 1-change/100.0f; - parts[r>>8].vy *= 1-change/100.0f; + float change = parts[i].life > 100 ? 100 : (parts[i].life < 0 ? 0 : parts[i].life); + parts[i].tmp = 0; + 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) && !(rx && ry)) + { + r = pmap[y+ry][x+rx]; + if(!r) + r = sim->photons[y+ry][x+rx]; + if ((r>>8)>=NPART || !r) + continue; + if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)) + { + if (parts[i].life) + { + parts[r>>8].vx *= 1.0f-(change/100.0f); + parts[r>>8].vy *= 1.0f-(change/100.0f); } else { |
