diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2011-08-18 12:44:09 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-08-19 11:23:38 (GMT) |
| commit | 961a393c7a20166277c10aebde43e7563951773a (patch) | |
| tree | 835f2ba00af186cd8577ad0edbecf2569700a4b9 /src | |
| parent | 34abbcc84ccbefac065a8c7afd62ce272b3e51ec (diff) | |
| download | powder-961a393c7a20166277c10aebde43e7563951773a.zip powder-961a393c7a20166277c10aebde43e7563951773a.tar.gz | |
Modify GBMB to only use life
tmp not needed, since it doesn't create powder during an explosion like BOMB does.
Diffstat (limited to 'src')
| -rw-r--r-- | src/elements/gbmb.c | 31 | ||||
| -rw-r--r-- | src/graphics.c | 8 | ||||
| -rw-r--r-- | src/powder.c | 5 |
3 files changed, 22 insertions, 22 deletions
diff --git a/src/elements/gbmb.c b/src/elements/gbmb.c index 30baf7b..d1d45b9 100644 --- a/src/elements/gbmb.c +++ b/src/elements/gbmb.c @@ -1,23 +1,26 @@ #include <element.h> int update_GBMB(UPDATE_FUNC_ARGS) { int rx,ry,r; - for (rx=-2; rx<3; rx++) - for (ry=-2; ry<3; ry++){ + if (parts[i].life<=0) + { + for (rx=-2; rx<3; rx++) + for (ry=-2; ry<3; ry++) + { r = pmap[y+ry][x+rx]; - if(r && (r>>8)<NPART) - if((r&0xFF)!=PT_BOMB&& - (r&0xFF)!=PT_GBMB&& - (r&0xFF)!=PT_CLNE&& - (r&0xFF)!=PT_PCLN&& - (r&0xFF)!=PT_DMND&& - !parts[i].tmp){ + if(!r || (r>>8)>=NPART) + continue; + if((r&0xFF)!=PT_BOMB && (r&0xFF)!=PT_GBMB && + (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && + (r&0xFF)!=PT_DMND) + { parts[i].life=60; - parts[i].tmp = 1; - } + break; } + } + } if(parts[i].life>20) - gravmap[y/CELL][x/CELL] = 20; + gravmap[y/CELL][x/CELL] = 20; if(parts[i].life<20 && parts[i].life>=1) - gravmap[y/CELL][x/CELL] = -80; -return 0; + gravmap[y/CELL][x/CELL] = -80; + return 0; } diff --git a/src/graphics.c b/src/graphics.c index 6225c6f..233a178 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -3255,7 +3255,7 @@ void draw_parts(pixel *vid) } else if (t==PT_GBMB) { - if (parts[i].tmp==0) { + if (parts[i].life<=0) {//not yet detonated cr = PIXR(ptypes[t].pcolors); cg = PIXG(ptypes[t].pcolors); cb = PIXB(ptypes[t].pcolors); @@ -3285,7 +3285,7 @@ void draw_parts(pixel *vid) blendpixel(vid, nx, ny, cr, cg, cb, 255); } } - else if (parts[i].tmp==1) { + else {//exploding cr = PIXR(ptypes[t].pcolors); cg = PIXG(ptypes[t].pcolors); cb = PIXB(ptypes[t].pcolors); @@ -3305,10 +3305,6 @@ void draw_parts(pixel *vid) blendpixel(vid, nx, ny, cr, cg, cb, 255); } } - else { - blendpixel(vid, nx, ny, 255, 255, 255, 255); - } - } else if (ptypes[t].properties&PROP_HOT_GLOW && parts[i].temp>(ptransitions[t].thv-800.0f)) { diff --git a/src/powder.c b/src/powder.c index abff116..9433aea 100644 --- a/src/powder.c +++ b/src/powder.c @@ -336,6 +336,9 @@ int try_move(int i, int x, int y, int nx, int ny) if ((bmap[y/CELL][x/CELL]==WL_EHOLE && !emap[y/CELL][x/CELL]) && !(bmap[ny/CELL][nx/CELL]==WL_EHOLE && !emap[ny/CELL][nx/CELL])) return 0; + if(parts[i].type==PT_GBMB&&parts[i].life>0) + return 0; + e = r >> 8; //e is now the particle number at r (pmap[ny][nx]) if (r && e<NPART)//the swap part, if we make it this far, swap { @@ -364,8 +367,6 @@ int try_move(int i, int x, int y, int nx, int ny) parts[e].y += y-ny; pmap[(int)(parts[e].y+0.5f)][(int)(parts[e].x+0.5f)] = (e<<8)|parts[e].type; } - if(parts[i].type==PT_GBMB&&parts[i].tmp==1) - return 0; return 1; } |
