diff options
| author | Cracker64 <cracker642@gmail.com> | 2011-03-01 00:48:53 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-03-02 20:05:51 (GMT) |
| commit | 4f4796b469ae2dc4ba3f131d940971f24a997df5 (patch) | |
| tree | 1b5c32bf1034e6b83d0fcd2c4c201b0a8bcd65df /src | |
| parent | 669a672b3d083af22c6aeb37a636903ce30bcf6c (diff) | |
| download | powder-4f4796b469ae2dc4ba3f131d940971f24a997df5.zip powder-4f4796b469ae2dc4ba3f131d940971f24a997df5.tar.gz | |
INST works with caps lock/replace mode, and fix some replace mode out of screen crashes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/powder.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/powder.c b/src/powder.c index 55c1233..1a41407 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2763,7 +2763,7 @@ int flood_parts(int x, int y, int c, int cm, int bm) bm = 0; } - if (((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm )||( (sdl_mod & (KMOD_CAPS)) && cm!=SLALT)) + if (((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm )||( (sdl_mod & (KMOD_CAPS)) && cm!=SLALT && !(cm==PT_INST&&co==PT_SPRK))) return 1; // go left as far as possible @@ -2788,7 +2788,12 @@ int flood_parts(int x, int y, int c, int cm, int bm) // fill span for (x=x1; x<=x2; x++) { - if (!create_parts(x, y, 0, 0, co)) + if(cm==PT_INST&&co==PT_SPRK) + { + if(create_part(-1,x, y, co)==-1) + return 0; + } + else if (!create_parts(x, y, 0, 0, co)) return 0; } // fill children @@ -2939,10 +2944,14 @@ int create_parts(int x, int y, int rx, int ry, int c) for (j=-ry; j<=ry; j++) for (i=-rx; i<=rx; i++) if ((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(rx,2))+(pow(j,2))/(pow(ry,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=ry*rx)) + { + if( x+i<0 || y+j<0 || x+i>=XRES || y+j>=YRES) + continue; if (!REPLACE_MODE) create_part(-2, x+i, y+j, c); else if ((pmap[y+j][x+i]&0xFF)==SLALT&&SLALT!=0) create_part(-2, x+i, y+j, c); + } return 1; } @@ -2981,6 +2990,8 @@ int create_parts(int x, int y, int rx, int ry, int c) for (i=-rx; i<=rx; i++) if ((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(rx,2))+(pow(j,2))/(pow(ry,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=ry*rx)) { + if( x+i<0 || y+j<0 || x+i>=XRES || y+j>=YRES) + continue; if ((pmap[y+j][x+i]&0xFF)!=SLALT&&SLALT!=0) continue; if ((pmap[y+j][x+i])) |
