diff options
| author | lieuwe <lieuwe@mint> | 2011-07-28 22:30:15 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-08-08 12:32:04 (GMT) |
| commit | 50c4bfd86d66c805097f4a12fb12ee8094cc2c5f (patch) | |
| tree | 95393718a34dcb04e72deef29cb9290427d0b47f /src | |
| parent | 15b4ba7532966da0bb9672c94c97d482271c7906 (diff) | |
| download | powder-50c4bfd86d66c805097f4a12fb12ee8094cc2c5f.zip powder-50c4bfd86d66c805097f4a12fb12ee8094cc2c5f.tar.gz | |
Y U NO WORK. added logic for WIRE but it's not being called.
Diffstat (limited to 'src')
| -rw-r--r-- | src/elements/wire.c | 32 | ||||
| -rw-r--r-- | src/graphics.c | 10 |
2 files changed, 42 insertions, 0 deletions
diff --git a/src/elements/wire.c b/src/elements/wire.c new file mode 100644 index 0000000..da41bd1 --- /dev/null +++ b/src/elements/wire.c @@ -0,0 +1,32 @@ +#include <element.h> + +int update_WIRE(UPDATE_FUNC_ARGS) { + int s,r,rx,ry,count; + printf("FUCK"); + s=pmap[y][x]; + /* + 0: wire + 1: spark head + 2: spark tail + + tmp is previous state, ctype is current state + */ + parts[s>>8].tmp=parts[s>>8].ctype; + if(parts[s>>8].tmp==1){parts[s>>8].ctype=2;} + if(parts[s>>8].tmp==2){parts[s>>8].ctype=0;} + + for(rx=-1; rx<2; rx++) + for(ry=-1; ry<2; ry++) + { + count=0; + if(x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && pmap[y+ry][x+rx] && rx==0 && ry==0 && (pmap[y+ry][x+rx]&0xFF)!=0xFF) + { + r = pmap[y+ry][x+rx]; + if((r&0xFF)==PT_SPRK){parts[s>>8].ctype=1;} + if((r&0xFF)==PT_WIRE && parts[r>>8].tmp==1){count++;} + } + if(count==1 || count==2) + parts[s>>8].ctype=1; + } + return 0; +} diff --git a/src/graphics.c b/src/graphics.c index 3cd3b8d..ed60df1 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1723,6 +1723,16 @@ void draw_parts(pixel *vid) if ((parts[i].ctype&7) == 7) draw_line(vid, nx, ny, (int)(parts[parts[i].tmp].x+0.5f), (int)(parts[parts[i].tmp].y+0.5f), 245, 245, 220, XRES+BARSIZE); } + + if(t==PT_WIRE) + { + if (parts[i].ctype==0) + blendpixel(vid, nx, ny, 255, 204, 0, 255); + else if(parts[i].ctype==1) + blendpixel(vid, nx, ny, 0, 0, 255, 255); + else + blendpixel(vid, nx, ny, 255, 255, 255, 255); + } if (cmode!=CM_HEAT) { |
