diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 71e569eec..2314c5c05 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -3089,15 +3089,10 @@ int Simulation::create_part(int p, int x, int y, int tv) break; case PT_DTEC: parts[i].tmp2 = 2; + break; case PT_TSNS: parts[i].tmp2 = 2; break; - case PT_ACEL: - parts[i].ctype = 10; - break; - case PT_DCEL: - parts[i].ctype = 9; - break; default: if (t==PT_FIGH) { diff --git a/src/simulation/elements/ACEL.cpp b/src/simulation/elements/ACEL.cpp index 81eeaf345..35f77dca0 100644 --- a/src/simulation/elements/ACEL.cpp +++ b/src/simulation/elements/ACEL.cpp @@ -50,23 +50,23 @@ Element_ACEL::Element_ACEL() int Element_ACEL::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+rxphotons[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 > 1000 ? 1000 : 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 > 1000 ? 1000 : (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+rxphotons[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 { diff --git a/src/simulation/elements/dcel.cpp b/src/simulation/elements/dcel.cpp index 294c84008..f079c56e6 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+rxphotons[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+rxphotons[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 {