OMG FIXES. Lots of fixes for triangle brush to make sure it works, from Cracker. Edited CLST to prevent "popcorning" when its float hits weird numbers. Also fixed it so it freezes nicely when cooled. Fingers are back! :DDD

This commit is contained in:
Cate 2011-07-12 11:28:33 -04:00 committed by Simon Robertshaw
parent 7480442c67
commit d3452b01c8
4 changed files with 22 additions and 9 deletions

View File

@ -16,7 +16,16 @@ int update_CLST(UPDATE_FUNC_ARGS) {
}
if ((r&0xFF)==PT_CLST)
{
parts[i].vx += 0.01*rx; parts[i].vy += 0.01*ry;
if(parts[i].temp <195)
cxy = 0.05;
if(parts[i].temp >= 195 && parts[i].temp <295)
cxy = 0.015;
if(parts[i].temp >= 295 && parts[i].temp <350)
cxy = 0.01;
if(parts[i].temp > 350)
cxy = 0.005;
parts[i].vx += cxy*rx;
parts[i].vy += cxy*ry;//These two can be set not to calculate over 350 later. They do virtually nothing over 0.005.
}
}
return 0;

View File

@ -4247,13 +4247,14 @@ void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry)
}
}
else if (CURRENT_BRUSH==TRI_BRUSH)
{
{
for (j=-ry; j<=ry; j++)
for (i=-rx; i<=rx; i++)
if ((j <= ry ) && ( j >= (((-2.0*ry)/rx)*i) -ry) && ( j >= (((-2.0*ry)/(-rx))*i)-ry ) && (j+1>ry || (j-1 < (((-2.0*ry)/rx)*i) -ry) || ( j-1 < (((-2.0*ry)/(-rx))*i)-ry )) )
{
xor_pixel(x+i, y+j, vid);
}
for (i=-rx; i<=0; i++)
if ((j <= ry ) && ( j >= (((-2.0*ry)/(rx))*i)-ry ) && (j+1>ry || ( j-1 < (((-2.0*ry)/(rx))*i)-ry )) )
{
xor_pixel(x+i, y+j, vid);
if (i) xor_pixel(x-i, y+j, vid);
}
}
}

View File

@ -3055,7 +3055,7 @@ int main(int argc, char *argv[])
{
for (j=-bsy; j<=bsy; j++)
for (i=-bsx; i<=bsx; i++)
if (lx+i>=0 && ly+j>=0 && lx+i<XRES && ly+j<YRES && ((CURRENT_BRUSH==CIRCLE_BRUSH && pow(i,2)*pow(bsy,2)+pow(j,2)*pow(bsx,2)<=pow(bsx,2)*pow(bsy,2))||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=bsy*bsx)))
if (x+i>0 && y+j>0 && x+i<XRES && y+j<YRES && InCurrentBrush(i,j,bsx,bsy))
{
vx[(ly+j)/CELL][(lx+i)/CELL] += (line_x-lx)*0.002f;
vy[(ly+j)/CELL][(lx+i)/CELL] += (line_y-ly)*0.002f;
@ -3075,7 +3075,7 @@ int main(int argc, char *argv[])
{
for (j=-bsy; j<=bsy; j++)
for (i=-bsx; i<=bsx; i++)
if (x+i>0 && y+j>0 && x+i<XRES && y+j<YRES && ((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(bsx,2))+(pow(j,2))/(pow(bsy,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=bsy*bsx)))
if (x+i>0 && y+j>0 && x+i<XRES && y+j<YRES && InCurrentBrush(i,j,bsx,bsy))
{
vx[(y+j)/CELL][(x+i)/CELL] += (x-lx)*0.01f;
vy[(y+j)/CELL][(x+i)/CELL] += (y-ly)*0.01f;

View File

@ -2791,6 +2791,9 @@ int InCurrentBrush(int i, int j, int rx, int ry)
case TRI_BRUSH:
return (j <= ry ) && ( j >= (((-2.0*ry)/rx)*i) -ry) && ( j >= (((-2.0*ry)/(-rx))*i)-ry ) ;
break;
default:
return 0;
break;
}
}
void create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c)