File tree Expand file tree Collapse file tree 5 files changed +17
-4
lines changed
Expand file tree Collapse file tree 5 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -1790,7 +1790,7 @@ void OptionLanguageCodeChanged()
17901790 UnloadFonts ();
17911791 LanguageInitialize ();
17921792 LoadLanguageArchive ();
1793- effects_cleanup_sfx ();
1793+ effects_cleanup_sfx (false );
17941794 if (gbRunGame)
17951795 sound_init ();
17961796 else
Original file line number Diff line number Diff line change @@ -246,10 +246,15 @@ void sound_update()
246246 StreamUpdate ();
247247}
248248
249- void effects_cleanup_sfx ()
249+ void effects_cleanup_sfx (bool fullUnload )
250250{
251251 sound_stop ();
252252
253+ if (fullUnload) {
254+ sgSFX.clear ();
255+ return ;
256+ }
257+
253258 for (auto &sfx : sgSFX)
254259 sfx.pSnd = nullptr ;
255260}
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ void PlaySFX(SfxID psfx);
3131void PlaySfxLoc (SfxID psfx, Point position, bool randomizeByCategory = true );
3232void sound_stop ();
3333void sound_update ();
34- void effects_cleanup_sfx ();
34+ void effects_cleanup_sfx (bool fullUnload = true );
3535void sound_init ();
3636void ui_sound_init ();
3737void effects_play_sound (SfxID);
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ int CapVolume(int volume)
171171
172172void OptionAudioChanged ()
173173{
174- effects_cleanup_sfx ();
174+ effects_cleanup_sfx (false );
175175 music_stop ();
176176 snd_deinit ();
177177 snd_init ();
Original file line number Diff line number Diff line change 1010#include < config.h>
1111
1212#include " appfat.h"
13+ #include " effects.h"
1314#include " engine/assets.hpp"
1415#include " lua/modules/audio.hpp"
1516#include " lua/modules/hellfire.hpp"
@@ -229,6 +230,13 @@ void LuaReloadActiveMods()
229230 handler ();
230231 }
231232
233+ // Reload sound effects in case a mod archive overrides effects.tsv
234+ effects_cleanup_sfx ();
235+ if (gbRunGame)
236+ sound_init ();
237+ else
238+ ui_sound_init ();
239+
232240 // Reload game data (this can probably be done later in the process to avoid having to reload it)
233241 LoadTextData ();
234242 LoadPlayerDataFiles ();
You can’t perform that action at this time.
0 commit comments