mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
New userdef structures: "menu_scrollbartilenum", "menu_scrollbarz", "menu_scrollcursorz"
Set "menu_scrollbartilenum" to the first tilenum of a series of 4 tiles: <tilenum> = Middle (tiled to fill the scrollbar height) <tilenum> + 1 = Top <tilenum> + 2 = Bottom <tilenum> + 3 = Cursor Default value for menu_scrollbartilenum is -1, which will display EDuke32's default scrollbar. Use "menu_scrollbarz" and "menu_scrollcursorz" to control the scale of the scrollbar. Default values are 65536. Patch from Fox. git-svn-id: https://svn.eduke32.com/eduke32@6686 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
50ac58f374
commit
63d93e8d9f
6 changed files with 46 additions and 7 deletions
|
@ -257,6 +257,9 @@ void CONFIG_SetDefaults(void)
|
|||
ud.default_skill = 1;
|
||||
ud.slidebar_paldisabled = 1;
|
||||
ud.shadow_pal = 4;
|
||||
ud.menu_scrollbartilenum = -1;
|
||||
ud.menu_scrollbarz = 65536;
|
||||
ud.menu_scrollcursorz = 65536;
|
||||
|
||||
ud.config.CheckForUpdates = 1;
|
||||
|
||||
|
|
|
@ -167,6 +167,7 @@ typedef struct {
|
|||
int32_t hudontop;
|
||||
int32_t screenarea_x1, screenarea_y1, screenarea_x2, screenarea_y2;
|
||||
int32_t menu_slidebarz, menu_slidebarmargin, menu_slidecursorz;
|
||||
int32_t menu_scrollbartilenum, menu_scrollbarz, menu_scrollcursorz;
|
||||
|
||||
int32_t entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
|
||||
int32_t coords,showfps,levelstats,m_coop,coop,screen_size,lockout,crosshair;
|
||||
|
|
|
@ -1314,6 +1314,9 @@ const memberlabel_t UserdefsLabels[]=
|
|||
{ "music_episode", USERDEFS_MUSIC_EPISODE, 0, 0 },
|
||||
{ "music_level", USERDEFS_MUSIC_LEVEL, 0, 0 },
|
||||
{ "shadow_pal", USERDEFS_SHADOW_PAL, 0, 0 },
|
||||
{ "menu_scrollbartilenum", USERDEFS_MENU_SCROLLBARTILENUM, 0, 0 },
|
||||
{ "menu_scrollbarz", USERDEFS_MENU_SCROLLBARZ, 0, 0 },
|
||||
{ "menu_scrollcursorz", USERDEFS_MENU_SCROLLCURSORZ, 0, 0 },
|
||||
{ NULL, -1, 0, 0 } // END OF LIST
|
||||
};
|
||||
|
||||
|
|
|
@ -585,6 +585,9 @@ enum UserdefsLabel_t
|
|||
USERDEFS_MUSIC_EPISODE,
|
||||
USERDEFS_MUSIC_LEVEL,
|
||||
USERDEFS_SHADOW_PAL,
|
||||
USERDEFS_MENU_SCROLLBARTILENUM,
|
||||
USERDEFS_MENU_SCROLLBARZ,
|
||||
USERDEFS_MENU_SCROLLCURSORZ,
|
||||
USERDEFS_END
|
||||
};
|
||||
|
||||
|
|
|
@ -215,6 +215,9 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum)
|
|||
case USERDEFS_MUSIC_EPISODE: labelNum = ud.music_episode; break;
|
||||
case USERDEFS_MUSIC_LEVEL: labelNum = ud.music_level; break;
|
||||
case USERDEFS_SHADOW_PAL: labelNum = ud.shadow_pal; break;
|
||||
case USERDEFS_MENU_SCROLLBARTILENUM: labelNum = ud.menu_scrollbartilenum; break;
|
||||
case USERDEFS_MENU_SCROLLBARZ: labelNum = ud.menu_scrollbarz; break;
|
||||
case USERDEFS_MENU_SCROLLCURSORZ: labelNum = ud.menu_scrollcursorz; break;
|
||||
default: labelNum = -1; break;
|
||||
}
|
||||
|
||||
|
@ -388,6 +391,9 @@ void __fastcall VM_SetUserdef(int32_t const labelNum, int32_t const iSet)
|
|||
case USERDEFS_SLIDEBAR_PALSELECTED: ud.slidebar_palselected = iSet; break;
|
||||
case USERDEFS_SLIDEBAR_PALDISABLED: ud.slidebar_paldisabled = iSet; break;
|
||||
case USERDEFS_SHADOW_PAL: ud.shadow_pal = iSet; break;
|
||||
case USERDEFS_MENU_SCROLLBARTILENUM: ud.menu_scrollbartilenum = iSet; break;
|
||||
case USERDEFS_MENU_SCROLLBARZ: ud.menu_scrollbarz = iSet; break;
|
||||
case USERDEFS_MENU_SCROLLCURSORZ: ud.menu_scrollcursorz = iSet; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4313,20 +4313,43 @@ static void Menu_RunScrollbar(Menu_t *cm, MenuMenuFormat_t const * const format,
|
|||
{
|
||||
if (totalextent > klabs(format->bottomcutoff))
|
||||
{
|
||||
const int32_t scrollx = origin.x + rightedge - (tilesiz[SELECTDIR].x<<16), scrolly = origin.y + format->pos.y;
|
||||
const int32_t scrollwidth = tilesiz[SELECTDIR].x<<16;
|
||||
int32_t scrollTile = (ud.menu_scrollbartilenum >= 0) ? ud.menu_scrollbartilenum : -1;
|
||||
int32_t scrollTileTop = (ud.menu_scrollbartilenum >= 0) ? ud.menu_scrollbartilenum + 1 : -1;
|
||||
int32_t scrollTileBottom = (ud.menu_scrollbartilenum >= 0) ? ud.menu_scrollbartilenum + 2 : -1;
|
||||
int32_t scrollTileCursor = (ud.menu_scrollbartilenum >= 0) ? ud.menu_scrollbartilenum + 3 : SELECTDIR;
|
||||
|
||||
const int32_t scrollwidth = (scrollTile >= 0) ? tilesiz[scrollTile].x*ud.menu_scrollbarz : tilesiz[scrollTileCursor].x*ud.menu_scrollcursorz;
|
||||
const int32_t scrollx = origin.x + rightedge - scrollwidth, scrolly = origin.y + format->pos.y;
|
||||
const int32_t scrollheight = klabs(format->bottomcutoff) - format->pos.y;
|
||||
const int32_t scrollregionheight = scrollheight - (tilesiz[SELECTDIR].y<<16);
|
||||
int32_t scrollregionstart = scrolly;
|
||||
int32_t scrollregionend = scrolly + scrollheight;
|
||||
if (ud.menu_scrollbartilenum >= 0)
|
||||
{
|
||||
scrollregionstart += tilesiz[scrollTileTop].y*ud.menu_scrollbarz;
|
||||
scrollregionend += tilesiz[scrollTileBottom].y*ud.menu_scrollbarz;
|
||||
}
|
||||
const int32_t scrollregionheight = scrollregionend - scrollregionstart - (tilesiz[scrollTileCursor].y*ud.menu_scrollcursorz);
|
||||
const int32_t scrollPosMax = totalextent - klabs(format->bottomcutoff);
|
||||
|
||||
Menu_BlackRectangle(scrollx, scrolly, scrollwidth, scrollheight, 1|32);
|
||||
if (scrollTile >= 0)
|
||||
{
|
||||
if (tilesiz[scrollTile].y > 0)
|
||||
{
|
||||
for (int32_t y = scrollregionstart; y < scrollregionend; y += tilesiz[scrollTile].y*ud.menu_scrollbarz)
|
||||
rotatesprite(scrollx, y, ud.menu_scrollbarz, 0, scrollTile, 0, 0, 26, 0, 0, xdim-1, mulscale16(scrollregionend, ydim*200)-1);
|
||||
}
|
||||
rotatesprite_fs(scrollx, scrolly, ud.menu_scrollbarz, 0, scrollTileTop, 0, 0, 26);
|
||||
rotatesprite_fs(scrollx, scrollregionend, ud.menu_scrollbarz, 0, scrollTileBottom, 0, 0, 26);
|
||||
}
|
||||
else
|
||||
Menu_BlackRectangle(scrollx, scrolly, scrollwidth, scrollheight, 1|32);
|
||||
|
||||
rotatesprite_fs(scrollx, scrolly + scale(scrollregionheight, *scrollPos, scrollPosMax), 65536, 0, SELECTDIR, 0, 0, 26);
|
||||
rotatesprite_fs(scrollx + (scrollwidth>>1) - ((tilesiz[scrollTileCursor].x*ud.menu_scrollcursorz)>>1), scrollregionstart + scale(scrollregionheight, *scrollPos, scrollPosMax), ud.menu_scrollcursorz, 0, scrollTileCursor, 0, 0, 26);
|
||||
|
||||
if (cm == m_currentMenu && !m_mousecaught && MOUSEACTIVECONDITIONAL(mousepressstate == Mouse_Pressed || mousepressstate == Mouse_Held))
|
||||
{
|
||||
const int32_t scrolltilehalfheight = tilesiz[SELECTDIR].y<<15;
|
||||
const int32_t scrollregiony = scrolly + scrolltilehalfheight;
|
||||
const int32_t scrolltilehalfheight = (tilesiz[scrollTileCursor].y*ud.menu_scrollcursorz)>>1;
|
||||
const int32_t scrollregiony = scrollregionstart + scrolltilehalfheight;
|
||||
|
||||
// region between the y-midline of the arrow at the extremes scrolls proportionally
|
||||
if (!Menu_MouseOutsideBounds(&m_mousepos, scrollx, scrollregiony, scrollwidth, scrollregionheight))
|
||||
|
|
Loading…
Reference in a new issue