Merge branch 'musicplus-feature-postboss' into musicplus-aug2019-b

This commit is contained in:
mazmazz 2019-08-04 03:22:36 -04:00
commit cdb7250da4
5 changed files with 44 additions and 0 deletions

View File

@ -1172,6 +1172,15 @@ static void readlevelheader(MYFILE *f, INT32 num)
else if (fastcmp(word, "MUSICINTER"))
deh_strlcpy(mapheaderinfo[num-1]->musintername, word2,
sizeof(mapheaderinfo[num-1]->musintername), va("Level header %d: intermission music", 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, "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);

View File

@ -327,6 +327,11 @@ typedef struct
// Music stuff.
UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds
char musintername[7]; ///< Intermission screen music.
char muspostbossname[7]; ///< Post-bossdeath music.
UINT16 muspostbosstrack; ///< Post-bossdeath track.
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.)

View File

@ -2009,6 +2009,14 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushinteger(L, header->musinterfadeout);
else if (fastcmp(field,"musintername"))
lua_pushstring(L, header->musintername);
else if (fastcmp(field,"muspostbossname"))
lua_pushstring(L, header->muspostbossname);
else if (fastcmp(field,"muspostbosstrack"))
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"))

View File

@ -3812,6 +3812,24 @@ void A_BossDeath(mobj_t *mo)
EV_DoElevator(&junk, elevateUp, false);
junk.tag = LE_CAPSULE2;
EV_DoElevator(&junk, elevateHighest, false);
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.
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;
mapmusposition = mapheaderinfo[gamemap-1]->muspostbosspos;
// 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_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2),
mapheaderinfo[gamemap-1]->muspostbossfadein);
}
}
bossjustdie:

View File

@ -217,6 +217,10 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->muspos = 0;
mapheaderinfo[num]->musinterfadeout = 0;
mapheaderinfo[num]->musintername[0] = '\0';
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;