INST works with caps lock/replace mode, and fix some replace mode out of screen crashes.

This commit is contained in:
Cracker64 2011-02-28 19:48:53 -05:00
parent 83d89ad4cd
commit 30ceffa46d

View File

@ -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]))