added specific element eraser again for my own uses sinces everyone else thinks its useless. alt-click to pick and then alt-click in the game to erase the picked element. you could then have right and left click be two different elements and alt-click on the eraser to keep two elements selected and an easy to use eraser as well
This commit is contained in:
parent
bff5961d60
commit
bb3b1a52ac
@ -100,6 +100,7 @@ struct ui_checkbox
|
|||||||
};
|
};
|
||||||
typedef struct ui_checkbox ui_checkbox;
|
typedef struct ui_checkbox ui_checkbox;
|
||||||
|
|
||||||
|
int SLALT;
|
||||||
extern SDLMod sdl_mod;
|
extern SDLMod sdl_mod;
|
||||||
extern int sdl_key, sdl_wheel, sdl_caps, sdl_ascii, sdl_zoom_trig;
|
extern int sdl_key, sdl_wheel, sdl_caps, sdl_ascii, sdl_zoom_trig;
|
||||||
extern char *shift_0;
|
extern char *shift_0;
|
||||||
|
@ -1484,6 +1484,15 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT)))
|
||||||
|
{
|
||||||
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
|
h = n;
|
||||||
|
}
|
||||||
|
else if(n==SLALT)
|
||||||
|
{
|
||||||
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
|
}
|
||||||
else if(n==*sl)
|
else if(n==*sl)
|
||||||
{
|
{
|
||||||
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);
|
||||||
@ -1509,6 +1518,15 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT)))
|
||||||
|
{
|
||||||
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
|
h = n;
|
||||||
|
}
|
||||||
|
else if(n==SLALT)
|
||||||
|
{
|
||||||
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
|
}
|
||||||
else if(n==*sl)
|
else if(n==*sl)
|
||||||
{
|
{
|
||||||
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);
|
||||||
@ -1537,6 +1555,15 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT)))
|
||||||
|
{
|
||||||
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
|
h = n;
|
||||||
|
}
|
||||||
|
else if(n==SLALT)
|
||||||
|
{
|
||||||
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
|
}
|
||||||
else if(n==*sl)
|
else if(n==*sl)
|
||||||
{
|
{
|
||||||
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);
|
||||||
@ -1564,12 +1591,24 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
|
|
||||||
if(b==1&&h!=-1)
|
if(b==1&&h!=-1)
|
||||||
{
|
{
|
||||||
|
if(sdl_mod & (KMOD_LALT))
|
||||||
|
{
|
||||||
|
SLALT = h;
|
||||||
|
}
|
||||||
|
else{
|
||||||
*sl = h;
|
*sl = h;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(b==4&&h!=-1)
|
if(b==4&&h!=-1)
|
||||||
{
|
{
|
||||||
|
if(sdl_mod & (KMOD_LALT))
|
||||||
|
{
|
||||||
|
SLALT = h;
|
||||||
|
}
|
||||||
|
else{
|
||||||
*sr = h;
|
*sr = h;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int sdl_poll(void)
|
int sdl_poll(void)
|
||||||
|
21
src/powder.c
21
src/powder.c
@ -663,9 +663,13 @@ inline void delete_part(int x, int y)
|
|||||||
i = pmap[y][x];
|
i = pmap[y][x];
|
||||||
if(!i || (i>>8)>=NPART)
|
if(!i || (i>>8)>=NPART)
|
||||||
return;
|
return;
|
||||||
|
if((parts[i>>8].type==SLALT)||SLALT==-1||SLALT==0)
|
||||||
|
{
|
||||||
kill_part(i>>8);
|
kill_part(i>>8);
|
||||||
pmap[y][x] = 0; // just in case
|
pmap[y][x] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -3580,7 +3584,7 @@ int flood_parts(int x, int y, int c, int cm, int bm)
|
|||||||
|
|
||||||
int create_parts(int x, int y, int r, int c)
|
int create_parts(int x, int y, int r, int c)
|
||||||
{
|
{
|
||||||
int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n;
|
int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0, stemp = 0; //n;
|
||||||
|
|
||||||
if(c == 125)
|
if(c == 125)
|
||||||
{
|
{
|
||||||
@ -3691,6 +3695,14 @@ int create_parts(int x, int y, int r, int c)
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if(sdl_mod & (KMOD_LALT))
|
||||||
|
{
|
||||||
|
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++)
|
||||||
@ -3702,10 +3714,13 @@ int create_parts(int x, int y, int r, int c)
|
|||||||
|
|
||||||
if(c == 0)
|
if(c == 0)
|
||||||
{
|
{
|
||||||
|
stemp = SLALT;
|
||||||
|
SLALT = -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)
|
||||||
delete_part(x+i, y+j);
|
delete_part(x+i, y+j);
|
||||||
|
SLALT = stemp;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user