summaryrefslogtreecommitdiff
path: root/src/simulation/elements/EMBR.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-03-13 19:54:34 (GMT)
committer jacob1 <jfu614@gmail.com>2013-03-13 19:54:34 (GMT)
commite493cf8a475baf2032f879b4c37a6b1ac1b51b54 (patch)
tree78d068526f3ea4ed6a2eb5be4c808349b906152e /src/simulation/elements/EMBR.cpp
parent7a055a9d90ea3464bbdc314df423e2aa768ce2be (diff)
downloadpowder-e493cf8a475baf2032f879b4c37a6b1ac1b51b54.zip
powder-e493cf8a475baf2032f879b4c37a6b1ac1b51b54.tar.gz
fix all tab spacing issues in all the element files
Diffstat (limited to 'src/simulation/elements/EMBR.cpp')
-rw-r--r--src/simulation/elements/EMBR.cpp213
1 files changed, 105 insertions, 108 deletions
diff --git a/src/simulation/elements/EMBR.cpp b/src/simulation/elements/EMBR.cpp
index 5ba37c2..754d0e5 100644
--- a/src/simulation/elements/EMBR.cpp
+++ b/src/simulation/elements/EMBR.cpp
@@ -2,125 +2,122 @@
//#TPT-Directive ElementClass Element_EMBR PT_EMBR 147
Element_EMBR::Element_EMBR()
{
-
- //{"EMBR", PIXPACK(0xFFF288), 0.4f, 0.001f * CFDS, 0.99f, 0.90f, 0.0f, 0.07f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 0, 1, 30, SC_EXPLOSIVE, 500.0f +273.15f, 29, "Sparks. Formed by explosions.", ST_NONE, TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL|PROP_SPARKSETTLE, &update_EMBR, &graphics_EMBR},
-
- Identifier = "DEFAULT_PT_EMBR";
- Name = "EMBR";
- Colour = PIXPACK(0xFFF288);
- MenuVisible = 0;
- MenuSection = SC_EXPLOSIVE;
- Enabled = 1;
-
- Advection = 0.4f;
- AirDrag = 0.001f * CFDS;
- AirLoss = 0.99f;
- Loss = 0.90f;
- Collision = 0.0f;
- Gravity = 0.07f;
- Diffusion = 0.00f;
- HotAir = 0.000f * CFDS;
- Falldown = 1;
-
- Flammable = 0;
- Explosive = 0;
- Meltable = 0;
- Hardness = 20;
-
- Weight = 30;
-
- Temperature = 500.0f +273.15f;
- HeatConduct = 29;
- Description = "Sparks. Formed by explosions.";
-
- State = ST_NONE;
- Properties = TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL|PROP_SPARKSETTLE;
-
- LowPressure = IPL;
- LowPressureTransition = NT;
- HighPressure = IPH;
- HighPressureTransition = NT;
- LowTemperature = ITL;
- LowTemperatureTransition = NT;
- HighTemperature = ITH;
- HighTemperatureTransition = NT;
-
- Update = &Element_EMBR::update;
- Graphics = &Element_EMBR::graphics;
+ Identifier = "DEFAULT_PT_EMBR";
+ Name = "EMBR";
+ Colour = PIXPACK(0xFFF288);
+ MenuVisible = 0;
+ MenuSection = SC_EXPLOSIVE;
+ Enabled = 1;
+
+ Advection = 0.4f;
+ AirDrag = 0.001f * CFDS;
+ AirLoss = 0.99f;
+ Loss = 0.90f;
+ Collision = 0.0f;
+ Gravity = 0.07f;
+ Diffusion = 0.00f;
+ HotAir = 0.000f * CFDS;
+ Falldown = 1;
+
+ Flammable = 0;
+ Explosive = 0;
+ Meltable = 0;
+ Hardness = 20;
+
+ Weight = 30;
+
+ Temperature = 500.0f +273.15f;
+ HeatConduct = 29;
+ Description = "Sparks. Formed by explosions.";
+
+ State = ST_NONE;
+ Properties = TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL|PROP_SPARKSETTLE;
+
+ LowPressure = IPL;
+ LowPressureTransition = NT;
+ HighPressure = IPH;
+ HighPressureTransition = NT;
+ LowTemperature = ITL;
+ LowTemperatureTransition = NT;
+ HighTemperature = ITH;
+ HighTemperatureTransition = NT;
+
+ Update = &Element_EMBR::update;
+ Graphics = &Element_EMBR::graphics;
}
//#TPT-Directive ElementHeader Element_EMBR static int update(UPDATE_FUNC_ARGS)
int Element_EMBR::update(UPDATE_FUNC_ARGS) {
- int r, rx, ry, nb;
- for (rx=-1; rx<2; rx++)
- for (ry=-1; ry<2; ry++)
- if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
- {
- r = pmap[y+ry][x+rx];
- if (!r)
- continue;
- if ((sim->elements[r&0xFF].Properties & (TYPE_SOLID | TYPE_PART | TYPE_LIQUID)) && !(sim->elements[r&0xFF].Properties & PROP_SPARKSETTLE))
- {
- sim->kill_part(i);
- return 1;
- }
- }
- return 0;
+ int r, rx, ry, nb;
+ for (rx=-1; rx<2; rx++)
+ for (ry=-1; ry<2; ry++)
+ if (BOUNDS_CHECK && (rx || ry))
+ {
+ r = pmap[y+ry][x+rx];
+ if (!r)
+ continue;
+ if ((sim->elements[r&0xFF].Properties & (TYPE_SOLID | TYPE_PART | TYPE_LIQUID)) && !(sim->elements[r&0xFF].Properties & PROP_SPARKSETTLE))
+ {
+ sim->kill_part(i);
+ return 1;
+ }
+ }
+ return 0;
}
//#TPT-Directive ElementHeader Element_EMBR static int graphics(GRAPHICS_FUNC_ARGS)
int Element_EMBR::graphics(GRAPHICS_FUNC_ARGS)
{
- if (cpart->ctype&0xFFFFFF)
- {
- int maxComponent;
- *colr = (cpart->ctype&0xFF0000)>>16;
- *colg = (cpart->ctype&0x00FF00)>>8;
- *colb = (cpart->ctype&0x0000FF);
- maxComponent = *colr;
+ if (cpart->ctype&0xFFFFFF)
+ {
+ int maxComponent;
+ *colr = (cpart->ctype&0xFF0000)>>16;
+ *colg = (cpart->ctype&0x00FF00)>>8;
+ *colb = (cpart->ctype&0x0000FF);
+ maxComponent = *colr;
- if (*colg>maxComponent) maxComponent = *colg;
- if (*colb>maxComponent) maxComponent = *colb;
- if (maxComponent<60)//make sure it isn't too dark to see
- {
- float multiplier = 60.0f/maxComponent;
- *colr *= multiplier;
- *colg *= multiplier;
- *colb *= multiplier;
- }
- }
- else if (cpart->tmp != 0)
- {
- *colr = *colg = *colb = 255;
- }
+ if (*colg>maxComponent) maxComponent = *colg;
+ if (*colb>maxComponent) maxComponent = *colb;
+ if (maxComponent<60)//make sure it isn't too dark to see
+ {
+ float multiplier = 60.0f/maxComponent;
+ *colr *= multiplier;
+ *colg *= multiplier;
+ *colb *= multiplier;
+ }
+ }
+ else if (cpart->tmp != 0)
+ {
+ *colr = *colg = *colb = 255;
+ }
- if (ren->decorations_enable && cpart->dcolour)
- {
- int a = (cpart->dcolour>>24)&0xFF;
- *colr = (a*((cpart->dcolour>>16)&0xFF) + (255-a)**colr) >> 8;
- *colg = (a*((cpart->dcolour>>8)&0xFF) + (255-a)**colg) >> 8;
- *colb = (a*((cpart->dcolour)&0xFF) + (255-a)**colb) >> 8;
- }
- *firer = *colr;
- *fireg = *colg;
- *fireb = *colb;
- if (cpart->tmp==1)
- {
- *pixel_mode = FIRE_ADD | PMODE_BLEND | PMODE_GLOW;
- *firea = (cpart->life-15)*4;
- *cola = (cpart->life+15)*4;
- }
- else if (cpart->tmp==2)
- {
- *pixel_mode = PMODE_FLAT | FIRE_ADD;
- *firea = 255;
- }
- else
- {
- *pixel_mode = PMODE_SPARK | PMODE_ADD;
- if (cpart->life<64) *cola = 4*cpart->life;
- }
- return 0;
+ if (ren->decorations_enable && cpart->dcolour)
+ {
+ int a = (cpart->dcolour>>24)&0xFF;
+ *colr = (a*((cpart->dcolour>>16)&0xFF) + (255-a)**colr) >> 8;
+ *colg = (a*((cpart->dcolour>>8)&0xFF) + (255-a)**colg) >> 8;
+ *colb = (a*((cpart->dcolour)&0xFF) + (255-a)**colb) >> 8;
+ }
+ *firer = *colr;
+ *fireg = *colg;
+ *fireb = *colb;
+ if (cpart->tmp==1)
+ {
+ *pixel_mode = FIRE_ADD | PMODE_BLEND | PMODE_GLOW;
+ *firea = (cpart->life-15)*4;
+ *cola = (cpart->life+15)*4;
+ }
+ else if (cpart->tmp==2)
+ {
+ *pixel_mode = PMODE_FLAT | FIRE_ADD;
+ *firea = 255;
+ }
+ else
+ {
+ *pixel_mode = PMODE_SPARK | PMODE_ADD;
+ if (cpart->life<64) *cola = 4*cpart->life;
+ }
+ return 0;
}
Element_EMBR::~Element_EMBR() {}