mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-29 23:22:01 +00:00
Fix up menu scrollbars somewhat for when there's a thousand entries.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5971 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
4ddb475e7b
commit
e41e42b966
1 changed files with 10 additions and 3 deletions
|
@ -479,6 +479,7 @@ static void MenuDrawItems(int xpos, int ypos, menuoption_t *option, emenu_t *men
|
|||
mpic_t *p;
|
||||
int pw,ph;
|
||||
int framescroll = 0;
|
||||
int framescrollheight = 0;
|
||||
|
||||
menuframe_t *framescroller = NULL;
|
||||
|
||||
|
@ -487,17 +488,21 @@ static void MenuDrawItems(int xpos, int ypos, menuoption_t *option, emenu_t *men
|
|||
if (option->common.ishidden)
|
||||
continue;
|
||||
|
||||
if (framescroller && option == menu->selecteditem)
|
||||
if (framescroller && option == menu->selecteditem && framescrollheight)
|
||||
{
|
||||
if (ypos+option->common.posy < framescroller->common.posy)
|
||||
{
|
||||
framescroller->frac -= 0.1;
|
||||
int i = ypos+option->common.posy+framescroll - framescroller->common.posy;
|
||||
i-=8;
|
||||
framescroller->frac = (i)/(float)framescrollheight;
|
||||
if (framescroller->frac < 0)
|
||||
framescroller->frac = 0;
|
||||
}
|
||||
else if (ypos+option->common.posy+option->common.height > framescroller->common.posy+framescroller->common.height)
|
||||
{
|
||||
framescroller->frac += 0.1;
|
||||
int i = ypos+option->common.posy+framescroll - framescroller->common.posy;
|
||||
i -= vid.height-8-framescroller->common.posy-option->common.height;
|
||||
framescroller->frac = (i)/(float)framescrollheight;
|
||||
if (framescroller->frac > 1)
|
||||
framescroller->frac = 1;
|
||||
}
|
||||
|
@ -594,6 +599,7 @@ static void MenuDrawItems(int xpos, int ypos, menuoption_t *option, emenu_t *men
|
|||
maxy = opt2->common.posy + opt2->common.height;
|
||||
}
|
||||
maxy -= vid.height-8;
|
||||
framescrollheight = maxy;
|
||||
|
||||
if (maxy < 0)
|
||||
{
|
||||
|
@ -601,6 +607,7 @@ static void MenuDrawItems(int xpos, int ypos, menuoption_t *option, emenu_t *men
|
|||
option->frame.frac = 0;
|
||||
option->frame.common.width = 0;
|
||||
option->frame.common.height = 0;
|
||||
framescrollheight= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue