New userdef structure: "menu_slidebarz", "menu_slidebarmargin", "menu_slidecursorz"

Self-explanatory. Default value for all is 65536.

Patch from Fox.

git-svn-id: https://svn.eduke32.com/eduke32@6589 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-01-26 04:35:02 +00:00
parent 4da012a15f
commit 1e04f43240
6 changed files with 40 additions and 21 deletions

View file

@ -220,6 +220,9 @@ void CONFIG_SetDefaults(void)
ud.lockout = 0; ud.lockout = 0;
ud.m_ffire = 1; ud.m_ffire = 1;
ud.m_marker = 1; ud.m_marker = 1;
ud.menu_slidebarz = 65536;
ud.menu_slidebarmargin = 65536;
ud.menu_slidecursorz = 65536;
ud.mouseaiming = 0; ud.mouseaiming = 0;
ud.mouseflip = 1; ud.mouseflip = 1;
ud.msgdisptime = 120; ud.msgdisptime = 120;

View file

@ -163,6 +163,7 @@ typedef struct {
int32_t statusbarflags, statusbarrange, statusbarcustom; int32_t statusbarflags, statusbarrange, statusbarcustom;
int32_t hudontop; int32_t hudontop;
int32_t screenarea_x1, screenarea_y1, screenarea_x2, screenarea_y2; int32_t screenarea_x1, screenarea_y1, screenarea_x2, screenarea_y2;
int32_t menu_slidebarz, menu_slidebarmargin, menu_slidecursorz;
int32_t entered_name,screen_tilting,shadows,fta_on,executions,auto_run; int32_t entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
int32_t coords,showfps,levelstats,m_coop,coop,screen_size,lockout,crosshair; int32_t coords,showfps,levelstats,m_coop,coop,screen_size,lockout,crosshair;

View file

@ -1240,6 +1240,9 @@ const memberlabel_t UserdefsLabels[]=
{ "statusbarrange", USERDEFS_STATUSBARRANGE, 0, 0 }, { "statusbarrange", USERDEFS_STATUSBARRANGE, 0, 0 },
{ "statusbarcustom", USERDEFS_STATUSBARCUSTOM, 0, 0 }, { "statusbarcustom", USERDEFS_STATUSBARCUSTOM, 0, 0 },
{ "hudontop", USERDEFS_HUDONTOP, 0, 0 }, { "hudontop", USERDEFS_HUDONTOP, 0, 0 },
{ "menu_slidebarz", USERDEFS_MENU_SLIDEBARZ, 0, 0 },
{ "menu_slidebarmargin", USERDEFS_MENU_SLIDEBARMARGIN, 0, 0 },
{ "menu_slidecursorz", USERDEFS_MENU_SLIDECURSORZ, 0, 0 },
{ NULL, -1, 0, 0 } // END OF LIST { NULL, -1, 0, 0 } // END OF LIST
}; };

View file

@ -538,6 +538,9 @@ enum UserdefsLabel_t
USERDEFS_STATUSBARRANGE, USERDEFS_STATUSBARRANGE,
USERDEFS_STATUSBARCUSTOM, USERDEFS_STATUSBARCUSTOM,
USERDEFS_HUDONTOP, USERDEFS_HUDONTOP,
USERDEFS_MENU_SLIDEBARZ,
USERDEFS_MENU_SLIDEBARMARGIN,
USERDEFS_MENU_SLIDECURSORZ,
USERDEFS_END USERDEFS_END
}; };

View file

@ -182,6 +182,9 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum)
case USERDEFS_STATUSBARRANGE: labelNum = ud.statusbarrange; break; case USERDEFS_STATUSBARRANGE: labelNum = ud.statusbarrange; break;
case USERDEFS_STATUSBARCUSTOM: labelNum = ud.statusbarcustom; break; case USERDEFS_STATUSBARCUSTOM: labelNum = ud.statusbarcustom; break;
case USERDEFS_HUDONTOP: labelNum = ud.hudontop; break; case USERDEFS_HUDONTOP: labelNum = ud.hudontop; break;
case USERDEFS_MENU_SLIDEBARZ: labelNum = ud.menu_slidebarz; break;
case USERDEFS_MENU_SLIDEBARMARGIN: labelNum = ud.menu_slidebarmargin; break;
case USERDEFS_MENU_SLIDECURSORZ: labelNum = ud.menu_slidecursorz; break;
default: labelNum = -1; break; default: labelNum = -1; break;
} }
@ -314,6 +317,9 @@ void __fastcall VM_SetUserdef(int32_t const labelNum, int32_t const iSet)
case USERDEFS_STATUSBARRANGE: ud.statusbarrange = iSet; break; case USERDEFS_STATUSBARRANGE: ud.statusbarrange = iSet; break;
case USERDEFS_STATUSBARCUSTOM: ud.statusbarcustom = iSet; break; case USERDEFS_STATUSBARCUSTOM: ud.statusbarcustom = iSet; break;
case USERDEFS_HUDONTOP: ud.hudontop = iSet; break; case USERDEFS_HUDONTOP: ud.hudontop = iSet; break;
case USERDEFS_MENU_SLIDEBARZ: ud.menu_slidebarz = iSet; break;
case USERDEFS_MENU_SLIDEBARMARGIN: ud.menu_slidebarmargin = iSet; break;
case USERDEFS_MENU_SLIDECURSORZ: ud.menu_slidecursorz = iSet; break;
default: break; default: break;
} }
} }

View file

@ -4625,8 +4625,8 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
int32_t z = entry->font->cursorScale; int32_t z = entry->font->cursorScale;
Menu_GetFmt(object->font, status, &s, &p, &z); Menu_GetFmt(object->font, status, &s, &p, &z);
const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x<<16, z); const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x * ud.menu_slidebarz, z);
const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y<<16, z); const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y * ud.menu_slidebarz, z);
if (status & MT_XRight) if (status & MT_XRight)
x -= slidebarwidth; x -= slidebarwidth;
@ -4635,14 +4635,15 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
const int32_t slidebarx = origin.x + x; const int32_t slidebarx = origin.x + x;
const int32_t slidebary = origin.y + y_upper + y + ((height - slidebarheight)>>1) - menu->scrollPos; const int32_t slidebary = origin.y + y_upper + y + ((height - slidebarheight)>>1) - menu->scrollPos;
const int32_t slidebarz = mulscale16(ud.menu_slidecursorz, z);
rotatesprite_ybounds(slidebarx, slidebary, z, 0, SLIDEBAR, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower); rotatesprite_ybounds(slidebarx, slidebary, slidebarz, 0, SLIDEBAR, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower);
const int32_t slideregionwidth = mulscale16((tilesiz[SLIDEBAR].x-2-tilesiz[SLIDEBAR+1].x)<<16, z); const int32_t slideregionwidth = mulscale16((tilesiz[SLIDEBAR].x * ud.menu_slidebarz) - (ud.menu_slidebarmargin<<1) - (tilesiz[SLIDEBAR+1].x * ud.menu_slidecursorz), z);
const int32_t slidepointx = slidebarx + (1<<16) + scale(slideregionwidth, *object->variable - object->min, object->max - object->min); const int32_t slidepointx = slidebarx + mulscale16(ud.menu_slidebarmargin, z) + scale(slideregionwidth, *object->variable - object->min, object->max - object->min);
const int32_t slidepointy = slidebary + mulscale16((tilesiz[SLIDEBAR].y-tilesiz[SLIDEBAR+1].y)<<15, z); const int32_t slidepointy = slidebary + mulscale16(((tilesiz[SLIDEBAR].y * ud.menu_slidebarz) - (tilesiz[SLIDEBAR+1].y * ud.menu_slidecursorz))>>1, z);
rotatesprite_ybounds(slidepointx, slidepointy, z, 0, SLIDEBAR+1, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower); rotatesprite_ybounds(slidepointx, slidepointy, slidebarz, 0, SLIDEBAR+1, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower);
if (object->flags & DisplayTypeMask) if (object->flags & DisplayTypeMask)
{ {
@ -4717,8 +4718,8 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
int32_t z = entry->font->cursorScale; int32_t z = entry->font->cursorScale;
Menu_GetFmt(object->font, status, &s, &p, &z); Menu_GetFmt(object->font, status, &s, &p, &z);
const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x<<16, z); const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x * ud.menu_slidebarz, z);
const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y<<16, z); const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y * ud.menu_slidebarz, z);
if (status & MT_XRight) if (status & MT_XRight)
x -= slidebarwidth; x -= slidebarwidth;
@ -4727,14 +4728,15 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
const int32_t slidebarx = origin.x + x; const int32_t slidebarx = origin.x + x;
const int32_t slidebary = origin.y + y_upper + y + ((height - slidebarheight)>>1) - menu->scrollPos; const int32_t slidebary = origin.y + y_upper + y + ((height - slidebarheight)>>1) - menu->scrollPos;
const int32_t slidebarz = mulscale16(ud.menu_slidecursorz, z);
rotatesprite_ybounds(slidebarx, slidebary, z, 0, SLIDEBAR, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower); rotatesprite_ybounds(slidebarx, slidebary, slidebarz, 0, SLIDEBAR, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower);
const int32_t slideregionwidth = mulscale16((tilesiz[SLIDEBAR].x-2-tilesiz[SLIDEBAR+1].x)<<16, z); const int32_t slideregionwidth = mulscale16((tilesiz[SLIDEBAR].x * ud.menu_slidebarz) - (ud.menu_slidebarmargin<<1) - (tilesiz[SLIDEBAR+1].x * ud.menu_slidecursorz), z);
const int32_t slidepointx = slidebarx + (1<<16) + Blrintf((float) slideregionwidth * (*object->variable - object->min) / (object->max - object->min)); const int32_t slidepointx = slidebarx + mulscale16(ud.menu_slidebarmargin, z) + Blrintf((float) slideregionwidth * (*object->variable - object->min) / (object->max - object->min));
const int32_t slidepointy = slidebary + mulscale16((tilesiz[SLIDEBAR].y-tilesiz[SLIDEBAR+1].y)<<15, z); const int32_t slidepointy = slidebary + mulscale16(((tilesiz[SLIDEBAR].y * ud.menu_slidebarz) - (tilesiz[SLIDEBAR+1].y * ud.menu_slidecursorz))>>1, z);
rotatesprite_ybounds(slidepointx, slidepointy, z, 0, SLIDEBAR+1, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower); rotatesprite_ybounds(slidepointx, slidepointy, slidebarz, 0, SLIDEBAR+1, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower);
if (object->flags & DisplayTypeMask) if (object->flags & DisplayTypeMask)
{ {
@ -4810,8 +4812,8 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
int32_t z = entry->font->cursorScale; int32_t z = entry->font->cursorScale;
Menu_GetFmt(object->font, status, &s, &p, &z); Menu_GetFmt(object->font, status, &s, &p, &z);
const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x<<16, z); const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x * ud.menu_slidebarz, z);
const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y<<16, z); const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y * ud.menu_slidebarz, z);
if (status & MT_XRight) if (status & MT_XRight)
x -= slidebarwidth; x -= slidebarwidth;
@ -4820,14 +4822,15 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
const int32_t slidebarx = origin.x + x; const int32_t slidebarx = origin.x + x;
const int32_t slidebary = origin.y + y_upper + y + ((height - slidebarheight)>>1) - menu->scrollPos; const int32_t slidebary = origin.y + y_upper + y + ((height - slidebarheight)>>1) - menu->scrollPos;
const int32_t slidebarz = mulscale16(ud.menu_slidecursorz, z);
rotatesprite_ybounds(slidebarx, slidebary, z, 0, SLIDEBAR, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower); rotatesprite_ybounds(slidebarx, slidebary, slidebarz, 0, SLIDEBAR, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower);
const int32_t slideregionwidth = mulscale16((tilesiz[SLIDEBAR].x-2-tilesiz[SLIDEBAR+1].x)<<16, z); const int32_t slideregionwidth = mulscale16((tilesiz[SLIDEBAR].x * ud.menu_slidebarz) - (ud.menu_slidebarmargin<<1) - (tilesiz[SLIDEBAR+1].x * ud.menu_slidecursorz), z);
const int32_t slidepointx = slidebarx + (1<<16) + lrint((double) slideregionwidth * (*object->variable - object->min) / (object->max - object->min)); const int32_t slidepointx = slidebarx + mulscale16(ud.menu_slidebarmargin, z) + lrint((double) slideregionwidth * (*object->variable - object->min) / (object->max - object->min));
const int32_t slidepointy = slidebary + mulscale16((tilesiz[SLIDEBAR].y-tilesiz[SLIDEBAR+1].y)<<15, z); const int32_t slidepointy = slidebary + mulscale16(((tilesiz[SLIDEBAR].y * ud.menu_slidebarz) - (tilesiz[SLIDEBAR+1].y * ud.menu_slidecursorz))>>1, z);
rotatesprite_ybounds(slidepointx, slidepointy, z, 0, SLIDEBAR+1, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower); rotatesprite_ybounds(slidepointx, slidepointy, slidebarz, 0, SLIDEBAR+1, s, (entry->flags & (MEF_Disabled|MEF_LookDisabled)) ? 1 : 0, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower);
if (object->flags & DisplayTypeMask) if (object->flags & DisplayTypeMask)
{ {