mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 17:22:12 +00:00
Merge branch 'musicplus-resetmusic-followup' into 'master'
Follow-up fixes for reset-upon-dying music See merge request STJr/SRB2Internal!284
This commit is contained in:
commit
440b63ef13
8 changed files with 47 additions and 7 deletions
|
@ -1181,6 +1181,20 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
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, "FORCERESETMUSIC"))
|
||||
{
|
||||
// This is a weird one because "FALSE"/"NO" could either apply to "leave to default preference" (cv_resetmusic)
|
||||
// or "force off". Let's assume it means "force off", and let an unspecified value mean "default preference"
|
||||
if (fastcmp(word2, "OFF") || word2[0] == 'F' || word2[0] == 'N') i = 0;
|
||||
else if (fastcmp(word2, "ON") || word2[0] == 'T' || word2[0] == 'Y') i = 1;
|
||||
else i = -1; // (fastcmp(word2, "DEFAULT"))
|
||||
|
||||
if (i >= -1 && i <= 1) // -1 to force off, 1 to force on, 0 to honor default.
|
||||
// This behavior can be disabled with cv_resetmusicbyheader
|
||||
mapheaderinfo[num-1]->musforcereset = (SINT8)i;
|
||||
else
|
||||
deh_warning("Level header %d: invalid forceresetmusic option %d", num, i);
|
||||
}
|
||||
else if (fastcmp(word, "FORCECHARACTER"))
|
||||
{
|
||||
strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1);
|
||||
|
|
|
@ -333,6 +333,8 @@ typedef struct
|
|||
UINT32 muspostbosspos; ///< Post-bossdeath position
|
||||
UINT32 muspostbossfadein; ///< Post-bossdeath fade-in milliseconds.
|
||||
|
||||
SINT8 musforcereset; ///< Force resetmusic (-1 for default; 0 for force off; 1 for force on)
|
||||
|
||||
// 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.
|
||||
|
|
|
@ -2280,7 +2280,7 @@ void G_PlayerReborn(INT32 player)
|
|||
}
|
||||
|
||||
// This is in S_Start, but this was not here previously.
|
||||
// if (cv_resetmusic.value)
|
||||
// if (RESETMUSIC)
|
||||
// S_StopMusic();
|
||||
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
|
||||
}
|
||||
|
|
|
@ -2017,6 +2017,8 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushinteger(L, header->muspostbosspos);
|
||||
else if (fastcmp(field,"muspostbossfadein"))
|
||||
lua_pushinteger(L, header->muspostbossfadein);
|
||||
else if (fastcmp(field,"musforcereset"))
|
||||
lua_pushinteger(L, header->musforcereset);
|
||||
else if (fastcmp(field,"forcecharacter"))
|
||||
lua_pushstring(L, header->forcecharacter);
|
||||
else if (fastcmp(field,"weather"))
|
||||
|
|
13
src/m_menu.c
13
src/m_menu.c
|
@ -1323,6 +1323,12 @@ static menuitem_t OP_SoundOptionsMenu[] =
|
|||
#define OPENMPT_MENUOFFSET 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MIXERX
|
||||
#define MIXERX_MENUOFFSET 81
|
||||
#else
|
||||
#define MIXERX_MENUOFFSET 0
|
||||
#endif
|
||||
|
||||
static menuitem_t OP_SoundAdvancedMenu[] =
|
||||
{
|
||||
#ifdef HAVE_OPENMPT
|
||||
|
@ -1334,12 +1340,15 @@ static menuitem_t OP_SoundAdvancedMenu[] =
|
|||
{IT_HEADER, NULL, "MIDI Settings", NULL, OPENMPT_MENUOFFSET+10},
|
||||
{IT_STRING | IT_CVAR, NULL, "MIDI Player", &cv_midiplayer, OPENMPT_MENUOFFSET+22},
|
||||
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "FluidSynth Sound Font File", &cv_midisoundfontpath, OPENMPT_MENUOFFSET+34},
|
||||
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "TiMidity++ Config Folder", &cv_miditimiditypath, OPENMPT_MENUOFFSET+61}
|
||||
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "TiMidity++ Config Folder", &cv_miditimiditypath, OPENMPT_MENUOFFSET+61},
|
||||
#endif
|
||||
|
||||
{IT_HEADER, NULL, "Miscellaneous", NULL, OPENMPT_MENUOFFSET+MIXERX_MENUOFFSET+10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Let Levels Force Reset Music", &cv_resetmusicbyheader, OPENMPT_MENUOFFSET+MIXERX_MENUOFFSET+22},
|
||||
};
|
||||
|
||||
#undef OPENMPT_MENUOFFSET
|
||||
|
||||
#undef MIXERX_MENUOFFSET
|
||||
#endif
|
||||
|
||||
static menuitem_t OP_DataOptionsMenu[] =
|
||||
|
|
|
@ -221,6 +221,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
|||
mapheaderinfo[num]->muspostbosstrack = 0;
|
||||
mapheaderinfo[num]->muspostbosspos = 0;
|
||||
mapheaderinfo[num]->muspostbossfadein = 0;
|
||||
mapheaderinfo[num]->musforcereset = -1;
|
||||
mapheaderinfo[num]->forcecharacter[0] = '\0';
|
||||
mapheaderinfo[num]->weather = 0;
|
||||
mapheaderinfo[num]->skynum = 1;
|
||||
|
@ -2703,7 +2704,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
S_StartSound(NULL, sfx_s3kaf);
|
||||
|
||||
// Fade music! Time it to S3KAF: 0.25 seconds is snappy.
|
||||
if (cv_resetmusic.value ||
|
||||
if (RESETMUSIC ||
|
||||
strnicmp(S_MusicName(),
|
||||
(mapmusflags & MUSIC_RELOADRESET) ? mapheaderinfo[gamemap-1]->musname : mapmusname, 7))
|
||||
S_FadeOutStopMusic(MUSICRATE/4); //FixedMul(FixedDiv(F_GetWipeLength(wipedefs[wipe_speclevel_towhite])*NEWTICRATERATIO, NEWTICRATE), MUSICRATE)
|
||||
|
@ -2736,7 +2737,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
|
||||
// Fade out music here. Deduct 2 tics so the fade volume actually reaches 0.
|
||||
// But don't halt the music! S_Start will take care of that. This dodges a MIDI crash bug.
|
||||
if (!titlemapinaction && (cv_resetmusic.value ||
|
||||
if (!titlemapinaction && (RESETMUSIC ||
|
||||
strnicmp(S_MusicName(),
|
||||
(mapmusflags & MUSIC_RELOADRESET) ? mapheaderinfo[gamemap-1]->musname : mapmusname, 7)))
|
||||
S_FadeMusic(0, FixedMul(
|
||||
|
|
|
@ -108,7 +108,9 @@ consvar_t cv_closedcaptioning = {"closedcaptioning", "Off", CV_SAVE|CV_CALL, CV_
|
|||
consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_resetmusic = {"resetmusic", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_resetmusic = {"resetmusic", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_resetmusicbyheader = {"resetmusicbyheader", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Sound system toggles, saved into the config
|
||||
consvar_t cv_gamedigimusic = {"digimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameDigiMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
@ -275,6 +277,7 @@ void S_RegisterSoundStuff(void)
|
|||
CV_RegisterVar(&surround);
|
||||
CV_RegisterVar(&cv_samplerate);
|
||||
CV_RegisterVar(&cv_resetmusic);
|
||||
CV_RegisterVar(&cv_resetmusicbyheader);
|
||||
CV_RegisterVar(&cv_gamesounds);
|
||||
CV_RegisterVar(&cv_gamedigimusic);
|
||||
CV_RegisterVar(&cv_gamemidimusic);
|
||||
|
@ -2096,7 +2099,7 @@ void S_StartEx(boolean reset)
|
|||
mapmusposition = mapheaderinfo[gamemap-1]->muspos;
|
||||
}
|
||||
|
||||
if (cv_resetmusic.value || reset)
|
||||
if (RESETMUSIC || reset)
|
||||
S_StopMusic();
|
||||
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
|
||||
|
||||
|
|
|
@ -31,7 +31,16 @@ openmpt_module *openmpt_mhandle;
|
|||
extern consvar_t stereoreverse;
|
||||
extern consvar_t cv_soundvolume, cv_closedcaptioning, cv_digmusicvolume, cv_midimusicvolume;
|
||||
extern consvar_t cv_numChannels;
|
||||
|
||||
extern consvar_t cv_resetmusic;
|
||||
extern consvar_t cv_resetmusicbyheader;
|
||||
|
||||
#define RESETMUSIC (!modeattacking && \
|
||||
(cv_resetmusicbyheader.value ? \
|
||||
(mapheaderinfo[gamemap-1]->musforcereset != -1 ? mapheaderinfo[gamemap-1]->musforcereset : cv_resetmusic.value) \
|
||||
: cv_resetmusic.value) \
|
||||
)
|
||||
|
||||
extern consvar_t cv_gamedigimusic;
|
||||
extern consvar_t cv_gamemidimusic;
|
||||
extern consvar_t cv_gamesounds;
|
||||
|
|
Loading…
Reference in a new issue