mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Interpolate music credits
This commit is contained in:
parent
762ee92c06
commit
fcc5c8e0c4
5 changed files with 134 additions and 58 deletions
173
src/hu_stuff.c
173
src/hu_stuff.c
|
|
@ -56,6 +56,7 @@
|
||||||
#include "k_kart.h"
|
#include "k_kart.h"
|
||||||
#include "k_color.h"
|
#include "k_color.h"
|
||||||
#include "k_hud.h"
|
#include "k_hud.h"
|
||||||
|
#include "r_fps.h"
|
||||||
|
|
||||||
// coords are scaled
|
// coords are scaled
|
||||||
#define HU_INPUTX 0
|
#define HU_INPUTX 0
|
||||||
|
|
@ -165,6 +166,8 @@ static tic_t cechotimer = 0;
|
||||||
static tic_t cechoduration = 5*TICRATE;
|
static tic_t cechoduration = 5*TICRATE;
|
||||||
static INT32 cechoflags = 0;
|
static INT32 cechoflags = 0;
|
||||||
|
|
||||||
|
static tic_t resynch_ticker = 0;
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// HEADS UP INIT
|
// HEADS UP INIT
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
@ -892,6 +895,64 @@ static inline boolean HU_keyInChatString(char *s, char ch)
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
static void HU_TickSongCredits(void)
|
||||||
|
{
|
||||||
|
char *str;
|
||||||
|
INT32 len;
|
||||||
|
fixed_t destx;
|
||||||
|
|
||||||
|
cursongcredit.old_x = cursongcredit.x;
|
||||||
|
|
||||||
|
if (!cursongcredit.def) // No def
|
||||||
|
{
|
||||||
|
cursongcredit.x = cursongcredit.old_x = 0;
|
||||||
|
cursongcredit.anim = 0;
|
||||||
|
cursongcredit.trans = NUMTRANSMAPS;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = va("\x1F"" %s", cursongcredit.def->source);
|
||||||
|
len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE);
|
||||||
|
destx = (len+7) * FRACUNIT;
|
||||||
|
|
||||||
|
if (cursongcredit.anim > 0)
|
||||||
|
{
|
||||||
|
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 (cursongcredit.trans < NUMTRANSMAPS)
|
||||||
|
{
|
||||||
|
cursongcredit.trans++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cursongcredit.x > 0)
|
||||||
|
{
|
||||||
|
cursongcredit.x /= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cursongcredit.x < 0)
|
||||||
|
{
|
||||||
|
cursongcredit.x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HU_Ticker(void)
|
void HU_Ticker(void)
|
||||||
{
|
{
|
||||||
if (dedicated)
|
if (dedicated)
|
||||||
|
|
@ -906,6 +967,49 @@ void HU_Ticker(void)
|
||||||
hu_showscores = false;
|
hu_showscores = false;
|
||||||
|
|
||||||
hu_keystrokes = false;
|
hu_keystrokes = false;
|
||||||
|
|
||||||
|
if (chat_on)
|
||||||
|
{
|
||||||
|
// count down the scroll timer.
|
||||||
|
if (chat_scrolltime > 0)
|
||||||
|
chat_scrolltime--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chat_scrolltime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (netgame) // would handle that in hu_drawminichat, but it's actually kinda awkward when you're typing a lot of messages. (only handle that in netgames duh)
|
||||||
|
{
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
|
// handle spam while we're at it:
|
||||||
|
for(; (i<MAXPLAYERS); i++)
|
||||||
|
{
|
||||||
|
if (stop_spamming[i] > 0)
|
||||||
|
stop_spamming[i]--;
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle chat timers
|
||||||
|
for (i=0; (i<chat_nummsg_min); i++)
|
||||||
|
{
|
||||||
|
if (chat_timers[i] > 0)
|
||||||
|
chat_timers[i]--;
|
||||||
|
else
|
||||||
|
HU_removeChatText_Mini();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cechotimer--;
|
||||||
|
|
||||||
|
if (gamestate != GS_LEVEL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resynch_ticker++;
|
||||||
|
|
||||||
|
HU_TickSongCredits();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
|
|
@ -1887,8 +1991,6 @@ static void HU_DrawCEcho(void)
|
||||||
echoptr = line;
|
echoptr = line;
|
||||||
echoptr++;
|
echoptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
--cechotimer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -1938,42 +2040,28 @@ static void HU_DrawDemoInfo(void)
|
||||||
void HU_DrawSongCredits(void)
|
void HU_DrawSongCredits(void)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
INT32 len, destx;
|
fixed_t x;
|
||||||
INT32 y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32);
|
fixed_t y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32) * FRACUNIT;
|
||||||
INT32 bgt;
|
INT32 bgt;
|
||||||
|
|
||||||
if (!cursongcredit.def) // No def
|
if (!cursongcredit.def) // No def
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
str = va("\x1F"" %s", cursongcredit.def->source);
|
str = va("\x1F"" %s", cursongcredit.def->source);
|
||||||
len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE);
|
bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans / 2);
|
||||||
destx = (len+7);
|
x = R_InterpolateFixed(cursongcredit.old_x, cursongcredit.x);
|
||||||
|
|
||||||
if (cursongcredit.anim)
|
|
||||||
{
|
|
||||||
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 (cursongcredit.trans < NUMTRANSMAPS)
|
|
||||||
cursongcredit.trans++;
|
|
||||||
if (cursongcredit.x > 0)
|
|
||||||
cursongcredit.x /= 2;
|
|
||||||
if (cursongcredit.x < 0)
|
|
||||||
cursongcredit.x = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bgt = (NUMTRANSMAPS/2)+(cursongcredit.trans/2);
|
|
||||||
if (bgt < NUMTRANSMAPS)
|
if (bgt < NUMTRANSMAPS)
|
||||||
V_DrawScaledPatch(cursongcredit.x, y-2, V_SNAPTOLEFT|(bgt<<V_ALPHASHIFT), songcreditbg);
|
{
|
||||||
|
V_DrawFixedPatch(x, y - (2 * FRACUNIT), FRACUNIT, V_SNAPTOLEFT|(bgt<<V_ALPHASHIFT), songcreditbg, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (cursongcredit.trans < NUMTRANSMAPS)
|
if (cursongcredit.trans < NUMTRANSMAPS)
|
||||||
V_DrawRightAlignedThinString(cursongcredit.x, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT), str);
|
{
|
||||||
|
V_DrawRightAlignedThinStringAtFixed(x, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT), str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1988,9 +2076,6 @@ void HU_Drawer(void)
|
||||||
// draw chat string plus cursor
|
// draw chat string plus cursor
|
||||||
if (chat_on)
|
if (chat_on)
|
||||||
{
|
{
|
||||||
// count down the scroll timer.
|
|
||||||
if (chat_scrolltime > 0)
|
|
||||||
chat_scrolltime--;
|
|
||||||
if (!OLDCHAT)
|
if (!OLDCHAT)
|
||||||
HU_DrawChat();
|
HU_DrawChat();
|
||||||
else
|
else
|
||||||
|
|
@ -1999,31 +2084,9 @@ void HU_Drawer(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
typelines = 1;
|
typelines = 1;
|
||||||
chat_scrolltime = 0;
|
|
||||||
if (!OLDCHAT && cv_consolechat.value < 2 && netgame) // Don't display minimized chat if you set the mode to Window (Hidden)
|
if (!OLDCHAT && cv_consolechat.value < 2 && netgame) // Don't display minimized chat if you set the mode to Window (Hidden)
|
||||||
HU_drawMiniChat(); // draw messages in a cool fashion.
|
HU_drawMiniChat(); // draw messages in a cool fashion.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netgame) // would handle that in hu_drawminichat, but it's actually kinda awkward when you're typing a lot of messages. (only handle that in netgames duh)
|
|
||||||
{
|
|
||||||
size_t i = 0;
|
|
||||||
|
|
||||||
// handle spam while we're at it:
|
|
||||||
for(; (i<MAXPLAYERS); i++)
|
|
||||||
{
|
|
||||||
if (stop_spamming[i] > 0)
|
|
||||||
stop_spamming[i]--;
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle chat timers
|
|
||||||
for (i=0; (i<chat_nummsg_min); i++)
|
|
||||||
{
|
|
||||||
if (chat_timers[i] > 0)
|
|
||||||
chat_timers[i]--;
|
|
||||||
else
|
|
||||||
HU_removeChatText_Mini();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (cechotimer)
|
if (cechotimer)
|
||||||
|
|
@ -2062,12 +2125,10 @@ void HU_Drawer(void)
|
||||||
// draw desynch text
|
// draw desynch text
|
||||||
if (hu_redownloadinggamestate)
|
if (hu_redownloadinggamestate)
|
||||||
{
|
{
|
||||||
static UINT32 resynch_ticker = 0;
|
|
||||||
char resynch_text[14];
|
char resynch_text[14];
|
||||||
UINT32 i;
|
UINT32 i;
|
||||||
|
|
||||||
// Animate the dots
|
// Animate the dots
|
||||||
resynch_ticker++;
|
|
||||||
strcpy(resynch_text, "Resynching");
|
strcpy(resynch_text, "Resynching");
|
||||||
for (i = 0; i < (resynch_ticker / 16) % 4; i++)
|
for (i = 0; i < (resynch_ticker / 16) % 4; i++)
|
||||||
strcat(resynch_text, ".");
|
strcat(resynch_text, ".");
|
||||||
|
|
|
||||||
|
|
@ -1580,7 +1580,7 @@ void S_ShowMusicCredit(void)
|
||||||
{
|
{
|
||||||
cursongcredit.def = def;
|
cursongcredit.def = def;
|
||||||
cursongcredit.anim = 5*TICRATE;
|
cursongcredit.anim = 5*TICRATE;
|
||||||
cursongcredit.x = 0;
|
cursongcredit.x = cursongcredit.old_x =0;
|
||||||
cursongcredit.trans = NUMTRANSMAPS;
|
cursongcredit.trans = NUMTRANSMAPS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,9 @@ extern struct cursongcredit
|
||||||
{
|
{
|
||||||
musicdef_t *def;
|
musicdef_t *def;
|
||||||
UINT16 anim;
|
UINT16 anim;
|
||||||
INT32 x;
|
|
||||||
UINT8 trans;
|
UINT8 trans;
|
||||||
|
fixed_t x;
|
||||||
|
fixed_t old_x;
|
||||||
} cursongcredit;
|
} cursongcredit;
|
||||||
|
|
||||||
extern musicdef_t *musicdefstart;
|
extern musicdef_t *musicdefstart;
|
||||||
|
|
|
||||||
|
|
@ -2216,6 +2216,18 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st
|
||||||
V_DrawThinString(x, y, option, string);
|
V_DrawThinString(x, y, option, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||||
|
{
|
||||||
|
x -= (V_ThinStringWidth(string, option) / 2) * FRACUNIT;
|
||||||
|
V_DrawThinStringAtFixed(x, y, option, string);
|
||||||
|
}
|
||||||
|
|
||||||
|
void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||||
|
{
|
||||||
|
x -= V_ThinStringWidth(string, option) * FRACUNIT;
|
||||||
|
V_DrawThinStringAtFixed(x, y, option, string);
|
||||||
|
}
|
||||||
|
|
||||||
// Draws a number using the PING font thingy.
|
// Draws a number using the PING font thingy.
|
||||||
// TODO: Merge number drawing functions into one with "font name" selection.
|
// TODO: Merge number drawing functions into one with "font name" selection.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,8 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st
|
||||||
|
|
||||||
#define V_DrawThinStringAtFixed( x,y,option,string ) \
|
#define V_DrawThinStringAtFixed( x,y,option,string ) \
|
||||||
V__DrawOneScaleString (x,y,FRACUNIT,option,TINY_FONT,string)
|
V__DrawOneScaleString (x,y,FRACUNIT,option,TINY_FONT,string)
|
||||||
|
void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||||
|
void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||||
|
|
||||||
// Draws a titlecard font string.
|
// Draws a titlecard font string.
|
||||||
// timer: when the letters start appearing (leave to 0 to disable)
|
// timer: when the letters start appearing (leave to 0 to disable)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue