Added MUSICPOSTBOSSTRACK and MUSICPOSTBOSSPOSITION level header/variables

This commit is contained in:
mazmazz 2018-08-25 16:10:46 -04:00
parent a3ed60d7bd
commit 610a83f60e
5 changed files with 16 additions and 3 deletions

View File

@ -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);

View File

@ -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.)

View File

@ -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"))

View File

@ -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);
}
}

View File

@ -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;