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/LIFE.cpp | |
| parent | fb111f42d00dd8a2041bae970c0913e096ac5101 (diff) | |
| download | powder-51b17badf4c72270bb762ea795d05d51c8b355e3.zip powder-51b17badf4c72270bb762ea795d05d51c8b355e3.tar.gz | |
A bit of refactoring (elements)
Diffstat (limited to 'src/simulation/elements/LIFE.cpp')
| -rw-r--r-- | src/simulation/elements/LIFE.cpp | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/src/simulation/elements/LIFE.cpp b/src/simulation/elements/LIFE.cpp new file mode 100644 index 0000000..84cec67 --- /dev/null +++ b/src/simulation/elements/LIFE.cpp @@ -0,0 +1,106 @@ +#include "simulation/Elements.h" +//#TPT-Directive ElementClass Element_LIFE PT_LIFE 78 +Element_LIFE::Element_LIFE() +{ + Identifier = "DEFAULT_PT_LIFE"; + Name = "LIFE"; + Colour = PIXPACK(0x0CAC00); + MenuVisible = 0; + MenuSection = SC_LIFE; + Enabled = 1; + + Advection = 0.0f; + AirDrag = 0.00f * CFDS; + AirLoss = 0.90f; + Loss = 0.00f; + Collision = 0.0f; + Gravity = 0.0f; + Diffusion = 0.00f; + HotAir = 0.000f * CFDS; + Falldown = 0; + + Flammable = 0; + Explosive = 0; + Meltable = 0; + Hardness = 0; + + Weight = 100; + + Temperature = 9000.0f; + HeatConduct = 40; + Description = "Game Of Life! B3/S23"; + + State = ST_NONE; + Properties = TYPE_SOLID|PROP_LIFE; + + LowPressure = IPL; + LowPressureTransition = NT; + HighPressure = IPH; + HighPressureTransition = NT; + LowTemperature = ITL; + LowTemperatureTransition = NT; + HighTemperature = ITH; + HighTemperatureTransition = NT; + + Update = NULL; + Graphics = &Element_LIFE::graphics; +} + +//#TPT-Directive ElementHeader Element_LIFE static int graphics(GRAPHICS_FUNC_ARGS) +int Element_LIFE::graphics(GRAPHICS_FUNC_ARGS) + +{ + pixel pc; + if (cpart->ctype==NGT_LOTE)//colors for life states + { + if (cpart->tmp==2) + pc = PIXRGB(255, 128, 0); + else if (cpart->tmp==1) + pc = PIXRGB(255, 255, 0); + else + pc = PIXRGB(255, 0, 0); + } + else if (cpart->ctype==NGT_FRG2)//colors for life states + { + if (cpart->tmp==2) + pc = PIXRGB(0, 100, 50); + else + pc = PIXRGB(0, 255, 90); + } + else if (cpart->ctype==NGT_STAR)//colors for life states + { + if (cpart->tmp==4) + pc = PIXRGB(0, 0, 128); + else if (cpart->tmp==3) + pc = PIXRGB(0, 0, 150); + else if (cpart->tmp==2) + pc = PIXRGB(0, 0, 190); + else if (cpart->tmp==1) + pc = PIXRGB(0, 0, 230); + else + pc = PIXRGB(0, 0, 70); + } + else if (cpart->ctype==NGT_FROG)//colors for life states + { + if (cpart->tmp==2) + pc = PIXRGB(0, 100, 0); + else + pc = PIXRGB(0, 255, 0); + } + else if (cpart->ctype==NGT_BRAN)//colors for life states + { + if (cpart->tmp==1) + pc = PIXRGB(150, 150, 0); + else + pc = PIXRGB(255, 255, 0); + } else { + pc = PIXRGB(255, 255, 0);//sim->gmenu[cpart->ctype].colour; + } + *colr = PIXR(pc); + *colg = PIXG(pc); + *colb = PIXB(pc); + return 0; +} + + +Element_LIFE::~Element_LIFE() {}
\ No newline at end of file |
