Merge branch 'tunes-show-credit' into 'master'

Print musicdef along with tunes -show

See merge request KartKrew/Kart!854
This commit is contained in:
James R 2023-01-06 02:03:35 +00:00
commit a345ccda68

View file

@ -2457,6 +2457,27 @@ void S_StartEx(boolean reset)
music_stack_fadein = JINGLEPOSTFADE; music_stack_fadein = JINGLEPOSTFADE;
} }
static inline void PrintMusicDefField(const char *label, const char *field)
{
if (field)
{
CONS_Printf("%s%s\n", label, field);
}
}
static void PrintSongAuthors(const musicdef_t *def)
{
CONS_Printf("Volume: %d/100\n\n", def->volume);
PrintMusicDefField("Title: ", def->title);
PrintMusicDefField("Author: ", def->author);
CONS_Printf("\n");
PrintMusicDefField("Original Source: ", def->source);
PrintMusicDefField("Original Composers: ", def->composers);
}
// TODO: fix this function, needs better support for map names // TODO: fix this function, needs better support for map names
static void Command_Tunes_f(void) static void Command_Tunes_f(void)
{ {
@ -2481,8 +2502,15 @@ static void Command_Tunes_f(void)
if (!strcasecmp(tunearg, "-show")) if (!strcasecmp(tunearg, "-show"))
{ {
const musicdef_t *def = S_FindMusicDef(mapmusname);
CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"), CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
mapmusname, (mapmusflags & MUSIC_TRACKMASK)); mapmusname, (mapmusflags & MUSIC_TRACKMASK));
if (def != NULL)
{
PrintSongAuthors(def);
}
return; return;
} }
if (!strcasecmp(tunearg, "-none")) if (!strcasecmp(tunearg, "-none"))