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/Element.cpp | |
| parent | fb111f42d00dd8a2041bae970c0913e096ac5101 (diff) | |
| download | powder-51b17badf4c72270bb762ea795d05d51c8b355e3.zip powder-51b17badf4c72270bb762ea795d05d51c8b355e3.tar.gz | |
A bit of refactoring (elements)
Diffstat (limited to 'src/simulation/elements/Element.cpp')
| -rw-r--r-- | src/simulation/elements/Element.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/simulation/elements/Element.cpp b/src/simulation/elements/Element.cpp new file mode 100644 index 0000000..44e7251 --- /dev/null +++ b/src/simulation/elements/Element.cpp @@ -0,0 +1,69 @@ +#include "simulation/Elements.h" + +Element::Element(): + Identifier("DEFAULT_INVALID"), + Name(""), + Colour(PIXPACK(0xFFFFFF)), + MenuVisible(0), + MenuSection(0), + Enabled(0), + + Advection(0.0f), + AirDrag(-0.0f * CFDS), + AirLoss(1.0f), + Loss(1.0f), + Collision(0.0f), + Gravity(0.0f), + Diffusion(0.0f), + HotAir(0.0f * CFDS), + Falldown(0), + + Flammable(0), + Explosive(0), + Meltable(0), + Hardness(30), + + Weight(50), + + Temperature(273.15f), + HeatConduct(128), + Description("No description"), + + State(ST_SOLID), + Properties(TYPE_SOLID), + + LowPressure(IPL), + LowPressureTransition(NT), + HighPressure(IPH), + HighPressureTransition(NT), + LowTemperature(ITL), + LowTemperatureTransition(NT), + HighTemperature(ITH), + HighTemperatureTransition(NT), + + Update(NULL), + Graphics(&Element::defaultGraphics) +{ +} + +int Element::defaultGraphics(GRAPHICS_FUNC_ARGS) +{ + int t = cpart->type; + //Property based defaults + if(ren->sim->elements[t].Properties & PROP_RADIOACTIVE) *pixel_mode |= PMODE_GLOW; + if(ren->sim->elements[t].Properties & TYPE_LIQUID) + { + *pixel_mode |= PMODE_BLUR; + } + if(ren->sim->elements[t].Properties & TYPE_GAS) + { + *pixel_mode &= ~PMODE; + *pixel_mode |= FIRE_BLEND; + *firer = *colr/2; + *fireg = *colg/2; + *fireb = *colb/2; + *firea = 125; + *pixel_mode |= DECO_FIRE; + } + return 1; +}
\ No newline at end of file |
