summaryrefslogtreecommitdiff
path: root/src/simulation
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-19 15:52:35 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-19 15:52:35 (GMT)
commitceb25440cbbb1c6b712985770a0379c4da57cdd4 (patch)
tree8a629af12bff3226c9368a9975bc7150a1aa9e4a /src/simulation
parentc4bace95bf97546ecb2fff4343fe82d0540d34ab (diff)
downloadpowder-ceb25440cbbb1c6b712985770a0379c4da57cdd4.zip
powder-ceb25440cbbb1c6b712985770a0379c4da57cdd4.tar.gz
TPT: Fix sponge bug. f93a829671
Diffstat (limited to 'src/simulation')
-rw-r--r--src/simulation/Elements.h1
-rw-r--r--src/simulation/SaveLoader.cpp6
-rw-r--r--src/simulation/Simulation.cpp7
-rw-r--r--src/simulation/SimulationData.cpp2
4 files changed, 13 insertions, 3 deletions
diff --git a/src/simulation/Elements.h b/src/simulation/Elements.h
index fc90929..5106c5f 100644
--- a/src/simulation/Elements.h
+++ b/src/simulation/Elements.h
@@ -47,6 +47,7 @@
#define FLAG_STAGNANT 1
#define FLAG_SKIPMOVE 0x2 // skip movement for one frame, only implemented for PHOT
+#define FLAG_MOVABLE 0x4 // if can move
#define ST_NONE 0
#define ST_SOLID 1
diff --git a/src/simulation/SaveLoader.cpp b/src/simulation/SaveLoader.cpp
index 2683a6f..71748c4 100644
--- a/src/simulation/SaveLoader.cpp
+++ b/src/simulation/SaveLoader.cpp
@@ -6,6 +6,7 @@
*/
#include <bzlib.h>
+#include <math.h>
#include "SaveLoader.h"
//!TODO: enum for LoadSave return
@@ -547,6 +548,11 @@ int SaveLoader::PSVLoad(unsigned char * data, int dataLength, Simulation * sim,
//STKM_init_legs(&(fighters[fcount]), i-1);
}
}
+ else if (parts[i-1].type == PT_SPNG)
+ {
+ if (fabs(parts[i-1].vx)>0.0f || fabs(parts[i-1].vy)>0.0f)
+ parts[i-1].flags |= FLAG_MOVABLE;
+ }
if (ver<48 && (ty==OLD_PT_WIND || (ty==PT_BRAY&&parts[i-1].life==0)))
{
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 2ad007b..e2f9880 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -2573,8 +2573,11 @@ void Simulation::update_particles_i(int start, int inc)
pGravY += gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
}
//velocity updates for the particle
- parts[i].vx *= ptypes[t].loss;
- parts[i].vy *= ptypes[t].loss;
+ if (!(parts[i].flags&FLAG_MOVABLE))
+ {
+ parts[i].vx *= ptypes[t].loss;
+ parts[i].vy *= ptypes[t].loss;
+ }
//particle gets velocity from the vx and vy maps
parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + pGravX;
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + pGravY;
diff --git a/src/simulation/SimulationData.cpp b/src/simulation/SimulationData.cpp
index d815a24..043091e 100644
--- a/src/simulation/SimulationData.cpp
+++ b/src/simulation/SimulationData.cpp
@@ -279,7 +279,7 @@ part_type * LoadElements(int & elementCount)
{"LIGH", PIXPACK(0xFFFFC0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 0, "More realistic lightning. Set pen size to set the size of the lightning.", ST_SOLID, TYPE_SOLID, &update_LIGH, &graphics_LIGH},
{"TESC", PIXPACK(0x707040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Tesla coil!", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_HOT_GLOW, NULL, NULL},
{"DEST", PIXPACK(0xFF3311), -0.05f, 0.00f * CFDS, 0.95f, 0.95f, -0.1f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 1, 101, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 150, "More destructive Bomb.", ST_SOLID, TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_DEST, &graphics_DEST},
- {"SPNG", PIXPACK(0xFFBE30), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 1, 30, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "A sponge, absorbs water.", ST_SOLID, TYPE_SOLID, &update_SPNG, &graphics_SPNG},
+ {"SPNG", PIXPACK(0xFFBE30), 0.00f, 0.00f * CFDS, 0.00f, 0.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 1, 30, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "A sponge, absorbs water.", ST_SOLID, TYPE_SOLID, &update_SPNG, &graphics_SPNG},
{"RIME", PIXPACK(0xCCCCCC), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, 100, SC_CRACKER2, 243.15f, 100, "Not quite Ice", ST_SOLID, TYPE_SOLID, &update_RIME, NULL},
{"FOG", PIXPACK(0xAAAAAA), 0.8f, 0.00f * CFDS, 0.4f, 0.70f, -0.1f, 0.0f, 0.99f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, 1, SC_CRACKER2, 243.15f, 100, "Not quite Steam", ST_GAS, TYPE_GAS|PROP_LIFE_DEC, &update_FOG, NULL},
{"BCLN", PIXPACK(0xFFD040), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Breakable Clone.", ST_NONE, TYPE_SOLID|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_BCLN, NULL},