mapheader_t: PositionMusic property

A little off-piste, but a trivial addition since I'm changing this part of the code.
- Plays in Position outside of Encore
- Shows up first in the Sound Test sequence for that map
This commit is contained in:
toaster 2023-03-28 15:14:09 +01:00
parent 48eca2d8cf
commit 9a343bd465
4 changed files with 24 additions and 2 deletions

View file

@ -1211,6 +1211,18 @@ void readlevelheader(MYFILE *f, char * name)
mapheaderinfo[num]->associatedmus_size = j;
}
}
else if (fastcmp(word, "POSITIONMUSIC"))
{
if (fastcmp(word2, "NONE"))
{
mapheaderinfo[num]->positionmus[0] = 0; // becomes empty string
}
else
{
deh_strlcpy(mapheaderinfo[num]->positionmus, word2,
sizeof(mapheaderinfo[num]->positionmus), va("Level header %d: POSITION!! music", num));
}
}
else if (fastcmp(word, "MUSICTRACK"))
mapheaderinfo[num]->mustrack = ((UINT16)i - 1);
else if (fastcmp(word, "MUSICPOS"))

View file

@ -445,8 +445,9 @@ struct mapheader_t
// Music information
char musname[MAXMUSNAMES][7]; ///< Music tracks to play. First dimension is the track number, second is the music string. "" for no music.
UINT8 musname_size; ///< Number of music tracks defined
char associatedmus[MAXMUSNAMES][7]; ///< Associated music tracks for sound test unlock.
char positionmus[7]; ///< Custom Position track. Doesn't play in Encore or other fun game-controlled contexts
UINT8 musname_size; ///< Number of music tracks defined
UINT8 associatedmus_size; ///< Number of associated music tracks defined
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.

View file

@ -801,7 +801,11 @@ void P_Ticker(boolean run)
{
// Plays the POSITION music after the camera spin
if (leveltime == introtime)
S_ChangeMusicInternal("postn", true);
S_ChangeMusicInternal(
(mapheaderinfo[gamemap-1]->positionmus[0]
? mapheaderinfo[gamemap-1]->positionmus
: "postn"
), true);
}
}

View file

@ -1391,6 +1391,11 @@ static void S_InsertMapIntoSoundTestSequence(UINT16 map, musicdef_t ***tail)
{
UINT8 i;
if (mapheaderinfo[map]->positionmus[0])
{
S_InsertMusicAtSoundTestSequenceTail(mapheaderinfo[map]->positionmus, map, tail);
}
for (i = 0; i < mapheaderinfo[map]->musname_size; i++)
{
S_InsertMusicAtSoundTestSequenceTail(mapheaderinfo[map]->musname[i], map, tail);