From 9abf2bca75bd5f938f7de44aaa1ee1bbd21e57b7 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 1 Oct 2024 15:46:09 +0200 Subject: [PATCH] fix some stuff --- src/p_spec.c | 6 +++--- src/p_user.c | 4 +++- src/s_sound.c | 17 ++++++++--------- src/s_sound.h | 1 + 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index e7d937a91..6146f422a 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2132,10 +2132,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 413: // Change music - if (keepmusic && (leveltime < (starttime + TICRATE))) //why check for starttime? cause encore music Zzz... + if (keepmusic && (leveltime <= MUSICSTARTTIME)) //why check for starttime? cause encore music Zzz... return; - if (cv_ignoremusicchanges.value && (leveltime > (starttime + TICRATE) && !fromlapexec)) // keep lap music intanct tho + if (cv_ignoremusicchanges.value && (leveltime >= MUSICSTARTTIME) && !fromlapexec) // keep lap music intanct tho return; // console player only unless NOCLIMB is set @@ -2221,7 +2221,7 @@ 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)))) + if (cv_skipintromusic.value && (leveltime < MUSICSTARTTIME)) 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 a6e4791e6..ac1537eb0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -742,7 +742,9 @@ void P_RestoreMusic(player_t *player) if (P_EndingMusic(player)) return; - if (leveltime > (starttime + (TICRATE/2))) + if (leveltime < MUSICSTARTTIME) + S_StartMapMusic(); + else // see also where time overs are handled - search for "lives = 2" in this file { INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow diff --git a/src/s_sound.c b/src/s_sound.c index 0eedb57ec..7aab19db9 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2262,7 +2262,7 @@ void S_InitMapMusic(void) if (cv_skipintromusic.value) return; - if (leveltime < starttime) // SRB2Kart + if (leveltime < MUSICSTARTTIME) // SRB2Kart S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic(); //S_ChangeMusicEx((encoremode ? "estart" : "kstart"), 0, false, mapmusposition, 0, 0); } @@ -2270,8 +2270,7 @@ void S_InitMapMusic(void) void S_StartMapMusic(void) { //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)) + if (leveltime > MUSICSTARTTIME) return; if (keepmusic) @@ -2279,18 +2278,18 @@ void S_StartMapMusic(void) if (cv_skipintromusic.value) { - if (leveltime == 0) // dumb but i dont need this to be spammed honestly + if (leveltime < starttime) // dumb but i dont need this to be spammed honestly S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); - if (leveltime == (starttime + (TICRATE/2))) + if (leveltime == MUSICSTARTTIME) S_ShowMusicCredit(); return; } - if (leveltime == starttime) // The GO! sound stops the level start ambience - S_StopMusic(); - else if (leveltime < starttime) // SRB2Kart + if (leveltime < starttime) // SRB2Kart S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); // yes this will be spammed otherwise encore and some stuff WILL overwrite it - else if (leveltime == (starttime + (TICRATE/2))) // Plays the music after the starting countdown. + else if (leveltime == starttime) // The GO! sound stops the level start ambience + S_StopMusic(); + else if (leveltime == MUSICSTARTTIME) // Plays the music after the starting countdown. { S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); S_ShowMusicCredit(); diff --git a/src/s_sound.h b/src/s_sound.h index 9d53cc357..39b61b49d 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -71,6 +71,7 @@ extern consvar_t cv_keepmusic; extern consvar_t cv_skipintromusic; extern consvar_t cv_ignoremusicchanges; extern boolean keepmusic; +#define MUSICSTARTTIME (starttime + (TICRATE/2)) extern consvar_t precachesound;