From 53bc3b817d712d56053d2210d1ff99fc8b44488b Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Mon, 28 Mar 2011 18:58:27 -0400 Subject: [PATCH] QRTZ grow changes, uses ctype. --- includes/powder.h | 2 +- src/elements/qrtz.c | 63 ++++++++++++++++++++++++++++++--------------- src/powder.c | 2 +- 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 4b9480629..38922ca68 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -504,7 +504,7 @@ static const part_type ptypes[PT_NUM] = {"C-5", PIXPACK(0x2050E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Cold explosive", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE, &update_C5}, {"SING", PIXPACK(0x242424), 0.7f, 0.36f * CFDS, 0.96f, 0.80f, 0.1f, 0.12f, 0.00f, -0.001f * CFDS, 1, 0, 0, 0, 0, 1, 86, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Singularity", ST_SOLID, TYPE_PART, &update_SING}, {"QRTZ", PIXPACK(0xAADDDD), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 3, "Quartz, breakable mineral. Conducts but becomes brittle at lower temperatures.", ST_SOLID, TYPE_SOLID|PROP_HOT_GLOW, &update_QRTZ}, - {"PQRT", PIXPACK(0x88BBBB), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.27f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 3, "Broken quartz.", ST_SOLID, TYPE_PART| PROP_HOT_GLOW, NULL}, + {"PQRT", PIXPACK(0x88BBBB), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.27f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 3, "Broken quartz.", ST_SOLID, TYPE_PART| PROP_HOT_GLOW, &update_QRTZ}, {"SEED", PIXPACK(0xFBEC7D), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B2/S", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, {"MAZE", PIXPACK(0xA8E4A0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B3/S12345", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, {"COAG", PIXPACK(0x9ACD32), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B378/S235678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, diff --git a/src/elements/qrtz.c b/src/elements/qrtz.c index e585361e1..431c46ee4 100644 --- a/src/elements/qrtz.c +++ b/src/elements/qrtz.c @@ -1,14 +1,18 @@ #include int update_QRTZ(UPDATE_FUNC_ARGS) { - 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)) + int r, tmp, trade, rx, ry, np, t; + t = parts[i].type; + if(t == PT_QRTZ) { - part_change_type(i,x,y,PT_PQRT); + 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 (rx=-2; rx<3 && parts[i].ctype!=-1; rx++) for (ry=-2; ry<3; ry++) if (x+rx>=0 && y+ry>0 && x+rxrand()%2500)) { kill_part(r>>8); - parts[i].life ++; + parts[i].ctype ++; } } - if (parts[i].life>0) + if (parts[i].ctype>0) { - for (rx=-1; rx<2; rx++) - for (ry=-1; ry<2; ry++) + for ( trade = 0; trade<5; trade ++) + { + rx = rand()%3-1; + ry = rand()%3-1; if (x+rx>=0 && y+ry>0 && x+rx>8)>=NPART || r || parts[i].life==0) continue; - np = create_part(-1,x+rx,y+ry,PT_QRTZ); - if (np<0) continue; - parts[np].tmp = parts[i].tmp; - parts[i].life = 0; + if ((r>>8)0) + { + parts[np].tmp = parts[i].tmp; + parts[i].ctype = 0; + if(5>rand()%10) + { + parts[np].ctype=-1;//dead qrtz + } + else if(1>rand()%15) + { + parts[i].ctype=-1; + } + + break; + } + } } + } } for ( trade = 0; trade<9; trade ++) { @@ -44,19 +65,19 @@ int update_QRTZ(UPDATE_FUNC_ARGS) { r = pmap[y+ry][x+rx]; if ((r>>8)>=NPART || !r) continue; - if ((r&0xFF)==PT_QRTZ&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion + if ((r&0xFF)==t && (parts[i].ctype>parts[r>>8].ctype) && parts[i].ctype>0 && parts[r>>8].ctype>=0 )//diffusion { - tmp = parts[i].life - parts[r>>8].life; + tmp = parts[i].ctype - parts[r>>8].ctype; if (tmp ==1) { - parts[r>>8].life ++; - parts[i].life --; + parts[r>>8].ctype ++; + parts[i].ctype --; trade = 9; } if (tmp>0) { - parts[r>>8].life += tmp/2; - parts[i].life -= tmp/2; + parts[r>>8].ctype += tmp/2; + parts[i].ctype -= tmp/2; trade = 9; } } diff --git a/src/powder.c b/src/powder.c index d7f1d8c3f..1b839e3ab 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1369,7 +1369,7 @@ void update_particles_i(pixel *vid, int start, int inc) t = parts[i].type; //printf("parts[%d].type: %d\n", i, parts[i].type); - if (parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_STKM && t!=PT_STKM2 && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_SPNG && t!=PT_QRTZ && t!=PT_DEUT && t!=PT_PRTO && t!=PT_PRTI) + if (parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_STKM && t!=PT_STKM2 && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_SPNG && t!=PT_DEUT && t!=PT_PRTO && t!=PT_PRTI) { if (!(parts[i].life==10&&(t==PT_SWCH||t==PT_LCRY||t==PT_PCLN||t==PT_HSWC||t==PT_PUMP))) parts[i].life--;