diff --git a/src/k_menu.h b/src/k_menu.h index 17d62d019..4b836ab98 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -1225,11 +1225,13 @@ typedef enum stereospecial_back, stereospecial_pause, stereospecial_play, + stereospecial_vol, stereospecial_track, } stereospecial_e; void M_SoundTest(INT32 choice); void M_DrawSoundTest(void); +consvar_t *M_GetSoundTestVolumeCvar(void); // These defines make it a little easier to make menus #define DEFAULTMENUSTYLE(source, prev, x, y)\ diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 5450fc828..31162482a 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -6043,6 +6043,48 @@ void M_DrawSoundTest(void) V_DrawFill(x+2, currentMenu->y + 22, 23, 1, 30); } + else if (currentMenu->menuitems[i].mvar2 == stereospecial_vol) // Vol + { + consvar_t *voltoadjust = M_GetSoundTestVolumeCvar(); + INT32 j, vol = 0; + const INT32 barheight = 22; + + V_DrawFixedPatch((x+1) << FRACBITS, y << FRACBITS, + FRACUNIT, 0, + W_CachePatchName("STER_KNB", PU_CACHE), + NULL + ); + + V_DrawFill(x+1+24, y+1, 5, barheight, 30); + + if (voltoadjust != NULL) + { + vol = (barheight*voltoadjust->value)/(MAX_SOUND_VOLUME*3); + } + + for (j = 0; j <= barheight/3; j++) + { + UINT8 col = 130; + + if (j == 0) + { + continue; + } + + if (j > vol) + { + col = 20; + } + else if (j > (barheight/3)-2) + { + col = 34; + } + + V_DrawFill(x+1+24+2, y+1 + (barheight-(j*3)), 1, 2, col); + } + + x += 5; + } else if (currentMenu->menuitems[i].mvar2 == stereospecial_track) // Track { if (i == itemOn) diff --git a/src/menus/transient/sound-test.c b/src/menus/transient/sound-test.c index 6273a7e68..b33514e4e 100644 --- a/src/menus/transient/sound-test.c +++ b/src/menus/transient/sound-test.c @@ -73,6 +73,29 @@ static void M_SoundTestNextPrev(INT32 choice) S_UpdateSoundTestDef((currentMenu->menuitems[itemOn].mvar1 < 0), true, false); } +consvar_t *M_GetSoundTestVolumeCvar(void) +{ + if (soundtest.current == NULL) + { + if (cv_soundtest.value == 0) + return NULL; + + return &cv_soundvolume; + } + + return &cv_digmusicvolume; +} + +static void M_SoundTestVol(INT32 choice) +{ + consvar_t *voltoadjust = M_GetSoundTestVolumeCvar(); + + if (!voltoadjust) + return; + + M_ChangeCvarDirect(choice, voltoadjust); +} + static void M_SoundTestTrack(INT32 choice) { const UINT8 numtracks = (soundtest.current != NULL) ? soundtest.current->numtracks : 0; @@ -131,7 +154,8 @@ menuitem_t MISC_SoundTest[] = {IT_SPACE, NULL, NULL, NULL, {NULL}, 8, 0}, {IT_STRING | IT_CALL, "Prev", "STER_IC4", NULL, {.routine = M_SoundTestNextPrev}, -1, 0}, {IT_STRING | IT_CALL, "Next", "STER_IC5", NULL, {.routine = M_SoundTestNextPrev}, 1, 0}, - {IT_SPACE, NULL, NULL, NULL, {NULL}, 0, 276}, + {IT_SPACE, NULL, NULL, NULL, {NULL}, 0, 244}, + {IT_STRING | IT_ARROWS, "Vol", NULL, NULL, {.routine = M_SoundTestVol}, 0, stereospecial_vol}, {IT_STRING | IT_ARROWS, "Track", NULL, NULL, {.routine = M_SoundTestTrack}, 0, stereospecial_track}, };