summaryrefslogtreecommitdiff
path: root/src/elements/fog.c
blob: 59c432f0ba4589f544f68b3d9d3d1608a3f88c25 (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
#include <powder.h>

int update_FOG(UPDATE_FUNC_ARGS) {
	int r;
	if (parts[i].temp>=373.15)
		parts[i].type = PT_WTRV;
	for (nx=-1; nx<2; nx++)
		for (ny=-1; ny<2; ny++)
			if (x+nx>=0 && y+ny>0 &&
			        x+nx<XRES && y+ny<YRES && (nx || ny))
			{
				r = pmap[y+ny][x+nx];
				if ((r>>8)>=NPART || !r)
					continue;
				if (pstates[parts[r>>8].type].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!(parts[r>>8].type==PT_CLNE||parts[r>>8].type==PT_PCLN))
				{
					parts[i].type = PT_RIME;
				}
				if (parts[r>>8].type==PT_SPRK)
				{
					parts[i].life += rand()%20;
				}
			}
	return 0;
}