summaryrefslogtreecommitdiff
path: root/src/simulation/elements/RIME.cpp
blob: 1ff2fade1f015f9f359d563d839851754dfaaac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "simulation/Elements.h"
//#TPT-Directive ElementClass Element_RIME PT_RIME 91
Element_RIME::Element_RIME()
{
    Identifier = "DEFAULT_PT_RIME";
    Name = "RIME";
    Colour = PIXPACK(0xCCCCCC);
    MenuVisible = 1;
    MenuSection = SC_CRACKER2;
    Enabled = 1;
    
    Advection = 0.00f;
    AirDrag = 0.00f * CFDS;
    AirLoss = 0.00f;
    Loss = 1.00f;
    Collision = 0.00f;
    Gravity = 0.0f;
    Diffusion = 0.00f;
    HotAir = 0.000f  * CFDS;
    Falldown = 0;
    
    Flammable = 0;
    Explosive = 0;
    Meltable = 0;
    Hardness = 30;
    
    Weight = 100;
    
    Temperature = 243.15f;
    HeatConduct = 100;
    Description = "Not quite Ice";
    
    State = ST_SOLID;
    Properties = TYPE_SOLID;
    
    LowPressure = IPL;
    LowPressureTransition = NT;
    HighPressure = IPH;
    HighPressureTransition = NT;
    LowTemperature = ITL;
    LowTemperatureTransition = NT;
    HighTemperature = 273.15f;
    HighTemperatureTransition = PT_WATR;
    
    Update = &Element_RIME::update;
    
}

//#TPT-Directive ElementHeader Element_RIME static int update(UPDATE_FUNC_ARGS)
int Element_RIME::update(UPDATE_FUNC_ARGS)
 {
	int r, rx, ry;
	parts[i].vx = 0;
	parts[i].vy = 0;
	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 ((r&0xFF)==PT_SPRK)
				{
					sim->part_change_type(i,x,y,PT_FOG);
					parts[i].life = rand()%50 + 60;
				}
				else if ((r&0xFF)==PT_FOG&&parts[r>>8].life>0)
				{
					sim->part_change_type(i,x,y,PT_FOG);
					parts[i].life = parts[r>>8].life;
				}
			}
	return 0;
}


Element_RIME::~Element_RIME() {}