diff --git a/src/m_menu.c b/src/m_menu.c index 9f621af6a..b75cfa430 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5766,7 +5766,8 @@ static void M_DrawMusicTest(void) x = 24; y = 64; - if (renderisnewtic) st_musictime++; + if (renderisnewtic) + st_musictime++; while (t <= b) { @@ -5774,12 +5775,13 @@ static void M_DrawMusicTest(void) V_DrawFill(20, y-4, 280-1, 16, 237); { + const musicdef_t *def = S_GetMusicCredit(t); - const size_t MAXLENGTH = 34; const char *songname = def->title[0] ? def->title : def->source; size_t namelength = strlen(songname); + static const size_t MAXLENGTH = 34; char buf[MAXLENGTH+1]; if (t == st_sel && namelength > MAXLENGTH) @@ -5788,11 +5790,13 @@ static void M_DrawMusicTest(void) strlcpy(buf, songname, MAXLENGTH); V_DrawString(x, y, (t == st_sel ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE|V_MONOSPACE, buf); + if (curplaying == def) { V_DrawFill(20+280-9, y-4, 8, 16, 230); } } + t++; y += 16; } diff --git a/src/m_misc.c b/src/m_misc.c index 493e66487..7fba30790 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1261,7 +1261,7 @@ void M_ScrollString(const char name[], size_t len, char result[], size_t maxlen, const size_t amount = len - maxlen + 1; // Note: anything above 17 will cause zero division - const size_t MAXSPEED = 6; + static const size_t MAXSPEED = 6; const tic_t t = timer / (35/min(amount, MAXSPEED)); const size_t state = (t / amount) % 4; @@ -1296,7 +1296,7 @@ void M_ScrollString(const char name[], size_t len, char result[], size_t maxlen, } // Technically not necessary, since it gets set again after function call, but just in case - result[maxlen] = 0; + result[maxlen-1] = '\0'; } void M_MinimapGenerate(void)