diff --git a/src/deh_soc.c b/src/deh_soc.c index dbbfc7178..a23ba330b 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -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")) diff --git a/src/doomstat.h b/src/doomstat.h index 5a8f40814..a0f28098f 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -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. diff --git a/src/p_tick.c b/src/p_tick.c index 32881d68e..7865aeacb 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -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); } } diff --git a/src/s_sound.c b/src/s_sound.c index 8e6977eb7..738c901c5 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -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);