diff --git a/src/dehacked.c b/src/dehacked.c index f30ec58e7..09159ad68 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1154,6 +1154,10 @@ static void readlevelheader(MYFILE *f, INT32 num) else if (fastcmp(word, "MUSICPOSTBOSS")) deh_strlcpy(mapheaderinfo[num-1]->muspostbossname, word2, sizeof(mapheaderinfo[num-1]->muspostbossname), va("Level header %d: post-boss music", num)); + else if (fastcmp(word, "MUSICPOSTBOSSTRACK")) + mapheaderinfo[num-1]->muspostbosstrack = ((UINT16)i - 1); + else if (fastcmp(word, "MUSICPOSTBOSSPOSITION")) + mapheaderinfo[num-1]->muspostbossposition = (UINT8)get_number(word2); else if (fastcmp(word, "FORCECHARACTER")) { strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1); diff --git a/src/doomstat.h b/src/doomstat.h index 38be6968c..147535a8c 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -257,7 +257,9 @@ typedef struct nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful. // Music stuff. - char muspostbossname[7]; ///< Post-bossdeath music. + char muspostbossname[7]; ///< Post-bossdeath music. + UINT16 muspostbosstrack; ///< Post-bossdeath track. + UINT32 muspostbossposition; ///< Post-bossdeath position // Lua stuff. // (This is not ifdeffed so the map header structure can stay identical, just in case.) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index d4bea333e..49add3713 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1762,6 +1762,10 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->mustrack); else if (fastcmp(field,"muspostbossname")) lua_pushstring(L, header->muspostbossname); + else if (fastcmp(field,"muspostbosstrack")) + lua_pushinteger(L, header->muspostbosstrack); + else if (fastcmp(field,"muspostbossposition")) + lua_pushinteger(L, header->muspostbossposition); else if (fastcmp(field,"forcecharacter")) lua_pushstring(L, header->forcecharacter); else if (fastcmp(field,"weather")) diff --git a/src/p_enemy.c b/src/p_enemy.c index 83b50a0cc..d8d1557ca 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3537,8 +3537,9 @@ void A_BossDeath(mobj_t *mo) // So just park ourselves in the mapmus variables. strncpy(mapmusname, mapheaderinfo[gamemap-1]->muspostbossname, 7); mapmusname[6] = 0; - mapmusflags = MUSIC_RELOADRESET; - S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, 0, (1*MUSICRATE)+(MUSICRATE/2), 0); + mapmusflags = (mapheaderinfo[gamemap-1]->muspostbosstrack & MUSIC_TRACKMASK) | MUSIC_RELOADRESET; + mapmusposition = mapheaderinfo[gamemap-1]->muspostbossposition; + S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2), 0); } } diff --git a/src/p_setup.c b/src/p_setup.c index f451401ae..5b2f8cf83 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -209,6 +209,8 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->musname[6] = 0; mapheaderinfo[num]->mustrack = 0; mapheaderinfo[num]->muspostbossname[6] = 0; + mapheaderinfo[num]->muspostbosstrack = 0; + mapheaderinfo[num]->muspostbossposition = 0; mapheaderinfo[num]->forcecharacter[0] = '\0'; mapheaderinfo[num]->weather = 0; mapheaderinfo[num]->skynum = 1;