Much better interface for eraser. Doesnt deselect current elements.

alt-click on the element/type you want erased, it will be light blue.
alt-click in the game will then erase the selected element only.
everything else works normally and uneffected if you dont use it.
This commit is contained in:
Phil 2010-09-12 20:34:47 -04:00
parent f94986a3ba
commit ebb784de70
2 changed files with 64 additions and 39 deletions

View File

@ -1425,7 +1425,12 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *psr,int b, int bq,
y += 19; y += 19;
} }
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5;
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15) if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT|KMOD_RALT)))
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
h = n;
}
else if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
{ {
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
h = n; h = n;
@ -1457,7 +1462,12 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *psr,int b, int bq,
y += 19; y += 19;
} }
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5;
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15) if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT|KMOD_RALT)))
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
h = n;
}
else if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
{ {
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
h = n; h = n;
@ -1486,7 +1496,12 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *psr,int b, int bq,
y += 19; y += 19;
} }
x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5; x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5;
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15) if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT|KMOD_RALT)))
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
h = n;
}
else if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
{ {
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
h = n; h = n;
@ -1518,7 +1533,12 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *psr,int b, int bq,
y += 19; y += 19;
} }
x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5; x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5;
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15) if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT|KMOD_RALT)))
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
h = n;
}
else if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
{ {
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
h = n; h = n;
@ -1558,38 +1578,39 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *psr,int b, int bq,
if(b==1&&h!=-1) if(b==1&&h!=-1)
{ {
*sl = h; if(sdl_mod & (KMOD_LALT|KMOD_RALT))
}
if(b==4&&h!=-1)
{
if(h!=0)
{ {
SEC = -1; PSR=h;
PSR = *sr; *psr=h;
*psr = *sr; SEC=-1;
} }
else else
{ *sl = h;
if(*psr==-2)
{
SEC = -1;
PSR = *sr;
*psr = *sr;
}
else
{
PSR = -1;
*psr = -2;
}
}
*sr = h;
} }
else if(b==4&&sec>=0) else if((b==1&&sec>0)&&(sdl_mod & (KMOD_LALT|KMOD_RALT)))
{ {
SEC = sec; SEC = sec;
PSR = -1; PSR=-1;
*psr = -1; *psr=-1;
} }
if(b==4&&h!=-1)
{
if(sdl_mod & (KMOD_LALT|KMOD_RALT))
{
PSR=h;
*psr=h;
SEC=-1;
}
else
*sr = h;
}
else if((b==4&&sec>0)&&(sdl_mod & (KMOD_LALT|KMOD_RALT)))
{
SEC = sec;
PSR=-1;
*psr=-1;
}
} }
int sdl_poll(void) int sdl_poll(void)

View File

@ -340,7 +340,7 @@ inline void delete_part(int x, int y)
kill_part(i>>8); kill_part(i>>8);
pmap[y][x] = 0; pmap[y][x] = 0;
} }
if(ptypes[parts[i>>8].type].menusection==SEC) else if(ptypes[parts[i>>8].type].menusection==SEC)
{ {
kill_part(i>>8); kill_part(i>>8);
pmap[y][x] = 0; pmap[y][x] = 0;
@ -1426,6 +1426,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 &&
(parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4) (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
{ {
if(!(rt==PT_PSCN&&parts[i].ctype==PT_NSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp>=373.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=373.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) if(!(rt==PT_PSCN&&parts[i].ctype==PT_NSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp>=373.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=373.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) )
{ {
parts[r>>8].type = PT_SPRK; parts[r>>8].type = PT_SPRK;
@ -1433,8 +1434,10 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[r>>8].ctype = rt; parts[r>>8].ctype = rt;
if(parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) if(parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR))
parts[r>>8].temp = parts[r>>8].temp+10.0f; parts[r>>8].temp = parts[r>>8].temp+10.0f;
} }
} }
if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 &&
(parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4) (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
{ {
@ -2966,6 +2969,16 @@ int create_parts(int x, int y, int r, int c)
} }
return 1; return 1;
} }
if(c == 0||((sdl_mod & (KMOD_LALT|KMOD_RALT))&&(PSR>0||SEC>0)))
{
for(j=-r; j<=r; j++)
for(i=-r; i<=r; i++)
if(i*i+j*j<=r*r)
delete_part(x+i, y+j);
return 1;
}
if(c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM) if(c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM)
{ {
for(j=-r; j<=r; j++) for(j=-r; j<=r; j++)
@ -2975,15 +2988,6 @@ int create_parts(int x, int y, int r, int c)
return 1; return 1;
} }
if(c == 0)
{
for(j=-r; j<=r; j++)
for(i=-r; i<=r; i++)
if(i*i+j*j<=r*r)
delete_part(x+i, y+j);
return 1;
}
for(j=-r; j<=r; j++) for(j=-r; j<=r; j++)
for(i=-r; i<=r; i++) for(i=-r; i<=r; i++)
if(i*i+j*j<=r*r) if(i*i+j*j<=r*r)