From 91a9f20af7948bd48368c4db2fe6b94b6a335b9a Mon Sep 17 00:00:00 2001 From: Indev Date: Tue, 24 Sep 2024 00:08:48 +0300 Subject: [PATCH 01/31] Skip map marker in vres_GetMap --- src/w_wad.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 5e2f4ce10..118c5011f 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -2169,8 +2169,16 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum) if (vsizecache[realentry] == 0) continue; vlumps[i].size = vsizecache[realentry]; + + const char *name = (fileinfo + realentry)->name; + if (strlen(name) == 5 && memcmp(name, "MAP", 3) == 0) + { + numlumps--; // We skip map marker, so 1 of entries becomes empty + continue; // This will skip i++ so we will write to same entry + } + // Play it safe with the name in this case. - memcpy(vlumps[i].name, (fileinfo + realentry)->name, 8); + memcpy(vlumps[i].name, name, 8); vlumps[i].name[8] = '\0'; vlumps[i].data = Z_Malloc(vlumps[i].size, PU_LEVEL, NULL); // This is memory inefficient, sorry about that. memcpy(vlumps[i].data, wadData + LONG((fileinfo + realentry)->filepos), vlumps[i].size); @@ -2196,8 +2204,17 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum) vlumps = Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL); for (i = 0; i < numlumps; i++, lumpnum++) { + // Check if it is map marker. It is not always first lump sadly, so we need to expect it anywhere + const char *name = W_CheckNameForNum(lumpnum); + if (strlen(name) == 5 && memcmp(name, "MAP", 3) == 0) + { + --i; // Decrement so on next iteration we write on same i, so we don't leave corrupted vlumps entry + numlumps--; // Just so we don't try to access the leftover vlumps entry + continue; + } + vlumps[i].size = W_LumpLength(lumpnum); - memcpy(vlumps[i].name, W_CheckNameForNum(lumpnum), 8); + memcpy(vlumps[i].name, name, 8); vlumps[i].name[8] = '\0'; vlumps[i].data = W_CacheLumpNum(lumpnum, PU_LEVEL); } From 0deff73a460c89431566e1b931fb482df7d62a1a Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 05:17:44 +0200 Subject: [PATCH 02/31] make a function for the music level start stuff --- src/k_kart.c | 10 ++-------- src/p_user.c | 5 +---- src/s_sound.c | 23 +++++++++++++++++++---- src/s_sound.h | 1 + 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 44497b0f2..fcb373782 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5361,11 +5361,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) K_UpdateInvincibilitySounds(player); // Also thanks, VAda! // Plays the music after the starting countdown. - if (P_IsLocalPlayer(player) && leveltime == (starttime + (TICRATE/2))) - { - S_ChangeMusic(mapmusname, mapmusflags, true); - S_ShowMusicCredit(); - } + if (P_IsLocalPlayer(player)) + M_Start(); } void K_KartPlayerAfterThink(player_t *player) @@ -6553,10 +6550,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if ((leveltime == starttime-(3*TICRATE)) || (leveltime == starttime-(2*TICRATE)) || (leveltime == starttime-TICRATE)) S_StartSound(NULL, sfx_s3ka7); if (leveltime == starttime) - { S_StartSound(NULL, sfx_s3kad); - S_StopMusic(); // The GO! sound stops the level start ambience - } } // Start charging once you're given the opportunity. diff --git a/src/p_user.c b/src/p_user.c index a9b1b6b72..a6e4791e6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -742,10 +742,7 @@ void P_RestoreMusic(player_t *player) if (P_EndingMusic(player)) return; - // Event - Level Start - if (leveltime < (starttime + (TICRATE/2))) - S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic(); - else // see also where time overs are handled - search for "lives = 2" in this file + if (leveltime > (starttime + (TICRATE/2))) { 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 ec5ebf00d..855026111 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2169,13 +2169,28 @@ void S_Start(void) mapmusresume = 0; } - //if (cv_resetmusic.value) // Starting ambience should always be restarted - S_StopMusic(); + S_StopMusic(); if (leveltime < (starttime + (TICRATE/2))) // SRB2Kart - S_ChangeMusicEx((encoremode ? "estart" : "kstart"), 0, false, mapmusposition, 0, 0); - else + S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic(); + //S_ChangeMusicEx((encoremode ? "estart" : "kstart"), 0, false, mapmusposition, 0, 0); +} + +void M_Start(void) +{ + if (leveltime > (starttime + (TICRATE/2))) + return; + + // The GO! sound stops the level start ambience + if (leveltime == starttime) + S_StopMusic(); + + // Plays the music after the starting countdown. + if (leveltime == (starttime + (TICRATE/2))) + { S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); + S_ShowMusicCredit(); + } } void S_RestartMusic(void) diff --git a/src/s_sound.h b/src/s_sound.h index 6f4d03f09..75c59dbc8 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -101,6 +101,7 @@ void S_InitSfxChannels(INT32 sfxVolume); void S_StopSounds(void); void S_ClearSfx(void); void S_Start(void); +void M_Start(void); // Stops music and restarts it from same position. Used for instant applying changes to amiga filters. void S_RestartMusic(void); From 0d150e4b08c1a923cc290f1f91e831a016708d9d Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 06:28:02 +0200 Subject: [PATCH 03/31] add some basics of what i wanna have for music stuff - basic keepmusic implementation (currently checks for if the song changes instead of the map, idk if i keep this, since this allows certain maps to change the music on start, ex abstract avenue or wandering balls) - Toggle to ignore any kind of music change during the level (includes intermission music, depends on how custom intermission music works) -toggle to start map music instantly on levelload and skip the intro fanfare (also skips any linedef executed sound so some map intros dont interfere with this) --- src/p_spec.c | 7 +++++++ src/p_user.c | 3 +++ src/s_sound.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 7066058fa..0fbd16ee4 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2127,6 +2127,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 413: // Change music + //if (ignoremusicchanges) + //return; + // console player only unless NOCLIMB is set if ((line->flags & ML_NOCLIMB) || (mo && mo->player && P_IsLocalPlayer(mo->player))) { @@ -2209,6 +2212,10 @@ 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; + sfxnum = sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS; if (sfxnum == sfx_None) diff --git a/src/p_user.c b/src/p_user.c index a6e4791e6..f5de9b704 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -650,6 +650,9 @@ boolean P_EndingMusic(player_t *player) INT32 bestlocalpos; player_t *bestlocalplayer; + //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 855026111..a7845ce24 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2149,6 +2149,28 @@ boolean S_FadeOutStopMusic(UINT32 ms) return I_FadeSong(0, ms, &S_StopMusic); } + +static boolean S_KeepMusic(const char *mapmusicname) +{ + //if (!cv_keepmusic.value) + //return false; + + // should i compare songs or maps? + // comparing songs makes this alot easier honestly + static char oldmusname[7] = ""; + + if (strcmp(music_name, mapmusicname) != 0) + return false; + + if (strcmp(oldmusname, mapmusicname) == 0) + return true; + + strncpy(oldmusname, mapmusicname, 7); + oldmusname[6] = '\0'; + + return false; +} + /// ------------------------ /// Init & Others /// ------------------------ @@ -2169,6 +2191,16 @@ void S_Start(void) mapmusresume = 0; } + if (S_KeepMusic(mapmusname)) + return; + + /*if (cv_skipintromusic.value) + { + S_StopMusic(); + S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); + return; + }*/ + S_StopMusic(); if (leveltime < (starttime + (TICRATE/2))) // SRB2Kart @@ -2178,7 +2210,21 @@ void S_Start(void) void M_Start(void) { - if (leveltime > (starttime + (TICRATE/2))) + // need to be after race starts so "certain" maps don´t break Zzz... + //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 (S_KeepMusic(mapmusname)) return; // The GO! sound stops the level start ambience @@ -2193,6 +2239,7 @@ void M_Start(void) } } + void S_RestartMusic(void) { S_StopMusic(); From e958e43b4976092932c2b1f85476ac2152ab5d52 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 06:31:43 +0200 Subject: [PATCH 04/31] update comments a little --- src/s_sound.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index a7845ce24..829a6a6da 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2156,7 +2156,6 @@ static boolean S_KeepMusic(const char *mapmusicname) //return false; // should i compare songs or maps? - // comparing songs makes this alot easier honestly static char oldmusname[7] = ""; if (strcmp(music_name, mapmusicname) != 0) @@ -2201,6 +2200,8 @@ void S_Start(void) 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 From 07f9756bc83466d3163aa94c4a635532e8a4e91c Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 06:38:29 +0200 Subject: [PATCH 05/31] forgor about encore music --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 0fbd16ee4..8c1e9b5da 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2127,7 +2127,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 413: // Change music - //if (ignoremusicchanges) + //if (ignoremusicchanges && (leveltime < (starttime + (TICRATE/2)))) //why check for starttime? cause encore music Zzz... //return; // console player only unless NOCLIMB is set From 42d957e21bcc876845d5887ce614647bd65db84c Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 11:45:33 +0200 Subject: [PATCH 06/31] change how keepmusic works compare map and encore instead of the music itself --- src/g_game.c | 1 + src/s_sound.c | 47 ++++++++++++++++++++++++++++++++++++++++------- src/s_sound.h | 2 ++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index f6b7d562c..d4d358431 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4368,6 +4368,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool else { LUAh_MapChange(gamemap); + S_KeepMusic(); G_DoLoadLevel(resetplayer); } diff --git a/src/s_sound.c b/src/s_sound.c index 829a6a6da..169dee2a0 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2149,8 +2149,7 @@ boolean S_FadeOutStopMusic(UINT32 ms) return I_FadeSong(0, ms, &S_StopMusic); } - -static boolean S_KeepMusic(const char *mapmusicname) +/*static boolean S_KeepMusic(void) { //if (!cv_keepmusic.value) //return false; @@ -2158,16 +2157,50 @@ static boolean S_KeepMusic(const char *mapmusicname) // should i compare songs or maps? static char oldmusname[7] = ""; - if (strcmp(music_name, mapmusicname) != 0) + if (strcmp(music_name, mapmusname) != 0) return false; - if (strcmp(oldmusname, mapmusicname) == 0) + if (strcmp(oldmusname, mapmusname) == 0) return true; - strncpy(oldmusname, mapmusicname, 7); + strncpy(oldmusname, mapmusname, 7); oldmusname[6] = '\0'; return false; +}*/ + +static INT16 oldmap = 0; +static INT32 oldencore = 0; +static boolean keepmusic = false; + +void S_KeepMusic(void) +{ + //if (!cv_keepmusic.value) + //return false; + + //this one compares map and encoremode instead of the music itself + //makes tunes work and stuff + + 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; + } + + oldmap = gamemap; } /// ------------------------ @@ -2190,7 +2223,7 @@ void S_Start(void) mapmusresume = 0; } - if (S_KeepMusic(mapmusname)) + if (keepmusic) return; /*if (cv_skipintromusic.value) @@ -2225,7 +2258,7 @@ void M_Start(void) return; }*/ - if (S_KeepMusic(mapmusname)) + if (keepmusic) return; // The GO! sound stops the level start ambience diff --git a/src/s_sound.h b/src/s_sound.h index 75c59dbc8..687054ee1 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -103,6 +103,8 @@ void S_ClearSfx(void); void S_Start(void); void M_Start(void); +void S_KeepMusic(void); + // Stops music and restarts it from same position. Used for instant applying changes to amiga filters. void S_RestartMusic(void); From f363663b3ebbe8c7a752cfcd4324f000611d851a Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 12:50:49 +0200 Subject: [PATCH 07/31] fix up everything and make stuff work i hope lmao --- src/p_spec.c | 16 +++++++++--- src/p_user.c | 4 +-- src/s_sound.c | 69 +++++++++++++++++++++++++-------------------------- src/s_sound.h | 7 ++++++ 4 files changed, 55 insertions(+), 41 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 8c1e9b5da..762540622 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 f5de9b704..093143e95 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -650,8 +650,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 169dee2a0..0380a2788 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); @@ -2170,36 +2182,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; } @@ -2226,18 +2223,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); } @@ -2245,28 +2242,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 687054ee1..2367d7729 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 From b4b206f57565954f4bbd2b3074fe5c007d11cb56 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 13:05:44 +0200 Subject: [PATCH 08/31] encoremusic... --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 762540622..decea017d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2135,7 +2135,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (keepmusic && (leveltime < (starttime + TICRATE))) //why check for starttime? cause encore music Zzz... return; - if (ignoremusicchanges && !fromlapexec) // keep lap music intanct tho + if (ignoremusicchanges && (leveltime < (starttime + TICRATE) && !fromlapexec)) // keep lap music intanct tho return; // console player only unless NOCLIMB is set From 7fa21e9aeaee811a8b6b11a0943448ef2fd3c566 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 15:41:19 +0200 Subject: [PATCH 09/31] work around custom vote theme music + rename a bunch of stuff please help me --- src/g_game.c | 2 +- src/k_kart.c | 4 ++-- src/p_setup.c | 2 +- src/p_spec.c | 6 +++--- src/s_sound.c | 60 +++++++++++++++++++++++++++++++++++++++++---------- src/s_sound.h | 7 +++--- 6 files changed, 60 insertions(+), 21 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index d4d358431..29e65a002 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4368,7 +4368,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool else { LUAh_MapChange(gamemap); - S_KeepMusic(); + S_CheckMap(); G_DoLoadLevel(resetplayer); } diff --git a/src/k_kart.c b/src/k_kart.c index fcb373782..1a586943f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5360,9 +5360,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) // Handle invincibility sfx K_UpdateInvincibilitySounds(player); // Also thanks, VAda! - // Plays the music after the starting countdown. + // Plays the music during and after the starting countdown. if (P_IsLocalPlayer(player)) - M_Start(); + S_StartMapMusic(); } void K_KartPlayerAfterThink(player_t *player) diff --git a/src/p_setup.c b/src/p_setup.c index 17d050dc4..672b1b347 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2683,7 +2683,7 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate) // As oddly named as this is, this handles music only. // We should be fine starting it here. if (!reloadinggamestate) - S_Start(); + S_InitMapMusic(); levelfadecol = (encoremode && !ranspecialwipe ? 122 : 120); diff --git a/src/p_spec.c b/src/p_spec.c index decea017d..058fe9413 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2118,12 +2118,12 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) return; if (bot) - P_Teleport(bot, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, (line->flags & ML_BLOCKMONSTERS) == 0, (line->flags & ML_EFFECT4) == ML_EFFECT4); + P_Teleport(bot, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, (line->flags & ML_BLOCKMONSTERS) == 0, (line->flags & ML_EFFECT4) == ML_EFFECT4); if (line->flags & ML_BLOCKMONSTERS) - P_Teleport(mo, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, false, (line->flags & ML_EFFECT4) == ML_EFFECT4); + P_Teleport(mo, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, false, (line->flags & ML_EFFECT4) == ML_EFFECT4); else { - P_Teleport(mo, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, true, (line->flags & ML_EFFECT4) == ML_EFFECT4); + P_Teleport(mo, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, true, (line->flags & ML_EFFECT4) == ML_EFFECT4); // Play the 'bowrwoosh!' sound S_StartSound(dest, sfx_mixup); } diff --git a/src/s_sound.c b/src/s_sound.c index 0380a2788..f8b0619eb 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -11,6 +11,7 @@ /// \file s_sound.c /// \brief System-independent sound and music routines +#include "d_netcmd.h" #include "doomdef.h" #include "doomstat.h" #include "command.h" @@ -124,6 +125,7 @@ consvar_t cv_ignoremusicchanges = {"ignoremusicchanges", "No", CV_SAVE, CV_YesNo boolean ignoremusicchanges = false; boolean keepmusic = false; +static void S_CheckEventMus(const char *newmus); #ifdef HAVE_OPENMPT openmpt_module *openmpt_mhandle = NULL; @@ -1973,6 +1975,8 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 strncpy(newmusic, mmusic, 6); + S_CheckEventMus(newmusic); + if (LUAh_MusicChange(music_name, newmusic, &mflags, &looping, &position, &prefadems, &fadeinms)) return; @@ -2161,6 +2165,10 @@ boolean S_FadeOutStopMusic(UINT32 ms) return I_FadeSong(0, ms, &S_StopMusic); } +/// ------------------------ +/// Init & Others +/// ------------------------ + /*static boolean S_KeepMusic(void) { //if (!cv_keepmusic.value) @@ -2183,8 +2191,45 @@ boolean S_FadeOutStopMusic(UINT32 ms) static INT16 oldmap = 0; static boolean oldencore = 0; +static boolean skipmusic = false; -void S_KeepMusic(void) +static const char *musicexception_list[16] = { + "vote", "voteea", "voteeb", "racent", "krwin", + "krok", "krlose", "krfail", "kbwin", "kbok", + "kblose", "kstart", "estart", "wait2j", "CHRSHP", + "CHRSHF" +}; + +//checks for any kind of event music like intermission, vote etc. +//always runs when musicchange gets invoked +static void S_CheckEventMus(const char *newmus) +{ + //if (leveltime > (starttime + (TICRATE/2))) + //return; + + skipmusic = false; + + if (!cv_keepmusic.value) + { + return; + } + + //this one compares map and encoremode instead of the music itself + //makes tunes work and stuff + for (int i = 0; i < 16; i++) + if (strcmp(music_name, musicexception_list[i]) == 0 || strcmp(newmus, musicexception_list[i]) == 0) + { + skipmusic = true; + break; + } + + //CONS_Printf("musname = %s\n", music_name); + //CONS_Printf("newmus = %s\n", newmus); + //CONS_Printf("newmus = %d\n", skipmusic); +} + +//check if map and encoremode has changed +void S_CheckMap(void) { if (!cv_keepmusic.value) { @@ -2192,24 +2237,18 @@ void S_KeepMusic(void) 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 = (!skipmusic && oldmap == gamemap && oldencore == encoremode); oldencore = encoremode; oldmap = gamemap; } -/// ------------------------ -/// Init & Others -/// ------------------------ - // // Per level startup code. // Kills playing sounds at start of level, // determines music if any, changes music. // -void S_Start(void) +void S_InitMapMusic(void) { if (mapmusflags & MUSIC_RELOADRESET) { @@ -2239,7 +2278,7 @@ void S_Start(void) //S_ChangeMusicEx((encoremode ? "estart" : "kstart"), 0, false, mapmusposition, 0, 0); } -void M_Start(void) +void S_StartMapMusic(void) { // need to be after race starts so "certain" maps don´t break Zzz... ignoremusicchanges = cv_ignoremusicchanges.value && (leveltime > (starttime + (TICRATE/2))); @@ -2272,7 +2311,6 @@ void M_Start(void) } } - void S_RestartMusic(void) { S_StopMusic(); diff --git a/src/s_sound.h b/src/s_sound.h index 2367d7729..0c576bfc1 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -107,10 +107,11 @@ void S_InitSfxChannels(INT32 sfxVolume); // void S_StopSounds(void); void S_ClearSfx(void); -void S_Start(void); -void M_Start(void); -void S_KeepMusic(void); +void S_InitMapMusic(void); +void S_StartMapMusic(void); + +void S_CheckMap(void); // Stops music and restarts it from same position. Used for instant applying changes to amiga filters. void S_RestartMusic(void); From 2ee29630fb3b30868ee73a3e63bdf0c827e094f4 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 16:19:54 +0200 Subject: [PATCH 10/31] fix encore music again lol --- src/p_spec.c | 2 +- src/p_user.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 058fe9413..f09562f4d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2135,7 +2135,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (keepmusic && (leveltime < (starttime + TICRATE))) //why check for starttime? cause encore music Zzz... return; - if (ignoremusicchanges && (leveltime < (starttime + TICRATE) && !fromlapexec)) // keep lap music intanct tho + if (ignoremusicchanges && (leveltime > (starttime + TICRATE) && !fromlapexec)) // keep lap music intanct tho return; // console player only unless NOCLIMB is set diff --git a/src/p_user.c b/src/p_user.c index 093143e95..a6e4791e6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -650,9 +650,6 @@ boolean P_EndingMusic(player_t *player) INT32 bestlocalpos; player_t *bestlocalplayer; - if (ignoremusicchanges) - return false; - if (!P_IsLocalPlayer(player)) // Only applies to a local player return false; From 67435ebf9ee9384abacc53c5c4d7fccf6f851f0b Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 16:27:56 +0200 Subject: [PATCH 11/31] work around encore music again S_InitMapMusic would play before the level actually started thus playing a smol bit of non encore music in encore --- src/s_sound.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index f8b0619eb..2970bce63 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2262,17 +2262,13 @@ void S_InitMapMusic(void) if (keepmusic) return; - 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 (cv_skipintromusic.value) + return; + if (leveltime < starttime) // SRB2Kart S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic(); //S_ChangeMusicEx((encoremode ? "estart" : "kstart"), 0, false, mapmusposition, 0, 0); @@ -2293,6 +2289,8 @@ void S_StartMapMusic(void) if (cv_skipintromusic.value) { + if (leveltime == 0) + S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); if (leveltime == (starttime + (TICRATE/2))) S_ShowMusicCredit(); return; From d06b8ac398d7fad39f9175ece8b79ca54e1925d6 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 16:32:03 +0200 Subject: [PATCH 12/31] cleanup + comments --- src/p_spec.c | 2 +- src/s_sound.c | 23 +++++++---------------- src/s_sound.h | 2 -- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index f09562f4d..e7d937a91 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2135,7 +2135,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (keepmusic && (leveltime < (starttime + TICRATE))) //why check for starttime? cause encore music Zzz... return; - if (ignoremusicchanges && (leveltime > (starttime + TICRATE) && !fromlapexec)) // keep lap music intanct tho + if (cv_ignoremusicchanges.value && (leveltime > (starttime + TICRATE) && !fromlapexec)) // keep lap music intanct tho return; // console player only unless NOCLIMB is set diff --git a/src/s_sound.c b/src/s_sound.c index 2970bce63..4ac8a9860 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -123,7 +123,6 @@ consvar_t cv_keepmusic = {"keepmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, N 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; static void S_CheckEventMus(const char *newmus); @@ -2204,9 +2203,6 @@ static const char *musicexception_list[16] = { //always runs when musicchange gets invoked static void S_CheckEventMus(const char *newmus) { - //if (leveltime > (starttime + (TICRATE/2))) - //return; - skipmusic = false; if (!cv_keepmusic.value) @@ -2214,8 +2210,7 @@ static void S_CheckEventMus(const char *newmus) return; } - //this one compares map and encoremode instead of the music itself - //makes tunes work and stuff + for (int i = 0; i < 16; i++) if (strcmp(music_name, musicexception_list[i]) == 0 || strcmp(newmus, musicexception_list[i]) == 0) { @@ -2228,7 +2223,8 @@ static void S_CheckEventMus(const char *newmus) //CONS_Printf("newmus = %d\n", skipmusic); } -//check if map and encoremode has changed +//this one compares map and encoremode instead of the music itself +//makes tunes work and stuff void S_CheckMap(void) { if (!cv_keepmusic.value) @@ -2276,9 +2272,6 @@ void S_InitMapMusic(void) void S_StartMapMusic(void) { - // need to be after race starts so "certain" maps don´t break Zzz... - 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)) @@ -2289,20 +2282,18 @@ void S_StartMapMusic(void) if (cv_skipintromusic.value) { - if (leveltime == 0) + if (leveltime == 0) // dumb but i dont need this to be spammed honestly S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); if (leveltime == (starttime + (TICRATE/2))) S_ShowMusicCredit(); return; } - // The GO! sound stops the level start ambience - if (leveltime == starttime) + if (leveltime == starttime) // The GO! sound stops the level start ambience S_StopMusic(); else if (leveltime < starttime) // SRB2Kart - S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); - // Plays the music after the starting countdown. - else if (leveltime == (starttime + (TICRATE/2))) + 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. { S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); S_ShowMusicCredit(); diff --git a/src/s_sound.h b/src/s_sound.h index 0c576bfc1..9d53cc357 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -70,8 +70,6 @@ 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; From 6b0d67ac36746398f4d840607598fd12429a5404 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 30 Sep 2024 16:33:29 +0200 Subject: [PATCH 13/31] more --- src/s_sound.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 4ac8a9860..33767a885 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2210,9 +2210,8 @@ static void S_CheckEventMus(const char *newmus) return; } - for (int i = 0; i < 16; i++) - if (strcmp(music_name, musicexception_list[i]) == 0 || strcmp(newmus, musicexception_list[i]) == 0) + if (strcmp(music_name, musicexception_list[i]) == 0 || strcmp(newmus, musicexception_list[i]) == 0) // weird? sure! but were lucky enough newmus reflects whats being replaced { skipmusic = true; break; From 3a951576ee498641a0b46e3193e298984c88ada9 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 1 Oct 2024 14:42:20 +0200 Subject: [PATCH 14/31] use stricmp for this --- src/s_sound.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 33767a885..0eedb57ec 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2206,12 +2206,10 @@ static void S_CheckEventMus(const char *newmus) skipmusic = false; if (!cv_keepmusic.value) - { return; - } for (int i = 0; i < 16; i++) - if (strcmp(music_name, musicexception_list[i]) == 0 || strcmp(newmus, musicexception_list[i]) == 0) // weird? sure! but were lucky enough newmus reflects whats being replaced + if (stricmp(music_name, musicexception_list[i]) == 0 || stricmp(newmus, musicexception_list[i]) == 0) // weird? sure! but were lucky enough newmus reflects whats being replaced { skipmusic = true; break; From 9abf2bca75bd5f938f7de44aaa1ee1bbd21e57b7 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 1 Oct 2024 15:46:09 +0200 Subject: [PATCH 15/31] 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; From 12d65460622c58745d5add88254d74f7705d6776 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 1 Oct 2024 16:02:39 +0200 Subject: [PATCH 16/31] dumb special case for wandering balls Zzz... --- src/p_spec.c | 2 +- src/s_sound.c | 7 +++++-- src/s_sound.h | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 6146f422a..dc7743446 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -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 < MUSICSTARTTIME)) + if (skipintromus && (leveltime < MUSICSTARTTIME)) return; sfxnum = sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS; diff --git a/src/s_sound.c b/src/s_sound.c index 7aab19db9..8728db343 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2191,6 +2191,7 @@ boolean S_FadeOutStopMusic(UINT32 ms) static INT16 oldmap = 0; static boolean oldencore = 0; static boolean skipmusic = false; +boolean skipintromus = false; static const char *musicexception_list[16] = { "vote", "voteea", "voteeb", "racent", "krwin", @@ -2243,6 +2244,8 @@ void S_CheckMap(void) // void S_InitMapMusic(void) { + skipintromus = cv_skipintromusic.value && stricmp(G_BuildMapTitle(gamemap), "Wandering Falls") != 0; + if (mapmusflags & MUSIC_RELOADRESET) { strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7); @@ -2259,7 +2262,7 @@ void S_InitMapMusic(void) // lug: but not when we keep the map music lol S_StopMusic(); - if (cv_skipintromusic.value) + if (skipintromus) return; if (leveltime < MUSICSTARTTIME) // SRB2Kart @@ -2276,7 +2279,7 @@ void S_StartMapMusic(void) if (keepmusic) return; - if (cv_skipintromusic.value) + if (skipintromus) { if (leveltime < starttime) // dumb but i dont need this to be spammed honestly S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); diff --git a/src/s_sound.h b/src/s_sound.h index 39b61b49d..e31040eac 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; +extern boolean skipintromus; #define MUSICSTARTTIME (starttime + (TICRATE/2)) extern consvar_t precachesound; From b985ce06a2b36bf2689cde4dae58cc14faa4f6e6 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 1 Oct 2024 16:03:48 +0200 Subject: [PATCH 17/31] lol --- src/s_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index 8728db343..7505c622e 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2244,7 +2244,7 @@ void S_CheckMap(void) // void S_InitMapMusic(void) { - skipintromus = cv_skipintromusic.value && stricmp(G_BuildMapTitle(gamemap), "Wandering Falls") != 0; + skipintromus = cv_skipintromusic.value && stricmp(G_BuildMapTitle(gamemap), "Wandering Falls") != 0; // thanks diggle! if (mapmusflags & MUSIC_RELOADRESET) { From bdb39fcd8d29d5e3fd8043f61952b9db05f740bb Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 1 Oct 2024 17:57:45 +0200 Subject: [PATCH 18/31] dont leak pls --- src/s_sound.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index 7505c622e..aa266c5a1 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2244,7 +2244,10 @@ void S_CheckMap(void) // void S_InitMapMusic(void) { - skipintromus = cv_skipintromusic.value && stricmp(G_BuildMapTitle(gamemap), "Wandering Falls") != 0; // thanks diggle! + char *maptitle = G_BuildMapTitle(gamemap); + skipintromus = cv_skipintromusic.value && stricmp(maptitle, "Wandering Falls") != 0; // thanks diggle! + if (maptitle) + Z_Free(maptitle); if (mapmusflags & MUSIC_RELOADRESET) { From f32c34653476da6ecc2fbcf48d0c6460d98b6276 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 5 Oct 2024 06:56:21 +0200 Subject: [PATCH 19/31] this needs gamestate check sometimes the title music kept playing --- src/s_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index aa266c5a1..6016b028b 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2231,7 +2231,7 @@ void S_CheckMap(void) return; } - keepmusic = (!skipmusic && oldmap == gamemap && oldencore == encoremode); + keepmusic = (!skipmusic && gamestate == GS_LEVEL && oldmap == gamemap && oldencore == encoremode); oldencore = encoremode; oldmap = gamemap; From 0b3e7240a8594c72341f8fa662fb39028cd2e3cd Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 6 Oct 2024 12:07:17 +0200 Subject: [PATCH 20/31] use saturn packet to determine if client can receive gamestate before the server always assumed every client cant receive the gamestate using the vanilla consistency check for everyone. aswell as before the first resynch it tried to send the gamestate resend packets to everyone --- src/Makefile | 12 ++++++------ src/d_clisrv.c | 46 +++++++++++++++++++--------------------------- src/doomdef.h | 6 +++--- 3 files changed, 28 insertions(+), 36 deletions(-) diff --git a/src/Makefile b/src/Makefile index 4668518b9..87226a60b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -213,9 +213,9 @@ DOSATURNSYNCH=1 ifndef NOSATURNJOIN DOSATURNJOIN=1 endif -#ifndef NOSATURNPAK -#DOSATURNPAK=1 -#endif +ifndef NOSATURNPAK +DOSATURNPAK=1 +endif endif endif @@ -404,9 +404,9 @@ OPTS+=-DDOSATURNSYNCH ifndef NOSATURNJOIN OPTS+=-DDOSATURNJOIN endif -#ifndef NOSATURNPAK -#OPTS+=-DDOSATURNPAK -#endif +ifndef NOSATURNPAK +OPTS+=-DDOSATURNPAK +endif endif endif diff --git a/src/d_clisrv.c b/src/d_clisrv.c index f9110bb2d..ac0dfad34 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5394,6 +5394,7 @@ static void HandlePacketFromPlayer(SINT8 node) && !resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())) { +#ifndef SATURNPAK // we need to send this so the client can tell us if it can receive the savegame netbuffer->packettype = PT_WILLRESENDGAMESTATE; HSendPacket(node, true, 0, 0); @@ -5405,6 +5406,21 @@ static void HandlePacketFromPlayer(SINT8 node) SV_RequireResynch(node); resendingsavegame[node] = false; } +#else + if (can_receive_gamestate[node]) + { + // Tell the client we are about to resend them the gamestate + netbuffer->packettype = PT_WILLRESENDGAMESTATE; + HSendPacket(node, true, 0, 0); + + resendingsavegame[node] = true; + } + else + { + SV_RequireResynch(node); + resendingsavegame[node] = false; + } +#endif if ((!can_receive_gamestate[node] && cv_resynchattempts.value && resynch_score[node] <= (unsigned)cv_resynchattempts.value*250) || (can_receive_gamestate[node] && (gamestate_resend_counter[node] < cv_gamestateattempts.value))) { @@ -5584,31 +5600,6 @@ static void HandlePacketFromPlayer(SINT8 node) else buf[1] = KICK_MSG_PLAYER_QUIT; SendNetXCmd(XD_KICK, &buf, 2); - //nodetoplayer[node] = -1; - - /*if (nodetoplayer2[node] != -1 && nodetoplayer2[node] >= 0 - && playeringame[(UINT8)nodetoplayer2[node]]) - { - buf[0] = nodetoplayer2[node]; - SendNetXCmd(XD_KICK, &buf, 2); - nodetoplayer2[node] = -1; - } - - if (nodetoplayer3[node] != -1 && nodetoplayer3[node] >= 0 - && playeringame[(UINT8)nodetoplayer3[node]]) - { - buf[0] = nodetoplayer3[node]; - SendNetXCmd(XD_KICK, &buf, 2); - nodetoplayer3[node] = -1; - } - - if (nodetoplayer4[node] != -1 && nodetoplayer4[node] >= 0 - && playeringame[(UINT8)nodetoplayer4[node]]) - { - buf[0] = nodetoplayer4[node]; - SendNetXCmd(XD_KICK, &buf, 2); - nodetoplayer4[node] = -1; - }*/ } Net_CloseConnection(node); nodeingame[node] = false; @@ -5799,6 +5790,7 @@ static void HandlePacketFromPlayer(SINT8 node) case PT_ISSATURN: //CONS_Printf("hi im on saturn%d\n", node); is_client_saturn[node] = true; + can_receive_gamestate[node] = true; break; #endif default: @@ -6634,7 +6626,7 @@ void NetKeepAlive(void) #ifdef MASTERSERVER MasterClient_Ticker(); #endif - + #ifdef HOLEPUNCH if (netgame && serverrunning) { @@ -6745,7 +6737,7 @@ void NetUpdate(void) CL_SendClientCmd(); // send it GetPackets(); // get packet from client or from server - + // client send the command after a receive of the server // the server send before because in single player is beter diff --git a/src/doomdef.h b/src/doomdef.h index bdc82a0ca..361cd92d1 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -585,9 +585,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// Server detection for if a connecting client is on Saturn. /// For stuff like extra synching, etc. -//#ifdef DOSATURNPAK -//#define SATURNPAK -//#endif +#ifdef DOSATURNPAK +#define SATURNPAK +#endif //-- <( ̄︶ ̄)> __ #endif From fc39a0dedf51ceab5e9de841d6b93f3e6b398c6f Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 6 Oct 2024 12:12:59 +0200 Subject: [PATCH 21/31] make the debug print a little better --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ac0dfad34..8a9a5417c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5788,7 +5788,7 @@ static void HandlePacketFromPlayer(SINT8 node) #endif #ifdef SATURNPAK case PT_ISSATURN: - //CONS_Printf("hi im on saturn%d\n", node); + //CONS_Printf("hi im on saturn [node = %d]\n", node); is_client_saturn[node] = true; can_receive_gamestate[node] = true; break; From 5cb207edfabacd34ccec7ad430e6eb3678acfc28 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 6 Oct 2024 12:14:32 +0200 Subject: [PATCH 22/31] add debfile prints whenever gamestate counter changes --- src/d_clisrv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 8a9a5417c..97ad460d6 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5385,7 +5385,10 @@ static void HandlePacketFromPlayer(SINT8 node) #ifdef SATURNSYNCH // this decreases by one point at twice the cooldown time (ex cooldown of 2 seconds means, this counter decreases by one every 4 seconds), pretty much there to prevent a resynch loop if ((gamestate_resend_counter[node] != 0) && (I_GetTime() % ((max(cv_resynchcooldown.value, 1) * TICRATE) *2) == 0)) + { gamestate_resend_counter[node]--; + DEBFILE(va("gamestate counter %d for node %d\n", gamestate_resend_counter[node], netconsole)); + } // Check player consistancy during the level if (((!can_receive_gamestate[node]) && realstart <= gametic && realstart > gametic - TICQUEUE+1 && gamestate == GS_LEVEL @@ -5427,7 +5430,7 @@ static void HandlePacketFromPlayer(SINT8 node) if (can_receive_gamestate[node] && resendingsavegame[node]) { gamestate_resend_counter[node]++; - DEBFILE(va("gamestate counter %d for player %d\n", gamestate_resend_counter[node], netconsole)); + DEBFILE(va("gamestate counter %d for node %d\n", gamestate_resend_counter[node], netconsole)); } if (cv_blamecfail.value) @@ -5451,6 +5454,7 @@ static void HandlePacketFromPlayer(SINT8 node) netconsole, realstart, consistancy[realstart%TICQUEUE], SHORT(netbuffer->u.clientpak.consistancy))); gamestate_resend_counter[node] = 0; + DEBFILE(va("gamestate counter %d for node %d\n", gamestate_resend_counter[node], netconsole)); break; } } From 4877c81728149b75571e4fd3902b327d146ccde1 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 6 Oct 2024 12:32:57 +0200 Subject: [PATCH 23/31] comment this out for now so v7 clients dont use vanilla resynch system keep sending PT_WILLRESENDGAMESTATE packets to everyone for now saturnpak will still mark the right clients so they will use the right consistency check without having to desynch first --- src/d_clisrv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 97ad460d6..996afbf7a 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5397,7 +5397,7 @@ static void HandlePacketFromPlayer(SINT8 node) && !resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())) { -#ifndef SATURNPAK +//#ifndef SATURNPAK // we need to send this so the client can tell us if it can receive the savegame netbuffer->packettype = PT_WILLRESENDGAMESTATE; HSendPacket(node, true, 0, 0); @@ -5409,7 +5409,7 @@ static void HandlePacketFromPlayer(SINT8 node) SV_RequireResynch(node); resendingsavegame[node] = false; } -#else +/*#else if (can_receive_gamestate[node]) { // Tell the client we are about to resend them the gamestate @@ -5423,7 +5423,7 @@ static void HandlePacketFromPlayer(SINT8 node) SV_RequireResynch(node); resendingsavegame[node] = false; } -#endif +#endif*/ if ((!can_receive_gamestate[node] && cv_resynchattempts.value && resynch_score[node] <= (unsigned)cv_resynchattempts.value*250) || (can_receive_gamestate[node] && (gamestate_resend_counter[node] < cv_gamestateattempts.value))) { From 7d65b5369ff5f3e61bbc66b5069b1ab0e946dd71 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 6 Oct 2024 12:34:51 +0200 Subject: [PATCH 24/31] add some brackets lul --- src/d_clisrv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 996afbf7a..c58491cfa 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5397,7 +5397,7 @@ static void HandlePacketFromPlayer(SINT8 node) && !resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())) { -//#ifndef SATURNPAK +//#ifndef SATURNPAK // lug: keep this behaviour for v7.1 atleast // we need to send this so the client can tell us if it can receive the savegame netbuffer->packettype = PT_WILLRESENDGAMESTATE; HSendPacket(node, true, 0, 0); @@ -5425,7 +5425,7 @@ static void HandlePacketFromPlayer(SINT8 node) } #endif*/ - if ((!can_receive_gamestate[node] && cv_resynchattempts.value && resynch_score[node] <= (unsigned)cv_resynchattempts.value*250) || (can_receive_gamestate[node] && (gamestate_resend_counter[node] < cv_gamestateattempts.value))) + if ((!can_receive_gamestate[node] && (cv_resynchattempts.value && resynch_score[node] <= (unsigned)cv_resynchattempts.value*250)) || (can_receive_gamestate[node] && (gamestate_resend_counter[node] < cv_gamestateattempts.value))) { if (can_receive_gamestate[node] && resendingsavegame[node]) { @@ -5466,7 +5466,7 @@ static void HandlePacketFromPlayer(SINT8 node) if (realstart <= gametic && realstart > gametic - TICQUEUE+1 && gamestate == GS_LEVEL && consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)) { - SV_RequireResynch(node); + SV_RequireResynch(node); if (cv_resynchattempts.value && resynch_score[node] <= (unsigned)cv_resynchattempts.value*250) { From 297af069cb3fd3059cc8f7160f14a1c6f5eafe23 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 7 Oct 2024 12:41:59 +0200 Subject: [PATCH 25/31] doubt anyone wants this also psure this will cause some weird issues somewhere idk --- src/p_spec.c | 10 +++++----- src/s_sound.c | 4 ++-- src/s_sound.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 710e76fd7..67d8cb617 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -99,7 +99,7 @@ typedef struct thinker_t **thinkers; } thinkerlist_t; -static boolean fromlapexec = false; +//static boolean fromlapexec = false; static void P_SearchForDisableLinedefs(void); static void P_SpawnScrollers(void); @@ -1342,7 +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; + //fromlapexec = false; ///////////////////////////////////////////////// // Distance-checking/sector trigger conditions // @@ -1465,7 +1465,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller return false; } - fromlapexec = true; + //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. @@ -2135,8 +2135,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (keepmusic && (leveltime <= MUSICSTARTTIME)) //why check for starttime? cause encore music Zzz... return; - if (cv_ignoremusicchanges.value && (leveltime >= MUSICSTARTTIME) && !fromlapexec) // keep lap music intanct tho - return; + //if (cv_ignoremusicchanges.value && (leveltime >= MUSICSTARTTIME) && !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))) diff --git a/src/s_sound.c b/src/s_sound.c index 6016b028b..c68e4d8e1 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -121,7 +121,7 @@ consvar_t cv_birdmusic = {"birdmusicstuff", "No", CV_SAVE|CV_CALL, CV_YesNo, Bir 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}; +//consvar_t cv_ignoremusicchanges = {"ignoremusicchanges", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; boolean keepmusic = false; static void S_CheckEventMus(const char *newmus); @@ -305,7 +305,7 @@ void S_RegisterSoundStuff(void) CV_RegisterVar(&cv_keepmusic); CV_RegisterVar(&cv_skipintromusic); - CV_RegisterVar(&cv_ignoremusicchanges); + //CV_RegisterVar(&cv_ignoremusicchanges); COM_AddCommand("tunes", Command_Tunes_f); COM_AddCommand("restartaudio", Command_RestartAudio_f); diff --git a/src/s_sound.h b/src/s_sound.h index e31040eac..5232ef5c1 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -69,7 +69,7 @@ extern consvar_t cv_birdmusic; extern consvar_t cv_keepmusic; extern consvar_t cv_skipintromusic; -extern consvar_t cv_ignoremusicchanges; +//extern consvar_t cv_ignoremusicchanges; extern boolean keepmusic; extern boolean skipintromus; #define MUSICSTARTTIME (starttime + (TICRATE/2)) From e8351d44b6d25b019bcd4df2ce68b253dbf5101b Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 7 Oct 2024 12:45:03 +0200 Subject: [PATCH 26/31] add crap to menu --- src/m_menu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 2bfb3e1f1..0f92ccedf 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1667,7 +1667,10 @@ static menuitem_t OP_SoundAdvancedMenu[] = {IT_STRING | IT_CVAR, NULL, "Grow Music", &cv_growmusic, 117}, {IT_STRING | IT_CVAR, NULL, "Invulnerability Music", &cv_supermusic, 127}, - {IT_STRING | IT_CVAR, NULL, "Audio Buffer Size", &cv_audbuffersize, 147}, + {IT_STRING | IT_CVAR, NULL, "Keep Map Music", &cv_keepmusic, 139}, + {IT_STRING | IT_CVAR, NULL, "Skip Intro Music", &cv_skipintromusic, 149}, + + {IT_STRING | IT_CVAR, NULL, "Audio Buffer Size", &cv_audbuffersize, 157}, }; static const char* OP_SoundAdvancedTooltips[] = @@ -1685,6 +1688,8 @@ static const char* OP_SoundAdvancedTooltips[] = NULL, "Should the Grow music be on or off?", "Should the Invulnerability music be on or off?", + "Should music be kept when restarting the map?", + "Should the Intro fanfare be skipped\nand map music be played on map start?", "Size of the Audio Buffer\nreducing it will result in less sound latency\nbut may cause issues such as crackling or distorted Sound.", }; From f3a18a0655179fc294b3b6f320295d0dd20839a7 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 7 Oct 2024 12:48:29 +0200 Subject: [PATCH 27/31] false --- src/s_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index c68e4d8e1..5019213fb 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2189,7 +2189,7 @@ boolean S_FadeOutStopMusic(UINT32 ms) }*/ static INT16 oldmap = 0; -static boolean oldencore = 0; +static boolean oldencore = false; static boolean skipmusic = false; boolean skipintromus = false; From 8b915f9ac1cbed7698b130a1db7e4d8e6a12b0fc Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 7 Oct 2024 12:53:25 +0200 Subject: [PATCH 28/31] make this less ugly --- src/m_menu.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 0f92ccedf..0aa2d3e93 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1653,24 +1653,25 @@ static const char* OP_SoundTooltips[] = static menuitem_t OP_SoundAdvancedMenu[] = { #ifdef HAVE_OPENMPT - {IT_HEADER, NULL, "Tracker Module Options", NULL, 10}, + {IT_HEADER, NULL, "Tracker Module Options", NULL, 0}, - {IT_STRING | IT_CVAR, NULL, "Instrument Filter", &cv_modfilter, 22}, - {IT_STRING | IT_CVAR, NULL, "Amiga Resampler", &cv_amigafilter, 42}, + {IT_STRING | IT_CVAR, NULL, "Instrument Filter", &cv_modfilter, 20}, + {IT_STRING | IT_CVAR, NULL, "Amiga Resampler", &cv_amigafilter, 30}, #if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4 - {IT_STRING | IT_CVAR, NULL, "Amiga Type", &cv_amigatype, 62}, + {IT_STRING | IT_CVAR, NULL, "Amiga Type", &cv_amigatype, 40}, #endif - {IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 82}, + {IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 50}, #endif - {IT_HEADER, NULL, "Misc", NULL, 105}, - {IT_STRING | IT_CVAR, NULL, "Grow Music", &cv_growmusic, 117}, - {IT_STRING | IT_CVAR, NULL, "Invulnerability Music", &cv_supermusic, 127}, + {IT_HEADER, NULL, "Misc", NULL, 70}, - {IT_STRING | IT_CVAR, NULL, "Keep Map Music", &cv_keepmusic, 139}, - {IT_STRING | IT_CVAR, NULL, "Skip Intro Music", &cv_skipintromusic, 149}, + {IT_STRING | IT_CVAR, NULL, "Grow Music", &cv_growmusic, 90}, + {IT_STRING | IT_CVAR, NULL, "Invulnerability Music", &cv_supermusic, 100}, - {IT_STRING | IT_CVAR, NULL, "Audio Buffer Size", &cv_audbuffersize, 157}, + {IT_STRING | IT_CVAR, NULL, "Keep Map Music", &cv_keepmusic, 120}, + {IT_STRING | IT_CVAR, NULL, "Skip Intro Music", &cv_skipintromusic, 130}, + + {IT_STRING | IT_CVAR, NULL, "Audio Buffer Size", &cv_audbuffersize, 150}, }; static const char* OP_SoundAdvancedTooltips[] = From 63c1372c34d13b34e654f340f8cd0ae0fad67ab9 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 7 Oct 2024 12:57:55 +0200 Subject: [PATCH 29/31] keep debug print for now --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a4049db9c..09813198a 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5792,7 +5792,7 @@ static void HandlePacketFromPlayer(SINT8 node) #endif #ifdef SATURNPAK case PT_ISSATURN: - //CONS_Printf("hi im on saturn [node = %d]\n", node); + CONS_Printf("hi im on saturn node = %d\n", node); is_client_saturn[node] = true; can_receive_gamestate[node] = true; break; From c51d33fa6efb9efa5573e9a8f8b362deb3bf06e6 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 12 Oct 2024 20:19:44 +0200 Subject: [PATCH 30/31] save 1 G_BuildMapTitle call kek --- src/s_sound.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 5019213fb..b36783d41 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2244,10 +2244,15 @@ void S_CheckMap(void) // void S_InitMapMusic(void) { - char *maptitle = G_BuildMapTitle(gamemap); - skipintromus = cv_skipintromusic.value && stricmp(maptitle, "Wandering Falls") != 0; // thanks diggle! - if (maptitle) - Z_Free(maptitle); + if (!cv_skipintromusic.value) + skipintromus = false; + else + { + char *maptitle = G_BuildMapTitle(gamemap); + skipintromus = cv_skipintromusic.value && stricmp(maptitle, "Wandering Falls") != 0; // thanks diggle! + if (maptitle) + Z_Free(maptitle); + } if (mapmusflags & MUSIC_RELOADRESET) { From f01d2a0ba6aebf8a21caa1aaef85bf116d950289 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 12 Oct 2024 23:29:11 +0200 Subject: [PATCH 31/31] print saturnpak print into debfile instead of console --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 89aa24b13..f230ab190 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5792,7 +5792,7 @@ static void HandlePacketFromPlayer(SINT8 node) #endif #ifdef SATURNPAK case PT_ISSATURN: - CONS_Printf("hi im on saturn node = %d\n", node); + DEBFILE(va("hi im on saturn! node = %d\n", node)); is_client_saturn[node] = true; can_receive_gamestate[node] = true; break;