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,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;
}

View File

@ -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))
{

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]))
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;
}