From 7bfe412e2946266be1aa409029c552768765fcc1 Mon Sep 17 00:00:00 2001 From: Cate Date: Thu, 24 Mar 2011 14:50:27 -0400 Subject: [PATCH] Cracker suggestion, fixed newly generated Quartz to always have color of previous particle it was created from. Makes cool patterns. Also increased speed. --- src/elements/qrtz.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/elements/qrtz.c b/src/elements/qrtz.c index 6e3d2e206..d40b06d4c 100644 --- a/src/elements/qrtz.c +++ b/src/elements/qrtz.c @@ -1,14 +1,13 @@ #include 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>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; }