From 24e7e4231d91d10e782bc2df3f66515368961048 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 4 Jan 2023 06:36:30 -0800 Subject: [PATCH] Print musicdef along with tunes -show --- src/s_sound.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/s_sound.c b/src/s_sound.c index c9a63e7bc..1fc80cf8e 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2457,6 +2457,27 @@ void S_StartEx(boolean reset) 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 static void Command_Tunes_f(void) { @@ -2481,8 +2502,15 @@ static void Command_Tunes_f(void) if (!strcasecmp(tunearg, "-show")) { + const musicdef_t *def = S_FindMusicDef(mapmusname); + CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"), mapmusname, (mapmusflags & MUSIC_TRACKMASK)); + + if (def != NULL) + { + PrintSongAuthors(def); + } return; } if (!strcasecmp(tunearg, "-none"))