summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-03-01 00:48:53 (GMT)
committer Cracker64 <cracker642@gmail.com>2011-03-01 00:48:53 (GMT)
commit30ceffa46dfae19c2422077faf4be27f6c3ab2a0 (patch)
tree359faea2980ebb96b1708789f4d241852e96de4e /src
parent83d89ad4cd4c23b85a6581e5f44f101a64e2f119 (diff)
downloadpowder-30ceffa46dfae19c2422077faf4be27f6c3ab2a0.zip
powder-30ceffa46dfae19c2422077faf4be27f6c3ab2a0.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.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/powder.c b/src/powder.c
index c8fc40b..dcdda77 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -2759,7 +2759,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
@@ -2784,7 +2784,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
@@ -2933,10 +2938,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;
}
@@ -2975,6 +2984,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]))