diff options
| author | Cate <cate@cate-6sh2.(none)> | 2011-07-11 18:09:34 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-07-12 13:00:21 (GMT) |
| commit | 0ce4104c7aacd6151d52a0b11a36e315cf8a5a67 (patch) | |
| tree | fd99304bfe55207fe3ebe8d989d578aadec68d25 /src | |
| parent | 0858b18255a5a31de7ebc677b6d36c73a43652d8 (diff) | |
| download | powder-0ce4104c7aacd6151d52a0b11a36e315cf8a5a67.zip powder-0ce4104c7aacd6151d52a0b11a36e315cf8a5a67.tar.gz | |
Added CLST element, which is Clay dust, for making concrete with water. :D Neat due to element cohesion with itself, which causes it to sludge downwards in a way very uncharacteristic of any current powder. Cohesion is very easy to modify. Thanks to Savask for help with cohesion code. :D
Diffstat (limited to 'src')
| -rw-r--r-- | src/elements/clst.c | 23 | ||||
| -rw-r--r-- | src/graphics.c | 11 | ||||
| -rw-r--r-- | src/powder.c | 2 |
3 files changed, 36 insertions, 0 deletions
diff --git a/src/elements/clst.c b/src/elements/clst.c new file mode 100644 index 0000000..db0eb7c --- /dev/null +++ b/src/elements/clst.c @@ -0,0 +1,23 @@ +#include <element.h> + +int update_CLST(UPDATE_FUNC_ARGS) { + int r, rx, ry; + for (rx=-2; rx<3; rx++) + for (ry=-2; ry<3; ry++) + if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) + { + r = pmap[y+ry][x+rx]; + if ((r>>8)>=NPART || !r) + continue; + if ((r&0xFF)==PT_WATR && 1>(rand()%1500)) + { + part_change_type(i,x,y,PT_PSTS); + kill_part(r>>8); + } + if ((r&0xFF)==PT_CLST) + { + parts[i].vx += 0.01*rx; parts[i].vy += 0.01*ry; + } + } + return 0; +} diff --git a/src/graphics.c b/src/graphics.c index 1f3865e..ecc6b4a 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -2052,6 +2052,17 @@ void draw_parts(pixel *vid) blendpixel(vid, nx, ny, cr, cg, cb, 255); } } + else if (t==PT_CLST) + { + int z = parts[i].tmp - 5;//speckles! + cr = z * 16 + PIXR(ptypes[t].pcolors); + cg = z * 16 + PIXG(ptypes[t].pcolors); + cb = z * 16 + PIXB(ptypes[t].pcolors); + cr = cr>255?255:cr; + cg = cg>255?255:cg; + cb = cb>255?255:cb; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + } else if (t==PT_SPNG) { cr = PIXR(ptypes[t].pcolors) - parts[i].life*15; diff --git a/src/powder.c b/src/powder.c index 1db8b3a..e1457c7 100644 --- a/src/powder.c +++ b/src/powder.c @@ -851,6 +851,8 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a parts[i].tmp = (rand()%11); if (t==PT_PQRT) parts[i].tmp = (rand()%11); + if (t==PT_CLST) + parts[i].tmp = (rand()%7); if (t==PT_FSEP) parts[i].life = 50; if (t==PT_COAL) { |
