summaryrefslogtreecommitdiff
path: root/src/powder.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/powder.c')
-rw-r--r--src/powder.c68
1 files changed, 66 insertions, 2 deletions
diff --git a/src/powder.c b/src/powder.c
index 02a740f..b6e843f 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -133,6 +133,10 @@ int try_move(int i, int x, int y, int nx, int ny)
return 1;
e = eval_move(parts[i].type, nx, ny, &r);
+
+ if((pmap[ny][nx]&0xFF)==PT_BOMB && parts[i].type==PT_BOMB && parts[i].tmp == 1)
+ e = 2;
+
if((pmap[ny][nx]&0xFF)==PT_INVIS && (pv[ny/CELL][nx/CELL]>4.0f ||pv[ny/CELL][nx/CELL]<-4.0f))
return 1;
/* half-silvered mirror */
@@ -500,7 +504,7 @@ inline int create_part(int p, int x, int y, int t)
(pmap[y][x]&0xFF)!=PT_BRMT &&
(pmap[y][x]&0xFF)!=PT_NBLE &&
(pmap[y][x]&0xFF)!=PT_IRON &&
- (pmap[y][x]&0xFF)!=PT_INST &&
+ (pmap[y][x]&0xFF)!=PT_INST &&
(pmap[y][x]&0xFF)!=PT_INWR)
return -1;
if(parts[pmap[y][x]>>8].life!=0)
@@ -2138,7 +2142,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
t = parts[i].type = PT_PLNT;
parts[r>>8].type = PT_PLNT;
- parts[r>>8].life = 0;
+ parts[r>>8].life = 0;
}
else if((r&0xFF)==PT_LAVA && 1>(rand()%250))
{
@@ -2788,6 +2792,66 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
+ else if(t==PT_BOMB)
+ {
+ if(parts[i].tmp==1){
+ 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))
+ {
+ r = pmap[y+ny][x+nx];
+ if((r>>8)>=NPART || !r)
+ continue;
+ if(parts[r>>8].type!=PT_NONE && parts[r>>8].type!=PT_BOMB){
+ parts[i].type = PT_NONE;
+ goto killed;
+ }
+ }
+ } else if(parts[i].tmp==0){
+ 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)
+ {
+ r = pmap[y+ny][x+nx];
+ if((r>>8)>=NPART || !r)
+ continue;
+ if(parts[r>>8].type!=PT_NONE && parts[r>>8].type!=PT_BOMB){
+ int rad = 8;
+ int nxi;
+ int nxj;
+ pmap[y][x] = 0;
+ for(nxj=-(rad+1); nxj<=(rad+1); nxj++)
+ for(nxi=-(rad+1); nxi<=(rad+1); nxi++)
+ if((pow(nxi,2))/(pow((rad+1),2))+(pow(nxj,2))/(pow((rad+1),2))<=1){
+ int nb = create_part(-1, x+nxi, y+nxj, PT_BOMB);
+ if(nb!=-1){
+ parts[nb].tmp = 1;
+ parts[nb].life = 50;
+ parts[nb].temp = MAX_TEMP;
+ parts[nb].vx = rand()%20-10;
+ parts[nb].vy = rand()%20-10;
+ }
+ }
+ for(nxj=-rad; nxj<=rad; nxj++)
+ for(nxi=-rad; nxi<=rad; nxi++)
+ if((pow(nxi,2))/(pow(rad,2))+(pow(nxj,2))/(pow(rad,2))<=1){
+ delete_part(x+nxi, y+nxj);
+ pv[(y+nxj)/CELL][(x+nxi)/CELL] += 0.1f;
+ int nb = create_part(-1, x+nxi, y+nxj, PT_BOMB);
+ if(nb!=-1){
+ parts[nb].tmp = 2;
+ parts[nb].life = 2;
+ parts[nb].temp = MAX_TEMP;
+ }
+ }
+ //create_parts(x, y, 9, 9, PT_BOMB);
+ //create_parts(x, y, 8, 8, PT_NONE);
+ parts[i].type = PT_NONE;
+ goto killed;
+ }
+ }
+ }
+ }
else if(t==PT_FWRK)
{
if((parts[i].temp>400&&(9+parts[i].temp/40)>rand()%100000&&parts[i].life==0&&!pmap[y-1][x])||parts[i].ctype==PT_DUST)