summaryrefslogtreecommitdiff
path: root/src/simulation
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-02-24 16:52:09 (GMT)
committer jacob1 <jfu614@gmail.com>2013-02-24 16:52:09 (GMT)
commitf138e10917b1bcdd7d270997312e8d672c182c3a (patch)
tree47455c512132496256570ef21143932ef46d064d /src/simulation
parent7379a6b5ba65ff106ec5656bdeb3a9707e9fac62 (diff)
parent8dfb1ecf8756e930c45482f707d00f188ff2ce53 (diff)
downloadpowder-f138e10917b1bcdd7d270997312e8d672c182c3a.zip
powder-f138e10917b1bcdd7d270997312e8d672c182c3a.tar.gz
Merge
Diffstat (limited to 'src/simulation')
-rw-r--r--src/simulation/Simulation.cpp7
-rw-r--r--src/simulation/elements/ACEL.cpp34
-rw-r--r--src/simulation/elements/dcel.cpp34
3 files changed, 35 insertions, 40 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 71e569e..2314c5c 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 81eeaf3..35f77dc 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+rx<XRES && y+ry<YRES && (rx || ry) && !(rx && ry))
- {
- r = pmap[y+ry][x+rx];
- if(!r)
- r = sim->photons[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+rx<XRES && y+ry<YRES && (rx || ry) && !(rx && ry))
+ {
+ r = pmap[y+ry][x+rx];
+ if(!r)
+ r = sim->photons[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 294c840..f079c56 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+rx<XRES && y+ry<YRES && (rx || ry) && !(rx && ry))
- {
- r = pmap[y+ry][x+rx];
- if(!r)
- r = sim->photons[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+rx<XRES && y+ry<YRES && (rx || ry) && !(rx && ry))
+ {
+ r = pmap[y+ry][x+rx];
+ if(!r)
+ r = sim->photons[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
{