From 4c6964590d29ecc51a455951d15f6ebf2354f384 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 21 Jan 2024 16:44:06 +0100 Subject: [PATCH 1/7] i hate this so i just make it a boolean confused the heck outta me so just do it like this lmao --- src/p_setup.c | 6 ++---- src/s_sound.c | 17 +++++++++++++---- src/s_sound.h | 2 +- src/sounds.c | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 010a28fd3..2fad372ab 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2936,11 +2936,9 @@ boolean P_SetupLevel(boolean skipprecip) // Make sure all sounds are stopped before Z_FreeTags. S_StopSounds(); - - if (!(M_CheckParm("-precachesound") || precachesound.value)) //why do this with soundprecaching enabled?????? - { + + if (!S_PrecacheSound()) S_ClearSfx(); - } // As oddly named as this is, this handles music only. // We should be fine starting it here. diff --git a/src/s_sound.c b/src/s_sound.c index 1fdfb790a..a95982f4a 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -378,6 +378,15 @@ boolean S_SoundDisabled(void) ); } +boolean S_PrecacheSound(void) +{ + if (!sound_disabled && (M_CheckParm("-precachesound"))) + return true; + if (!sound_disabled && precachesound.value) + return true; + return false; +} + // Stop all sounds, load level info, THEN start sounds. void S_StopSounds(void) { @@ -1260,8 +1269,8 @@ void S_InitSfxChannels(INT32 sfxVolume) S_sfx[i].lumpnum = LUMPERROR; } - // precache sounds if requested by cmdline, or precachesound var true - if (!sound_disabled && (M_CheckParm("-precachesound") || precachesound.value)) + // Precache sounds if requested + if (S_PrecacheSound()) { // Initialize external data (all sounds) at start, keep static. CONS_Printf(M_GetText("Loading sounds... ")); @@ -2386,11 +2395,11 @@ static void GameSounds_OnChange(void) static void SoundPrecache_OnChange(void) { - if ((precachesound.value) && (!sound_disabled)) + if (S_PrecacheSound()) { S_InitSfxChannels(cv_soundvolume.value); } - else if (!precachesound.value) + else if (!S_PrecacheSound()) { S_ClearSfx(); if (!sound_disabled) diff --git a/src/s_sound.h b/src/s_sound.h index aa4b2b28f..12efb9c44 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -139,6 +139,7 @@ boolean S_MusicDisabled(void); boolean S_MusicPlaying(void); boolean S_MusicPaused(void); boolean S_MusicNotInFocus(void); +boolean S_PrecacheSound(void); musictype_t S_MusicType(void); const char *S_MusicName(void); boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping); @@ -247,7 +248,6 @@ void S_StopMusic(void); void S_PauseAudio(void); void S_ResumeAudio(void); - // // Music Fading // diff --git a/src/sounds.c b/src/sounds.c index a69eb744d..0d2ca4499 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1033,7 +1033,7 @@ sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean S_sfx[i].skinsound = -1; S_sfx[i].usefulness = -1; - if (!sound_disabled && (M_CheckParm("-precachesound") || precachesound.value)){ + if (S_PrecacheSound()){ S_sfx[i].data = I_GetSfx(&S_sfx[i]); } else From 2b38cb2f1c37528f8b6bc387741f6280ea37b9d4 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 21 Jan 2024 15:43:46 +0100 Subject: [PATCH 2/7] simplify this uuh --- src/s_sound.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index a95982f4a..6d3fb36c1 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -380,11 +380,7 @@ boolean S_SoundDisabled(void) boolean S_PrecacheSound(void) { - if (!sound_disabled && (M_CheckParm("-precachesound"))) - return true; - if (!sound_disabled && precachesound.value) - return true; - return false; + return (!sound_disabled && (M_CheckParm("-precachesound") || precachesound.value)); } // Stop all sounds, load level info, THEN start sounds. From 6ab1b09aa82fd57e561c633a268a2d1f870e6239 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 21 Jan 2024 16:41:38 +0100 Subject: [PATCH 3/7] fix merge conflict --- src/p_setup.c | 2 +- src/sounds.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 2fad372ab..0ad4844b9 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3520,7 +3520,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local) I_FreeSfx(&S_sfx[j]); // Re-cache it - if (!sound_disabled && (M_CheckParm("-precachesound") || precachesound.value)) + if (S_PrecacheSound()) S_sfx[j].data = I_GetSfx(&S_sfx[j]); sreplaces++; diff --git a/src/sounds.c b/src/sounds.c index 0d2ca4499..51961b906 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1033,9 +1033,8 @@ sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean S_sfx[i].skinsound = -1; S_sfx[i].usefulness = -1; - if (S_PrecacheSound()){ + if (S_PrecacheSound()) S_sfx[i].data = I_GetSfx(&S_sfx[i]); - } else S_sfx[i].data = NULL; return i; From e2c52c0d149fa4c8d0be6bd9d5d5f6ad581a34f0 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 22 Jan 2024 02:52:33 +0100 Subject: [PATCH 4/7] forgor --- src/hardware/hw_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index b4a77cc24..3732a380a 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -6334,8 +6334,7 @@ void HWR_TogglePaletteRendering(void) // If the r_opengl "texture palette" stays the same during this switch, these textures // will not be cleared out. However they are still out of date since the // composite texture blending method has changed. Therefore they need to be cleared. - //HWD.pfnClearMipMapCache(); - HWR_PrepLevelCache(numtextures); + HWD.pfnClearMipMapCache(); } } else @@ -6349,8 +6348,7 @@ void HWR_TogglePaletteRendering(void) // If the r_opengl "texture palette" stays the same during this switch, these textures // will not be cleared out. However they are still out of date since the // composite texture blending method has changed. Therefore they need to be cleared. - //HWD.pfnClearMipMapCache(); - HWR_PrepLevelCache(numtextures); + HWD.pfnClearMipMapCache(); } } } From a064a9e88eb95f3267e93df1e7089524844c8990 Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 22 Jan 2024 10:52:54 +0300 Subject: [PATCH 5/7] Fix sound, music, and midi music toggles --- src/s_sound.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 6d3fb36c1..a2f81f210 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2375,14 +2375,14 @@ static void GameSounds_OnChange(void) if (M_CheckParm("-nosound") || M_CheckParm("-noaudio")) return; - if (sound_disabled && !cv_gamesounds.value) + if (sound_disabled && cv_gamesounds.value) { sound_disabled = false; I_StartupSound(); // will return early if initialised S_InitSfxChannels(cv_soundvolume.value); S_StartSound(NULL, sfx_strpst); } - else if (!sound_disabled && cv_gamesounds.value) + else if (!sound_disabled && !cv_gamesounds.value) { sound_disabled = true; S_StopSounds(); @@ -2410,7 +2410,7 @@ static void GameDigiMusic_OnChange(void) else if (M_CheckParm("-nodigmusic")) return; - if (digital_disabled && !cv_gamedigimusic.value) + if (digital_disabled && cv_gamedigimusic.value) { digital_disabled = false; I_StartupSound(); // will return early if initialised @@ -2421,7 +2421,7 @@ static void GameDigiMusic_OnChange(void) else S_ChangeMusicInternal("titles", looptitle); } - else if (!digital_disabled && cv_gamedigimusic.value) + else if (!digital_disabled && !cv_gamedigimusic.value) { digital_disabled = true; if (S_MusicType() != MU_MID) @@ -2495,7 +2495,7 @@ static void GameMIDIMusic_OnChange(void) else if (M_CheckParm("-nomidimusic")) return; - if (midi_disabled && !cv_gamemidimusic.value) + if (midi_disabled && cv_gamemidimusic.value) { midi_disabled = false; I_InitMusic(); @@ -2504,7 +2504,7 @@ static void GameMIDIMusic_OnChange(void) else S_ChangeMusicInternal("titles", looptitle); } - else if (!midi_disabled && cv_gamemidimusic.value) + else if (!midi_disabled && !cv_gamemidimusic.value) { midi_disabled = true; if (S_MusicType() == MU_MID) From b78d3bb0a8d85c2f8ea1eea346d5ee35471aaaaf Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 22 Jan 2024 23:18:53 +0300 Subject: [PATCH 6/7] Force postload for autoloaded character addons --- src/d_main.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index 3850243b8..0f8d7b1df 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -968,7 +968,8 @@ static void D_FindAddonsToAutoload(void) const char *autoloadpath; boolean postload; - INT32 i; + INT32 i, len; + boolean hasprefix = false; char wadsToAutoload[256] = "", renameAutoloadStrings[256] = ""; // does it exist tho @@ -999,6 +1000,36 @@ static void D_FindAddonsToAutoload(void) wadsToAutoload[i] = '\0'; } + len = strlen(wadsToAutoload); + hasprefix = false; + + for (i = 0; i < len; ++i) + { + if (wadsToAutoload[i] == '_') + { + hasprefix = true; + break; + } + } + + // Lets just hope no one adds bonuschars in autoload + if (hasprefix) + { + // We searching for c in prefix, which stands for "character" and doesn't work well with + // autoload atm, only fine for postload + for (i = 0; i < len; ++i) + { + if (wadsToAutoload[i] == '_') break; // Prefix end + + if (wadsToAutoload[i] == 'c' || wadsToAutoload[i] == 'C') + { + CONS_Alert(CONS_WARNING, "forcing postload for %s as local skin\n", wadsToAutoload); + postload = true; + break; // Found it + } + } + } + // LOAD IT if (!postload) D_AutoloadFile(wadsToAutoload, autoloadwadfiles); From b305759212905c542ab47845fbd5a430a84141dc Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 22 Jan 2024 23:24:19 +0300 Subject: [PATCH 7/7] Move autoloading to run after everything else is initialized --- src/d_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 0f8d7b1df..1afca6e54 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1474,11 +1474,6 @@ void D_SRB2Main(void) statdp = true; } - CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n"); - if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0) - CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n"); - D_CleanFile(autoloadwadfiles); - // // search for maps // @@ -1680,6 +1675,11 @@ void D_SRB2Main(void) CONS_Printf("ST_Init(): Init status bar.\n"); ST_Init(); + CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n"); + if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0) + CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n"); + D_CleanFile(autoloadwadfiles); + // Set up splitscreen players before joining! if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm())) {