diff options
| author | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-09 19:23:05 (GMT) |
|---|---|---|
| committer | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-09 19:23:05 (GMT) |
| commit | 144e4bdb6991a042f9b985a9719299f612420dd0 (patch) | |
| tree | 3da5132fc731dea1334048c707f4c074e390a86c /src/elements/acid.c | |
| parent | 56a3ad373c126da22be05e4c5b64a446c7d7dff0 (diff) | |
| download | powder-144e4bdb6991a042f9b985a9719299f612420dd0.zip powder-144e4bdb6991a042f9b985a9719299f612420dd0.tar.gz | |
Begin cleanup of update functions
Diffstat (limited to 'src/elements/acid.c')
| -rw-r--r-- | src/elements/acid.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/elements/acid.c b/src/elements/acid.c index b42379a..18f3891 100644 --- a/src/elements/acid.c +++ b/src/elements/acid.c @@ -1,36 +1,34 @@ #include <powder.h> int update_ACID(UPDATE_FUNC_ARGS) { - int r; - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) + int r,rx,ry; + for (rx=-2; rx<3; rx++) + for (ry=-2; ry<3; ry++) + if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) { - r = pmap[y+ny][x+nx]; + r = pmap[y+ry][x+rx]; if ((r>>8)>=NPART || !r) continue; if ((r&0xFF)!=PT_ACID) { if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) { - parts[i].type = PT_FIRE; + part_change_type(i,x,y,PT_FIRE); + part_change_type(r>>8,x+rx,y+ry,PT_FIRE); parts[i].life = 4; - parts[r>>8].type = PT_FIRE; parts[r>>8].life = 4; } - else if (((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) + else if (((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && ptypes[r&0xFF].hardness>(rand()%1000))&&parts[i].life>=50) { if (parts_avg(i, r>>8,PT_GLAS)!= PT_GLAS) { parts[i].life--; - parts[r>>8].type = PT_NONE; - return 1; + kill_part(r>>8); } } else if (parts[i].life<=50) { - parts[i].life = 0; - parts[i].type = PT_NONE; + kill_part(i); return 1; } } |
