diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index 2845e8fc8..fef0ab505 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -220,6 +220,9 @@ void CONFIG_SetDefaults(void) ud.lockout = 0; ud.m_ffire = 1; ud.m_marker = 1; + ud.menu_slidebarz = 65536; + ud.menu_slidebarmargin = 65536; + ud.menu_slidecursorz = 65536; ud.mouseaiming = 0; ud.mouseflip = 1; ud.msgdisptime = 120; diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index 80461af0d..54bbd1048 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -163,6 +163,7 @@ typedef struct { int32_t statusbarflags, statusbarrange, statusbarcustom; int32_t hudontop; 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 coords,showfps,levelstats,m_coop,coop,screen_size,lockout,crosshair; diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 2ee874b30..bb4db08b0 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -1240,6 +1240,9 @@ const memberlabel_t UserdefsLabels[]= { "statusbarrange", USERDEFS_STATUSBARRANGE, 0, 0 }, { "statusbarcustom", USERDEFS_STATUSBARCUSTOM, 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 }; diff --git a/source/duke3d/src/gamedef.h b/source/duke3d/src/gamedef.h index 7b17c1342..9ff58744f 100644 --- a/source/duke3d/src/gamedef.h +++ b/source/duke3d/src/gamedef.h @@ -538,6 +538,9 @@ enum UserdefsLabel_t USERDEFS_STATUSBARRANGE, USERDEFS_STATUSBARCUSTOM, USERDEFS_HUDONTOP, + USERDEFS_MENU_SLIDEBARZ, + USERDEFS_MENU_SLIDEBARMARGIN, + USERDEFS_MENU_SLIDECURSORZ, USERDEFS_END }; diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index 237f2faeb..dd6d13fba 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -182,6 +182,9 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum) case USERDEFS_STATUSBARRANGE: labelNum = ud.statusbarrange; break; case USERDEFS_STATUSBARCUSTOM: labelNum = ud.statusbarcustom; 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; } @@ -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_STATUSBARCUSTOM: ud.statusbarcustom = 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; } } diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index d3fe38a63..ce180266a 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -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; Menu_GetFmt(object->font, status, &s, &p, &z); - const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x<<16, z); - const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y<<16, z); + const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x * ud.menu_slidebarz, z); + const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y * ud.menu_slidebarz, z); if (status & MT_XRight) 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 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 slidepointx = slidebarx + (1<<16) + 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 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 + mulscale16(ud.menu_slidebarmargin, z) + scale(slideregionwidth, *object->variable - object->min, object->max - object->min); + 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) { @@ -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; Menu_GetFmt(object->font, status, &s, &p, &z); - const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x<<16, z); - const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y<<16, z); + const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x * ud.menu_slidebarz, z); + const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y * ud.menu_slidebarz, z); if (status & MT_XRight) 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 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 slidepointx = slidebarx + (1<<16) + 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 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 + 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 * 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) { @@ -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; Menu_GetFmt(object->font, status, &s, &p, &z); - const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x<<16, z); - const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y<<16, z); + const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x * ud.menu_slidebarz, z); + const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y * ud.menu_slidebarz, z); if (status & MT_XRight) 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 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 slidepointx = slidebarx + (1<<16) + 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 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 + 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 * 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) {