diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-07 16:59:50 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-07 16:59:50 (GMT) |
| commit | 51b17badf4c72270bb762ea795d05d51c8b355e3 (patch) | |
| tree | b66671e0496b68114c6e91eedb58bf783d5343c0 /src/simulation/elements/FOG.cpp | |
| parent | fb111f42d00dd8a2041bae970c0913e096ac5101 (diff) | |
| download | powder-51b17badf4c72270bb762ea795d05d51c8b355e3.zip powder-51b17badf4c72270bb762ea795d05d51c8b355e3.tar.gz | |
A bit of refactoring (elements)
Diffstat (limited to 'src/simulation/elements/FOG.cpp')
| -rw-r--r-- | src/simulation/elements/FOG.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/simulation/elements/FOG.cpp b/src/simulation/elements/FOG.cpp new file mode 100644 index 0000000..ca2beb4 --- /dev/null +++ b/src/simulation/elements/FOG.cpp @@ -0,0 +1,73 @@ +#include "simulation/Elements.h" +//#TPT-Directive ElementClass Element_FOG PT_FOG 92 +Element_FOG::Element_FOG() +{ + Identifier = "DEFAULT_PT_FOG"; + Name = "FOG"; + Colour = PIXPACK(0xAAAAAA); + MenuVisible = 1; + MenuSection = SC_CRACKER2; + Enabled = 1; + + Advection = 0.8f; + AirDrag = 0.00f * CFDS; + AirLoss = 0.4f; + Loss = 0.70f; + Collision = -0.1f; + Gravity = 0.0f; + Diffusion = 0.99f; + HotAir = 0.000f * CFDS; + Falldown = 0; + + Flammable = 0; + Explosive = 0; + Meltable = 0; + Hardness = 30; + + Weight = 1; + + Temperature = 243.15f; + HeatConduct = 100; + Description = "Not quite Steam"; + + State = ST_GAS; + Properties = TYPE_GAS|PROP_LIFE_DEC; + + LowPressure = IPL; + LowPressureTransition = NT; + HighPressure = IPH; + HighPressureTransition = NT; + LowTemperature = ITL; + LowTemperatureTransition = NT; + HighTemperature = 373.15f; + HighTemperatureTransition = PT_WTRV; + + Update = &Element_FOG::update; + Graphics = NULL; +} + +//#TPT-Directive ElementHeader Element_FOG static int update(UPDATE_FUNC_ARGS) +int Element_FOG::update(UPDATE_FUNC_ARGS) + { + int r, rx, ry; + 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)) + { + r = pmap[y+ry][x+rx]; + if (!r) + continue; + if (sim->elements[r&0xFF].State==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!((r&0xFF)==PT_CLNE||(r&0xFF)==PT_PCLN)) // TODO: should this also exclude BCLN? + { + sim->part_change_type(i,x,y,PT_RIME); + } + if ((r&0xFF)==PT_SPRK) + { + parts[i].life += rand()%20; + } + } + return 0; +} + + +Element_FOG::~Element_FOG() {}
\ No newline at end of file |
