diff options
| author | Cate <cate@Catelite.(none)> | 2011-03-24 18:50:27 (GMT) |
|---|---|---|
| committer | Simon <simon@hardwired.org.uk> | 2011-03-24 20:09:32 (GMT) |
| commit | 7bfe412e2946266be1aa409029c552768765fcc1 (patch) | |
| tree | db1ac13bfbaa4bb033b19f3a77ad7f3fdfc0ca32 /src/elements | |
| parent | bb0907bc96316565c3582580bc0af3c09844bb26 (diff) | |
| download | powder-7bfe412e2946266be1aa409029c552768765fcc1.zip powder-7bfe412e2946266be1aa409029c552768765fcc1.tar.gz | |
Cracker suggestion, fixed newly generated Quartz to always have color of previous particle it was created from. Makes cool patterns. Also increased speed.
Diffstat (limited to 'src/elements')
| -rw-r--r-- | src/elements/qrtz.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/elements/qrtz.c b/src/elements/qrtz.c index 6e3d2e2..d40b06d 100644 --- a/src/elements/qrtz.c +++ b/src/elements/qrtz.c @@ -1,14 +1,13 @@ #include <element.h> int update_QRTZ(UPDATE_FUNC_ARGS) { - int r, tmp, trade, rx, ry; + int r, tmp, trade, rx, ry, np; parts[i].pavg[0] = parts[i].pavg[1]; parts[i].pavg[1] = pv[y/CELL][x/CELL]; if (parts[i].pavg[1]-parts[i].pavg[0] > 0.05*(parts[i].temp/3) || parts[i].pavg[1]-parts[i].pavg[0] < -0.05*(parts[i].temp/3)) { part_change_type(i,x,y,PT_PQRT); } - 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)) @@ -16,14 +15,13 @@ int update_QRTZ(UPDATE_FUNC_ARGS) { r = pmap[y+ry][x+rx]; if ((r>>8)>=NPART || !r) continue; - else if ((r&0xFF)==PT_SLTW && (1>rand()%5000)) + else if ((r&0xFF)==PT_SLTW && (1>rand()%2500)) { kill_part(r>>8); parts[i].life = 1; } } - if (parts[i].life==1) { for (rx=-1; rx<2; rx++) @@ -33,14 +31,12 @@ int update_QRTZ(UPDATE_FUNC_ARGS) { r = pmap[y+ry][x+rx]; if ((r>>8)>=NPART || r) continue; - create_part(-1,x+rx,y+ry,PT_QRTZ); + np = create_part(-1,x+rx,y+ry,PT_QRTZ); + if (np<0) continue; + parts[np].tmp = parts[i].tmp; parts[i].life = 0; } - - } - - for ( trade = 0; trade<9; trade ++) { rx = rand()%5-2; @@ -68,7 +64,5 @@ int update_QRTZ(UPDATE_FUNC_ARGS) { } } } - - return 0; } |
