diff --git a/src/simulation/elements/ACEL.cpp b/src/simulation/elements/ACEL.cpp index 35f77dca0..143e19560 100644 --- a/src/simulation/elements/ACEL.cpp +++ b/src/simulation/elements/ACEL.cpp @@ -50,7 +50,16 @@ Element_ACEL::Element_ACEL() int Element_ACEL::update(UPDATE_FUNC_ARGS) { int r, rx, ry; - float change = parts[i].life > 1000 ? 1000 : (parts[i].life < 0 ? 0 : parts[i].life); + float multiplier; + if (parts[i].life!=0) + { + float change = parts[i].life > 1000 ? 1000 : (parts[i].life < 0 ? 0 : parts[i].life); + multiplier = 1.0f+(change/100.0f); + } + else + { + multiplier = 1.1f; + } parts[i].tmp = 0; for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) @@ -63,16 +72,8 @@ int Element_ACEL::update(UPDATE_FUNC_ARGS) 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 - { - parts[r>>8].vx *= 1.1f; - parts[r>>8].vy *= 1.1f; - } + parts[r>>8].vx *= multiplier; + parts[r>>8].vy *= multiplier; parts[i].tmp = 1; } } @@ -91,4 +92,4 @@ int Element_ACEL::graphics(GRAPHICS_FUNC_ARGS) } -Element_ACEL::~Element_ACEL() {} \ No newline at end of file +Element_ACEL::~Element_ACEL() {} diff --git a/src/simulation/elements/dcel.cpp b/src/simulation/elements/dcel.cpp index f079c56e6..0fe7c787e 100644 --- a/src/simulation/elements/dcel.cpp +++ b/src/simulation/elements/dcel.cpp @@ -50,7 +50,16 @@ Element_DCEL::Element_DCEL() int Element_DCEL::update(UPDATE_FUNC_ARGS) { int r, rx, ry; - float change = parts[i].life > 100 ? 100 : (parts[i].life < 0 ? 0 : parts[i].life); + float multiplier; + if (parts[i].life!=0) + { + float change = parts[i].life > 100 ? 100 : (parts[i].life < 0 ? 0 : parts[i].life); + multiplier = 1.0f-(change/100.0f); + } + else + { + multiplier = 1.0f/1.1f; + } parts[i].tmp = 0; for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) @@ -63,16 +72,8 @@ int Element_DCEL::update(UPDATE_FUNC_ARGS) 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 - { - parts[r>>8].vx *= 0.9f; - parts[r>>8].vy *= 0.9f; - } + parts[r>>8].vx *= multiplier; + parts[r>>8].vy *= multiplier; parts[i].tmp = 1; } } @@ -91,4 +92,4 @@ int Element_DCEL::graphics(GRAPHICS_FUNC_ARGS) } -Element_DCEL::~Element_DCEL() {} \ No newline at end of file +Element_DCEL::~Element_DCEL() {}