Add new music credit draw style, 'songcredits Box'
This commit is contained in:
1 parent
e1cb7e2cc2
commit
00d55ba058
2 files changed
+67
-5
No files matched your search
+2
-1
@@ -385,7 +385,8 @@ consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, N
|
||||
consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Display song credits
|
||||
consvar_t cv_songcredits = {"songcredits", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t songcredits_cons_t[] = {{0, "Off"}, {1, "Default"}, {2, "Box"}, {0, NULL}};
|
||||
consvar_t cv_songcredits = {"songcredits", "Default", CV_SAVE, songcredits_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Show "FREE PLAY" when you're alone. :(
|
||||
consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
+65
-4
@@ -2131,7 +2131,7 @@ void HU_TickSongCredits(void)
|
||||
}
|
||||
}
|
||||
|
||||
void HU_DrawSongCredits(void)
|
||||
static void HU_DrawSongCreditsVanilla(void)
|
||||
{
|
||||
char *str;
|
||||
INT32 len;
|
||||
@@ -2139,9 +2139,6 @@ void HU_DrawSongCredits(void)
|
||||
INT32 y = (splitscreen ? (BASEVIDHEIGHT/2)-4 : 32);
|
||||
INT32 bgt;
|
||||
|
||||
if (!cursongcredit.def) // No def
|
||||
return;
|
||||
|
||||
str = va("\x1F"" %s", cursongcredit.def->source);
|
||||
len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE);
|
||||
destx = (len + 7) * FRACUNIT;
|
||||
@@ -2171,6 +2168,70 @@ void HU_DrawSongCredits(void)
|
||||
V_DrawRightAlignedThinString(cursongcredit.x / FRACUNIT, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT), str);
|
||||
}
|
||||
|
||||
#define BOXCREDITSLIDEIN (5*TICRATE-TICRATE/2)
|
||||
#define BOXCREDITSLIDEOUT (TICRATE/2)
|
||||
#define BOXCREDITHEIGHT 8
|
||||
static void HU_DrawSongCreditsBox(void)
|
||||
{
|
||||
char *str = cursongcredit.def->source;
|
||||
INT32 strwidth = V_SmallStringWidth(str, V_ALLOWLOWERCASE) + 4;
|
||||
|
||||
// dup dup dup dup
|
||||
INT32 dup = min(vid.dupx, vid.dupy);
|
||||
|
||||
// Center it
|
||||
INT32 x = (BASEVIDWIDTH/2 - strwidth/2)*dup + ((vid.width - (BASEVIDWIDTH * vid.dupx)) / 2);
|
||||
INT32 y = 0;
|
||||
|
||||
INT32 flags = V_SNAPTOTOP|V_NOSCALESTART;
|
||||
INT32 t = cursongcredit.anim;
|
||||
INT32 bgt;
|
||||
|
||||
fixed_t interpoffset = FixedMul(BOXCREDITHEIGHT*dup*FRACUNIT/(TICRATE/2), R_GetHudUncap());
|
||||
|
||||
if (t > BOXCREDITSLIDEIN)
|
||||
{
|
||||
// Sliding in
|
||||
t = TICRATE/2 - (t - BOXCREDITSLIDEIN);
|
||||
y = -BOXCREDITHEIGHT*dup + (FixedMul(BOXCREDITHEIGHT*FRACUNIT, FixedDiv(t*FRACUNIT, TICRATE*FRACUNIT/2))*dup + interpoffset)/FRACUNIT;
|
||||
}
|
||||
else if (t < TICRATE/2)
|
||||
{
|
||||
// Sliding out
|
||||
y = -BOXCREDITHEIGHT*dup + (FixedMul(BOXCREDITHEIGHT*FRACUNIT, FixedDiv(t*FRACUNIT, TICRATE*FRACUNIT/2))*dup - interpoffset)/FRACUNIT;
|
||||
}
|
||||
|
||||
bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans/2);
|
||||
|
||||
if (bgt < NUMTRANSMAPS)
|
||||
{
|
||||
V_DrawFill(x, y, strwidth*dup, BOXCREDITHEIGHT*dup, 28|flags|(bgt<<V_ALPHASHIFT));
|
||||
V_DrawFill(x+dup, y+dup, (strwidth-2)*dup, (BOXCREDITHEIGHT-2)*dup, 30|flags|(bgt<<V_ALPHASHIFT));
|
||||
}
|
||||
if (cursongcredit.trans < NUMTRANSMAPS)
|
||||
{
|
||||
V_DrawSmallString(x+2*dup, y+2*dup, V_ALLOWLOWERCASE|flags|(cursongcredit.trans<<V_ALPHASHIFT), str);
|
||||
}
|
||||
}
|
||||
|
||||
void HU_DrawSongCredits(void)
|
||||
{
|
||||
if (!cursongcredit.def) // No def
|
||||
return;
|
||||
|
||||
switch (cv_songcredits.value)
|
||||
{
|
||||
case 1:
|
||||
HU_DrawSongCreditsVanilla();
|
||||
break;
|
||||
case 2:
|
||||
HU_DrawSongCreditsBox();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Heads up displays drawer, call each frame
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user