From 6908f3dd0b65c127b0c3aa665fa1edc71d68ae1c Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Fri, 7 Jan 2011 20:26:09 +0000 Subject: [PATCH] Tidy up. --- includes/powder.h | 2 +- src/elements/isz.c | 20 ++++++++++---------- src/powder.c | 38 ++++++-------------------------------- 3 files changed, 17 insertions(+), 43 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 7b7586732..1b52803b8 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -465,7 +465,7 @@ static const part_type ptypes[PT_NUM] = {"PRTO", PIXPACK(0x0020EB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 0, "Portal OUT. Things come out here. Alter temperature for channels", TYPE_SOLID, &update_PRTO}, {"PSTE", PIXPACK(0xAA99AA), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Colloid, Hardens under pressure", TYPE_LIQUID, NULL}, {"PSTS", PIXPACK(0x776677), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 20, 0, 100, SC_CRACKER, R_TEMP-2.0f +273.15f, 29, "Solid form of PSTE, temporary", TYPE_SOLID, NULL}, - {"ANAR", PIXPACK(0xFFFFEE), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Behaves opposite gravity", TYPE_PART, NULL}, + {"ANAR", PIXPACK(0xFFFFEE), -0.7f, -0.02f * CFDS, 0.96f, 0.80f, 0.1f, -0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Behaves opposite gravity", TYPE_PART, NULL}, {"VINE", PIXPACK(0x079A00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Vine, grows", TYPE_SOLID, &update_VINE}, {"INVS", PIXPACK(0x00CCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Invisible to everything while under pressure.", TYPE_SOLID | PROP_NEUTPASS, NULL}, {"EQVE", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 0, 85, SC_CRACKER2, R_TEMP+0.0f +273.15f, 70, "Shared velocity test", TYPE_PART, NULL}, diff --git a/src/elements/isz.c b/src/elements/isz.c index 56bae102f..3f397a233 100644 --- a/src/elements/isz.c +++ b/src/elements/isz.c @@ -3,15 +3,15 @@ int update_ISZ(UPDATE_FUNC_ARGS) { float rr, rrr; if (1>rand()%200 && ((int)(-4.0f*(pv[y/CELL][x/CELL])))>(rand()%1000)) - { - parts[i].type = PT_PHOT; - rr = (rand()%228+128)/127.0f; - rrr = (rand()%360)*3.14159f/180.0f; - parts[i].life = 680; - parts[i].ctype = 0x3FFFFFFF; - parts[i].vx = rr*cosf(rrr); - parts[i].vy = rr*sinf(rrr); - create_part(i, x, y, PT_PHOT); - } + { + parts[i].type = PT_PHOT; + rr = (rand()%228+128)/127.0f; + rrr = (rand()%360)*3.14159f/180.0f; + parts[i].life = 680; + parts[i].ctype = 0x3FFFFFFF; + parts[i].vx = rr*cosf(rrr); + parts[i].vy = rr*sinf(rrr); + create_part(i, x, y, PT_PHOT); + } return 0; } diff --git a/src/powder.c b/src/powder.c index 7d871088d..b531a6383 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1331,18 +1331,9 @@ void update_particles_i(pixel *vid, int start, int inc) continue; } - vx[y/CELL][x/CELL] *= ptypes[t].airloss; - vy[y/CELL][x/CELL] *= ptypes[t].airloss; - if (t==PT_ANAR) - { - vx[y/CELL][x/CELL] -= ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] -= ptypes[t].airdrag*parts[i].vy; - } - else - { - vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - } + vx[y/CELL][x/CELL] = vx[y/CELL][x/CELL]*ptypes[t].airloss + ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] = vy[y/CELL][x/CELL]*ptypes[t].airloss + ptypes[t].airdrag*parts[i].vy; + if (t==PT_GAS||t==PT_NBLE) { if (pv[y/CELL][x/CELL]<3.5f) @@ -1439,16 +1430,8 @@ void update_particles_i(pixel *vid, int start, int inc) } - if (t==PT_ANAR) - { - parts[i].vx -= ptypes[t].advection*vx[y/CELL][x/CELL] + pGravX; - parts[i].vy -= ptypes[t].advection*vy[y/CELL][x/CELL] + pGravY; - } - else { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + pGravX; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + pGravY; - - } + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + pGravX; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + pGravY; } if (ptypes[t].diffusion) @@ -1720,11 +1703,7 @@ void update_particles_i(pixel *vid, int start, int inc) pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); } } - if (t==PT_PTCT&&parts[i].temp>295.0f) - { - pt = parts[i].temp -= 2.5f; - } - if (t==PT_NTCT&&parts[i].temp>295.0f) + if ((t==PT_PTCT||t==PT_NTCT)&&parts[i].temp>295.0f) { pt = parts[i].temp -= 2.5f; } @@ -2089,11 +2068,6 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - if (t==PT_SWCH) - if ((parts[i].life>0&&parts[i].life<10)|| parts[i].life > 10) - { - parts[i].life--; - } if (t==PT_SPRK) { ct = parts[i].ctype;