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/PLSM.cpp | |
| parent | fb111f42d00dd8a2041bae970c0913e096ac5101 (diff) | |
| download | powder-51b17badf4c72270bb762ea795d05d51c8b355e3.zip powder-51b17badf4c72270bb762ea795d05d51c8b355e3.tar.gz | |
A bit of refactoring (elements)
Diffstat (limited to 'src/simulation/elements/PLSM.cpp')
| -rw-r--r-- | src/simulation/elements/PLSM.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/simulation/elements/PLSM.cpp b/src/simulation/elements/PLSM.cpp new file mode 100644 index 0000000..4812b84 --- /dev/null +++ b/src/simulation/elements/PLSM.cpp @@ -0,0 +1,70 @@ +#include "simulation/Elements.h" +//#TPT-Directive ElementClass Element_PLSM PT_PLSM 49 +Element_PLSM::Element_PLSM() +{ + Identifier = "DEFAULT_PT_PLSM"; + Name = "PLSM"; + Colour = PIXPACK(0xBB99FF); + MenuVisible = 1; + MenuSection = SC_GAS; + Enabled = 1; + + Advection = 0.9f; + AirDrag = 0.04f * CFDS; + AirLoss = 0.97f; + Loss = 0.20f; + Collision = 0.0f; + Gravity = -0.1f; + Diffusion = 0.30f; + HotAir = 0.001f * CFDS; + Falldown = 0; + + Flammable = 0; + Explosive = 0; + Meltable = 0; + Hardness = 0; + + Weight = 1; + + Temperature = 10000.0f +273.15f; + HeatConduct = 5; + Description = "Plasma, extremely hot."; + + State = ST_NONE; + Properties = TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL; + + LowPressure = IPL; + LowPressureTransition = NT; + HighPressure = IPH; + HighPressureTransition = NT; + LowTemperature = ITL; + LowTemperatureTransition = NT; + HighTemperature = ITH; + HighTemperatureTransition = NT; + + Update = &Element_FIRE::update; + Graphics = &Element_PLSM::graphics; +} + +//#TPT-Directive ElementHeader Element_PLSM static int graphics(GRAPHICS_FUNC_ARGS) +int Element_PLSM::graphics(GRAPHICS_FUNC_ARGS) + +{ + int caddress = restrict_flt(restrict_flt((float)cpart->life, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + *colr = (unsigned char)ren->plasma_data[caddress]; + *colg = (unsigned char)ren->plasma_data[caddress+1]; + *colb = (unsigned char)ren->plasma_data[caddress+2]; + + *firea = 255; + *firer = *colr; + *fireg = *colg; + *fireb = *colb; + + *pixel_mode = PMODE_GLOW | PMODE_ADD; //Clear default, don't draw pixel + *pixel_mode |= FIRE_ADD; + //Returning 0 means dynamic, do not cache + return 0; +} + + +Element_PLSM::~Element_PLSM() {}
\ No newline at end of file |
