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:
parent
372e655d70
commit
110c9e2dc7
4 changed files with 81 additions and 24 deletions
|
|
@ -998,8 +998,7 @@ static void HU_TickSongCredits(void)
|
|||
|
||||
if (cursongcredit.anim > 0)
|
||||
{
|
||||
char *str = va("\x1F"" %s", cursongcredit.def->source);
|
||||
INT32 len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE);
|
||||
INT32 len = V_ThinStringWidth(cursongcredit.text, V_ALLOWLOWERCASE|V_6WIDTHSPACE);
|
||||
fixed_t destx = (len+7) * FRACUNIT;
|
||||
|
||||
if (cursongcredit.trans > 0)
|
||||
|
|
@ -2094,29 +2093,28 @@ static void HU_DrawDemoInfo(void)
|
|||
//
|
||||
void HU_DrawSongCredits(void)
|
||||
{
|
||||
char *str;
|
||||
fixed_t x;
|
||||
fixed_t y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32) * FRACUNIT;
|
||||
INT32 bgt;
|
||||
|
||||
if (!cursongcredit.def) // No def
|
||||
if (!cursongcredit.def || cursongcredit.trans >= NUMTRANSMAPS) // No def
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
str = va("\x1F"" %s", cursongcredit.def->source);
|
||||
bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans / 2);
|
||||
x = R_InterpolateFixed(cursongcredit.old_x, cursongcredit.x);
|
||||
|
||||
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), str);
|
||||
}
|
||||
V_DrawRightAlignedThinStringAtFixed(x, y,
|
||||
V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT),
|
||||
cursongcredit.text);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7291,6 +7291,7 @@ static void P_InitLevelSettings(boolean reloadinggamestate)
|
|||
memset(&quake,0,sizeof(struct quake));
|
||||
|
||||
// song credit init
|
||||
Z_Free(cursongcredit.text);
|
||||
memset(&cursongcredit,0,sizeof(struct cursongcredit));
|
||||
cursongcredit.trans = NUMTRANSMAPS;
|
||||
|
||||
|
|
|
|||
|
|
@ -1465,16 +1465,32 @@ ReadMusicDefFields
|
|||
|
||||
textline = value;
|
||||
|
||||
/* based ignored lumps */
|
||||
if (!stricmp(stoken, "usage")) {
|
||||
#if 0 // Ignore for now
|
||||
STRBUFCPY(def->usage, textline);
|
||||
#endif
|
||||
} else if (!stricmp(stoken, "source")) {
|
||||
STRBUFCPY(def->source, textline);
|
||||
} else if (!stricmp(stoken, "volume")) {
|
||||
if (!stricmp(stoken, "title"))
|
||||
{
|
||||
Z_Free(def->title);
|
||||
def->title = Z_StrDup(textline);
|
||||
}
|
||||
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);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
MusicDefError(CONS_WARNING,
|
||||
"Unknown field '%s'.",
|
||||
stoken, lumpnum, line);
|
||||
|
|
@ -1597,14 +1613,53 @@ void S_ShowMusicCredit(void)
|
|||
{
|
||||
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;
|
||||
Z_Free(cursongcredit.text);
|
||||
cursongcredit.text = Z_StrDup(credittext);
|
||||
cursongcredit.anim = 5*TICRATE;
|
||||
cursongcredit.x = cursongcredit.old_x =0;
|
||||
cursongcredit.x = cursongcredit.old_x = 0;
|
||||
cursongcredit.trans = NUMTRANSMAPS;
|
||||
return;
|
||||
}
|
||||
else
|
||||
def = def->next;
|
||||
|
||||
def = def->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,8 +168,10 @@ boolean S_SpeedMusic(float speed);
|
|||
typedef struct musicdef_s
|
||||
{
|
||||
char name[7];
|
||||
//char usage[256];
|
||||
char source[256];
|
||||
char *title;
|
||||
char *author;
|
||||
char *source;
|
||||
char *composers;
|
||||
int volume;
|
||||
struct musicdef_s *next;
|
||||
} musicdef_t;
|
||||
|
|
@ -177,6 +179,7 @@ typedef struct musicdef_s
|
|||
extern struct cursongcredit
|
||||
{
|
||||
musicdef_t *def;
|
||||
char *text;
|
||||
UINT16 anim;
|
||||
UINT8 trans;
|
||||
fixed_t x;
|
||||
|
|
|
|||
Loading…
Reference in a new issue