From ebb784de700240d0f8c2f2c5ffe3d2ab783c6557 Mon Sep 17 00:00:00 2001 From: Phil Date: Sun, 12 Sep 2010 20:34:47 -0400 Subject: [PATCH] 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. --- interface.c | 79 +++++++++++++++++++++++++++++++++-------------------- powder.c | 24 +++++++++------- 2 files changed, 64 insertions(+), 39 deletions(-) diff --git a/interface.c b/interface.c index 6bb0c563d..fa6c3736b 100644 --- a/interface.c +++ b/interface.c @@ -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; } x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15) + if(!bq && mx>=x+32 && mx=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=y && my< y+15) { drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); 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; } x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15) + if(!bq && mx>=x+32 && mx=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=y && my< y+15) { drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); 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; } x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15) + if(!bq && mx>=x+32 && mx=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=y && my< y+15) { drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); 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; } x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15) + if(!bq && mx>=x+32 && mx=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=y && my< y+15) { drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); 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) { - *sl = h; - } - if(b==4&&h!=-1) - { - if(h!=0) + if(sdl_mod & (KMOD_LALT|KMOD_RALT)) { - SEC = -1; - PSR = *sr; - *psr = *sr; + PSR=h; + *psr=h; + SEC=-1; } else - { - if(*psr==-2) - { - SEC = -1; - PSR = *sr; - *psr = *sr; - } - else - { - PSR = -1; - *psr = -2; - } - } - *sr = h; + *sl = h; } - else if(b==4&&sec>=0) + else if((b==1&&sec>0)&&(sdl_mod & (KMOD_LALT|KMOD_RALT))) { 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) diff --git a/powder.c b/powder.c index e185b0eae..51b84099d 100644 --- a/powder.c +++ b/powder.c @@ -340,7 +340,7 @@ inline void delete_part(int x, int y) kill_part(i>>8); 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); 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 && (parts[i].life<3 || ((r>>8)=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; @@ -1433,8 +1434,10 @@ void update_particles_i(pixel *vid, int start, int inc) 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)) parts[r>>8].temp = parts[r>>8].temp+10.0f; + } } + if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)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) { for(j=-r; j<=r; j++) @@ -2975,15 +2988,6 @@ int create_parts(int x, int y, int r, int c) 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(i=-r; i<=r; i++) if(i*i+j*j<=r*r)