mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Further changes to musicdef based on discussion with Gunla
- Add "author" and "originalcomposers" fields
- "author" is for remixes and original compositions, can be ommitted
- "originalcomposers" will not be visible mid-game, but will be visible in music test. Stores original sound team info
- Store all strings as Zone memory instead of static arrays, since not every field will be relevant for every track
This commit is contained in:
parent
81fec17bb4
commit
ac423b3461
2 changed files with 67 additions and 10 deletions
|
|
@ -1476,14 +1476,32 @@ ReadMusicDefFields
|
||||||
|
|
||||||
textline = value;
|
textline = value;
|
||||||
|
|
||||||
/* based ignored lumps */
|
if (!stricmp(stoken, "title"))
|
||||||
if (!stricmp(stoken, "title")) {
|
{
|
||||||
STRBUFCPY(def->title, textline);
|
Z_Free(def->title);
|
||||||
} else if (!stricmp(stoken, "source")) {
|
def->title = Z_StrDup(textline);
|
||||||
STRBUFCPY(def->source, textline);
|
}
|
||||||
} else if (!stricmp(stoken, "volume")) {
|
else if (!stricmp(stoken, "author"))
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
@ -1606,9 +1624,46 @@ 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);
|
Z_Free(cursongcredit.text);
|
||||||
cursongcredit.text = Z_StrDup(va("\x1F"" %s - %s", def->title, def->source));
|
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;
|
||||||
|
|
|
||||||
|
|
@ -173,8 +173,10 @@ boolean S_SpeedMusic(float speed);
|
||||||
struct musicdef_t
|
struct musicdef_t
|
||||||
{
|
{
|
||||||
char name[7];
|
char name[7];
|
||||||
char title[256];
|
char *title;
|
||||||
char source[256];
|
char *author;
|
||||||
|
char *source;
|
||||||
|
char *composers;
|
||||||
int volume;
|
int volume;
|
||||||
musicdef_t *next;
|
musicdef_t *next;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue