Minor touchups/cleanup

This commit is contained in:
SeventhSentinel 2019-01-04 16:47:03 -05:00
parent 5d51754936
commit 3e37d131ed
5 changed files with 39 additions and 29 deletions

View file

@ -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<<V_ALPHASHIFT), songcreditbg);
if (transparency < NUMTRANSMAPS)
V_DrawThinString(x-len-10, 32, V_SNAPTOLEFT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|(transparency<<V_ALPHASHIFT), va("\x1F"" %s", songCredits[cursongcredit.index].info));
V_DrawScaledPatch(cursongcredit.x, y-2, V_SNAPTOLEFT|(bgt<<V_ALPHASHIFT), songcreditbg);
if (cursongcredit.trans < NUMTRANSMAPS)
V_DrawRightAlignedThinString(cursongcredit.x, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT), str);
}
// Heads up displays drawer, call each frame

View file

@ -2304,6 +2304,10 @@ static void P_LevelInitStuff(void)
// earthquake camera
memset(&quake,0,sizeof(struct quake));
// song credit init
memset(&cursongcredit,0,sizeof(struct cursongcredit));
cursongcredit.trans = NUMTRANSMAPS;
for (i = 0; i < MAXPLAYERS; i++)
{
#if 0

View file

@ -1744,6 +1744,8 @@ void S_InitMusicCredit(void)
{
cursongcredit.index = i;
cursongcredit.anim = 5*TICRATE;
cursongcredit.x = 0;
cursongcredit.trans = NUMTRANSMAPS;
return; // Don't return when there's SOC support, to see if there's any "replacement" credits?
}
}

View file

@ -133,6 +133,8 @@ extern struct cursongcredit
{
UINT16 index;
UINT16 anim;
INT32 x;
UINT8 trans;
} cursongcredit;
typedef struct

View file

@ -2266,6 +2266,7 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
{
INT32 c, w = 0;
INT32 spacewidth = 2, charwidth = 0;
boolean lowercase = (option & V_ALLOWLOWERCASE);
size_t i;
switch (option & V_SPACINGMASK)
@ -2289,13 +2290,20 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
if ((UINT8)c >= 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;
}