mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Stereo Volume
Access to soundvolume and musicvolume through the Stereo Mode menu
- Draws a knob and volume bar (with loudness warning)
- Changes which cvar is associated with it depending on selected song/lack of
- If on any regular song, use digital music volume
- If on soundtest, use sound volume
- unless on entry 0 aka N/A, where no volume is visible at all
This commit is contained in:
parent
f9975d6a71
commit
e5c3b566bf
3 changed files with 69 additions and 1 deletions
|
|
@ -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)\
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue