mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
Merge branch 'musicdef-update' into 'master'
First Musicdef changes in preparation for music test See merge request KartKrew/Kart!812
This commit is contained in:
commit
6247d42971
4 changed files with 81 additions and 24 deletions
|
|
@ -938,8 +938,7 @@ static void HU_TickSongCredits(void)
|
||||||
|
|
||||||
if (cursongcredit.anim > 0)
|
if (cursongcredit.anim > 0)
|
||||||
{
|
{
|
||||||
char *str = va("\x1F"" %s", cursongcredit.def->source);
|
INT32 len = V_ThinStringWidth(cursongcredit.text, V_ALLOWLOWERCASE|V_6WIDTHSPACE);
|
||||||
INT32 len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE);
|
|
||||||
fixed_t destx = (len+7) * FRACUNIT;
|
fixed_t destx = (len+7) * FRACUNIT;
|
||||||
|
|
||||||
if (cursongcredit.trans > 0)
|
if (cursongcredit.trans > 0)
|
||||||
|
|
@ -2045,29 +2044,28 @@ static void HU_DrawDemoInfo(void)
|
||||||
//
|
//
|
||||||
void HU_DrawSongCredits(void)
|
void HU_DrawSongCredits(void)
|
||||||
{
|
{
|
||||||
char *str;
|
|
||||||
fixed_t x;
|
fixed_t x;
|
||||||
fixed_t y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32) * FRACUNIT;
|
fixed_t y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32) * FRACUNIT;
|
||||||
INT32 bgt;
|
INT32 bgt;
|
||||||
|
|
||||||
if (!cursongcredit.def) // No def
|
if (!cursongcredit.def || cursongcredit.trans >= NUMTRANSMAPS) // No def
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = va("\x1F"" %s", cursongcredit.def->source);
|
|
||||||
bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans / 2);
|
bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans / 2);
|
||||||
x = R_InterpolateFixed(cursongcredit.old_x, cursongcredit.x);
|
x = R_InterpolateFixed(cursongcredit.old_x, cursongcredit.x);
|
||||||
|
|
||||||
if (bgt < NUMTRANSMAPS)
|
if (bgt < NUMTRANSMAPS)
|
||||||
{
|
{
|
||||||
V_DrawFixedPatch(x, y - (2 * FRACUNIT), FRACUNIT, V_SNAPTOLEFT|(bgt<<V_ALPHASHIFT), songcreditbg, NULL);
|
V_DrawFixedPatch(x, y - (2 * FRACUNIT),
|
||||||
|
FRACUNIT, V_SNAPTOLEFT|(bgt<<V_ALPHASHIFT),
|
||||||
|
songcreditbg, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursongcredit.trans < NUMTRANSMAPS)
|
V_DrawRightAlignedThinStringAtFixed(x, y,
|
||||||
{
|
V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT),
|
||||||
V_DrawRightAlignedThinStringAtFixed(x, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT), str);
|
cursongcredit.text);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6837,6 +6837,7 @@ static void P_InitLevelSettings(void)
|
||||||
memset(&quake,0,sizeof(struct quake));
|
memset(&quake,0,sizeof(struct quake));
|
||||||
|
|
||||||
// song credit init
|
// song credit init
|
||||||
|
Z_Free(cursongcredit.text);
|
||||||
memset(&cursongcredit,0,sizeof(struct cursongcredit));
|
memset(&cursongcredit,0,sizeof(struct cursongcredit));
|
||||||
cursongcredit.trans = NUMTRANSMAPS;
|
cursongcredit.trans = NUMTRANSMAPS;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1476,16 +1476,32 @@ ReadMusicDefFields
|
||||||
|
|
||||||
textline = value;
|
textline = value;
|
||||||
|
|
||||||
/* based ignored lumps */
|
if (!stricmp(stoken, "title"))
|
||||||
if (!stricmp(stoken, "usage")) {
|
{
|
||||||
#if 0 // Ignore for now
|
Z_Free(def->title);
|
||||||
STRBUFCPY(def->usage, textline);
|
def->title = Z_StrDup(textline);
|
||||||
#endif
|
}
|
||||||
} else if (!stricmp(stoken, "source")) {
|
else if (!stricmp(stoken, "author"))
|
||||||
STRBUFCPY(def->source, textline);
|
{
|
||||||
} else if (!stricmp(stoken, "volume")) {
|
Z_Free(def->author);
|
||||||
|
def->author = Z_StrDup(textline);
|
||||||
|
}
|
||||||
|
else if (!stricmp(stoken, "source"))
|
||||||
|
{
|
||||||
|
Z_Free(def->source);
|
||||||
|
def->source = Z_StrDup(textline);
|
||||||
|
}
|
||||||
|
else if (!stricmp(stoken, "originalcomposers"))
|
||||||
|
{
|
||||||
|
Z_Free(def->composers);
|
||||||
|
def->composers = Z_StrDup(textline);
|
||||||
|
}
|
||||||
|
else if (!stricmp(stoken, "volume"))
|
||||||
|
{
|
||||||
def->volume = atoi(textline);
|
def->volume = atoi(textline);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
MusicDefError(CONS_WARNING,
|
MusicDefError(CONS_WARNING,
|
||||||
"Unknown field '%s'.",
|
"Unknown field '%s'.",
|
||||||
stoken, lumpnum, line);
|
stoken, lumpnum, line);
|
||||||
|
|
@ -1608,14 +1624,53 @@ void S_ShowMusicCredit(void)
|
||||||
{
|
{
|
||||||
if (!stricmp(def->name, music_name))
|
if (!stricmp(def->name, music_name))
|
||||||
{
|
{
|
||||||
|
char credittext[128] = "";
|
||||||
|
char *work = NULL;
|
||||||
|
size_t len = 128, worklen;
|
||||||
|
|
||||||
|
if (!def->title)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
work = va("\x1F %s", def->title);
|
||||||
|
worklen = strlen(work);
|
||||||
|
if (worklen <= len)
|
||||||
|
{
|
||||||
|
strncat(credittext, work, len);
|
||||||
|
len -= worklen;
|
||||||
|
|
||||||
|
#define MUSICCREDITAPPEND(field)\
|
||||||
|
if (field)\
|
||||||
|
{\
|
||||||
|
work = va(" - %s", field);\
|
||||||
|
worklen = strlen(work);\
|
||||||
|
if (worklen <= len)\
|
||||||
|
{\
|
||||||
|
strncat(credittext, work, len);\
|
||||||
|
len -= worklen;\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
|
MUSICCREDITAPPEND(def->author);
|
||||||
|
MUSICCREDITAPPEND(def->source);
|
||||||
|
|
||||||
|
#undef MUSICCREDITAPPEND
|
||||||
|
}
|
||||||
|
|
||||||
|
if (credittext[0] == '\0')
|
||||||
|
return;
|
||||||
|
|
||||||
cursongcredit.def = def;
|
cursongcredit.def = def;
|
||||||
|
Z_Free(cursongcredit.text);
|
||||||
|
cursongcredit.text = Z_StrDup(credittext);
|
||||||
cursongcredit.anim = 5*TICRATE;
|
cursongcredit.anim = 5*TICRATE;
|
||||||
cursongcredit.x = cursongcredit.old_x =0;
|
cursongcredit.x = cursongcredit.old_x = 0;
|
||||||
cursongcredit.trans = NUMTRANSMAPS;
|
cursongcredit.trans = NUMTRANSMAPS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
def = def->next;
|
def = def->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,8 +173,10 @@ boolean S_SpeedMusic(float speed);
|
||||||
struct musicdef_t
|
struct musicdef_t
|
||||||
{
|
{
|
||||||
char name[7];
|
char name[7];
|
||||||
//char usage[256];
|
char *title;
|
||||||
char source[256];
|
char *author;
|
||||||
|
char *source;
|
||||||
|
char *composers;
|
||||||
int volume;
|
int volume;
|
||||||
musicdef_t *next;
|
musicdef_t *next;
|
||||||
};
|
};
|
||||||
|
|
@ -182,6 +184,7 @@ struct musicdef_t
|
||||||
extern struct cursongcredit
|
extern struct cursongcredit
|
||||||
{
|
{
|
||||||
musicdef_t *def;
|
musicdef_t *def;
|
||||||
|
char *text;
|
||||||
UINT16 anim;
|
UINT16 anim;
|
||||||
UINT8 trans;
|
UINT8 trans;
|
||||||
fixed_t x;
|
fixed_t x;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue