another swch fix, desl fire fix, shift-g will make grid go down, BIZR glows from velocity in FIRE,ect. METL/BRMT/BMTL change color when heated in heat gradient view. other small changes.

This commit is contained in:
Cracker64 2010-12-14 17:23:27 -05:00
parent 23f828135a
commit 5b2c689394
6 changed files with 127 additions and 41 deletions

View File

@ -8,7 +8,7 @@
#endif #endif
#define SAVE_VERSION 44 #define SAVE_VERSION 44
#define MINOR_VERSION 6 #define MINOR_VERSION 7
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
//#define BETA //#define BETA

View File

@ -137,7 +137,7 @@
#define PT_34 87 #define PT_34 87
#define PT_LLIF 88 #define PT_LLIF 88
#define PT_STAN 89 #define PT_STAN 89
#define PT_CRAC 90 #define PT_SPNG 90
#define PT_RIME 91 #define PT_RIME 91
#define PT_FOG 92 #define PT_FOG 92
#define PT_BCLN 93 #define PT_BCLN 93
@ -490,7 +490,7 @@ static part_state pstates[PT_NUM] =
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* Crac */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 2730.0f}, /* SPNG */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 2730.0f},
/* RIME */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.15f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* RIME */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.15f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FOG */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FOG */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},

View File

@ -1432,27 +1432,50 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
} }
else if(cmode==CM_GRAD)//forgot to put else, broke nothing view else if(cmode==CM_GRAD)
{ {
float frequency = 0.05; if((t==PT_METL||t==PT_BRMT||t==PT_BMTL)&&parts[i].temp>473&&parts[i].temp<1370)
int q = parts[i].temp; {
cr = sin(frequency*q) * 16 + PIXR(ptypes[t].pcolors); float frequency = 0.00146;
cg = sin(frequency*q) * 16 + PIXG(ptypes[t].pcolors); int q = parts[i].temp-473;
cb = sin(frequency*q) * 16 + PIXB(ptypes[t].pcolors); cr = sin(frequency*q) * 226 + PIXR(ptypes[t].pcolors);
if(cr>=255) cg = sin(frequency*q*4.55 +3.14) * 34 + PIXG(ptypes[t].pcolors);
cb = sin(frequency*q*2.22 +3.14) * 64 + PIXB(ptypes[t].pcolors);
if(cr>=255)
cr = 255; cr = 255;
if(cg>=255) if(cg>=255)
cg = 255; cg = 255;
if(cb>=255) if(cb>=255)
cb = 255; cb = 255;
if(cr<=0) if(cr<=0)
cr = 0; cr = 0;
if(cg<=0) if(cg<=0)
cg = 0; cg = 0;
if(cb<=0) if(cb<=0)
cb = 0; cb = 0;
blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
else
{
float frequency = 0.05;
int q = parts[i].temp-40;
cr = sin(frequency*q) * 16 + PIXR(ptypes[t].pcolors);
cg = sin(frequency*q) * 16 + PIXG(ptypes[t].pcolors);
cb = sin(frequency*q) * 16 + PIXB(ptypes[t].pcolors);
if(cr>=255)
cr = 255;
if(cg>=255)
cg = 255;
if(cb>=255)
cb = 255;
if(cr<=0)
cr = 0;
if(cg<=0)
cg = 0;
if(cb<=0)
cb = 0;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
} }
else if(t==PT_MWAX&&cmode == CM_FANCY) else if(t==PT_MWAX&&cmode == CM_FANCY)
@ -1471,7 +1494,7 @@ void draw_parts(pixel *vid)
} }
} }
else if(t==PT_CRAC) else if(t==PT_SPNG)
{ {
cr = PIXR(ptypes[t].pcolors) - parts[i].life*15; cr = PIXR(ptypes[t].pcolors) - parts[i].life*15;
cg = PIXG(ptypes[t].pcolors) - parts[i].life*15; cg = PIXG(ptypes[t].pcolors) - parts[i].life*15;
@ -1623,7 +1646,28 @@ void draw_parts(pixel *vid)
cr = cr>255?255:cr; cr = cr>255?255:cr;
cg = cg>255?255:cg; cg = cg>255?255:cg;
cb = cb>255?255:cb; cb = cb>255?255:cb;
blendpixel(vid, nx, ny, cr, cg, cb, 255); if(fabs(parts[i].vx)+fabs(parts[i].vy)>0 &&(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)) {
fg = 0;
fb = 0;
fr = 0;
fg = cg/40 * fabs(parts[i].vx)+fabs(parts[i].vy);
fb = cb/40 * fabs(parts[i].vx)+fabs(parts[i].vy);
fr = cr/40 * fabs(parts[i].vx)+fabs(parts[i].vy);
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(cr, 0, 255), (int)restrict_flt(cg, 0, 255), (int)restrict_flt(cb, 0, 255));
x = nx/CELL;
y = ny/CELL;
fg += fire_g[y][x];
if(fg > 255) fg = 255;
fire_g[y][x] = fg;
fb += fire_b[y][x];
if(fb > 255) fb = 255;
fire_b[y][x] = fb;
fr += fire_r[y][x];
if(fr > 255) fr = 255;
fire_r[y][x] = fr;
}
else
blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
else if(t==PT_PIPE) else if(t==PT_PIPE)
{ {

View File

@ -147,6 +147,7 @@ void add_sign_ui(pixel *vid_buf, int mx, int my)
ed.focus = 1; ed.focus = 1;
ed.hide = 0; ed.hide = 0;
ed.cursor = strlen(signs[i].text); ed.cursor = strlen(signs[i].text);
ed.multiline = 0;
strcpy(ed.str, signs[i].text); strcpy(ed.str, signs[i].text);
ju = signs[i].ju; ju = signs[i].ju;
@ -763,6 +764,7 @@ void login_ui(pixel *vid_buf)
ed1.def = "[user name]"; ed1.def = "[user name]";
ed1.focus = 1; ed1.focus = 1;
ed1.hide = 0; ed1.hide = 0;
ed1.multiline = 0;
ed1.cursor = strlen(svf_user); ed1.cursor = strlen(svf_user);
strcpy(ed1.str, svf_user); strcpy(ed1.str, svf_user);
ed2.x = x0+25; ed2.x = x0+25;
@ -773,6 +775,7 @@ void login_ui(pixel *vid_buf)
ed2.focus = 0; ed2.focus = 0;
ed2.hide = 1; ed2.hide = 1;
ed2.cursor = 0; ed2.cursor = 0;
ed2.multiline = 0;
strcpy(ed2.str, ""); strcpy(ed2.str, "");
fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192);
@ -1024,6 +1027,7 @@ void tag_list_ui(pixel *vid_buf)
ed.focus = 0; ed.focus = 0;
ed.hide = 0; ed.hide = 0;
ed.cursor = 0; ed.cursor = 0;
ed.multiline = 0;
strcpy(ed.str, ""); strcpy(ed.str, "");
fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192);

View File

@ -1481,7 +1481,12 @@ int main(int argc, char *argv[])
if(sdl_key==SDLK_INSERT) if(sdl_key==SDLK_INSERT)
REPLACE_MODE = !REPLACE_MODE; REPLACE_MODE = !REPLACE_MODE;
if(sdl_key=='g') if(sdl_key=='g')
GRID_MODE = (GRID_MODE+1)%10; {
if(sdl_mod & (KMOD_SHIFT))
GRID_MODE = (GRID_MODE+9)%10;
else
GRID_MODE = (GRID_MODE+1)%10;
}
if(sdl_key=='t') if(sdl_key=='t')
VINE_MODE = !VINE_MODE; VINE_MODE = !VINE_MODE;
if(sdl_key==SDLK_SPACE) if(sdl_key==SDLK_SPACE)
@ -1630,14 +1635,15 @@ int main(int argc, char *argv[])
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
#else #else
if(DEBUG_MODE) if(DEBUG_MODE)
{ {
int tctype = parts[cr>>8].ctype; int tctype = parts[cr>>8].ctype;
if(tctype>=PT_NUM) if(tctype>=PT_NUM)
tctype = 0; tctype = 0;
sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
} //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
else } else {
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f); sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f);
}
#endif #endif
} }
else else

View File

@ -467,11 +467,25 @@ inline int create_part(int p, int x, int y, int t)
pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK;
return pmap[y][x]>>8; return pmap[y][x]>>8;
} }
if(p==-1)//creating from anything but brush
if(p==-1) {
if(pmap[y][x])
return -1;
if(pfree == -1)
return -1;
i = pfree;
pfree = parts[i].life;
}
else if(p==-2)//creating from brush
{ {
if(pmap[y][x]) if(pmap[y][x])
{
if(((pmap[y][x]&0xFF)==PT_CLNE||(pmap[y][x]&0xFF)==PT_BCLN||(pmap[y][x]&0xFF)==PT_PCLN)&&(t!=PT_CLNE&&t!=PT_PCLN&&t!=PT_BCLN))
{
parts[pmap[y][x]>>8].ctype = t;
}
return -1; return -1;
}
if(pfree == -1) if(pfree == -1)
return -1; return -1;
i = pfree; i = pfree;
@ -562,7 +576,8 @@ inline int create_part(int p, int x, int y, int t)
parts[i].vx = 3.0f*cosf(a); parts[i].vx = 3.0f*cosf(a);
parts[i].vy = 3.0f*sinf(a); parts[i].vy = 3.0f*sinf(a);
} }
if(t==PT_BIZR||t==PT_BIZRG)
parts[i].ctype = 0x47FFFF;
if(t!=PT_STKM)// && t!=PT_PHOT && t!=PT_NEUT) is this needed? it breaks floodfill if(t!=PT_STKM)// && t!=PT_PHOT && t!=PT_NEUT) is this needed? it breaks floodfill
pmap[y][x] = t|(i<<8); pmap[y][x] = t|(i<<8);
else if(t==PT_STKM) else if(t==PT_STKM)
@ -1141,7 +1156,7 @@ void update_particles_i(pixel *vid, int start, int inc)
ly = parts[i].y; ly = parts[i].y;
t = parts[i].type; t = parts[i].type;
if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_CRAC && t!=PT_DEUT) if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_SPNG && t!=PT_DEUT)
{ {
if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC||parts[i].type==PT_PUMP))) if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC||parts[i].type==PT_PUMP)))
parts[i].life--; parts[i].life--;
@ -1368,12 +1383,18 @@ void update_particles_i(pixel *vid, int start, int inc)
if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f) if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f)
t = parts[i].type = PT_OIL; t = parts[i].type = PT_OIL;
if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f)
{
t = parts[i].type = PT_FIRE; t = parts[i].type = PT_FIRE;
parts[i].life = rand()%50+120;
}
} }
if(t==PT_GAS && pv[y/CELL][x/CELL]<-6.0f) if(t==PT_GAS && pv[y/CELL][x/CELL]<-6.0f)
t = parts[i].type = PT_OIL; t = parts[i].type = PT_OIL;
if(t==PT_DESL && pv[y/CELL][x/CELL]>5.0f) // Only way I know to make it if(t==PT_DESL && pv[y/CELL][x/CELL]>5.0f)
t = parts[i].type = PT_FIRE; // combust under pressure. { // Only way I know to make it
t = parts[i].type = PT_FIRE; // combust under pressure.
parts[i].life = rand()%50+120;
}
if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f) if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f)
t = parts[i].type = PT_OIL; t = parts[i].type = PT_OIL;
if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f)
@ -1555,9 +1576,15 @@ void update_particles_i(pixel *vid, int start, int inc)
} }
else else
{ {
t = parts[i].type = pstates[t].gas; if((t==PT_BIZR||t==PT_BIZRG||t==PT_BIZRS)&&pt>=pstates[t].gtemp)
if(t!=PT_BIZRS) {
t = parts[i].type = pstates[t].gas;
}
else{
t = parts[i].type = pstates[t].gas;
pv[y/CELL][x/CELL] += 0.50f; pv[y/CELL][x/CELL] += 0.50f;
}
if(t==PT_FIRE) if(t==PT_FIRE)
parts[i].life = rand()%50+120; parts[i].life = rand()%50+120;
if(t==PT_HFLM) if(t==PT_HFLM)
@ -2381,7 +2408,7 @@ void update_particles_i(pixel *vid, int start, int inc)
ISLOLZ=1; ISLOLZ=1;
else if(t==PT_GRAV) else if(t==PT_GRAV)
ISGRAV=1; ISGRAV=1;
else if(t==PT_CRAC) else if(t==PT_SPNG)
{ {
if(pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3) if(pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3)
{ {
@ -3262,7 +3289,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if((r>>8)>=NPART || !r) if((r>>8)>=NPART || !r)
continue; continue;
rt = parts[r>>8].type; rt = parts[r>>8].type;
if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL) if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL && (r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO)
{ {
t = parts[i].life++; t = parts[i].life++;
if(parts[i].life==3) if(parts[i].life==3)
@ -3388,6 +3415,11 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].life = 10; parts[i].life = 10;
} }
} }
else if(parts[r>>8].type == PT_SPRK && parts[r>>8].ctype==PT_SWCH && parts[i].life<10&&parts_avg(i,r>>8,PT_INSL)!=PT_INSL)
{
parts[r>>8].type = parts[r>>8].ctype;
parts[r>>8].life = 9;
}
} }
} }
if(t==PT_SWCH) if(t==PT_SWCH)
@ -3410,7 +3442,7 @@ void update_particles_i(pixel *vid, int start, int inc)
rt = parts[r>>8].type; rt = parts[r>>8].type;
if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) &&
!(t==PT_PHOT && rt==PT_INSL) && !(t==PT_PHOT && rt==PT_INSL) &&
(t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && !(rt==PT_CRAC && parts[r>>8].life>0) && (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && !(rt==PT_SPNG && parts[r>>8].life>0) &&
ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000))
{ {
parts[r>>8].type = PT_FIRE; parts[r>>8].type = PT_FIRE;
@ -5120,7 +5152,7 @@ int create_parts(int x, int y, int rx, int ry, int c)
for(j=-ry; j<=ry; j++) for(j=-ry; j<=ry; j++)
for(i=-rx; i<=rx; i++) 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((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))
create_part(-1, x+i, y+j, c); create_part(-2, x+i, y+j, c);
return 1; return 1;
} }
@ -5147,7 +5179,7 @@ int create_parts(int x, int y, int rx, int ry, int c)
{ {
delete_part(x+i, y+j); delete_part(x+i, y+j);
if(c!=0) if(c!=0)
create_part(-1, x+i, y+j, c); create_part(-2, x+i, y+j, c);
} }
} }
return 1; return 1;
@ -5156,7 +5188,7 @@ int create_parts(int x, int y, int rx, int ry, int c)
for(j=-ry; j<=ry; j++) for(j=-ry; j<=ry; j++)
for(i=-rx; i<=rx; i++) 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((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(create_part(-1, x+i, y+j, c)==-1) if(create_part(-2, x+i, y+j, c)==-1)
f = 1; f = 1;
return !f; return !f;
} }