diff options
| author | Cracker64 <cracker642@gmail.com> | 2011-02-01 04:30:53 (GMT) |
|---|---|---|
| committer | Cracker64 <cracker642@gmail.com> | 2011-02-01 04:30:53 (GMT) |
| commit | c558df240bce1e623522bc5b3d84ad9120b1d070 (patch) | |
| tree | 52a547dc5da1dfacea1835b5d76b000679b598eb /src | |
| parent | fea297b2ac430a6e4d32a9842d8904a04989d495 (diff) | |
| download | powder-c558df240bce1e623522bc5b3d84ad9120b1d070.zip powder-c558df240bce1e623522bc5b3d84ad9120b1d070.tar.gz | |
made set work with all of one type of a particle (set type dust deut) turns all dust into deut
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 83 | ||||
| -rw-r--r-- | src/powder.c | 14 |
2 files changed, 89 insertions, 8 deletions
@@ -2553,7 +2553,7 @@ int main(int argc, char *argv[]) } int process_command(pixel *vid_buf,char *console,char *console_error) { -int nx,ny,i,j; +int nx,ny,i,j,k; char *console2; char *console3; char *console4; @@ -2674,6 +2674,15 @@ char *console5; parts[i].life = j; } } + else if (console_parse_type(console4, &j, console_error)) + { + k = atoi(console5); + for(i=0; i<NPART; i++) + { + if(parts[i].type == j) + parts[i].life = k; + } + } else { if (console_parse_partref(console4, &i, console_error)) @@ -2694,6 +2703,15 @@ char *console5; parts[i].type = j; } } + else if (console_parse_type(console4, &j, console_error) + && console_parse_type(console5, &k, console_error)) + { + for(i=0; i<NPART; i++) + { + if(parts[i].type == j) + parts[i].type = k; + } + } else { if (console_parse_partref(console4, &i, console_error) @@ -2714,6 +2732,15 @@ char *console5; parts[i].temp = j; } } + else if (console_parse_type(console4, &j, console_error)) + { + k = atoi(console5); + for(i=0; i<NPART; i++) + { + if(parts[i].type == j) + parts[i].temp= k; + } + } else { if (console_parse_partref(console4, &i, console_error)) @@ -2734,6 +2761,15 @@ char *console5; parts[i].tmp = j; } } + else if (console_parse_type(console4, &j, console_error)) + { + k = atoi(console5); + for(i=0; i<NPART; i++) + { + if(parts[i].type == j) + parts[i].tmp = k; + } + } else { if (console_parse_partref(console4, &i, console_error)) @@ -2754,6 +2790,15 @@ char *console5; parts[i].x = j; } } + else if (console_parse_type(console4, &j, console_error)) + { + k = atoi(console5); + for(i=0; i<NPART; i++) + { + if(parts[i].type == j) + parts[i].x = k; + } + } else { if (console_parse_partref(console4, &i, console_error)) @@ -2774,6 +2819,15 @@ char *console5; parts[i].y = j; } } + else if (console_parse_type(console4, &j, console_error)) + { + k = atoi(console5); + for(i=0; i<NPART; i++) + { + if(parts[i].type == j) + parts[i].y = k; + } + } else { if (console_parse_partref(console4, &i, console_error)) @@ -2794,6 +2848,15 @@ char *console5; parts[i].ctype = j; } } + else if (console_parse_type(console4, &j, console_error) + && console_parse_type(console5, &k, console_error)) + { + for(i=0; i<NPART; i++) + { + if(parts[i].type == j) + parts[i].ctype = k; + } + } else { if (console_parse_partref(console4, &i, console_error) @@ -2814,6 +2877,15 @@ char *console5; parts[i].vx = j; } } + else if (console_parse_type(console4, &j, console_error)) + { + k = atoi(console5); + for(i=0; i<NPART; i++) + { + if(parts[i].type == j) + parts[i].vx = k; + } + } else { if (console_parse_partref(console4, &i, console_error)) @@ -2834,6 +2906,15 @@ char *console5; parts[i].vy = j; } } + else if (console_parse_type(console4, &j, console_error)) + { + k = atoi(console5); + for(i=0; i<NPART; i++) + { + if(parts[i].type == j) + parts[i].vy = k; + } + } else { if (console_parse_partref(console4, &i, console_error)) diff --git a/src/powder.c b/src/powder.c index 6cafdb6..6897cb1 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1328,7 +1328,7 @@ void update_particles_i(pixel *vid, int start, int inc) neighbors = gol2[nx][ny][0]; if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !r&0xFF) || (r>>8)>=NPART) continue; - for ( golnum = 1; golnum<NGOL; golnum++) + for ( golnum = 1; golnum<=NGOL; golnum++) for ( goldelete = 0; goldelete<9; goldelete++) { if (neighbors==goldelete&&gol[nx][ny]==0&&grule[golnum][goldelete]>=2&&gol2[nx][ny][golnum]>=(goldelete%2)+goldelete/2) @@ -1345,7 +1345,7 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_NONE;//using kill_part makes it not work } gol2[nx][ny][0] = 0; - for ( z = 1; z<NGOL; z++) + for ( z = 1; z<=NGOL; z++) gol2[nx][ny][z] = 0; } if (createdsomething) @@ -1963,15 +1963,15 @@ killed: { parts[i].x = clear_xf+(j-clear_x); parts[i].y = fin_yf; - x = j; - y = fin_y; + nx = j; + ny = fin_y; s = 1; break; } if (try_move(i, x, y, j, clear_y)) { parts[i].x = clear_xf+(j-clear_x); - x = j; + nx = j; s = 1; break; } @@ -1985,12 +1985,12 @@ killed: if (s) for (j=clear_y+r; j>=0 && j<YRES && j>=clear_y-rt && j<clear_y+rt; j+=r) { - if (try_move(i, x, y, clear_x, j)) + if (try_move(i, x, y, nx, j)) { parts[i].y = clear_yf+(j-clear_y); break; } - if ((pmap[j][x]&255)!=t || (bmap[j/CELL][x/CELL] && bmap[j/CELL][x/CELL]!=WL_STREAM)) + if ((pmap[j][nx]&255)!=t || (bmap[j/CELL][nx/CELL] && bmap[j/CELL][nx/CELL]!=WL_STREAM)) { s = 0; break; |
