diff --git a/src/p_spec.c b/src/p_spec.c index 7d4b8c9ef..0518f4b70 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -99,6 +99,8 @@ typedef struct thinker_t **thinkers; } thinkerlist_t; +static boolean fromlapexec = false; + static void P_SearchForDisableLinedefs(void); static void P_SpawnScrollers(void); static void P_SpawnFriction(void); @@ -1340,6 +1342,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller fixed_t dist = P_AproxDistance(triggerline->dx, triggerline->dy)>>FRACBITS; size_t i, linecnt, sectori; INT16 specialtype = triggerline->special; + fromlapexec = false; ///////////////////////////////////////////////// // Distance-checking/sector trigger conditions // @@ -1461,6 +1464,8 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (lap != (sides[triggerline->sidenum[0]].textureoffset >> FRACBITS)) return false; } + + fromlapexec = true; } // If we were not triggered by a sector type especially for the purpose, // a Linedef Executor linedef trigger is not handling sector triggers properly, return. @@ -2127,8 +2132,11 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 413: // Change music - //if (ignoremusicchanges && (leveltime < (starttime + (TICRATE/2)))) //why check for starttime? cause encore music Zzz... - //return; + if (keepmusic && (leveltime < (starttime + TICRATE))) //why check for starttime? cause encore music Zzz... + return; + + if (ignoremusicchanges && !fromlapexec) // keep lap music intanct tho + return; // console player only unless NOCLIMB is set if ((line->flags & ML_NOCLIMB) || (mo && mo->player && P_IsLocalPlayer(mo->player))) @@ -2213,8 +2221,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) INT32 sfxnum; //dont play any funky sound intros that may interfere with the music - //if (cv_skipintromusic.value && (leveltime < (starttime + (TICRATE/2)))) - //return; + if (cv_skipintromusic.value && (leveltime < (starttime + (TICRATE/2)))) + return; sfxnum = sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS; diff --git a/src/p_user.c b/src/p_user.c index 2bd9cfb73..c1cc317b3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -611,8 +611,8 @@ boolean P_EndingMusic(player_t *player) INT32 bestlocalpos; player_t *bestlocalplayer; - //if (!ignoremusicchanges) - //return false; + if (ignoremusicchanges) + return false; if (!P_IsLocalPlayer(player)) // Only applies to a local player return false; diff --git a/src/s_sound.c b/src/s_sound.c index 08671cdad..e1f184097 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -117,6 +117,14 @@ consvar_t cv_resume = {"resume", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0 consvar_t cv_fading = {"fading", "Off", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_birdmusic = {"birdmusicstuff", "No", CV_SAVE|CV_CALL, CV_YesNo, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_keepmusic = {"keepmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_skipintromusic = {"skipintromusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_ignoremusicchanges = {"ignoremusicchanges", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; + +boolean ignoremusicchanges = false; +boolean keepmusic = false; + #ifdef HAVE_OPENMPT openmpt_module *openmpt_mhandle = NULL; @@ -294,6 +302,10 @@ void S_RegisterSoundStuff(void) CV_RegisterVar(&cv_fading); CV_RegisterVar(&cv_birdmusic); + CV_RegisterVar(&cv_keepmusic); + CV_RegisterVar(&cv_skipintromusic); + CV_RegisterVar(&cv_ignoremusicchanges); + COM_AddCommand("tunes", Command_Tunes_f); COM_AddCommand("restartaudio", Command_RestartAudio_f); COM_AddCommand("restartmusic", Command_RestartMusic_f); @@ -1967,36 +1979,21 @@ boolean S_FadeOutStopMusic(UINT32 ms) }*/ static INT16 oldmap = 0; -static INT32 oldencore = 0; -static boolean keepmusic = false; +static boolean oldencore = 0; void S_KeepMusic(void) { - //if (!cv_keepmusic.value) - //return false; + if (!cv_keepmusic.value) + { + keepmusic = false; + return; + } //this one compares map and encoremode instead of the music itself //makes tunes work and stuff + keepmusic = (strcmp(music_name, (encoremode ? "estart" : "kstart")) != 0 && oldmap == gamemap && oldencore == encoremode); // we on the same map and intro sound aint playin? keep it - keepmusic = false; - - //dont keep the intro "sound" lmao - if (strcmp(music_name, (encoremode ? "estart" : "kstart")) == 0) - return; - - if (oldencore != cv_kartencore.value) - { - oldencore = cv_kartencore.value; - return; - } - - // we on the same map? keep it - if (oldmap == gamemap) - { - keepmusic = true; - return; - } - + oldencore = encoremode; oldmap = gamemap; } @@ -2023,18 +2020,18 @@ void S_Start(void) if (keepmusic) return; - /*if (cv_skipintromusic.value) + if (cv_skipintromusic.value) { S_StopMusic(); S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); return; - }*/ + } // Starting ambience should always be restarted // lug: but not when we keep the map music lol S_StopMusic(); - if (leveltime < (starttime + (TICRATE/2))) // SRB2Kart + if (leveltime < starttime) // SRB2Kart S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic(); //S_ChangeMusicEx((encoremode ? "estart" : "kstart"), 0, false, mapmusposition, 0, 0); } @@ -2042,28 +2039,30 @@ void S_Start(void) void M_Start(void) { // need to be after race starts so "certain" maps don“t break Zzz... - //ignoremusicchanges = cv_ignoremusicchanges.value && (leveltime > (starttime + (TICRATE/2))); + ignoremusicchanges = cv_ignoremusicchanges.value && (leveltime > (starttime + (TICRATE/2))); //no need to constantly run this after race has started //but let it run atleast half a tic after map music started to let shit update lmao if (leveltime > (starttime + TICRATE)) return; - /*if (cv_skipintromusic.value && leveltime == (starttime + (TICRATE/2))) - { - S_ShowMusicCredit(); - return; - }*/ - if (keepmusic) return; + if (cv_skipintromusic.value) + { + if (leveltime == (starttime + (TICRATE/2))) + S_ShowMusicCredit(); + return; + } + // The GO! sound stops the level start ambience if (leveltime == starttime) S_StopMusic(); - + else if (leveltime < starttime) // SRB2Kart + S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); // Plays the music after the starting countdown. - if (leveltime == (starttime + (TICRATE/2))) + else if (leveltime == (starttime + (TICRATE/2))) { S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); S_ShowMusicCredit(); diff --git a/src/s_sound.h b/src/s_sound.h index e90914162..2f58b489a 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -67,6 +67,13 @@ extern consvar_t cv_resume; extern consvar_t cv_fading; extern consvar_t cv_birdmusic; +extern consvar_t cv_keepmusic; +extern consvar_t cv_skipintromusic; +extern consvar_t cv_ignoremusicchanges; + +extern boolean ignoremusicchanges; +extern boolean keepmusic; + extern consvar_t precachesound; typedef enum