1 #include "simulation/ElementCommon.h"
2 
3 static int graphics(GRAPHICS_FUNC_ARGS);
4 
Element_BRAY()5 void Element::Element_BRAY()
6 {
7 	Identifier = "DEFAULT_PT_BRAY";
8 	Name = "BRAY";
9 	Colour = PIXPACK(0xFFFFFF);
10 	MenuVisible = 0;
11 	MenuSection = SC_ELEC;
12 	Enabled = 1;
13 
14 	Advection = 0.0f;
15 	AirDrag = 0.00f * CFDS;
16 	AirLoss = 0.90f;
17 	Loss = 0.00f;
18 	Collision = 0.0f;
19 	Gravity = 0.0f;
20 	Diffusion = 0.00f;
21 	HotAir = 0.000f	* CFDS;
22 	Falldown = 0;
23 
24 	Flammable = 0;
25 	Explosive = 0;
26 	Meltable = 0;
27 	Hardness = 1;
28 
29 	Weight = 100;
30 
31 	HeatConduct = 251;
32 	Description = "Ray Point. Rays create points when they collide.";
33 
34 	Properties = TYPE_SOLID|PROP_LIFE_DEC|PROP_LIFE_KILL;
35 
36 	LowPressure = IPL;
37 	LowPressureTransition = NT;
38 	HighPressure = IPH;
39 	HighPressureTransition = NT;
40 	LowTemperature = ITL;
41 	LowTemperatureTransition = NT;
42 	HighTemperature = ITH;
43 	HighTemperatureTransition = NT;
44 
45 	DefaultProperties.life = 30;
46 
47 	Graphics = &graphics;
48 }
49 
graphics(GRAPHICS_FUNC_ARGS)50 static int graphics(GRAPHICS_FUNC_ARGS)
51 {
52 	int x, trans = 255;
53 	if(cpart->tmp==0)
54 	{
55 		trans = cpart->life * 7;
56 		if (trans>255) trans = 255;
57 		if (cpart->ctype&0x3FFFFFFF) {
58 			*colg = 0;
59 			*colb = 0;
60 			*colr = 0;
61 			for (x=0; x<12; x++) {
62 				*colr += (cpart->ctype >> (x+18)) & 1;
63 				*colb += (cpart->ctype >>  x)	 & 1;
64 			}
65 			for (x=0; x<12; x++)
66 				*colg += (cpart->ctype >> (x+9))  & 1;
67 			x = 624/(*colr+*colg+*colb+1);
68 			*colr *= x;
69 			*colg *= x;
70 			*colb *= x;
71 		}
72 	}
73 	else if(cpart->tmp==1)
74 	{
75 		trans = cpart->life/4;
76 		if (trans>255) trans = 255;
77 		if (cpart->ctype&0x3FFFFFFF) {
78 			*colg = 0;
79 			*colb = 0;
80 			*colr = 0;
81 			for (x=0; x<12; x++) {
82 				*colr += (cpart->ctype >> (x+18)) & 1;
83 				*colb += (cpart->ctype >>  x)	 & 1;
84 			}
85 			for (x=0; x<12; x++)
86 				*colg += (cpart->ctype >> (x+9))  & 1;
87 			x = 624/(*colr+*colg+*colb+1);
88 			*colr *= x;
89 			*colg *= x;
90 			*colb *= x;
91 		}
92 	}
93 	else if(cpart->tmp==2)
94 	{
95 		trans = cpart->life*100;
96 		if (trans>255) trans = 255;
97 		*colr = 255;
98 		*colg = 150;
99 		*colb = 50;
100 	}
101 	*cola = trans;
102 	*pixel_mode &= ~PMODE;
103 	*pixel_mode |= PMODE_BLEND | PMODE_GLOW;
104 	return 0;
105 }
106