diff options
| author | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-07 20:26:09 (GMT) |
|---|---|---|
| committer | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-07 20:26:09 (GMT) |
| commit | 6908f3dd0b65c127b0c3aa665fa1edc71d68ae1c (patch) | |
| tree | 0d66aefad5e67bb025ec71b4592ef6a0096c58f9 /src | |
| parent | b69712bbdbaf32fef65e15141458cb27f9f7ec88 (diff) | |
| download | powder-6908f3dd0b65c127b0c3aa665fa1edc71d68ae1c.zip powder-6908f3dd0b65c127b0c3aa665fa1edc71d68ae1c.tar.gz | |
Tidy up.
Diffstat (limited to 'src')
| -rw-r--r-- | src/elements/isz.c | 20 | ||||
| -rw-r--r-- | src/powder.c | 38 |
2 files changed, 16 insertions, 42 deletions
diff --git a/src/elements/isz.c b/src/elements/isz.c index 56bae10..3f397a2 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 7d87108..b531a63 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; |
