mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 22:54:24 +00:00
Fade out music on scenario start and on disabling it
This commit is contained in:
parent
40bc508f7f
commit
d4e6d0bf2b
@ -1,6 +1,7 @@
|
|||||||
Version 1.13.5+dev:
|
Version 1.13.5+dev:
|
||||||
* Music and sound effects:
|
* Music and sound effects:
|
||||||
* Added a preference to pause the music when the game loses focus.
|
* Added a preference to pause the music when the game loses focus.
|
||||||
|
* Now the storyscreen music fades out at the start of each scenario.
|
||||||
* Units:
|
* Units:
|
||||||
* Changed the sound for the melee attack of the
|
* Changed the sound for the melee attack of the
|
||||||
Loyalist Bowman, Orcish Crossbowman and Orcish Slurbow.
|
Loyalist Bowman, Orcish Crossbowman and Orcish Slurbow.
|
||||||
|
@ -628,6 +628,7 @@
|
|||||||
[music]
|
[music]
|
||||||
name={MUSIC}
|
name={MUSIC}
|
||||||
immediate=yes
|
immediate=yes
|
||||||
|
ms_after=2000
|
||||||
[/music]
|
[/music]
|
||||||
[/event]
|
[/event]
|
||||||
#enddef
|
#enddef
|
||||||
@ -661,6 +662,7 @@
|
|||||||
name={SCENARIO_MUSIC}
|
name={SCENARIO_MUSIC}
|
||||||
immediate=yes
|
immediate=yes
|
||||||
append=no
|
append=no
|
||||||
|
ms_after=2000
|
||||||
[/music]
|
[/music]
|
||||||
[/event]
|
[/event]
|
||||||
#enddef
|
#enddef
|
||||||
|
@ -5,15 +5,16 @@ changelog: https://github.com/wesnoth/wesnoth/blob/master/changelog
|
|||||||
Version 1.13.5+dev:
|
Version 1.13.5+dev:
|
||||||
* Music and sound effects:
|
* Music and sound effects:
|
||||||
* Added a preference to pause the music when the game loses focus.
|
* Added a preference to pause the music when the game loses focus.
|
||||||
|
* Now the storyscreen music fades out at the start of each scenario.
|
||||||
* Units:
|
* Units:
|
||||||
* Changed the sound for the melee attack of the
|
* Changed the sound for the melee attack of the
|
||||||
Loyalist Bowman, Orcish Crossbowman and Orcish Slurbow.
|
Loyalist Bowman, Orcish Crossbowman and Orcish Slurbow.
|
||||||
* Performance:
|
* Performance:
|
||||||
* When a heuristic determines that it's probably faster, the game predicts battle
|
* When a heuristic determines that it's probably faster, the game predicts battle
|
||||||
outcome by simulating a few thousand fights instead of calculating exact
|
outcome by simulating a few thousand fights instead of calculating exact
|
||||||
probabilities. This method is inexact, but in very complex battles (extremely
|
probabilities. This method is inexact, but in very complex battles (extremely
|
||||||
high HP, drain, slow, berserk, etc.) it's significantly faster than the default
|
high HP, drain, slow, berserk, etc.) it's significantly faster than the default
|
||||||
damage calculation method.
|
damage calculation method.
|
||||||
|
|
||||||
Version 1.13.5:
|
Version 1.13.5:
|
||||||
* Campaigns:
|
* Campaigns:
|
||||||
|
@ -61,6 +61,7 @@ unsigned music_refresh_rate = 20;
|
|||||||
bool want_new_music = false;
|
bool want_new_music = false;
|
||||||
int fadingout_time=5000;
|
int fadingout_time=5000;
|
||||||
bool no_fading = false;
|
bool no_fading = false;
|
||||||
|
bool unload_music = false;
|
||||||
|
|
||||||
// number of allocated channels,
|
// number of allocated channels,
|
||||||
const size_t n_of_channels = 32;
|
const size_t n_of_channels = 32;
|
||||||
@ -410,12 +411,8 @@ void reset_sound() {
|
|||||||
|
|
||||||
void stop_music() {
|
void stop_music() {
|
||||||
if(mix_ok) {
|
if(mix_ok) {
|
||||||
Mix_HaltMusic();
|
Mix_FadeOutMusic(500);
|
||||||
|
Mix_HookMusicFinished([](){ unload_music = true; });
|
||||||
std::map<std::string,Mix_Music*>::iterator i;
|
|
||||||
for(i = music_cache.begin(); i != music_cache.end(); ++i)
|
|
||||||
Mix_FreeMusic(i->second);
|
|
||||||
music_cache.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,9 +610,22 @@ void music_thinker::process(events::pump_info &info) {
|
|||||||
if(Mix_PlayingMusic()) {
|
if(Mix_PlayingMusic()) {
|
||||||
Mix_FadeOutMusic(fadingout_time);
|
Mix_FadeOutMusic(fadingout_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unload_music = false;
|
||||||
play_new_music();
|
play_new_music();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unload_music) {
|
||||||
|
for (auto track : music_cache) {
|
||||||
|
Mix_FreeMusic(track.second);
|
||||||
|
}
|
||||||
|
music_cache.clear();
|
||||||
|
|
||||||
|
Mix_HookMusicFinished(nullptr);
|
||||||
|
|
||||||
|
unload_music = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
music_muter::music_muter() :
|
music_muter::music_muter() :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user