summaryrefslogtreecommitdiff
path: root/src/powder.c
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2010-12-04 17:24:54 (GMT)
committer Cracker64 <cracker642@gmail.com>2010-12-04 17:24:54 (GMT)
commitd56684312dd9429da8be8666206ad1656d3185a9 (patch)
treed8db260b8b24c1e193bc6a76700cb1de374ed7ef /src/powder.c
parent01a2dcaf419b207702d959a5016107674c636325 (diff)
downloadpowder-d56684312dd9429da8be8666206ad1656d3185a9.zip
powder-d56684312dd9429da8be8666206ad1656d3185a9.tar.gz
WIFI, a wireless SPRK transmitter, has 25 'channels' controlled by temp. starting at 0C, every 100 degrees is a different channel, they are colored as well. Heat-gradient display, colors of elements is slightly changed based on temp. maybe some other fixes.
Diffstat (limited to 'src/powder.c')
-rw-r--r--src/powder.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/powder.c b/src/powder.c
index dbf05b0..ff5b926 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1112,8 +1112,16 @@ void update_particles_i(pixel *vid, int start, int inc)
gol2[nx][ny][z] = 0;
}
}
- if(CGOL==0)
- CGOL++;
+ if(ISWIRE==1)
+ {
+ CGOL = 0;
+ ISWIRE = 0;
+ }
+ if(CGOL==1)
+ {
+ for(int q = 0;q<25;q++)
+ wireless[q] = 0;
+ }
for(i=start; i<(NPART-starti); i+=inc)
if(parts[i].type)
{
@@ -2817,12 +2825,12 @@ void update_particles_i(pixel *vid, int start, int inc)
}
else if(t==PT_INST2)
{
- if(parts[i].life%4==0)
+ if(parts[i].life%4<=1)
t = parts[pmap[y][x]>>8].type=PT_INST;
}
else if(t==PT_INST3)
{
- if(parts[i].life%4!=0)
+ if(parts[i].life%4<=1)
t = parts[pmap[y][x]>>8].type=PT_INST;
}
else if(t==PT_PRTI)
@@ -2894,6 +2902,35 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
+ else if(t==PT_WIFI)
+ {
+ CGOL = 1;
+ int temprange = 100;
+ for(int temp = 0; temp < 2500; temp += temprange)
+ if(parts[i].temp-273.15>temp&&parts[i].temp-273.15<temp+temprange)
+ parts[i].tmp = temp/100;
+ for(ny=-1; ny<2; ny++)
+ for(nx=-1; nx<2; nx++)
+ 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(parts[r>>8].type==PT_NSCN&&parts[r>>8].life==0 && wireless[parts[i].tmp])
+ {
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].ctype = PT_NSCN;
+ parts[r>>8].life = 4;
+ }
+ else if(parts[r>>8].type==PT_SPRK && parts[r>>8].ctype!=PT_NSCN && parts[r>>8].life>=3 && !wireless[parts[i].tmp])
+ {
+ parts[r>>8].type = parts[r>>8].ctype;
+ wireless[parts[i].tmp] = 1;
+ ISWIRE = 1;
+ }
+ }
+ }
else if(t==PT_PCLN)
{
for(nx=-2; nx<3; nx++)