summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil <cracker642@gmail.com>2010-09-13 00:34:47 (GMT)
committer Phil <cracker642@gmail.com>2010-09-13 00:34:47 (GMT)
commitebb784de700240d0f8c2f2c5ffe3d2ab783c6557 (patch)
treedd8563942e60cbf2f06f725837e2a60bb4da9ec8
parentf94986a3bacc60bc3b571209130611437fe9dabc (diff)
downloadpowder-ebb784de700240d0f8c2f2c5ffe3d2ab783c6557.zip
powder-ebb784de700240d0f8c2f2c5ffe3d2ab783c6557.tar.gz
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.
-rw-r--r--interface.c69
-rw-r--r--powder.c14
2 files changed, 54 insertions, 29 deletions
diff --git a/interface.c b/interface.c
index 6bb0c56..fa6c373 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<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);
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<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);
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<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);
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<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);
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(sdl_mod & (KMOD_LALT|KMOD_RALT))
+ {
+ PSR=h;
+ *psr=h;
+ SEC=-1;
+ }
+ else
*sl = h;
}
+ else if((b==1&&sec>0)&&(sdl_mod & (KMOD_LALT|KMOD_RALT)))
+ {
+ SEC = sec;
+ PSR=-1;
+ *psr=-1;
+ }
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;
}
- else if(b==4&&sec>=0)
+ else if((b==4&&sec>0)&&(sdl_mod & (KMOD_LALT|KMOD_RALT)))
{
SEC = sec;
- PSR = -1;
- *psr = -1;
+ PSR=-1;
+ *psr=-1;
}
+
}
int sdl_poll(void)
diff --git a/powder.c b/powder.c
index e185b0e..51b8409 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)<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)) )
{
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)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
{
@@ -2966,21 +2969,22 @@ int create_parts(int x, int y, int r, int c)
}
return 1;
}
- if(c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM)
+
+ 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)
- create_part(-1, x+i, y+j, c);
+ delete_part(x+i, y+j);
return 1;
}
- if(c == 0)
+ if(c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM)
{
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);
+ create_part(-1, x+i, y+j, c);
return 1;
}