diff --git a/src/s_sound.c b/src/s_sound.c index ae2b51d64..e0cab7e89 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -54,6 +54,7 @@ static void SetChannelsNum(void); static void Command_Tunes_f(void); static void Command_RestartAudio_f(void); static void Command_RestartMusic_f(void); //mhhhm amiga type filters here i come uwu +static void Command_ShowMusicCredit_f(void); // Sound system toggles #ifndef NO_MIDI @@ -322,6 +323,7 @@ void S_RegisterSoundStuff(void) COM_AddCommand("tunes", Command_Tunes_f); COM_AddCommand("restartaudio", Command_RestartAudio_f); COM_AddCommand("restartmusic", Command_RestartMusic_f); + COM_AddCommand("showmusiccredit", Command_ShowMusicCredit_f); #if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff @@ -1514,18 +1516,16 @@ void S_InitMusicDefs(void) S_LoadMusicDefs(i); } + // -// S_ShowSpecifiedMusicCredit +// S_FindMusicCredit // -// Display song's credit on screen +// Returns musicdef of specified song, or null if musicdef for it doesn't exist // -void S_ShowSpecifiedMusicCredit(const char *musname) +musicdef_t *S_FindMusicCredit(const char *musname) { musicdef_t *def = musicdefstart; - if (!cv_songcredits.value || demo.rewinding) - return; - if (!def) // No definitions return; @@ -1533,15 +1533,36 @@ void S_ShowSpecifiedMusicCredit(const char *musname) { if (!stricmp(def->name, musname)) { - cursongcredit.def = def; - cursongcredit.anim = 5*TICRATE; - cursongcredit.x = 0; - cursongcredit.trans = NUMTRANSMAPS; - return; + return def; } else def = def->next; } + + return NULL; +} + +// +// S_ShowSpecifiedMusicCredit +// +// Display song's credit on screen +// +void S_ShowSpecifiedMusicCredit(const char *musname) +{ + musicdef_t *def; + + if (!cv_songcredits.value || demo.rewinding) + return; + + def = S_FindMusicCredit(musname); + + if (def) + { + cursongcredit.def = def; + cursongcredit.anim = 5*TICRATE; + cursongcredit.x = 0; + cursongcredit.trans = NUMTRANSMAPS; + } } // @@ -2175,6 +2196,26 @@ static void Command_RestartMusic_f(void) //same as RestartAudio but only music g S_RestartMusic(); } +static void Command_ShowMusicCredit_f(void) +{ + const char *musname = music_name; + + if (COM_Argc() > 1) + { + musname = COM_Argv(1); + } + else + { + S_ShowMusicCredit(); + } + + musicdef_t *def = S_FindMusicCredit(musname); + + if (def) { + CONS_Printf("%.6s - %.255s\n", musname, def->source); + } +} + void GameSounds_OnChange(void) { if (M_CheckParm("-nosound") || M_CheckParm("-noaudio")) diff --git a/src/s_sound.h b/src/s_sound.h index 2dd39f6f4..f19361714 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -172,6 +172,7 @@ extern musicdef_t *musicdefstart; void S_LoadMusicDefs(UINT16 wadnum); void S_InitMusicDefs(void); +musicdef_t *S_FindMusicCredit(const char *musname); void S_ShowSpecifiedMusicCredit(const char *musname); void S_ShowMusicCredit(void);