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/GRAV.cpp | |
| parent | fb111f42d00dd8a2041bae970c0913e096ac5101 (diff) | |
| download | powder-51b17badf4c72270bb762ea795d05d51c8b355e3.zip powder-51b17badf4c72270bb762ea795d05d51c8b355e3.tar.gz | |
A bit of refactoring (elements)
Diffstat (limited to 'src/simulation/elements/GRAV.cpp')
| -rw-r--r-- | src/simulation/elements/GRAV.cpp | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/src/simulation/elements/GRAV.cpp b/src/simulation/elements/GRAV.cpp new file mode 100644 index 0000000..ea8ff4d --- /dev/null +++ b/src/simulation/elements/GRAV.cpp @@ -0,0 +1,101 @@ +#include "simulation/Elements.h" +//#TPT-Directive ElementClass Element_GRAV PT_GRAV 102 +Element_GRAV::Element_GRAV() +{ + Identifier = "DEFAULT_PT_GRAV"; + Name = "GRAV"; + Colour = PIXPACK(0xFFE0A0); + MenuVisible = 1; + MenuSection = SC_POWDERS; + Enabled = 1; + + Advection = 0.7f; + AirDrag = 0.00f * CFDS; + AirLoss = 1.00f; + Loss = 1.00f; + Collision = 0.0f; + Gravity = 0.0f; + Diffusion = 0.00f; + HotAir = 0.000f * CFDS; + Falldown = 1; + + Flammable = 10; + Explosive = 0; + Meltable = 0; + Hardness = 30; + + Weight = 85; + + Temperature = R_TEMP+0.0f +273.15f; + HeatConduct = 70; + Description = "Very light dust. Changes colour based on velocity."; + + State = ST_SOLID; + Properties = TYPE_PART; + + LowPressure = IPL; + LowPressureTransition = NT; + HighPressure = IPH; + HighPressureTransition = NT; + LowTemperature = ITL; + LowTemperatureTransition = NT; + HighTemperature = ITH; + HighTemperatureTransition = NT; + + Update = &Element_GRAV::update; + Graphics = &Element_GRAV::graphics; +} + +//#TPT-Directive ElementHeader Element_GRAV static int update(UPDATE_FUNC_ARGS) +int Element_GRAV::update(UPDATE_FUNC_ARGS) + { + /*int t = parts[i].type; + if (t==PT_LOVE) + ISLOVE=1; + else if (t==PT_LOLZ) + ISLOLZ=1; + else if (t==PT_GRAV) + ISGRAV=1;*/ + return 0; +} + + +//#TPT-Directive ElementHeader Element_GRAV static int graphics(GRAPHICS_FUNC_ARGS) +int Element_GRAV::graphics(GRAPHICS_FUNC_ARGS) + +{ + int GRAV_R, GRAV_B, GRAV_G, GRAV_R2, GRAV_B2, GRAV_G2; + *colr = 20; + *colg = 20; + *colb = 20; + if (cpart->vx>0) + { + *colr += (cpart->vx)*GRAV_R; + *colg += (cpart->vx)*GRAV_G; + *colb += (cpart->vx)*GRAV_B; + } + if (cpart->vy>0) + { + *colr += (cpart->vy)*GRAV_G; + *colg += (cpart->vy)*GRAV_B; + *colb += (cpart->vy)*GRAV_R; + + } + if (cpart->vx<0) + { + *colr -= (cpart->vx)*GRAV_B; + *colg -= (cpart->vx)*GRAV_R; + *colb -= (cpart->vx)*GRAV_G; + + } + if (cpart->vy<0) + { + *colr -= (cpart->vy)*GRAV_R2; + *colg -= (cpart->vy)*GRAV_G2; + *colb -= (cpart->vy)*GRAV_B2; + } + return 0; +} + + +Element_GRAV::~Element_GRAV() {}
\ No newline at end of file |
