From 3e37d131edeca64295a0d033fe11001250af0313 Mon Sep 17 00:00:00 2001 From: SeventhSentinel Date: Fri, 4 Jan 2019 16:47:03 -0500 Subject: [PATCH] Minor touchups/cleanup --- src/hu_stuff.c | 48 +++++++++++++++++++++--------------------------- src/p_setup.c | 4 ++++ src/s_sound.c | 2 ++ src/s_sound.h | 2 ++ src/v_video.c | 12 ++++++++++-- 5 files changed, 39 insertions(+), 29 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 08aaec77..2602cda2 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -294,7 +294,7 @@ void HU_LoadGraphics(void) tinyemeraldpics[5] = W_CachePatchName("TEMER6", PU_HUDGFX); tinyemeraldpics[6] = W_CachePatchName("TEMER7", PU_HUDGFX); - songcreditbg = W_CachePatchName("MUSCRED", PU_HUDGFX); + songcreditbg = W_CachePatchName("K_SONGCR", PU_HUDGFX); } // Initialise Heads up @@ -2059,45 +2059,39 @@ static void HU_DrawDemoInfo(void) // // Song credits // -boolean songcreditinit = false; - static void HU_DrawSongCredits(void) { - static UINT8 transparency = NUMTRANSMAPS; - static INT32 x = 0; - UINT16 len = V_ThinStringWidth(songCredits[cursongcredit.index].info, V_ALLOWLOWERCASE|V_6WIDTHSPACE); + const char *str = va("\x1F"" %s", songCredits[cursongcredit.index].info); + INT32 len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE); + INT32 destx = (len+7); + INT32 y = (splitscreen ? (BASEVIDHEIGHT/2)-4 : 32); INT32 bgt; - if (!songcreditinit) - { - memset(&cursongcredit,0,sizeof(struct cursongcredit)); - songcreditinit = true; - return; - } - if (cursongcredit.anim) { - if (transparency > 0) - transparency--; - if (x < (len+16)) - x += ((len+16) - x) / 2; + if (cursongcredit.trans > 0) + cursongcredit.trans--; + if (cursongcredit.x < destx) + cursongcredit.x += (destx - cursongcredit.x) / 2; + if (cursongcredit.x > destx) + cursongcredit.x = destx; cursongcredit.anim--; } else { - if (transparency < NUMTRANSMAPS) - transparency++; - if (x > 0) - x /= 2; + if (cursongcredit.trans < NUMTRANSMAPS) + cursongcredit.trans++; + if (cursongcredit.x > 0) + cursongcredit.x /= 2; + if (cursongcredit.x < 0) + cursongcredit.x = 0; } - //V_DrawThinString(0, 0, 0, transparency); - - bgt = (NUMTRANSMAPS/2)+(transparency/2); + bgt = (NUMTRANSMAPS/2)+(cursongcredit.trans/2); if (bgt < NUMTRANSMAPS) - V_DrawScaledPatch(x, 30, V_SNAPTOLEFT|(bgt<= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09 continue; - c = toupper(c) - HU_FONTSTART; + if (!lowercase || !tny_font[c-HU_FONTSTART]) + c = toupper(c); + c -= HU_FONTSTART; + if (c < 0 || c >= HU_FONTSIZE || !tny_font[c]) w += spacewidth; else + { w += (charwidth ? charwidth - : (option & V_6WIDTHSPACE ? max(1, SHORT(tny_font[c]->width)-1) : SHORT(tny_font[c]->width))); // Reuse this flag for the alternate bunched-up spacing + : ((option & V_6WIDTHSPACE && i < strlen(string)-1) ? max(1, SHORT(tny_font[c]->width)-1) // Reuse this flag for the alternate bunched-up spacing + : SHORT(tny_font[c]->width))); + } } + return w; }