Menu scrolling for 'special' menu
This commit is contained in:
parent
2e2694e0fb
commit
7d283335d4
@ -92,7 +92,7 @@ void menu_count(void)//puts the number of elements in each section into .itemcou
|
|||||||
int i=0;
|
int i=0;
|
||||||
msections[SC_LIFE].itemcount = NGOLALT;
|
msections[SC_LIFE].itemcount = NGOLALT;
|
||||||
msections[SC_WALL].itemcount = UI_WALLCOUNT-4;
|
msections[SC_WALL].itemcount = UI_WALLCOUNT-4;
|
||||||
msections[SC_SPECIAL].itemcount = 4;
|
msections[SC_SPECIAL].itemcount = 7;
|
||||||
for (i=0; i<PT_NUM; i++)
|
for (i=0; i<PT_NUM; i++)
|
||||||
{
|
{
|
||||||
msections[ptypes[i].menusection].itemcount+=ptypes[i].menu;
|
msections[ptypes[i].menusection].itemcount+=ptypes[i].menu;
|
||||||
@ -1948,6 +1948,10 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *dae, int b, int bq
|
|||||||
}
|
}
|
||||||
else if (i==SC_SPECIAL)//special menu
|
else if (i==SC_SPECIAL)//special menu
|
||||||
{
|
{
|
||||||
|
if (fwidth > XRES-BARSIZE) { //fancy scrolling
|
||||||
|
float overflow = fwidth-(XRES-BARSIZE), location = ((float)XRES-BARSIZE)/((float)(mx-(XRES-BARSIZE)));
|
||||||
|
xoff = (int)(overflow / location);
|
||||||
|
}
|
||||||
for (n = UI_WALLSTART; n<UI_WALLSTART+UI_WALLCOUNT; n++)
|
for (n = UI_WALLSTART; n<UI_WALLSTART+UI_WALLCOUNT; n++)
|
||||||
{
|
{
|
||||||
if (n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM||n==SPC_WIND||n==SPC_PGRV||n==SPC_NGRV)
|
if (n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM||n==SPC_WIND||n==SPC_PGRV||n==SPC_NGRV)
|
||||||
@ -1957,28 +1961,28 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *dae, int b, int bq
|
|||||||
x = XRES-BARSIZE-18;
|
x = XRES-BARSIZE-18;
|
||||||
y += 19;
|
y += 19;
|
||||||
}*/
|
}*/
|
||||||
x -= draw_tool_xy(vid_buf, x, y, n, wtypes[n-UI_WALLSTART].colour)+5;
|
x -= draw_tool_xy(vid_buf, x-xoff, y, n, wtypes[n-UI_WALLSTART].colour)+5;
|
||||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
if (!bq && mx>=x+32-xoff && mx<x+58-xoff && my>=y && my< y+15)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 55, 55, 255);
|
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 255, 55, 55, 255);
|
||||||
h = n;
|
h = n;
|
||||||
}
|
}
|
||||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_CTRL)))
|
if (!bq && mx>=x+32-xoff && mx<x+58-xoff && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_CTRL)))
|
||||||
{
|
{
|
||||||
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;
|
h = n;
|
||||||
}
|
}
|
||||||
else if (n==SLALT)
|
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)
|
else if (n==*sl)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 55, 55, 255);
|
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 255, 55, 55, 255);
|
||||||
}
|
}
|
||||||
else if (n==*sr)
|
else if (n==*sr)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 55, 55, 255, 255);
|
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 55, 55, 255, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1991,28 +1995,28 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *dae, int b, int bq
|
|||||||
x = XRES-BARSIZE-18;
|
x = XRES-BARSIZE-18;
|
||||||
y += 19;
|
y += 19;
|
||||||
}*/
|
}*/
|
||||||
x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5;
|
x -= draw_tool_xy(vid_buf, x-xoff, y, n, ptypes[n].pcolors)+5;
|
||||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
if (!bq && mx>=x+32-xoff && mx<x+58-xoff && my>=y && my< y+15)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 55, 55, 255);
|
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 255, 55, 55, 255);
|
||||||
h = n;
|
h = n;
|
||||||
}
|
}
|
||||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_CTRL)))
|
if (!bq && mx>=x+32-xoff && mx<x+58-xoff && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_CTRL)))
|
||||||
{
|
{
|
||||||
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;
|
h = n;
|
||||||
}
|
}
|
||||||
else if (n==SLALT)
|
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)
|
else if (n==*sl)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 55, 55, 255);
|
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 255, 55, 55, 255);
|
||||||
}
|
}
|
||||||
else if (n==*sr)
|
else if (n==*sr)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 55, 55, 255, 255);
|
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 55, 55, 255, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5470,7 +5474,7 @@ void catalogue_ui(pixel * vid_buf)
|
|||||||
int listy = 0, listxc;
|
int listy = 0, listxc;
|
||||||
int listx = 0, listyc;
|
int listx = 0, listyc;
|
||||||
pixel * vid_buf2;
|
pixel * vid_buf2;
|
||||||
float scrollvel = 0.0f, offsetf = 0.0f;
|
float scrollvel, offsetf = 0.0f;
|
||||||
char savetext[128] = "";
|
char savetext[128] = "";
|
||||||
char * last = mystrdup("");
|
char * last = mystrdup("");
|
||||||
savelist_e *saves, *cssave, *csave;
|
savelist_e *saves, *cssave, *csave;
|
||||||
@ -5687,8 +5691,6 @@ openfin:
|
|||||||
|
|
||||||
if(saves)
|
if(saves)
|
||||||
free_saveslist(saves);
|
free_saveslist(saves);
|
||||||
free(last);
|
|
||||||
free(vid_buf2);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user