summaryrefslogtreecommitdiff
path: root/src/simulation/elements
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-02-24 04:42:54 (GMT)
committer jacob1 <jfu614@gmail.com>2013-02-24 04:45:40 (GMT)
commit6b1e99a73169550e8bcb4c29ff105dde83924cea (patch)
treeb407cb73874392e46803b23523430fa95cf62a9d /src/simulation/elements
parent20d8eff7f526aa91997ec09266374d14775607ef (diff)
downloadpowder-6b1e99a73169550e8bcb4c29ff105dde83924cea.zip
powder-6b1e99a73169550e8bcb4c29ff105dde83924cea.tar.gz
allow ACEL and DCEL strength to be modified with ctype
Diffstat (limited to 'src/simulation/elements')
-rw-r--r--src/simulation/elements/ACEL.cpp13
-rw-r--r--src/simulation/elements/dcel.cpp13
2 files changed, 22 insertions, 4 deletions
diff --git a/src/simulation/elements/ACEL.cpp b/src/simulation/elements/ACEL.cpp
index 8dfad79..81eeaf3 100644
--- a/src/simulation/elements/ACEL.cpp
+++ b/src/simulation/elements/ACEL.cpp
@@ -62,8 +62,17 @@ int Element_ACEL::update(UPDATE_FUNC_ARGS)
continue;
if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY))
{
- parts[r>>8].vx *= 1.1f;
- parts[r>>8].vy *= 1.1f;
+ 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;
+ }
+ else
+ {
+ parts[r>>8].vx *= 1.1f;
+ parts[r>>8].vy *= 1.1f;
+ }
parts[i].tmp = 1;
}
}
diff --git a/src/simulation/elements/dcel.cpp b/src/simulation/elements/dcel.cpp
index 07f930b..294c840 100644
--- a/src/simulation/elements/dcel.cpp
+++ b/src/simulation/elements/dcel.cpp
@@ -62,8 +62,17 @@ int Element_DCEL::update(UPDATE_FUNC_ARGS)
continue;
if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY))
{
- parts[r>>8].vx *= 0.9f;
- parts[r>>8].vy *= 0.9f;
+ 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;
+ }
+ else
+ {
+ parts[r>>8].vx *= 0.9f;
+ parts[r>>8].vy *= 0.9f;
+ }
parts[i].tmp = 1;
}
}