mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Basic alt music
mapheaderinfo's musname field is now a 2 dimensional array, it can take up to 3 tracks and will randomly select between them on level load.
This commit is contained in:
parent
c9ab4105da
commit
276cba4641
5 changed files with 21 additions and 8 deletions
|
|
@ -1165,11 +1165,16 @@ void readlevelheader(MYFILE *f, char * name)
|
|||
else if (fastcmp(word, "MUSIC"))
|
||||
{
|
||||
if (fastcmp(word2, "NONE"))
|
||||
mapheaderinfo[num]->musname[0] = 0; // becomes empty string
|
||||
mapheaderinfo[num]->musname[0][0] = 0; // becomes empty string
|
||||
else
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num]->musname, word2,
|
||||
sizeof(mapheaderinfo[num]->musname), va("Level header %d: music", num));
|
||||
UINT8 i = 0;
|
||||
tmp = strtok(word2, ",");
|
||||
do {
|
||||
deh_strlcpy(mapheaderinfo[num]->musname[i], tmp,
|
||||
sizeof(mapheaderinfo[num]->musname[i]), va("Level header %d: music", num));
|
||||
i += 1;
|
||||
} while ((tmp = strtok(NULL,",")) != NULL);
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "MUSICSLOT"))
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ struct mapheader_t
|
|||
fixed_t gravity; ///< Map-wide gravity.
|
||||
|
||||
// Music information
|
||||
char musname[7]; ///< Music track to play. "" for no music.
|
||||
char musname[3][7]; ///< Music tracks to play. First dimension is the track number, second is the music string. "" for no music.
|
||||
UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
|
||||
UINT32 muspos; ///< Music position to jump to.
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ typedef enum
|
|||
PR_SPARKLE, // Endsign and/or Emerald
|
||||
|
||||
PR_MOVINGTARGET, // Randomised moving targets
|
||||
|
||||
PR_MUSICSELECT, // Randomized music selection
|
||||
|
||||
PRNUMCLASS
|
||||
} pr_class_t;
|
||||
|
|
|
|||
|
|
@ -378,6 +378,8 @@ void P_DeleteFlickies(INT16 i)
|
|||
*/
|
||||
static void P_ClearSingleMapHeaderInfo(INT16 num)
|
||||
{
|
||||
UINT8 i = 0;
|
||||
|
||||
mapheaderinfo[num]->lvlttl[0] = '\0';
|
||||
mapheaderinfo[num]->subttl[0] = '\0';
|
||||
mapheaderinfo[num]->zonttl[0] = '\0';
|
||||
|
|
@ -385,8 +387,11 @@ static void P_ClearSingleMapHeaderInfo(INT16 num)
|
|||
mapheaderinfo[num]->typeoflevel = 0;
|
||||
mapheaderinfo[num]->gravity = DEFAULT_GRAVITY;
|
||||
mapheaderinfo[num]->keywords[0] = '\0';
|
||||
sprintf(mapheaderinfo[num]->musname, "%.5sM", G_BuildMapName(num+1));
|
||||
mapheaderinfo[num]->musname[6] = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
sprintf(mapheaderinfo[num]->musname[i], "%.5sM", G_BuildMapName(num+1));
|
||||
mapheaderinfo[num]->musname[i][6] = 0;
|
||||
}
|
||||
mapheaderinfo[num]->mustrack = 0;
|
||||
mapheaderinfo[num]->muspos = 0;
|
||||
mapheaderinfo[num]->weather = PRECIP_NONE;
|
||||
|
|
|
|||
|
|
@ -2431,7 +2431,8 @@ void S_StartEx(boolean reset)
|
|||
|
||||
if (mapmusflags & MUSIC_RELOADRESET)
|
||||
{
|
||||
strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7);
|
||||
UINT32 i = P_RandomKey(PR_MUSICSELECT, 2);
|
||||
strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname[i], 7);
|
||||
mapmusname[6] = 0;
|
||||
mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK);
|
||||
mapmusposition = mapheaderinfo[gamemap-1]->muspos;
|
||||
|
|
@ -2514,7 +2515,7 @@ static void Command_Tunes_f(void)
|
|||
}
|
||||
else if (!strcasecmp(tunearg, "-default"))
|
||||
{
|
||||
tunearg = mapheaderinfo[gamemap-1]->musname;
|
||||
tunearg = mapheaderinfo[gamemap-1]->musname[0];
|
||||
track = mapheaderinfo[gamemap-1]->mustrack;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue