From a3ed60d7bd1b36ca785df18829177e6e58e3214f Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 25 Aug 2018 15:21:55 -0400 Subject: [PATCH 01/12] Added MUSICPOSTBOSS level header for boss post-defeat music --- src/dehacked.c | 3 +++ src/doomstat.h | 3 +++ src/lua_maplib.c | 2 ++ src/p_enemy.c | 13 ++++++++++++- src/p_setup.c | 1 + 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 52b1623d2..f30ec58e7 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1151,6 +1151,9 @@ static void readlevelheader(MYFILE *f, INT32 num) #endif else if (fastcmp(word, "MUSICTRACK")) mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1); + 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, "FORCECHARACTER")) { strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1); diff --git a/src/doomstat.h b/src/doomstat.h index 092fce418..38be6968c 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -256,6 +256,9 @@ typedef struct UINT8 numGradedMares; ///< Internal. For grade support. nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful. + // Music stuff. + char muspostbossname[7]; ///< Post-bossdeath music. + // Lua stuff. // (This is not ifdeffed so the map header structure can stay identical, just in case.) UINT8 numCustomOptions; ///< Internal. For Lua custom value support. diff --git a/src/lua_maplib.c b/src/lua_maplib.c index b929fc0bc..d4bea333e 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1760,6 +1760,8 @@ static int mapheaderinfo_get(lua_State *L) lua_pushstring(L, header->musname); else if (fastcmp(field,"mustrack")) lua_pushinteger(L, header->mustrack); + else if (fastcmp(field,"muspostbossname")) + lua_pushstring(L, header->muspostbossname); 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 9235a1d0f..83b50a0cc 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3529,6 +3529,17 @@ void A_BossDeath(mobj_t *mo) EV_DoElevator(&junk, elevateUp, false); junk.tag = 682; EV_DoElevator(&junk, elevateHighest, false); + + // change the music if specified + if (mapheaderinfo[gamemap-1]->muspostbossname && !strncmp(mapheaderinfo[gamemap-1]->musname, mapmusname, 7)) + { + // Touching the egg trap button calls P_DoPlayerExit, which calls P_RestoreMusic. + // 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); + } } bossjustdie: @@ -11636,4 +11647,4 @@ void A_CheckFlags2(mobj_t *actor) if (actor->flags2 & locvar1) P_SetMobjState(actor, (statenum_t)locvar2); -} \ No newline at end of file +} diff --git a/src/p_setup.c b/src/p_setup.c index c62f281b3..f451401ae 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -208,6 +208,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i)); mapheaderinfo[num]->musname[6] = 0; mapheaderinfo[num]->mustrack = 0; + mapheaderinfo[num]->muspostbossname[6] = 0; mapheaderinfo[num]->forcecharacter[0] = '\0'; mapheaderinfo[num]->weather = 0; mapheaderinfo[num]->skynum = 1; From 610a83f60e8821b2327ab15fd2e671e09dab1cd0 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 25 Aug 2018 16:10:46 -0400 Subject: [PATCH 02/12] Added MUSICPOSTBOSSTRACK and MUSICPOSTBOSSPOSITION level header/variables --- src/dehacked.c | 4 ++++ src/doomstat.h | 4 +++- src/lua_maplib.c | 4 ++++ src/p_enemy.c | 5 +++-- src/p_setup.c | 2 ++ 5 files changed, 16 insertions(+), 3 deletions(-) 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; From ed8288a028c5992463d9e5e28151ee3fa25d2554 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 25 Aug 2018 16:18:09 -0400 Subject: [PATCH 03/12] MUSICPOSTBOSSPOSITION -> MUSICPOSTBOSSPOS --- src/dehacked.c | 4 ++-- src/doomstat.h | 2 +- src/lua_maplib.c | 4 ++-- src/p_enemy.c | 2 +- src/p_setup.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index dc0d94e0a..858b0b67c 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1158,8 +1158,8 @@ static void readlevelheader(MYFILE *f, INT32 num) 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, "MUSICPOSTBOSSPOS")) + mapheaderinfo[num-1]->muspostbosspos = (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 7d83e75f1..cb6798884 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -262,7 +262,7 @@ typedef struct // Music stuff. char muspostbossname[7]; ///< Post-bossdeath music. UINT16 muspostbosstrack; ///< Post-bossdeath track. - UINT32 muspostbossposition; ///< Post-bossdeath position + UINT32 muspostbosspos; ///< 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 49add3713..d90bc3a03 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1764,8 +1764,8 @@ static int mapheaderinfo_get(lua_State *L) 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,"muspostbosspos")) + lua_pushinteger(L, header->muspostbosspos); 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 d8d1557ca..eae86c785 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3538,7 +3538,7 @@ void A_BossDeath(mobj_t *mo) strncpy(mapmusname, mapheaderinfo[gamemap-1]->muspostbossname, 7); mapmusname[6] = 0; mapmusflags = (mapheaderinfo[gamemap-1]->muspostbosstrack & MUSIC_TRACKMASK) | MUSIC_RELOADRESET; - mapmusposition = mapheaderinfo[gamemap-1]->muspostbossposition; + mapmusposition = mapheaderinfo[gamemap-1]->muspostbosspos; S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2), 0); } } diff --git a/src/p_setup.c b/src/p_setup.c index 0cb5fbd85..28efb0c26 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -211,7 +211,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->musposition = 0; mapheaderinfo[num]->muspostbossname[6] = 0; mapheaderinfo[num]->muspostbosstrack = 0; - mapheaderinfo[num]->muspostbossposition = 0; + mapheaderinfo[num]->muspostbosspos = 0; mapheaderinfo[num]->forcecharacter[0] = '\0'; mapheaderinfo[num]->weather = 0; mapheaderinfo[num]->skynum = 1; From 493bc86b086eed7159522e4f321ca174bf12f842 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 25 Aug 2018 16:21:34 -0400 Subject: [PATCH 04/12] MUSICPOSITION -> MUSICPOS * Added muspos level header var to lua --- src/dehacked.c | 6 +++--- src/doomstat.h | 2 +- src/lua_maplib.c | 2 ++ src/p_setup.c | 2 +- src/s_sound.c | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 858b0b67c..5db242a66 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1151,8 +1151,8 @@ static void readlevelheader(MYFILE *f, INT32 num) #endif else if (fastcmp(word, "MUSICTRACK")) mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1); - else if (fastcmp(word, "MUSICPOSITION")) - mapheaderinfo[num-1]->musposition = (UINT32)get_number(word2); + else if (fastcmp(word, "MUSICPOS")) + mapheaderinfo[num-1]->muspos = (UINT32)get_number(word2); 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)); @@ -1456,7 +1456,7 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) { cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK; } - else if (fastcmp(word, "MUSICPOSITION")) + else if (fastcmp(word, "MUSICPOS")) { cutscenes[num]->scene[scenenum].musswitchposition = (UINT32)get_number(word2); } diff --git a/src/doomstat.h b/src/doomstat.h index cb6798884..f51baec23 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -225,7 +225,7 @@ typedef struct INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end. char musname[7]; ///< Music track to play. "" for no music. UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. - UINT32 musposition; ///< Music position to jump to. + UINT32 muspos; ///< Music position to jump to. char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable. UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave. INT16 skynum; ///< Sky number to use. diff --git a/src/lua_maplib.c b/src/lua_maplib.c index d90bc3a03..77b6120ba 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1760,6 +1760,8 @@ static int mapheaderinfo_get(lua_State *L) lua_pushstring(L, header->musname); else if (fastcmp(field,"mustrack")) lua_pushinteger(L, header->mustrack); + else if (fastcmp(field,"muspos")) + lua_pushinteger(L, header->muspos); else if (fastcmp(field,"muspostbossname")) lua_pushstring(L, header->muspostbossname); else if (fastcmp(field,"muspostbosstrack")) diff --git a/src/p_setup.c b/src/p_setup.c index 28efb0c26..716d51d7b 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -208,7 +208,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i)); mapheaderinfo[num]->musname[6] = 0; mapheaderinfo[num]->mustrack = 0; - mapheaderinfo[num]->musposition = 0; + mapheaderinfo[num]->muspos = 0; mapheaderinfo[num]->muspostbossname[6] = 0; mapheaderinfo[num]->muspostbosstrack = 0; mapheaderinfo[num]->muspostbosspos = 0; diff --git a/src/s_sound.c b/src/s_sound.c index 604b710ee..03e724a4d 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1741,7 +1741,7 @@ void S_Start(void) strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7); mapmusname[6] = 0; mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK); - mapmusposition = mapheaderinfo[gamemap-1]->musposition; + mapmusposition = mapheaderinfo[gamemap-1]->muspos; } if (cv_resetmusic.value) From 7d882c482f89d63dd9709e76f1eadd847df1e93d Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 25 Aug 2018 16:28:56 -0400 Subject: [PATCH 05/12] UINT32 muspostbosspos fix --- src/dehacked.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 5db242a66..3f021847a 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1159,7 +1159,7 @@ static void readlevelheader(MYFILE *f, INT32 num) else if (fastcmp(word, "MUSICPOSTBOSSTRACK")) mapheaderinfo[num-1]->muspostbosstrack = ((UINT16)i - 1); else if (fastcmp(word, "MUSICPOSTBOSSPOS")) - mapheaderinfo[num-1]->muspostbosspos = (UINT8)get_number(word2); + mapheaderinfo[num-1]->muspostbosspos = (UINT32)get_number(word2); else if (fastcmp(word, "FORCECHARACTER")) { strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1); From 083de09f88e811b3935eb62bc53462b37bf86bab Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 25 Aug 2018 17:42:46 -0400 Subject: [PATCH 06/12] Load mapmus vars post-boss even if another tune is playing, like a jingle --- src/p_enemy.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index eae86c785..bea166759 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3530,8 +3530,7 @@ void A_BossDeath(mobj_t *mo) junk.tag = 682; EV_DoElevator(&junk, elevateHighest, false); - // change the music if specified - if (mapheaderinfo[gamemap-1]->muspostbossname && !strncmp(mapheaderinfo[gamemap-1]->musname, mapmusname, 7)) + if (mapheaderinfo[gamemap-1]->muspostbossname) { // Touching the egg trap button calls P_DoPlayerExit, which calls P_RestoreMusic. // So just park ourselves in the mapmus variables. @@ -3539,7 +3538,11 @@ void A_BossDeath(mobj_t *mo) mapmusname[6] = 0; mapmusflags = (mapheaderinfo[gamemap-1]->muspostbosstrack & MUSIC_TRACKMASK) | MUSIC_RELOADRESET; mapmusposition = mapheaderinfo[gamemap-1]->muspostbosspos; - S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2), 0); + + // don't change if we're in another tune + // but in case we're in jingle, use our parked mapmus variables so the correct track restores + if (!strncmp(mapheaderinfo[gamemap-1]->musname, mapmusname, 7)) + S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2), 0); } } From 01c6dbed5c21eb0489e8ad14f387c0ce7fabcbb2 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 25 Aug 2018 21:50:56 -0400 Subject: [PATCH 07/12] Case-insensitive music matching --- src/p_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index bea166759..88a05f384 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3541,7 +3541,7 @@ void A_BossDeath(mobj_t *mo) // don't change if we're in another tune // but in case we're in jingle, use our parked mapmus variables so the correct track restores - if (!strncmp(mapheaderinfo[gamemap-1]->musname, mapmusname, 7)) + if (!strnicmp(mapheaderinfo[gamemap-1]->musname, mapmusname, 7)) S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2), 0); } } From 0f42363a976bd8a0b0ea4ca2bb3cca3d5e130196 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 25 Aug 2018 22:18:11 -0400 Subject: [PATCH 08/12] Fixed post-boss music change with mapmusname comparison --- src/p_enemy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 88a05f384..110f369b4 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3534,6 +3534,7 @@ void A_BossDeath(mobj_t *mo) { // Touching the egg trap button calls P_DoPlayerExit, which calls P_RestoreMusic. // So just park ourselves in the mapmus variables. + boolean changed = (boolean)strnicmp(mapheaderinfo[gamemap-1]->musname, mapmusname, 7); strncpy(mapmusname, mapheaderinfo[gamemap-1]->muspostbossname, 7); mapmusname[6] = 0; mapmusflags = (mapheaderinfo[gamemap-1]->muspostbosstrack & MUSIC_TRACKMASK) | MUSIC_RELOADRESET; @@ -3541,7 +3542,7 @@ void A_BossDeath(mobj_t *mo) // don't change if we're in another tune // but in case we're in jingle, use our parked mapmus variables so the correct track restores - if (!strnicmp(mapheaderinfo[gamemap-1]->musname, mapmusname, 7)) + if (!changed) S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2), 0); } } From b0be27a54e0f2c6674cf6baa67b71b236ca7c2a8 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Tue, 28 Aug 2018 14:37:03 -0400 Subject: [PATCH 09/12] Fix music fade out when MUSICPOSTBOSS is not specified or doesn't exist --- src/p_enemy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 110f369b4..7670aa543 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3530,7 +3530,8 @@ void A_BossDeath(mobj_t *mo) junk.tag = 682; EV_DoElevator(&junk, elevateHighest, false); - if (mapheaderinfo[gamemap-1]->muspostbossname) + if (mapheaderinfo[gamemap-1]->muspostbossname[0] && + S_MusicExists(mapheaderinfo[gamemap-1]->muspostbossname, !midi_disabled, !digital_disabled)) { // Touching the egg trap button calls P_DoPlayerExit, which calls P_RestoreMusic. // So just park ourselves in the mapmus variables. From dabd7f99e60734eb2d18a50e3f8854ade9607f6e Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 1 Sep 2018 13:10:50 -0400 Subject: [PATCH 10/12] Add MUSICPOSTBOSSFADEIN --- src/dehacked.c | 2 ++ src/doomstat.h | 3 ++- src/lua_maplib.c | 2 ++ src/p_enemy.c | 3 ++- src/p_setup.c | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 3f021847a..f95695e4f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1160,6 +1160,8 @@ static void readlevelheader(MYFILE *f, INT32 num) mapheaderinfo[num-1]->muspostbosstrack = ((UINT16)i - 1); else if (fastcmp(word, "MUSICPOSTBOSSPOS")) mapheaderinfo[num-1]->muspostbosspos = (UINT32)get_number(word2); + else if (fastcmp(word, "MUSICPOSTBOSSFADEIN")) + mapheaderinfo[num-1]->muspostbossfadein = (UINT32)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 f51baec23..5682dcff6 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -262,7 +262,8 @@ typedef struct // Music stuff. char muspostbossname[7]; ///< Post-bossdeath music. UINT16 muspostbosstrack; ///< Post-bossdeath track. - UINT32 muspostbosspos; ///< Post-bossdeath position + UINT32 muspostbosspos; ///< Post-bossdeath position + UINT32 muspostbossfadein; ///< Post-bossdeath fade-in milliseconds. // 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 77b6120ba..878ff03c9 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1768,6 +1768,8 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->muspostbosstrack); else if (fastcmp(field,"muspostbosspos")) lua_pushinteger(L, header->muspostbosspos); + else if (fastcmp(field,"muspostbossfadein")) + lua_pushinteger(L, header->muspostbossfadein); 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 7670aa543..8964691cc 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3544,7 +3544,8 @@ void A_BossDeath(mobj_t *mo) // don't change if we're in another tune // but in case we're in jingle, use our parked mapmus variables so the correct track restores if (!changed) - S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2), 0); + S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2), + mapheaderinfo[gamemap-1]->muspostbossfadein); } } diff --git a/src/p_setup.c b/src/p_setup.c index 716d51d7b..e18dadaa8 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -212,6 +212,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->muspostbossname[6] = 0; mapheaderinfo[num]->muspostbosstrack = 0; mapheaderinfo[num]->muspostbosspos = 0; + mapheaderinfo[num]->muspostbossfadein = 0; mapheaderinfo[num]->forcecharacter[0] = '\0'; mapheaderinfo[num]->weather = 0; mapheaderinfo[num]->skynum = 1; From 67c4e9e8a21682dc1de4e7cb44e7933fb21e060a Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sun, 16 Sep 2018 23:44:42 -0400 Subject: [PATCH 11/12] Postboss: S_ChangeMusicAdvanced -> Ex --- src/p_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 04afc6bcc..a49a89225 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3545,7 +3545,7 @@ void A_BossDeath(mobj_t *mo) // don't change if we're in another tune // but in case we're in jingle, use our parked mapmus variables so the correct track restores if (!changed) - S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2), + S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2), mapheaderinfo[gamemap-1]->muspostbossfadein); } } From f52659d9f97009e3baa9857ad60f325d437d24ac Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 19 Sep 2018 19:53:01 -0400 Subject: [PATCH 12/12] MP Postboss: strnicmp -> boolean remove cast (buildbots) --- src/p_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index a49a89225..6c19ed5d3 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3536,7 +3536,7 @@ void A_BossDeath(mobj_t *mo) { // Touching the egg trap button calls P_DoPlayerExit, which calls P_RestoreMusic. // So just park ourselves in the mapmus variables. - boolean changed = (boolean)strnicmp(mapheaderinfo[gamemap-1]->musname, mapmusname, 7); + boolean changed = strnicmp(mapheaderinfo[gamemap-1]->musname, mapmusname, 7); strncpy(mapmusname, mapheaderinfo[gamemap-1]->muspostbossname, 7); mapmusname[6] = 0; mapmusflags = (mapheaderinfo[gamemap-1]->muspostbosstrack & MUSIC_TRACKMASK) | MUSIC_RELOADRESET;