Modify GBMB to only use life

tmp not needed, since it doesn't create powder during an explosion like BOMB does.
This commit is contained in:
jacksonmj
2011-08-18 13:44:09 +01:00
committed by Simon Robertshaw
parent 34abbcc84c
commit 961a393c7a
3 changed files with 22 additions and 22 deletions

View File

@@ -1,18 +1,21 @@
#include <element.h> #include <element.h>
int update_GBMB(UPDATE_FUNC_ARGS) { int update_GBMB(UPDATE_FUNC_ARGS) {
int rx,ry,r; int rx,ry,r;
if (parts[i].life<=0)
{
for (rx=-2; rx<3; rx++) for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++){ for (ry=-2; ry<3; ry++)
{
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if(r && (r>>8)<NPART) if(!r || (r>>8)>=NPART)
if((r&0xFF)!=PT_BOMB&& continue;
(r&0xFF)!=PT_GBMB&& if((r&0xFF)!=PT_BOMB && (r&0xFF)!=PT_GBMB &&
(r&0xFF)!=PT_CLNE&& (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN &&
(r&0xFF)!=PT_PCLN&& (r&0xFF)!=PT_DMND)
(r&0xFF)!=PT_DMND&& {
!parts[i].tmp){
parts[i].life=60; parts[i].life=60;
parts[i].tmp = 1; break;
}
} }
} }
if(parts[i].life>20) if(parts[i].life>20)

View File

@@ -3255,7 +3255,7 @@ void draw_parts(pixel *vid)
} }
else if (t==PT_GBMB) else if (t==PT_GBMB)
{ {
if (parts[i].tmp==0) { if (parts[i].life<=0) {//not yet detonated
cr = PIXR(ptypes[t].pcolors); cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors); cg = PIXG(ptypes[t].pcolors);
cb = PIXB(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); blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
} }
else if (parts[i].tmp==1) { else {//exploding
cr = PIXR(ptypes[t].pcolors); cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors); cg = PIXG(ptypes[t].pcolors);
cb = PIXB(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); 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)) else if (ptypes[t].properties&PROP_HOT_GLOW && parts[i].temp>(ptransitions[t].thv-800.0f))
{ {

View File

@@ -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])) 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; 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]) 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 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; parts[e].y += y-ny;
pmap[(int)(parts[e].y+0.5f)][(int)(parts[e].x+0.5f)] = (e<<8)|parts[e].type; 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; return 1;
} }