Skip to content

Commit

Permalink
Made the battle music start from the beginning when it is not the sam…
Browse files Browse the repository at this point in the history
…e music than the previous mode.
  • Loading branch information
Yohann Ferreira committed Jan 12, 2016
1 parent d09d0ee commit b7b2a5e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/modes/battle/battle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,11 @@ void BattleMode::_ResetMusicState()
MusicDescriptor* active_music = AudioManager->GetActiveMusic();

// Stop the current music if it's not the right one.
if (active_music != nullptr && music != active_music)
if (active_music != nullptr && music != active_music) {
active_music->FadeOut(500);
if (music)
music->Rewind();
}

// If there is no map music or the music is already in the correct state, don't do anything.
if (!music)
Expand All @@ -157,10 +160,12 @@ void BattleMode::_ResetMusicState()
case AUDIO_STATE_STOPPED:
default:
// In case the music volume was modified, we fade it back in smoothly
if(music->GetVolume() < 1.0f)
if(music->GetVolume() < 1.0f) {
music->FadeIn(1000);
else
}
else {
music->Play();
}
break;
}
}
Expand Down

0 comments on commit b7b2a5e

Please sign in to comment.