From eefb4de6d6183d43a5cf618bba9a62e1b874e3a9 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 29 Jan 2024 22:16:33 -0800 Subject: [PATCH 1/6] Intermission: scroll map name above "DR. ROBOTNIK'S RING RACERS" --- src/y_inter.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/src/y_inter.c b/src/y_inter.c index 84ffa9398..58a7652d6 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -82,6 +82,7 @@ static INT32 replayprompttic; static fixed_t mqscroll = 0; static fixed_t chkscroll = 0; +static fixed_t ttlscroll = 0; intertype_t intertype = int_none; @@ -1523,6 +1524,55 @@ void Y_DrawIntermissionHeader(fixed_t x, fixed_t y, boolean gotthrough, const ch V_ClearClipRect(); } +static void Y_DrawMapTitleString(fixed_t x, const char *name) +{ + V_DrawStringScaled( + x - ttlscroll, + (BASEVIDHEIGHT - 73) * FRACUNIT, + FRACUNIT, + FRACUNIT, + FRACUNIT, + V_SUBTRACT | V_60TRANS, + NULL, + LSHI_FONT, + name + ); +} + +static fixed_t Y_DrawMapTitle(void) +{ + const char *name = bossinfo.valid && bossinfo.enemyname ? + bossinfo.enemyname : mapheaderinfo[prevmap]->menuttl; + char *buf = NULL; + + if (!name[0]) + { + buf = G_BuildMapTitle(prevmap + 1); + name = buf; + } + + fixed_t w = V_StringScaledWidth( + FRACUNIT, + FRACUNIT, + FRACUNIT, + 0, + LSHI_FONT, + name + ) + (16 * FRACUNIT); + + fixed_t x = BASEVIDWIDTH * FRACUNIT; + + while (x > -w) + { + Y_DrawMapTitleString(x, name); + x -= w; + } + + Z_Free(buf); + + return w; +} + // // Y_IntermissionDrawer // @@ -1565,6 +1615,8 @@ void Y_IntermissionDrawer(void) V_DrawFixedPatch(chkscroll, 0, FRACUNIT, V_SUBTRACT, rbgchk, NULL); V_DrawFixedPatch(chkscroll - chkloop, 0, FRACUNIT, V_SUBTRACT, rbgchk, NULL); + fixed_t ttlloop = Y_DrawMapTitle(); + // Animate scrolling elements if relevant if (!paused && !P_AutoPause()) { @@ -1575,6 +1627,10 @@ void Y_IntermissionDrawer(void) chkscroll += renderdeltatics; if (chkscroll > chkloop) chkscroll %= chkloop; + + ttlscroll += renderdeltatics * 2; + if (ttlscroll > ttlloop) + ttlscroll %= ttlloop; } if (renderisnewtic) From 3876f16c0d86fb636cfa6089f387cd13c0009135 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 29 Jan 2024 22:21:24 -0800 Subject: [PATCH 2/6] Intermission: fix speed scramble position in non-green resolutions --- src/y_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index 58a7652d6..62c08ee29 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1674,7 +1674,7 @@ skiptallydrawer: { if (speedscramble != -1 && speedscramble != gamespeed) { - V_DrawCenteredThinString(BASEVIDWIDTH/2, 154, highlightflags|V_SNAPTOBOTTOM, + V_DrawCenteredThinString(BASEVIDWIDTH/2, 154, highlightflags, va(M_GetText("Next race will be %s Speed!"), kartspeed_cons_t[1+speedscramble].strvalue)); } } From fb9f4a68b9f04ad567dae497335139b420202ef4 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 29 Jan 2024 22:22:51 -0800 Subject: [PATCH 3/6] Server splash: display server name in medium font --- src/st_stuff.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 00c8773bd..d65d19ea1 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1459,10 +1459,19 @@ void ST_DrawServerSplash(boolean timelimited) fixed_t textX = (BASEVIDWIDTH - 16 - 36) * FRACUNIT; fixed_t textY = (24 - 8) * FRACUNIT; - - V_DrawRightAlignedStringAtFixed( - textX, textY, + fixed_t textW = V_StringScaledWidth( + FRACUNIT, FRACUNIT, FRACUNIT, (V_SNAPTORIGHT|V_SNAPTOTOP) | opacityFlag, + MED_FONT, + connectedservername + ); + + V_DrawStringScaled( + textX - textW, textY, + FRACUNIT, FRACUNIT, FRACUNIT, + (V_SNAPTORIGHT|V_SNAPTOTOP) | opacityFlag, + NULL, + MED_FONT, connectedservername ); From d7e0a4d01a8260555768e47fa70b204ae25c100a Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 29 Jan 2024 22:24:30 -0800 Subject: [PATCH 4/6] Add S_LoadSongCredit/S_UnloadSongCredit, refactor cursongcredit - cursongcredit behaves the same as before - Always compose song credit string - g_realsongcredit always stores the song credit for the current music, even if no song credit is displayed on the HUD --- src/hu_stuff.c | 4 ++-- src/music_manager.cpp | 3 +++ src/p_setup.cpp | 3 +-- src/s_sound.c | 46 ++++++++++++++++++++++++++++++++----------- src/s_sound.h | 7 ++++++- 5 files changed, 46 insertions(+), 17 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 8473f5ce1..39ccfbb21 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -883,7 +883,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) void HU_TickSongCredits(void) { - if (cursongcredit.def == NULL) // No def + if (cursongcredit.text == NULL) // No def { cursongcredit.x = cursongcredit.old_x = 0; cursongcredit.anim = 0; @@ -1991,7 +1991,7 @@ static void HU_DrawDemoInfo(void) // void HU_DrawSongCredits(void) { - if (!cursongcredit.def || cursongcredit.trans >= NUMTRANSMAPS) // No def + if (!cursongcredit.text || cursongcredit.trans >= NUMTRANSMAPS) // No def { return; } diff --git a/src/music_manager.cpp b/src/music_manager.cpp index abf71fbb6..2233bdb97 100644 --- a/src/music_manager.cpp +++ b/src/music_manager.cpp @@ -60,6 +60,7 @@ void TuneManager::tick() // Only stop the music credit if the song actually // changed. S_StopMusicCredit(); + S_UnloadMusicCredit(); } stop_credit_ = false; @@ -91,6 +92,8 @@ void TuneManager::tick() adjust_volume(); I_SetSongSpeed(tune->speed()); + S_LoadMusicCredit(); + if (tune->credit && !tune->resume) { S_ShowMusicCredit(); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index d5d33f861..42f596ff8 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -7629,8 +7629,7 @@ static void P_InitLevelSettings(void) g_quakes = NULL; // song credit init - Z_Free(cursongcredit.text); - memset(&cursongcredit,0,sizeof(struct cursongcredit)); + S_StopMusicCredit(); cursongcredit.trans = NUMTRANSMAPS; for (i = 0; i < MAXPLAYERS; i++) diff --git a/src/s_sound.c b/src/s_sound.c index 78d5f618b..eb5f8b020 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1244,6 +1244,7 @@ void S_AttemptToRestoreMusic(void) musicdef_t *musicdefstart = NULL; struct cursongcredit cursongcredit; // Currently displayed song credit info +char *g_realsongcredit; struct soundtest soundtest; // Sound Test (sound test) static void S_InsertMusicAtSoundTestSequenceTail(const char *musname, UINT16 map, UINT8 altref, musicdef_t ***tail) @@ -2093,11 +2094,11 @@ void S_InitMusicDefs(void) } // -// S_ShowMusicCredit +// S_LoadMusicCredit // -// Display current song's credit on screen +// Load the current song's credit into memory // -void S_ShowMusicCredit(void) +void S_LoadMusicCredit(void) { UINT8 i = 0; musicdef_t *def = S_FindMusicDef(Music_CurrentSong(), &i); @@ -2107,18 +2108,13 @@ void S_ShowMusicCredit(void) size_t len = 128, worklen; INT32 widthused = (3*BASEVIDWIDTH/4) - 7, workwidth; - if (!cv_songcredits.value) - return; + S_UnloadMusicCredit(); if (!def) // No definitions return; if (!def->title) - { - // Like showing a blank credit. - S_StopMusicCredit(); return; - } work = va("\x1F %s", def->title); worklen = strlen(work); @@ -2166,9 +2162,34 @@ void S_ShowMusicCredit(void) if (credittext[0] == '\0') return; - cursongcredit.def = def; + g_realsongcredit = Z_StrDup(credittext); +} + +void S_UnloadMusicCredit(void) +{ + Z_Free(g_realsongcredit); + g_realsongcredit = NULL; +} + +// +// S_ShowMusicCredit +// +// Display current song's credit on screen +// +void S_ShowMusicCredit(void) +{ + if (!cv_songcredits.value) + return; + + if (!g_realsongcredit) + { + // Like showing a blank credit. + S_StopMusicCredit(); + return; + } + Z_Free(cursongcredit.text); - cursongcredit.text = Z_StrDup(credittext); + cursongcredit.text = Z_StrDup(g_realsongcredit); cursongcredit.anim = 5*TICRATE; cursongcredit.x = cursongcredit.old_x = 0; cursongcredit.trans = NUMTRANSMAPS; @@ -2176,7 +2197,8 @@ void S_ShowMusicCredit(void) void S_StopMusicCredit(void) { - cursongcredit.def = NULL; + Z_Free(cursongcredit.text); + memset(&cursongcredit,0,sizeof(struct cursongcredit)); } /// ------------------------ diff --git a/src/s_sound.h b/src/s_sound.h index 94dc4935a..9cf67dde0 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -174,9 +174,9 @@ struct musicdef_t soundtestsequence_t sequence; }; +// For HUD, doesn't always appear extern struct cursongcredit { - musicdef_t *def; char *text; UINT16 anim; UINT8 trans; @@ -184,6 +184,9 @@ extern struct cursongcredit fixed_t old_x; } cursongcredit; +// For menu, always appears +extern char *g_realsongcredit; + extern struct soundtest { UINT8 tune; // Tune used for music system @@ -216,6 +219,8 @@ extern musicdef_t *musicdefstart; void S_LoadMusicDefs(UINT16 wadnum); void S_InitMusicDefs(void); musicdef_t *S_FindMusicDef(const char *name, UINT8 *i); +void S_LoadMusicCredit(void); +void S_UnloadMusicCredit(void); void S_ShowMusicCredit(void); void S_StopMusicCredit(void); From 1a0525b0c0231325fa07bf2272879f0630680890 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 9 Feb 2024 17:13:04 -0800 Subject: [PATCH 5/6] Adjust position of PAUSE graphic - Move the graphic up a little - Fix position on pause menu in non-green resolutions --- src/k_menudraw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/k_menudraw.c b/src/k_menudraw.c index c147b1985..87ee6ecef 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -912,8 +912,10 @@ static void M_DrawPausedText(INT32 x) patch_t *pausebg = W_CachePatchName("M_STRIPU", PU_CACHE); patch_t *pausetext = W_CachePatchName("M_PAUSET", PU_CACHE); - V_DrawFixedPatch(x, 0, FRACUNIT, V_SNAPTOLEFT|V_SNAPTOTOP|V_ADD, pausebg, NULL); - V_DrawFixedPatch(x, 0, FRACUNIT, V_SNAPTOLEFT|V_SNAPTOTOP, pausetext, NULL); + INT32 snapFlags = menuactive ? 0 : (V_SNAPTOLEFT|V_SNAPTOTOP); + + V_DrawFixedPatch(x, -5*FRACUNIT, FRACUNIT, snapFlags|V_ADD, pausebg, NULL); + V_DrawFixedPatch(x, -5*FRACUNIT, FRACUNIT, snapFlags, pausetext, NULL); } // From ce7d22d0290a8bcd79e6c80fe54fb4b13485e9ff Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 29 Jan 2024 22:27:18 -0800 Subject: [PATCH 6/6] Pause menu: display map icon, map name and currently playing song credit --- src/k_menudraw.c | 71 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 4 deletions(-) diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 87ee6ecef..55a1289c1 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -53,6 +53,7 @@ #include "k_grandprix.h" // K_CanChangeRules #include "k_rank.h" // K_GetGradeColor #include "k_zvote.h" // K_GetMidVoteLabel +#include "k_boss.h" #include "y_inter.h" // Y_RoundQueueDrawer @@ -5330,9 +5331,12 @@ void M_DrawPause(void) INT16 ypos = -50; // Draw 3 items from selected item (y=100 - 3 items spaced by 50 px each... you get the idea.) INT16 dypos; - fixed_t t = M_DueFrac(pausemenu.openoffset.start, 6); - INT16 offset = menutransition.tics ? floor(pow(2, (double)menutransition.tics)) : - (pausemenu.openoffset.dist ? Easing_InQuad(t, 0, 256) : Easing_OutQuad(t, 256, 0)); + fixed_t mt = M_DueFrac(pausemenu.openoffset.start, 6); + + if (pausemenu.openoffset.dist) + mt = FRACUNIT - mt; + + INT16 offset = menutransition.tics ? floor(pow(2, (double)menutransition.tics)) : Easing_OutQuad(mt, 256, 0); INT16 arrxpos = 150 + 2*offset; // To draw the background arrow. INT16 j = 0; @@ -5341,10 +5345,69 @@ void M_DrawPause(void) patch_t *arrstart = W_CachePatchName("M_PTIP", PU_CACHE); patch_t *arrfill = W_CachePatchName("M_PFILL", PU_CACHE); - t = M_DueFrac(pausemenu.offset.start, 3); + fixed_t t = M_DueFrac(pausemenu.offset.start, 3); //V_DrawFadeScreen(0xFF00, 16); + { + INT32 x = Easing_OutQuad(mt, -BASEVIDWIDTH, 0); + INT32 y = 56; + + if (g_realsongcredit) + { + V_DrawThinString(x + 2, y, 0, g_realsongcredit); + } + + if (gamestate == GS_LEVEL) + { + const char *name = bossinfo.valid && bossinfo.enemyname ? + bossinfo.enemyname : mapheaderinfo[gamemap-1]->menuttl; + char *buf = NULL; + + if (!name[0]) + { + buf = G_BuildMapTitle(gamemap); + name = buf; + } + + INT32 width = V_StringScaledWidth( + FRACUNIT, + FRACUNIT, + FRACUNIT, + 0, + MED_FONT, + name + ) / FRACUNIT; + + y += 11; + + V_DrawFill(x + 1, y + 8, width + 20, 3, 31); + + V_DrawStringScaled( + (x + 19) * FRACUNIT, + y * FRACUNIT, + FRACUNIT, + FRACUNIT, + FRACUNIT, + V_AQUAMAP, + NULL, + MED_FONT, + name + ); + + K_DrawMapThumbnail( + (x + 1) * FRACUNIT, + (y - 1) * FRACUNIT, + 16 * FRACUNIT, + 0, + gamemap - 1, + NULL + ); + + Z_Free(buf); + } + } + // "PAUSED" if (!paused && !demo.playback && !modeattacking && !netgame) // as close to possible as P_AutoPause, but not dependent on menuactive {