diff options
| author | Cracker64 <cracker642@gmail.com> | 2010-12-04 17:24:54 (GMT) |
|---|---|---|
| committer | Cracker64 <cracker642@gmail.com> | 2010-12-04 17:24:54 (GMT) |
| commit | d56684312dd9429da8be8666206ad1656d3185a9 (patch) | |
| tree | d8db260b8b24c1e193bc6a76700cb1de374ed7ef /src | |
| parent | 01a2dcaf419b207702d959a5016107674c636325 (diff) | |
| download | powder-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')
| -rw-r--r-- | src/graphics.c | 32 | ||||
| -rw-r--r-- | src/interface.c | 7 | ||||
| -rw-r--r-- | src/main.c | 4 | ||||
| -rw-r--r-- | src/powder.c | 45 |
4 files changed, 84 insertions, 4 deletions
diff --git a/src/graphics.c b/src/graphics.c index ed1a4b3..1af3f9b 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1409,6 +1409,29 @@ void draw_parts(pixel *vid) cb = PIXB(ptypes[t].pcolors); blendpixel(vid, nx, ny, cr, cg, cb, 255); } + if(cmode==CM_GRAD) + { + float frequency = 0.05; + int q = parts[i].temp; + cr = sin(frequency*q) * 16 + PIXR(ptypes[t].pcolors); + cg = sin(frequency*q) * 16 + PIXG(ptypes[t].pcolors); + cb = sin(frequency*q) * 16 + PIXB(ptypes[t].pcolors); + if(cr>=255) + cr = 255; + if(cg>=255) + cg = 255; + if(cb>=255) + cb = 255; + if(cr<=0) + cr = 0; + if(cg<=0) + cg = 0; + if(cb<=0) + cb = 0; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + + + } else if(t==PT_MWAX&&cmode == CM_FANCY) { for(x=-1; x<=1; x++) @@ -1539,6 +1562,15 @@ void draw_parts(pixel *vid) cb=255; blendpixel(vid, nx, ny, cr, cg, cb, 255); } + else if(t==PT_WIFI) + { + float frequency = 0.25; + int q = parts[i].tmp; + cr = sin(frequency*q + 0) * 127 + 128; + cg = sin(frequency*q + 2) * 127 + 128; + cb = sin(frequency*q + 4) * 127 + 128; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + } else if(t==PT_PIPE) { if(parts[i].ctype==2) diff --git a/src/interface.c b/src/interface.c index a4ecc8f..3937ec8 100644 --- a/src/interface.c +++ b/src/interface.c @@ -550,10 +550,15 @@ void draw_svf_ui(pixel *vid_buf) break; case CM_FANCY: drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255); + break; case CM_NOTHING: drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255); + break; case CM_CRACK: drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255); + break; + case CM_GRAD: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255); break; } drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); @@ -1814,6 +1819,8 @@ void set_cmode(int cm) strcpy(itc_msg, "Nothing Display"); else if(cmode==CM_CRACK) strcpy(itc_msg, "Alternate Velocity Display"); + else if(cmode==CM_GRAD) + strcpy(itc_msg, "Heat Gradient Display"); else strcpy(itc_msg, "Velocity Display"); } @@ -1307,6 +1307,10 @@ int main(int argc, char *argv[]) { set_cmode(CM_CRACK); } + if(sdl_key=='0') + { + set_cmode(CM_GRAD); + } if(sdl_key==SDLK_TAB) { CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ; 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++) |
