make sound precaching useful at all

so it also precaches addon sounds and all
thx indev for help <3
This commit is contained in:
Alug committed 2024-01-20 15:39:25 +01:00
1 parent 8891869013
commit 07fd6a3ad4
3 files changed
+14 -3

No files matched your search

+1 -1
View File
@@ -2938,7 +2938,7 @@ boolean P_SetupLevel(boolean skipprecip)
// Make sure all sounds are stopped before Z_FreeTags.
S_StopSounds();
if ((!(!sound_disabled && (M_CheckParm("-precachesound")))) || (!precachesound.value)) //why do this with soundprecaching enabled??????
if (!(M_CheckParm("-precachesound") || precachesound.value)) //why do this with soundprecaching enabled??????
{
S_ClearSfx();
}
+5 -1
View File
@@ -1270,10 +1270,14 @@ void S_InitSfxChannels(INT32 sfxVolume)
// Initialize external data (all sounds) at start, keep static.
CONS_Printf(M_GetText("Loading sounds... "));
for (i = 1; i < NUMSFX; i++)
for (i = 1; i < sfx_freeslot0; i++)
if (S_sfx[i].name && !S_sfx[i].data)
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
for (i = sfx_freeslot0; i < NUMSFX; i++)
if (S_sfx[i].priority && !S_sfx[i].data)
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
CONS_Printf(M_GetText(" pre-cached all sound data\n"));
}
}
+8 -1
View File
@@ -14,6 +14,8 @@
#include "doomtype.h"
#include "i_sound.h"
#include "sounds.h"
#include "s_sound.h" //for soundprecaching
#include "m_argv.h"
#include "r_defs.h"
#include "r_things.h"
#include "z_zone.h"
@@ -1032,7 +1034,12 @@ sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean
S_sfx[i].usefulness = -1;
/// \todo if precached load it here
S_sfx[i].data = NULL;
if (!sound_disabled && (M_CheckParm("-precachesound") || precachesound.value)){
CONS_Printf("Precaching sounds...\n");
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
}
else
S_sfx[i].data = NULL;
return i;
}
}