QRTZ grow changes, uses ctype.

This commit is contained in:
Cracker64 2011-03-28 18:58:27 -04:00 committed by Simon
parent 83590424b0
commit 53bc3b817d
3 changed files with 44 additions and 23 deletions

View File

@ -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},

View File

@ -1,14 +1,18 @@
#include <element.h>
int update_QRTZ(UPDATE_FUNC_ARGS) {
int r, tmp, trade, rx, ry, np;
int r, tmp, trade, rx, ry, np, t;
t = parts[i].type;
if(t == PT_QRTZ)
{
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+rx<XRES && y+ry<YRES && (rx || ry))
{
@ -18,21 +22,38 @@ int update_QRTZ(UPDATE_FUNC_ARGS) {
else if ((r&0xFF)==PT_SLTW && (1>rand()%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<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || r || parts[i].life==0) continue;
if ((r>>8)<NPART && !r && parts[i].ctype!=0)
{
np = create_part(-1,x+rx,y+ry,PT_QRTZ);
if (np<0) continue;
if (np>0)
{
parts[np].tmp = parts[i].tmp;
parts[i].life = 0;
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;
}
}

View File

@ -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--;