summaryrefslogtreecommitdiff
path: root/src/simulation/elements/ACEL.cpp
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2013-02-25 01:05:12 (GMT)
committer jacksonmj <mj-pt@jacksonmj.co.uk>2013-02-25 01:05:12 (GMT)
commit5c2f310577d7114334692b8abc5564d8d1081eed (patch)
tree9652469407f0eae42da4e526f83583754827d62f /src/simulation/elements/ACEL.cpp
parent27ac5ab75d361e2933172b6ec1c08b6e7076d1f3 (diff)
downloadpowder-5c2f310577d7114334692b8abc5564d8d1081eed.zip
powder-5c2f310577d7114334692b8abc5564d8d1081eed.tar.gz
Make default DCEL exactly reverse the effect of default ACEL
Diffstat (limited to 'src/simulation/elements/ACEL.cpp')
-rw-r--r--src/simulation/elements/ACEL.cpp25
1 files changed, 13 insertions, 12 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() {}