diff options
| author | jacob1 <jfu614@gmail.com> | 2013-02-25 03:10:31 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-02-25 03:10:31 (GMT) |
| commit | e700ff29883fcc3479ad8d9fce9805fbb0d31dfa (patch) | |
| tree | 9591435819097a64415862c72061033497d1de8f /src | |
| parent | 572d099e29135fe059e756059c1ff715ec68474a (diff) | |
| parent | 5c2f310577d7114334692b8abc5564d8d1081eed (diff) | |
| download | powder-e700ff29883fcc3479ad8d9fce9805fbb0d31dfa.zip powder-e700ff29883fcc3479ad8d9fce9805fbb0d31dfa.tar.gz | |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src')
| -rw-r--r-- | src/simulation/elements/ACEL.cpp | 25 | ||||
| -rw-r--r-- | src/simulation/elements/dcel.cpp | 25 |
2 files changed, 26 insertions, 24 deletions
diff --git a/src/simulation/elements/ACEL.cpp b/src/simulation/elements/ACEL.cpp index 35f77dc..143e195 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 f079c56..0fe7c78 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() {} |
