From e0ac6b6044f4d0d807ae0f7a27c71c9d429989b5 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 25 Feb 2023 22:54:36 +0000 Subject: [PATCH 1/2] Music credits show up in more contexts - Drawn over the top of basically everything when enabled. - Update song credit on - Menu music update (can sometimes clear it) - Intermission begin - Vote begin - Return to title (by clearing it) --- src/d_main.c | 2 ++ src/hu_stuff.c | 10 +--------- src/hu_stuff.h | 3 ++- src/hwr2/pass_software.cpp | 3 +++ src/i_video_common.cpp | 3 +++ src/k_menufunc.c | 19 +++++++++++++++++-- src/v_video.h | 2 ++ src/y_inter.c | 5 +++++ 8 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index d6a097607..7cbddf194 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -967,6 +967,8 @@ void D_ClearState(void) // The title screen is obviously not a tutorial! (Unless I'm mistaken) tutorialmode = false; + cursongcredit.def = NULL; + G_SetGamestate(GS_NULL); wipegamestate = GS_NULL; } diff --git a/src/hu_stuff.c b/src/hu_stuff.c index cd4277dc6..9f4b52cef 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -924,9 +924,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) #endif } -// -// -static void HU_TickSongCredits(void) +void HU_TickSongCredits(void) { if (cursongcredit.def == NULL) // No def { @@ -1042,8 +1040,6 @@ void HU_Ticker(void) } resynch_ticker++; - - HU_TickSongCredits(); } static boolean teamtalk = false; @@ -2129,10 +2125,6 @@ void HU_Drawer(void) V_DrawCenteredString(BASEVIDWIDTH/2, 180, V_YELLOWMAP | V_ALLOWLOWERCASE, resynch_text); } - // draw song credits - if (cv_songcredits.value && !( hu_showscores && (netgame || multiplayer) )) - HU_DrawSongCredits(); - drawontop: // Opened chat if (chat_on) diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 3e8233020..1fc98d002 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -137,8 +137,9 @@ void HU_Start(void); boolean HU_Responder(event_t *ev); void HU_Ticker(void); -void HU_DrawSongCredits(void); void HU_Drawer(void); +void HU_DrawSongCredits(void); +void HU_TickSongCredits(void); char HU_dequeueChatChar(void); void HU_Erase(void); void HU_clearChatChars(void); diff --git a/src/hwr2/pass_software.cpp b/src/hwr2/pass_software.cpp index f3bfd69ef..a94b40169 100644 --- a/src/hwr2/pass_software.cpp +++ b/src/hwr2/pass_software.cpp @@ -94,6 +94,9 @@ static void temp_legacy_finishupdate_draws() SCR_CalculateFPS(); if (st_overlay) { + if (cv_songcredits.value) + HU_DrawSongCredits(); + if (cv_ticrate.value) SCR_DisplayTicRate(); diff --git a/src/i_video_common.cpp b/src/i_video_common.cpp index 7be4ca116..14f5e31ae 100644 --- a/src/i_video_common.cpp +++ b/src/i_video_common.cpp @@ -42,6 +42,9 @@ static void finish_legacy_ogl_update() if (st_overlay) { + if (cv_songcredits.value) + HU_DrawSongCredits(); + if (cv_ticrate.value) SCR_DisplayTicRate(); diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 39570b209..05d282e7f 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -63,7 +63,7 @@ consvar_t cv_showfocuslost = CVAR_INIT ("showfocuslost", "Yes", CV_SAVE, CV_YesN consvar_t cv_menujam_update = CVAR_INIT ("menujam_update", "Off", CV_SAVE, CV_OnOff, NULL); static CV_PossibleValue_t menujam_cons_t[] = {{0, "menu"}, {1, "menu2"}, {2, "menu3"}, {0, NULL}}; -static consvar_t cv_menujam = CVAR_INIT ("menujam", "0", CV_SAVE, menujam_cons_t, NULL); +static consvar_t cv_menujam = CVAR_INIT ("menujam", "menu", CV_SAVE, menujam_cons_t, NULL); // first time memory consvar_t cv_tutorialprompt = CVAR_INIT ("tutorialprompt", "On", CV_SAVE, CV_OnOff, NULL); @@ -333,6 +333,8 @@ boolean M_Responder(event_t *ev) return true; } +#define NotCurrentlyPlaying(desiredname) (!S_MusicPlaying() || strcmp(desiredname, S_MusicName())) + void M_PlayMenuJam(void) { menu_t *refMenu = (menuactive ? currentMenu : restoreMenu); @@ -348,10 +350,15 @@ void M_PlayMenuJam(void) if (refMenu->music[0] == '.' && refMenu->music[1] == '\0') { S_StopMusic(); + cursongcredit.def = NULL; } else { - S_ChangeMusicInternal(refMenu->music, true); + if (NotCurrentlyPlaying(refMenu->music)) + { + S_ChangeMusicInternal(refMenu->music, true); + S_ShowMusicCredit(); + } } return; } @@ -362,9 +369,15 @@ void M_PlayMenuJam(void) CV_SetValue(&cv_menujam_update, 0); } + if (!NotCurrentlyPlaying(cv_menujam.string)) + return; + S_ChangeMusicInternal(cv_menujam.string, true); + S_ShowMusicCredit(); } +#undef IsCurrentlyPlaying + // // M_SpecificMenuRestore // @@ -982,6 +995,8 @@ void M_Ticker(void) { INT32 i; + HU_TickSongCredits(); + if (!menuactive) { noFurtherInput = false; diff --git a/src/v_video.h b/src/v_video.h index 8a47d87d0..497f0e712 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -41,6 +41,8 @@ cv_rgamma, cv_ygamma, cv_ggamma, cv_cgamma, cv_bgamma, cv_mgamma, cv_rsaturation, cv_ysaturation, cv_gsaturation, cv_csaturation, cv_bsaturation, cv_msaturation, cv_palette, cv_palettenum; +extern consvar_t cv_songcredits; + // Allocates buffer screens, call before R_Init. void V_Init(void); diff --git a/src/y_inter.c b/src/y_inter.c index e40a55fcd..715289525 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -834,6 +834,8 @@ void Y_StartIntermission(void) if (!(gametyperules & GTR_CIRCUIT) && (timer > 1)) S_ChangeMusicInternal("racent", true); // loop it + S_ShowMusicCredit(); // Always call + switch (intertype) { case int_score: @@ -1281,7 +1283,10 @@ void Y_VoteTicker(void) D_PickVote(); if (!votetic) + { S_ChangeMusicInternal("vote", true); + S_ShowMusicCredit(); + } if (timer) timer--; From 3cc00ee09569a0665f763c05540f27a5418795ba Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 25 Feb 2023 23:11:09 +0000 Subject: [PATCH 2/2] Command_Tunes_f: Additional functionality - `tunes -show` now shows music_name rather than mapmusname - `tunes -showdefault` does the previous mapmusname behaviour --- src/s_sound.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index 6416080a7..6deab1f91 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2493,6 +2493,7 @@ static void Command_Tunes_f(void) CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n")); CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n")); CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n")); + CONS_Printf(M_GetText("* With \"-showdefault\", shows the current music for the level.\n")); CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n")); CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n")); return; @@ -2503,9 +2504,22 @@ static void Command_Tunes_f(void) if (!strcasecmp(tunearg, "-show")) { - const musicdef_t *def = S_FindMusicDef(mapmusname); + const musicdef_t *def = S_FindMusicDef(music_name); CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"), + music_name, (music_flags & MUSIC_TRACKMASK)); + + if (def != NULL) + { + PrintSongAuthors(def); + } + return; + } + if (!strcasecmp(tunearg, "-showdefault")) + { + const musicdef_t *def = S_FindMusicDef(mapmusname); + + CONS_Printf(M_GetText("The default tune is: %s [track %d]\n"), mapmusname, (mapmusflags & MUSIC_TRACKMASK)); if (def != NULL)