Improve Stereo text header drawing

- Use LSTitleHighString at the top of the menu for the music's title/Sound Test
- Only show Track for relevant entries
- Show cv_soundtest.value in hex for that Classic Sonic soundtest flavour
This commit is contained in:
toaster 2023-03-30 18:36:09 +01:00
parent 99f4641700
commit 2c0645cba2
3 changed files with 41 additions and 5 deletions

View file

@ -5931,6 +5931,9 @@ void M_DrawSoundTest(void)
UINT8 pid = 0; // todo: Add ability for any splitscreen player to bring up the menu.
INT32 x, y, i, cursorx = 0;
INT32 titleoffset = 0, titlewidth;
const char *titletext;
patch_t *btn = W_CachePatchName("STER_BTN", PU_CACHE);
if (gamestate == GS_MENU)
@ -5950,6 +5953,8 @@ void M_DrawSoundTest(void)
0
);
y += 32;
if (soundtest.current != NULL)
{
if (soundtest.current->sequence.map < nummapheaders)
@ -5962,8 +5967,11 @@ void M_DrawSoundTest(void)
NULL);
}
V_DrawThinString(x, y, (soundtest.playing ? highlightflags : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, soundtest.current->title);
V_DrawThinString(x, (y += 10), V_ALLOWLOWERCASE|V_6WIDTHSPACE, va("%d", soundtest.currenttrack));
titletext = soundtest.current->title;
y -= 10;
if (soundtest.current->numtracks > 1)
V_DrawThinString(x, (y += 10), V_ALLOWLOWERCASE|V_6WIDTHSPACE, va("Track %c", 'A'+soundtest.currenttrack));
if (soundtest.current->author)
V_DrawThinString(x, (y += 10), V_ALLOWLOWERCASE|V_6WIDTHSPACE, soundtest.current->author);
if (soundtest.current->source)
@ -5974,8 +5982,26 @@ void M_DrawSoundTest(void)
else
{
const char *sfxstr = (cv_soundtest.value) ? S_sfx[cv_soundtest.value].name : "N/A";
V_DrawThinString(x, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE, sfxstr);
V_DrawThinString(x, (y += 10), V_ALLOWLOWERCASE|V_6WIDTHSPACE, va("%d", cv_soundtest.value));
titletext = "Sound Test";
V_DrawThinString(x, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE, "Track ");
V_DrawThinString(
x + V_ThinStringWidth("Track ", V_ALLOWLOWERCASE|V_6WIDTHSPACE),
y,
V_6WIDTHSPACE,
va("%04X - %s", cv_soundtest.value, sfxstr)
);
}
titletext = va("%s - ", titletext);
titlewidth = V_LSTitleHighStringWidth(titletext, 0);
titleoffset = (-soundtest.menutick) % titlewidth;
while (titleoffset < 272)
{
V_DrawLSTitleHighString(x + titleoffset, 18+1, 0, titletext);
titleoffset += titlewidth;
}
V_ClearClipRect();

View file

@ -144,6 +144,11 @@ static boolean M_SoundTestInputs(INT32 ch)
return false;
}
static void M_SoundTestTick(void)
{
soundtest.menutick++;
}
menuitem_t MISC_SoundTest[] =
{
{IT_STRING | IT_CALL, "Back", "STER_IC0", NULL, {.routine = M_GoBack}, 0, stereospecial_back},
@ -171,7 +176,7 @@ menu_t MISC_SoundTestDef = {
".",
98, 0,
M_DrawSoundTest,
NULL,
M_SoundTestTick,
NULL,
NULL,
M_SoundTestInputs,
@ -182,6 +187,7 @@ void M_SoundTest(INT32 choice)
(void)choice;
// I reserve the right to add some sort of setup here -- toast 250323
soundtest.menutick = 0;
soundtest.justopened = true;
MISC_SoundTestDef.prevMenu = currentMenu;

View file

@ -214,8 +214,12 @@ extern struct soundtest
boolean paused; // System paused?
boolean justopened; // Menu visual assist
boolean privilegedrequest; // Overrides S_PlaysimMusicDisabled w/o changing every function signature
INT32 menutick;
musicdef_t *current; // Current selected music definition
SINT8 currenttrack; // Current selected music track for definition
soundtestsequence_t sequence; // Sequence head
} soundtest;