UI improvements for elements menu
This commit is contained in:
parent
383eaff5b2
commit
bb0b4e6802
@ -52,10 +52,9 @@ static menu_wall mwalls[] =
|
||||
#define SC_LIQUID 4
|
||||
#define SC_NUCLEAR 7
|
||||
#define SC_LIFE 9
|
||||
#define SC_LIFE2 10
|
||||
#define SC_CRACKER 12
|
||||
#define SC_CRACKER2 13
|
||||
#define SC_TOTAL 11
|
||||
#define SC_TOTAL 10
|
||||
|
||||
static menu_section msections[] =
|
||||
{
|
||||
|
@ -511,11 +511,11 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"REPL", PIXPACK(0x259588), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B1357/S1357", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"MYST", PIXPACK(0x0C3C00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B3458/S05678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"BOYL", PIXPACK(0x0A3200), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.18f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Boyle, variable pressure gas. Expands when heated.", ST_GAS, TYPE_GAS, &update_BOYL},
|
||||
{"LOTE", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Behaves kinda like Living on the Edge S3458/B37/4", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"FRG2", PIXPACK(0x00FF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Like Frogs rule S124/B3/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"STAR", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"FROG", PIXPACK(0x00AA00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Frogs S12/B34/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"BRAN", PIXPACK(0xCCCC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"LOTE", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Behaves kinda like Living on the Edge S3458/B37/4", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"FRG2", PIXPACK(0x00FF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Like Frogs rule S124/B3/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"STAR", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"FROG", PIXPACK(0x00AA00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Frogs S12/B34/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"BRAN", PIXPACK(0xCCCC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
|
||||
};
|
||||
|
||||
|
@ -448,6 +448,8 @@ void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswa
|
||||
int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
|
||||
{
|
||||
int i, j, c;
|
||||
if (x > XRES-26 || x < 0)
|
||||
return 26;
|
||||
if (b>=UI_WALLSTART)
|
||||
{
|
||||
b = b-100;
|
||||
|
@ -1531,13 +1531,14 @@ void menu_ui(pixel *vid_buf, int i, int *sl, int *sr)
|
||||
|
||||
void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int my)
|
||||
{
|
||||
int h,x,y,n=0,height,width,sy,rows=0;
|
||||
int h,x,y,n=0,height,width,sy,rows=0,xoff=0,fwidth;
|
||||
SEC = SEC2;
|
||||
mx /= sdl_scale;
|
||||
my /= sdl_scale;
|
||||
rows = ceil((float)msections[i].itemcount/16.0f);
|
||||
height = (ceil((float)msections[i].itemcount/16.0f)*18);
|
||||
width = restrict_flt(msections[i].itemcount*31, 0, 16*31);
|
||||
fwidth = msections[i].itemcount*31;
|
||||
h = -1;
|
||||
x = XRES-BARSIZE-18;
|
||||
y = YRES+1;
|
||||
@ -1548,11 +1549,11 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
||||
{
|
||||
if (n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM)
|
||||
{
|
||||
if (x-18<=2)
|
||||
/*if (x-18<=2)
|
||||
{
|
||||
x = XRES-BARSIZE-18;
|
||||
y += 19;
|
||||
}
|
||||
}*/
|
||||
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5;
|
||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
||||
{
|
||||
@ -1585,11 +1586,11 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
||||
{
|
||||
if (n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM)
|
||||
{
|
||||
if (x-18<=0)
|
||||
/*if (x-18<=0)
|
||||
{
|
||||
x = XRES-BARSIZE-18;
|
||||
y += 19;
|
||||
}
|
||||
}*/
|
||||
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5;
|
||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
||||
{
|
||||
@ -1619,11 +1620,11 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
||||
{
|
||||
if (ptypes[n].menusection==i&&ptypes[n].menu==1)
|
||||
{
|
||||
if (x-18<=0)
|
||||
/*if (x-18<=0)
|
||||
{
|
||||
x = XRES-BARSIZE-18;
|
||||
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)
|
||||
{
|
||||
@ -1652,37 +1653,36 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fwidth > XRES){
|
||||
float overflow = fwidth-XRES+BARSIZE, location = ((float)XRES+BARSIZE)/((float)(mx-XRES+BARSIZE));
|
||||
xoff = (int)(overflow / location);
|
||||
}
|
||||
for (n = 0; n<PT_NUM; n++)
|
||||
{
|
||||
if (ptypes[n].menusection==i&&ptypes[n].menu==1)
|
||||
{
|
||||
if (x-18<=0)
|
||||
x -= draw_tool_xy(vid_buf, x-xoff, y, n, ptypes[n].pcolors)+5;
|
||||
if (!bq && mx>=x+32-xoff && mx<x+58-xoff && my>=y && my< y+15)
|
||||
{
|
||||
x = XRES-BARSIZE-18;
|
||||
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)
|
||||
{
|
||||
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
|
||||
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 255, 0, 0, 255);
|
||||
h = n;
|
||||
}
|
||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)))
|
||||
if (!bq && mx>=x+32-xoff && mx<x+58-xoff && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)))
|
||||
{
|
||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||
drawrect(vid_buf, x+30-xoff, 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);
|
||||
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 0, 255, 255, 255);
|
||||
}
|
||||
else if (n==*sl)
|
||||
{
|
||||
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
|
||||
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 255, 0, 0, 255);
|
||||
}
|
||||
else if (n==*sr)
|
||||
{
|
||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
||||
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 0, 0, 255, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user