summaryrefslogtreecommitdiff
path: root/src/simulation/elements/GRAV.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-11-17 19:44:09 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-11-17 19:44:09 (GMT)
commit058a2edd75debbd0297f92572316daa704bd379f (patch)
treead303f091f9a08b209b91eb34a9fcad996a3de69 /src/simulation/elements/GRAV.cpp
parente3594aba9e05c6865d396418c028049cda92c2f3 (diff)
parent7a21ae192fe19868539956f3fe28e62b2c7c4429 (diff)
downloadpowder-058a2edd75debbd0297f92572316daa704bd379f.zip
powder-058a2edd75debbd0297f92572316daa704bd379f.tar.gz
Merge branch 'master' of github.com:FacialTurd/PowderToypp
Diffstat (limited to 'src/simulation/elements/GRAV.cpp')
-rw-r--r--src/simulation/elements/GRAV.cpp111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/simulation/elements/GRAV.cpp b/src/simulation/elements/GRAV.cpp
new file mode 100644
index 0000000..b913a28
--- /dev/null
+++ b/src/simulation/elements/GRAV.cpp
@@ -0,0 +1,111 @@
+#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;
+}
+
+int lastIndex;
+
+//#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;
+
+ GRAV_R = std::abs((ren->sim->currentTick%120)-60);
+ GRAV_G = std::abs(((ren->sim->currentTick+60)%120)-60);
+ GRAV_B = std::abs(((ren->sim->currentTick+120)%120)-60);
+ GRAV_R2 = std::abs((ren->sim->currentTick%60)-30);
+ GRAV_G2 = std::abs(((ren->sim->currentTick+30)%60)-30);
+ GRAV_B2 = std::abs(((ren->sim->currentTick+60)%60)-30);
+
+
+ *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