Implement MUSICINTERFADEOUT level header

This commit is contained in:
mazmazz 2019-03-15 01:00:50 -04:00
parent dcd8669ec2
commit b5fc27c545
5 changed files with 14 additions and 3 deletions

View file

@ -1198,6 +1198,8 @@ static void readlevelheader(MYFILE *f, INT32 num)
mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1); mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1);
else if (fastcmp(word, "MUSICPOS")) else if (fastcmp(word, "MUSICPOS"))
mapheaderinfo[num-1]->muspos = (UINT32)get_number(word2); mapheaderinfo[num-1]->muspos = (UINT32)get_number(word2);
else if (fastcmp(word, "MUSICINTERFADEOUT"))
mapheaderinfo[num-1]->musicinterfadeout = (UINT32)get_number(word2);
else if (fastcmp(word, "MUSICINTER")) else if (fastcmp(word, "MUSICINTER"))
deh_strlcpy(mapheaderinfo[num-1]->musintername, word2, deh_strlcpy(mapheaderinfo[num-1]->musintername, word2,
sizeof(mapheaderinfo[num-1]->musintername), va("Level header %d: intermission music", num)); sizeof(mapheaderinfo[num-1]->musintername), va("Level header %d: intermission music", num));

View file

@ -248,6 +248,7 @@ typedef struct
nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful. nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful.
// Music stuff. // Music stuff.
UINT32 musicinterfadeout; ///< Fade out level music on intermission screen in milliseconds
char musintername[7]; ///< Intermission screen music. char musintername[7]; ///< Intermission screen music.
// Lua stuff. // Lua stuff.

View file

@ -1489,7 +1489,9 @@ static int mapheaderinfo_get(lua_State *L)
if (!header->interscreen[i]) if (!header->interscreen[i])
break; break;
lua_pushlstring(L, header->interscreen, i); lua_pushlstring(L, header->interscreen, i);
} else if (fastcmp(field,"runsoc")) } else if (fastcmp(field,"musicinterfadeout"))
lua_pushinteger(L, header->musicinterfadeout);
else if (fastcmp(field,"runsoc"))
lua_pushstring(L, header->runsoc); lua_pushstring(L, header->runsoc);
else if (fastcmp(field,"scriptname")) else if (fastcmp(field,"scriptname"))
lua_pushstring(L, header->scriptname); lua_pushstring(L, header->scriptname);

View file

@ -189,6 +189,8 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->mustrack = 0; mapheaderinfo[num]->mustrack = 0;
DEH_WriteUndoline("MUSICPOS", va("%d", mapheaderinfo[num]->muspos), UNDO_NONE); DEH_WriteUndoline("MUSICPOS", va("%d", mapheaderinfo[num]->muspos), UNDO_NONE);
mapheaderinfo[num]->muspos = 0; mapheaderinfo[num]->muspos = 0;
DEH_WriteUndoline("MUSICINTERFADEOUT", va("%d", mapheaderinfo[num]->musicinterfadeout), UNDO_NONE);
mapheaderinfo[num]->musicinterfadeout = 0;
DEH_WriteUndoline("MUSICINTER", mapheaderinfo[num]->musintername, UNDO_NONE); DEH_WriteUndoline("MUSICINTER", mapheaderinfo[num]->musintername, UNDO_NONE);
mapheaderinfo[num]->musintername[0] = '\0'; mapheaderinfo[num]->musintername[0] = '\0';
DEH_WriteUndoline("FORCECHARACTER", va("%d", mapheaderinfo[num]->forcecharacter), UNDO_NONE); DEH_WriteUndoline("FORCECHARACTER", va("%d", mapheaderinfo[num]->forcecharacter), UNDO_NONE);

View file

@ -697,7 +697,9 @@ void Y_Ticker(void)
if (!intertic) // first time only if (!intertic) // first time only
{ {
if (mapheaderinfo[gamemap-1]->musintername[0] && S_MusicExists(mapheaderinfo[gamemap-1]->musintername, !midi_disabled, !digital_disabled)) if (mapheaderinfo[gamemap-1]->musicinterfadeout)
S_FadeOutStopMusic(mapheaderinfo[gamemap-1]->musicinterfadeout);
else if (mapheaderinfo[gamemap-1]->musintername[0] && S_MusicExists(mapheaderinfo[gamemap-1]->musintername, !midi_disabled, !digital_disabled))
S_ChangeMusicInternal(mapheaderinfo[gamemap-1]->musintername, false); // don't loop it S_ChangeMusicInternal(mapheaderinfo[gamemap-1]->musintername, false); // don't loop it
else else
S_ChangeMusicInternal("lclear", false); // don't loop it S_ChangeMusicInternal("lclear", false); // don't loop it
@ -762,7 +764,9 @@ void Y_Ticker(void)
if (!intertic) // first time only if (!intertic) // first time only
{ {
if (mapheaderinfo[gamemap-1]->musintername[0] && S_MusicExists(mapheaderinfo[gamemap-1]->musintername, !midi_disabled, !digital_disabled)) if (mapheaderinfo[gamemap-1]->musicinterfadeout)
S_FadeOutStopMusic(mapheaderinfo[gamemap-1]->musicinterfadeout);
else if (mapheaderinfo[gamemap-1]->musintername[0] && S_MusicExists(mapheaderinfo[gamemap-1]->musintername, !midi_disabled, !digital_disabled))
S_ChangeMusicInternal(mapheaderinfo[gamemap-1]->musintername, false); // don't loop it S_ChangeMusicInternal(mapheaderinfo[gamemap-1]->musintername, false); // don't loop it
else else
S_ChangeMusicInternal("lclear", false); // don't loop it S_ChangeMusicInternal("lclear", false); // don't loop it