From ceb25440cbbb1c6b712985770a0379c4da57cdd4 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Thu, 19 Apr 2012 16:52:35 +0100 Subject: TPT: Fix sponge bug. f93a829671 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 +#include #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}, -- cgit v0.9.2-21-gd62e