From 8e3383909b0301c14eee2b7f3473c4df095d77e0 Mon Sep 17 00:00:00 2001 From: Phil Date: Wed, 8 Sep 2010 19:43:06 -0400 Subject: Added specific element erase, right click on element in menu, then right click on eraser, the one to be erased will have a light blue box around it. works for walls too. changed some wall code because it looks like someone just put random numbers in. fixed a wall bug diff --git a/air.c b/air.c index 55108d6..9415bbf 100644 --- a/air.c +++ b/air.c @@ -54,15 +54,15 @@ void update_air(void) vy[y][x] *= VLOSS; vx[y][x] += dx*TSTEPV; vy[y][x] += dy*TSTEPV; - if(bmap[y][x]==1 || bmap[y][x+1]==1 || - bmap[y][x]==8 || bmap[y][x+1]==8 || - (bmap[y][x]==7 && !emap[y][x]) || - (bmap[y][x+1]==7 && !emap[y][x+1])) + if(bmap[y][x]==11 || bmap[y][x+1]==11 || + bmap[y][x]==2 || bmap[y][x+1]==2 || + (bmap[y][x]==3 && !emap[y][x]) || + (bmap[y][x+1]==3 && !emap[y][x+1])) vx[y][x] = 0; - if(bmap[y][x]==1 || bmap[y+1][x]==1 || - bmap[y][x]==8 || bmap[y+1][x]==8 || - (bmap[y][x]==7 && !emap[y][x]) || - (bmap[y+1][x]==7 && !emap[y+1][x])) + if(bmap[y][x]==11 || bmap[y+1][x]==11 || + bmap[y][x]==2 || bmap[y+1][x]==2 || + (bmap[y][x]==3 && !emap[y][x]) || + (bmap[y+1][x]==3 && !emap[y+1][x])) vy[y][x] = 0; } @@ -76,9 +76,9 @@ void update_air(void) for(i=-1; i<2; i++) if(y+j>0 && y+j0 && x+i=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy && x=0 && ly>=0 && lx=0 && ly>=0 && lx=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) + if(c!=127 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=7) create_line(lx, ly, x, y, bs, c); } else diff --git a/powder.c b/powder.c index e7bc8f8..cb19a5d 100644 --- a/powder.c +++ b/powder.c @@ -59,30 +59,30 @@ int try_move(int i, int x, int y, int nx, int ny) return 1; } - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) + if(bmap[ny/CELL][nx/CELL]==15 && !emap[y/CELL][x/CELL]) { return 1; } - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) + if(bmap[ny/CELL][nx/CELL]==20 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) { return 0; } - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) + if((bmap[y/CELL][x/CELL]==15 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=15 && !emap[ny/CELL][nx/CELL])) { return 0; } - if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==8) return 0; - if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) + if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==3 && !emap[ny/CELL][nx/CELL]) return 0; - if(r && (r>>8)>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) @@ -326,15 +326,20 @@ inline void delete_part(int x, int y) #endif { unsigned i; - if(x<0 || y<0 || x>=XRES || y>=YRES) return; i = pmap[y][x]; if(!i || (i>>8)>=NPART) return; - - kill_part(i>>8); - pmap[y][x] = 0; // just in case + if((parts[i>>8].type==PSR)||PSR==0||PSR==130) + { + kill_part(i>>8); + pmap[y][x] = 0; + } + else + { + return; + } } #ifdef WIN32 @@ -343,7 +348,7 @@ _inline int is_wire(int x, int y) inline int is_wire(int x, int y) #endif { - return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; + return bmap[y][x]==4 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==2 || bmap[y][x]==14 || bmap[y][x]==15; } #ifdef WIN32 @@ -352,7 +357,7 @@ _inline int is_wire_off(int x, int y) inline int is_wire_off(int x, int y) #endif { - return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; + return (bmap[y][x]==4 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==2 || bmap[y][x]==14 || bmap[y][x]==15) && emap[y][x]<8; } void set_emap(int x, int y) @@ -508,14 +513,14 @@ void update_particles_i(pixel *vid, int start, int inc) if(x<0 || y<0 || x>=XRES || y>=YRES || - ((bmap[y/CELL][x/CELL]==1 || - bmap[y/CELL][x/CELL]==8 || - bmap[y/CELL][x/CELL]==9 || - (bmap[y/CELL][x/CELL]==2) || - (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || - (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) + ((bmap[y/CELL][x/CELL]==11 || + bmap[y/CELL][x/CELL]==2 || + bmap[y/CELL][x/CELL]==12 || + (bmap[y/CELL][x/CELL]==9) || + (bmap[y/CELL][x/CELL]==8 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==4 && (t==PT_METL || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==3 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) { kill_part(i); continue; @@ -858,14 +863,14 @@ void update_particles_i(pixel *vid, int start, int inc) t = PT_SPRK; } } - else if(bmap[ny][nx]==6 || bmap[ny][nx]==7 || bmap[ny][nx]==3 || bmap[ny][nx]==8 || bmap[ny][nx]==11 || bmap[ny][nx]==12) + else if(bmap[ny][nx]==4 || bmap[ny][nx]==3 || bmap[ny][nx]==8 || bmap[ny][nx]==2 || bmap[ny][nx]==14 || bmap[ny][nx]==15) set_emap(nx, ny); } } nx = x/CELL; ny = y/CELL; - if(bmap[ny][nx]==6 && emap[ny][nx]<8) + if(bmap[ny][nx]==4 && emap[ny][nx]<8) set_emap(nx, ny); fe = 0; @@ -1647,9 +1652,9 @@ player[23] = 1; } //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==4) set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==4) set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); //Searching for particles near head @@ -1676,7 +1681,7 @@ player[23] = 1; parts[i].life -= (102-parts[i].life)/2; kill_part(pmap[ny+y][nx+x]>>8); } - if(bmap[(ny+y)/CELL][(nx+x)/CELL]==4) + if(bmap[(ny+y)/CELL][(nx+x)/CELL]==7) player[2] = SPC_AIR; } @@ -1935,6 +1940,7 @@ player[23] = 1; if(5>=rand()%8) { create_part(-1, x+nx, y+ny , PT_DUST); + pv[y/CELL][x/CELL] += 2.00f*CFDS; a= pmap[y+ny][x+nx]; if(parts[a>>8].type==PT_DUST) { @@ -2427,18 +2433,18 @@ void update_particles(pixel *vid) { for(x=0; x>1)&1; i>1)&1; i>1)&1; i121&&PSR<141)) + { + r = r/CELL; + x = x/CELL; + y = y/CELL; + x -= r/2; + y -= r/2; + for (ox=x; ox<=x+r; ox++) + { + for (oy=y; oy<=y+r; oy++) + { + if(ox>=0&&ox=0&&oy